Package com.maverick.crypto.digests

Examples of com.maverick.crypto.digests.SHA1Digest.update()


      signatureInt = Rsa.removePKCS1(signatureInt, 1);

      signature = signatureInt.toByteArray();

      SHA1Digest h = new SHA1Digest();
      h.update(msg, 0, msg.length);
      byte[] data = new byte[h.getDigestSize()];
      h.doFinal(data, 0);

      if(data.length != (signature.length - ASN_SHA1.length)) {
        return false;
View Full Code Here


*/
public byte[] sign(byte[] msg) throws IOException {


    SHA1Digest hash = new SHA1Digest();
    hash.update(msg, 0, msg.length);

    byte[] data = new byte[hash.getDigestSize()];
    hash.doFinal(data, 0);


View Full Code Here

* @see com.maverick.crypto.publickey.DsaPrivateKeyInterface#sign(byte[])
*/
public byte[] sign(byte[] msg) {

    SHA1Digest h = new SHA1Digest();
    h.update(msg, 0, msg.length);
    byte[] data = new byte[h.getDigestSize()];
    h.doFinal(data, 0);
    return Dsa.sign(x, p, q, g, data);
  }

View Full Code Here

   */
  public boolean verifySignature(byte[] signature, byte[] msg) {

      // Create a SHA1 hash of the message
      SHA1Digest h = new SHA1Digest();
      h.update(msg, 0, msg.length);
      byte[] data = new byte[h.getDigestSize()];
      h.doFinal(data, 0);

      return Dsa.verify(y, p, q, g, signature, data);
  }
View Full Code Here

      BigInteger r,
      BigInteger s) {

    // Create a SHA1 hash of the message
    SHA1Digest h = new SHA1Digest();
    h.update(msg, 0, msg.length);
    byte[] data = new byte[h.getDigestSize()];
    h.doFinal(data, 0);


    BigInteger m = new BigInteger(1, data);
View Full Code Here

*/
public byte[] sign(byte[] msg) throws IOException {


      SHA1Digest hash = new SHA1Digest();
      hash.update(msg, 0, msg.length);

      byte[] data = new byte[hash.getDigestSize()];
      hash.doFinal(data, 0);

      byte[] tmp = new byte[data.length + ASN_SHA1.length];
View Full Code Here

    while (!primesFound) {
      do {
        random.nextBytes(seed);

        sha1.update(seed, 0, seed.length);

        sha1.doFinal(part1, 0);

        System.arraycopy(seed, 0, part2, 0, seed.length);
View Full Code Here

        System.arraycopy(seed, 0, part2, 0, seed.length);

        add(part2, seed, 1);

        sha1.update(part2, 0, part2.length);

        sha1.doFinal(part2, 0);

        for (int i = 0; i != u.length; i++) {
          u[i] = (byte) (part1[i] ^ part2[i]);
View Full Code Here

      int offset = 2;

      while (counter < 4096) {
        for (int k = 0; k < n; k++) {
          add(part1, seed, offset + k);
          sha1.update(part1, 0, part1.length);
          sha1.doFinal(part1, 0);
          System.arraycopy(part1, 0, w, w.length - (k + 1) * part1.length,
                           part1.length);
        }

View Full Code Here

          System.arraycopy(part1, 0, w, w.length - (k + 1) * part1.length,
                           part1.length);
        }

        add(part1, seed, offset + n);
        sha1.update(part1, 0, part1.length);
        sha1.doFinal(part1, 0);
        System.arraycopy(part1, part1.length - ( (w.length - (n) * part1.length)),
                         w, 0, w.length - n * part1.length);

        w[0] |= (byte) 0x80;
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.