Package org.bouncycastle.crypto.signers

Examples of org.bouncycastle.crypto.signers.PSSSigner


        {
            throw new InvalidKeyException("Supplied key is not a RSAPublicKey instance");
        }

    // Note: trailerField defaults to the only legal value
        pss = new PSSSigner(signer, digest, saltLength);
        pss.init(false,
            RSAUtil.generatePublicKeyParameter((RSAPublicKey)publicKey));
    }
View Full Code Here


        if (!(privateKey instanceof RSAPrivateKey))
        {
            throw new InvalidKeyException("Supplied key is not a RSAPrivateKey instance");
        }

        pss = new PSSSigner(signer, digest, saltLength, trailer);
        pss.init(true, new ParametersWithRandom(RSAUtil.generatePrivateKeyParameter((RSAPrivateKey)privateKey), random));
    }
View Full Code Here

        if (!(privateKey instanceof RSAPrivateKey))
        {
            throw new InvalidKeyException("Supplied key is not a RSAPrivateKey instance");
        }

        pss = new PSSSigner(signer, digest, saltLength, trailer);
        pss.init(true, RSAUtil.generatePrivateKeyParameter((RSAPrivateKey)privateKey));
    }
View Full Code Here

        RSAKeyParameters    prv,
        byte[]              slt,
        byte[]              msg,
        byte[]              sig)
    {
        PSSSigner           eng = new PSSSigner(new RSAEngine(), new SHA1Digest(), 20);

        eng.init(true, new ParametersWithRandom(prv, new FixedRandom(slt)));

        try
        {
            eng.update(msg, 0, msg.length);

            byte[]  s = eng.generateSignature();

            if (!isEqualTo(s, sig))
            {
                return new SimpleTestResult(false, getName() + ": test " + id + " failed generation");
            }

            eng.init(false, pub);

            eng.update(msg, 0, msg.length);

            if (!eng.verifySignature(s))
            {
                return new SimpleTestResult(false, getName() + ": test " + id + " failed verification");
            }
        }
        catch (Exception e)
View Full Code Here

        }
       
        //
        // loop test
        //
        PSSSigner           eng = new PSSSigner(new RSAEngine(), new SHA1Digest(), 20);
        int failed = 0;
        byte[] data = new byte[DATA_LENGTH];

        SecureRandom    random = new SecureRandom();
        random.nextBytes(data);
       
        for (int j = 0; j < NUM_TESTS; j++)
        {
            eng.init(true, new ParametersWithRandom(prv8, new SecureRandom()));
       
            try
            {
                eng.update(data, 0, data.length);
       
                byte[] s = eng.generateSignature();
       
                eng.init(false, pub8);
       
                eng.update(data, 0, data.length);
       
                if (!eng.verifySignature(s))
                {
                    failed++;
                }
            }
            catch (Exception e)
View Full Code Here

        if (!(publicKey instanceof RSAPublicKey))
        {
            throw new InvalidKeyException("Supplied key is not a RSAPublicKey instance");
        }

        pss = new PSSSigner(signer, contentDigest, mgfDigest, saltLength, trailer);
        pss.init(false,
            RSAUtil.generatePublicKeyParameter((RSAPublicKey)publicKey));
    }
View Full Code Here

        if (!(privateKey instanceof RSAPrivateKey))
        {
            throw new InvalidKeyException("Supplied key is not a RSAPrivateKey instance");
        }

        pss = new PSSSigner(signer, contentDigest, mgfDigest, saltLength, trailer);
        pss.init(true, new ParametersWithRandom(RSAUtil.generatePrivateKeyParameter((RSAPrivateKey)privateKey), random));
    }
View Full Code Here

        if (!(privateKey instanceof RSAPrivateKey))
        {
            throw new InvalidKeyException("Supplied key is not a RSAPrivateKey instance");
        }

        pss = new PSSSigner(signer, contentDigest, mgfDigest, saltLength, trailer);
        pss.init(true, RSAUtil.generatePrivateKeyParameter((RSAPrivateKey)privateKey));
    }
View Full Code Here

        if (!(publicKey instanceof RSAPublicKey))
        {
            throw new InvalidKeyException("Supplied key is not a RSAPublicKey instance");
        }

        pss = new PSSSigner(signer, digest, saltLength);
        pss.init(false,
            RSAUtil.generatePublicKeyParameter((RSAPublicKey)publicKey));
    }
View Full Code Here

        if (!(privateKey instanceof RSAPrivateKey))
        {
            throw new InvalidKeyException("Supplied key is not a RSAPrivateKey instance");
        }

        pss = new PSSSigner(signer, digest, saltLength);
        pss.init(true, new ParametersWithRandom(RSAUtil.generatePrivateKeyParameter((RSAPrivateKey)privateKey), random));
    }
View Full Code Here

TOP

Related Classes of org.bouncycastle.crypto.signers.PSSSigner

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.