Examples of generateSignature()


Examples of org.bouncycastle.crypto.Signer.generateSignature()

        // Note: Only use the SHA1 part of the hash
        Signer signer = makeSigner(new NullDigest(), true,
            new ParametersWithRandom(privateKey, this.context.getSecureRandom()));
        signer.update(md5AndSha1, 16, 20);
        return signer.generateSignature();
    }

    public boolean verifyRawSignature(byte[] sigBytes, AsymmetricKeyParameter publicKey, byte[] md5AndSha1)
        throws CryptoException
    {
View Full Code Here

Examples of org.bouncycastle.crypto.Signer.generateSignature()

            public byte[] getSignature()
            {
                try
                {
                    return signer.generateSignature();
                }
                catch (CryptoException e)
                {    // TODO: need a specific runtime exception for PGP operators.
                    throw new IllegalStateException("unable to create signature");
                }
View Full Code Here

Examples of org.bouncycastle.crypto.signers.DSASigner.generateSignature()

        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")
View Full Code Here

Examples of org.bouncycastle.crypto.signers.ECDSASigner.generateSignature()

            ECDSASigner ecdsa = new ECDSASigner();

            ecdsa.init(true, param);

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

            if (!r.equals(sig[0]))
            {
                return new SimpleTestResult(false, getName()
                    + ": r component wrong." + System.getProperty("line.separator")
View Full Code Here

Examples of org.bouncycastle.crypto.signers.ECDSASigner.generateSignature()

            ParametersWithRandom param = new ParametersWithRandom(priKey, k);

            ecdsa.init(true, param);

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

            if (!r.equals(sig[0]))
            {
                return new SimpleTestResult(false, getName()
                    + ": r component wrong." + System.getProperty("line.separator")
View Full Code Here

Examples of org.bouncycastle.crypto.signers.ECDSASigner.generateSignature()

            ECDSASigner ecdsa = new ECDSASigner();

            ecdsa.init(true, param);

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

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

            if (ecdsa.verifySignature(message, sig[0], sig[1]))
            {
View Full Code Here

Examples of org.bouncycastle.crypto.signers.ECDSASigner.generateSignature()

      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.generateSignature()

    {
      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.ISO9796d2PSSSigner.generateSignature()

        eng.init(true, sigParameters);

        try
        {
            data = eng.generateSignature();
        }
        catch (Exception e)
        {
            return new SimpleTestResult(false, "ISO9796: failed - exception " + e.toString());
        }
View Full Code Here

Examples of org.bouncycastle.crypto.signers.ISO9796d2PSSSigner.generateSignature()

        try
        {
            eng.update(msg7[0]);
            eng.update(msg7, 1, msg7.length - 1);

            data = eng.generateSignature();
        }
        catch (Exception e)
        {
            return new SimpleTestResult(false, "ISO9796: failed - exception " + e.toString());
        }
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.