Examples of doFinal()


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

       
        byte[] output = new byte[digest.getDigestSize()];
       
        digest.update(keyByteArray, 0, keyByteArray.length);

        digest.doFinal(output, 0);

        return new BigInteger(output);
    }
}
View Full Code Here

Examples of org.bouncycastle.crypto.digests.SHA384Digest.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

Examples of org.bouncycastle.crypto.digests.SHA512Digest.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

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

        for (int i = 0; i < messages.length; i++)
        {
            byte[] m = messages[i].getBytes();
            digest.update(m, 0, m.length);
            digest.doFinal(resBuf, 0);

            if (!arraysEqual(resBuf, Hex.decode(digests[i])))
            {
                return new SimpleTestResult(false, getName() + ": Vector " + i + " failed got " + new String(Hex.encode(resBuf)));
            }
View Full Code Here

Examples of org.bouncycastle.crypto.macs.CBCBlockCipherMac.doFinal()

        //
        // add the text
        //
        cMac.update(data, dataOff, dataLen);

        return cMac.doFinal(macBlock, 0);
    }

    private boolean hasAssociatedText()
    {
        return associatedText != null && associatedText.length != 0;
View Full Code Here

Examples of org.bouncycastle.crypto.macs.HMac.doFinal()

        byte[] buf2 = new byte[mac.getMacSize()];
        for (int i = 0; i < iterations; i++)
        {
            mac.init(param);
            mac.update(a, 0, a.length);
            mac.doFinal(buf, 0);
            a = buf;
            mac.init(param);
            mac.update(a, 0, a.length);
            mac.update(seed, 0, seed.length);
            mac.doFinal(buf2, 0);
View Full Code Here

Examples of org.bouncycastle.crypto.macs.SkeinMac.doFinal()

                SkeinMac sm = new SkeinMac();

                sm.init(pfs);
                sm.updateBits(kr.msg, 0, kr.msgLength);
                byte[] mac = new byte[sm.getMacSize()];
                sm.doFinal(mac, 0);

                if (!Arrays.equals(mac, kr.result)) {
                    System.out.println(kr.stateSize + "-" + kr.hashBitLength
                            + "-" + kr.msgLength + "-" + kr.restOfLine);
                    hexdump("Computed mac", mac, mac.length);
View Full Code Here

Examples of org.bouncycastle.crypto.modes.CTSBlockCipher.doFinal()

   
            int len = engine.processBytes(input, 0, input.length, out, 0);
   
            try
            {
                engine.doFinal(out, len);
            }
            catch (Exception e)
            {
                return new SimpleTestResult(false, getName() + ": encryption exception - " + e.toString());
            }
View Full Code Here

Examples of org.bouncycastle.crypto.modes.GCMBlockCipher.doFinal()

    int outputOffset = cipher.processBytes(plainText, 0, plainText.length, output, 0);


    // Produce authentication tag
    try {
      outputOffset += cipher.doFinal(output, outputOffset);

    } catch (InvalidCipherTextException e) {

      throw new RuntimeException("Couldn't generate GCM authentication tag: " + e.getMessage(), e);
    }
View Full Code Here

Examples of org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher.doFinal()

    // process ciphering
    byte[] output = new byte[cipher.getOutputSize(data.length)];

    int bytesProcessed1 = cipher.processBytes(data, 0, data.length, output, 0);
    int bytesProcessed2 = cipher.doFinal(output, bytesProcessed1);

    byte[] result = new byte[bytesProcessed1 + bytesProcessed2];
    System.arraycopy(output, 0, result, 0, result.length);
    return result;
  }
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.