Package org.bouncycastle.crypto.digests

Examples of org.bouncycastle.crypto.digests.SHA224Digest.doFinal()


        String  resStr;

        //
        // test 1
        //
        digest.doFinal(resBuf, 0);

        resStr = new String(Hex.encode(resBuf));
        if (!resVec1.equals(resStr))
        {
            return new SimpleTestResult(false,
View Full Code Here


        //
        byte[]  bytes = Hex.decode(testVec2);

        digest.update(bytes, 0, bytes.length);

        digest.doFinal(resBuf, 0);

        resStr = new String(Hex.encode(resBuf));
        if (!resVec2.equals(resStr))
        {
            return new SimpleTestResult(false,
View Full Code Here

        //
        bytes = Hex.decode(testVec3);

        digest.update(bytes, 0, bytes.length);

        digest.doFinal(resBuf, 0);

        resStr = new String(Hex.encode(resBuf));
        if (!resVec3.equals(resStr))
        {
            return new SimpleTestResult(false,
View Full Code Here

        //
        bytes = Hex.decode(testVec4);

        digest.update(bytes, 0, bytes.length);

        digest.doFinal(resBuf, 0);

        resStr = new String(Hex.encode(resBuf));
        if (!resVec4.equals(resStr))
        {
            return new SimpleTestResult(false,
View Full Code Here

                + System.getProperty("line.separator")
                + "    got     : " + resStr);
        }

        d.update(bytes, bytes.length/2, bytes.length - bytes.length/2);
        d.doFinal(resBuf, 0);

        resStr = new String(Hex.encode(resBuf));
        if (!resVec4.equals(resStr))
        {
            return new SimpleTestResult(false,
View Full Code Here

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

      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

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.