Package java.security

Examples of java.security.Signature.initSign()


        p = g.generateKeyPair();

        sKey = p.getPrivate();
        vKey = p.getPublic();

        s.initSign(sKey);

        s.update(data);

        sigBytes = s.sign();
View Full Code Here


        PublicKey   vKey = p.getPublic();
       
        Signature           s = Signature.getInstance("DSA", "BC");
        byte[]              data = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };
       
        s.initSign(sKey);
       
        s.update(data);
       
        byte[]  sigBytes = s.sign();
       
View Full Code Here

        }

        Signature           s = Signature.getInstance("DSA", "BC");
        byte[]              data = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };

        s.initSign(sKey);

        s.update(data);

        byte[]  sigBytes = s.sign();
View Full Code Here

        PublicKey   vKey = p.getPublic();
       
        //
        // sign SUN - verify with BC
        //
        s.initSign(sKey);
       
        s.update(data);
       
        byte[]  sigBytes = s.sign();
       
View Full Code Here

       
        //
        // sign BC - verify with SUN
        //
       
        s.initSign(sKey);
       
        s.update(data);
       
        sigBytes = s.sign();
       
View Full Code Here

        KeyPair          kp = kpGen.generateKeyPair();

        Signature        sig = Signature.getInstance("NONEwithDSA", "BC");

        sig.initSign(kp.getPrivate());

        sig.update(dummySha1);

        byte[] sigBytes = sig.sign();
View Full Code Here

        Signature           sgr = Signature.getInstance("ECDSA", "BC");
        KeyFactory          f = KeyFactory.getInstance("ECDSA", "BC");
        PrivateKey          sKey = f.generatePrivate(priKey);
        PublicKey           vKey = f.generatePublic(pubKey);
       
        sgr.initSign(sKey, k);
       
        byte[] message = new byte[] { (byte)'a', (byte)'b', (byte)'c' };
       
        sgr.update(message);
       
View Full Code Here

      throws NoSuchAlgorithmException, SignatureException,
      InvalidKeyException {

    Signature sign = Signature.getInstance(signature.getIdHash() + "with"
        + signature.getIdAlg());
    sign.initSign(signature.getKey());
    sign.update(value.getBytes(), 0, value.getBytes().length);
    return sign.sign();
  }

}
View Full Code Here

                             String data,
                             SignatureAlgorithm algorithm)
      throws GeneralSecurityException {

    Signature signature = Signature.getInstance(algorithm.getJCAName());
    signature.initSign(key);
    signature.update(data.getBytes());
    return signature.sign();
  }

View Full Code Here

  public String getSignature(String baseString, OAuthParameters oauthParameters)
      throws OAuthException {
    try {
      Signature signer = Signature.getInstance("SHA1withRSA");
      signer.initSign(privateKey);
      signer.update(baseString.getBytes("UTF-8"));
      return Base64.encode(signer.sign());
    } catch (NoSuchAlgorithmException e) {
      throw new OAuthException("Error generating signature", e);
    } catch (InvalidKeyException e) {
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.