Package org.bouncycastle.crypto.signers

Examples of org.bouncycastle.crypto.signers.DSASigner


        return publicKey instanceof DSAPublicKeyParameters;
    }

    protected DSA createDSAImpl()
    {
        return new DSASigner();
    }
View Full Code Here


        // lightweight test
        DSAPublicKey  key = (DSAPublicKey)kp.getPublic();
        DSAParameters params = new DSAParameters(key.getParams().getP(), key.getParams().getQ(), key.getParams().getG());
        DSAPublicKeyParameters keyParams = new DSAPublicKeyParameters(key.getY(), params);
        DSASigner signer = new DSASigner();
        ASN1Sequence derSig = ASN1Sequence.getInstance(ASN1Primitive.fromByteArray(sigBytes));

        signer.init(false, keyParams);

        if (!signer.verifySignature(dummySha1, DERInteger.getInstance(derSig.getObjectAt(0)).getValue(), DERInteger.getInstance(derSig.getObjectAt(1)).getValue()))
        {
            fail("NONEwithDSA not really NONE!");
        }
    }
View Full Code Here

    static public class stdDSA
        extends JDKDSASigner
    {
        public stdDSA()
        {
            super(new SHA1Digest(), new DSASigner());
        }
View Full Code Here

    static public class dsa224
        extends JDKDSASigner
    {
        public dsa224()
        {
            super(new SHA224Digest(), new DSASigner());
        }
View Full Code Here

    static public class dsa256
        extends JDKDSASigner
    {
        public dsa256()
        {
            super(new SHA256Digest(), new DSASigner());
        }
View Full Code Here

    static public class dsa384
        extends JDKDSASigner
    {
        public dsa384()
        {
            super(new SHA384Digest(), new DSASigner());
        }
View Full Code Here

    static public class dsa512
        extends JDKDSASigner
    {
        public dsa512()
        {
            super(new SHA512Digest(), new DSASigner());
        }
View Full Code Here

    static public class noneDSA
        extends JDKDSASigner
    {
        public noneDSA()
        {
            super(new NullDigest(), new DSASigner());
        }
View Full Code Here

        AsymmetricCipherKeyPair  pair = dsaKeyGen.generateKeyPair();

        ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), keyRandom);

        DSASigner dsa = new DSASigner();

        dsa.init(true, param);

        byte[] message = new BigInteger("968236873715988614170569073515315707566766479517").toByteArray();
        BigInteger[] sig = dsa.generateSignature(message);

        if (!r.equals(sig[0]))
        {
            return new SimpleTestResult(false, getName()
                + ": r component wrong." + System.getProperty("line.separator")
                + " expecting: " + r + System.getProperty("line.separator")
                + " got      : " + sig[0]);
        }

        if (!s.equals(sig[1]))
        {
            return new SimpleTestResult(false, getName()
                + ": s component wrong." + System.getProperty("line.separator")
                + " expecting: " + s + System.getProperty("line.separator")
                + " got      : " + sig[1]);
        }

        dsa.init(false, pair.getPublic());

        if (dsa.verifySignature(message, sig[0], sig[1]))
        {
            return new SimpleTestResult(true, getName() + ": Okay");
        }
        else
        {
View Full Code Here

public class SignatureDSA implements com.jcraft.jsch.SignatureDSA{
  private DSASigner signature;
  private SHA1 sha;

  public void init() throws Exception{
    signature=new DSASigner();
    sha=new SHA1();
    sha.init();
  }    
View Full Code Here

TOP

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

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.