Examples of ECDSASigner


Examples of org.bouncycastle.crypto.signers.ECDSASigner

    static public class ecDSA256
        extends JDKDSASigner
    {
        public ecDSA256()
        {
            super("SHA256withECDSA", new SHA256Digest(), new ECDSASigner());
        }
View Full Code Here

Examples of org.bouncycastle.crypto.signers.ECDSASigner

    static public class ecDSA384
        extends JDKDSASigner
    {
        public ecDSA384()
        {
            super("SHA384withECDSA", new SHA384Digest(), new ECDSASigner());
        }
View Full Code Here

Examples of org.bouncycastle.crypto.signers.ECDSASigner

    static public class ecDSA512
        extends JDKDSASigner
    {
        public ecDSA512()
        {
            super("SHA512withECDSA", new SHA512Digest(), new ECDSASigner());
        }
View Full Code Here

Examples of org.bouncycastle.crypto.signers.ECDSASigner

      dos.writeLong(userID);
      dos.write(passphrase.getBytes(Charset.forName("UTF-8")));
      dos.flush();
      byte[] digest = new byte[28];
      sha.doFinal(digest, 0);
      ECDSASigner signer = new ECDSASigner();
      signer.init(true, new ECPrivateKeyParameters(new BigInteger(1, digest), secp224k1));
      dos.writeLong(userID);
      dos.write(Base64.decode(serverNonce));
      dos.write(clientNonce);
      dos.flush();
      dos.close();
      sha.doFinal(digest, 0);
      BigInteger[] signature = signer.generateSignature(digest);
      return Arrays.asList(bigIntegerToBase64(signature[0]), bigIntegerToBase64(signature[1]));
    } catch (IOException e) {
      throw new ExchangeException("Could not build signature for authentication");
    }
  }
View Full Code Here

Examples of org.bouncycastle.crypto.signers.ECDSASigner

  {
    if ( priv == null )
    {
      throw new ValidationException ("Need private key to sign");
    }
    ECDSASigner signer = new ECDSASigner (new HMacDSAKCalculator (new SHA256Digest ()));
    signer.init (true, new ECPrivateKeyParameters (priv, domain));
    BigInteger[] signature = signer.generateSignature (hash);
    ByteArrayOutputStream s = new ByteArrayOutputStream ();
    try
    {
      DERSequenceGenerator seq = new DERSequenceGenerator (s);
      seq.addObject (new ASN1Integer (signature[0]));
View Full Code Here

Examples of org.bouncycastle.crypto.signers.ECDSASigner

  public static boolean verify (byte[] hash, byte[] signature, byte[] pub)
  {
    ASN1InputStream asn1 = new ASN1InputStream (signature);
    try
    {
      ECDSASigner signer = new ECDSASigner ();
      signer.init (false, new ECPublicKeyParameters (curve.getCurve ().decodePoint (pub), domain));

      DLSequence seq = (DLSequence) asn1.readObject ();
      BigInteger r = ((ASN1Integer) seq.getObjectAt (0)).getPositiveValue ();
      BigInteger s = ((ASN1Integer) seq.getObjectAt (1)).getPositiveValue ();
      return signer.verifySignature (hash, r, s);
    }
    catch ( Exception e )
    {
      // threat format errors as invalid signatures
      return false;
View Full Code Here

Examples of org.bouncycastle.crypto.signers.ECDSASigner

    static public class ecDSA
        extends Signature
    {
        public ecDSA()
        {
            super(new SHA1Digest(), new ECDSASigner(), new StdDSAEncoder());
        }
View Full Code Here

Examples of org.bouncycastle.crypto.signers.ECDSASigner

    static public class ecDSAnone
        extends Signature
    {
        public ecDSAnone()
        {
            super(new NullDigest(), new ECDSASigner(), new StdDSAEncoder());
        }
View Full Code Here

Examples of org.bouncycastle.crypto.signers.ECDSASigner

    static public class ecDSA224
        extends Signature
    {
        public ecDSA224()
        {
            super(new SHA224Digest(), new ECDSASigner(), new StdDSAEncoder());
        }
View Full Code Here

Examples of org.bouncycastle.crypto.signers.ECDSASigner

    static public class ecDSA256
        extends Signature
    {
        public ecDSA256()
        {
            super(new SHA256Digest(), new ECDSASigner(), new StdDSAEncoder());
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.