Examples of processBytes()


Examples of freenet.crypt.CTRBlockCipher.processBytes()

    }
    aes.initialize(cryptoKey);
        CTRBlockCipher cipher = new CTRBlockCipher(aes);
        cipher.init(hash, 0, 16);
        byte[] plaintext = new byte[data.length];
        cipher.processBytes(data, 0, data.length, plaintext, 0);
        byte[] lengthBytes = new byte[2];
        cipher.processBytes(headers, hash.length+2, 2, lengthBytes, 0);
        int size = ((lengthBytes[0] & 0xff) << 8) + (lengthBytes[1] & 0xff);
        if((size > 32768) || (size < 0)) {
            throw new CHKDecodeException("Invalid size: "+size);
View Full Code Here

Examples of freenet.crypt.CTRBlockCipher.processBytes()

        CTRBlockCipher cipher = new CTRBlockCipher(aes);
        cipher.init(hash, 0, 16);
        byte[] plaintext = new byte[data.length];
        cipher.processBytes(data, 0, data.length, plaintext, 0);
        byte[] lengthBytes = new byte[2];
        cipher.processBytes(headers, hash.length+2, 2, lengthBytes, 0);
        int size = ((lengthBytes[0] & 0xff) << 8) + (lengthBytes[1] & 0xff);
        if((size > 32768) || (size < 0)) {
            throw new CHKDecodeException("Invalid size: "+size);
        }
    try {
View Full Code Here

Examples of freenet.crypt.CTRBlockCipher.processBytes()

        // CTR mode IV is only 16 bytes.
        // That's still plenty though. It will still be unique.
        ctr.init(hash, 0, 16);
        System.arraycopy(hash, 0, header, 2, hash.length);
        byte[] cdata = new byte[data.length];
        ctr.processBytes(data, 0, data.length, cdata, 0);
        ctr.processBytes(tmpLen, 0, 2, header, hash.length+2);
       
        // Now calculate the final hash
        md256.update(header);
        byte[] finalHash = md256.digest(cdata);
View Full Code Here

Examples of freenet.crypt.CTRBlockCipher.processBytes()

        // That's still plenty though. It will still be unique.
        ctr.init(hash, 0, 16);
        System.arraycopy(hash, 0, header, 2, hash.length);
        byte[] cdata = new byte[data.length];
        ctr.processBytes(data, 0, data.length, cdata, 0);
        ctr.processBytes(tmpLen, 0, 2, header, hash.length+2);
       
        // Now calculate the final hash
        md256.update(header);
        byte[] finalHash = md256.digest(cdata);
       
View Full Code Here

Examples of org.bouncycastle.crypto.BufferedAsymmetricBlockCipher.processBytes()

            {
                byte[] bi = secKeyData[0].toByteArray();

                if (bi[0] == 0)
                {
                    c1.processBytes(bi, 1, bi.length - 1);
                }
                else
                {
                    c1.processBytes(bi, 0, bi.length);
                }
View Full Code Here

Examples of org.bouncycastle.crypto.BufferedAsymmetricBlockCipher.processBytes()

                {
                    c1.processBytes(bi, 1, bi.length - 1);
                }
                else
                {
                    c1.processBytes(bi, 0, bi.length);
                }
            }
            else
            {
                BcPGPKeyConverter converter = new BcPGPKeyConverter();
View Full Code Here

Examples of org.bouncycastle.crypto.BufferedAsymmetricBlockCipher.processBytes()

                byte[] tmp = new byte[size];

                byte[] bi = secKeyData[0].toByteArray();
                if (bi.length > size)
                {
                    c1.processBytes(bi, 1, bi.length - 1);
                }
                else
                {
                    System.arraycopy(bi, 0, tmp, tmp.length - bi.length, bi.length);
                    c1.processBytes(tmp, 0, tmp.length);
View Full Code Here

Examples of org.bouncycastle.crypto.BufferedAsymmetricBlockCipher.processBytes()

                    c1.processBytes(bi, 1, bi.length - 1);
                }
                else
                {
                    System.arraycopy(bi, 0, tmp, tmp.length - bi.length, bi.length);
                    c1.processBytes(tmp, 0, tmp.length);
                }

                bi = secKeyData[1].toByteArray();
                for (int i = 0; i != tmp.length; i++)
                {
View Full Code Here

Examples of org.bouncycastle.crypto.BufferedAsymmetricBlockCipher.processBytes()

                    tmp[i] = 0;
                }

                if (bi.length > size)
                {
                    c1.processBytes(bi, 1, bi.length - 1);
                }
                else
                {
                    System.arraycopy(bi, 0, tmp, tmp.length - bi.length, bi.length);
                    c1.processBytes(tmp, 0, tmp.length);
View Full Code Here

Examples of org.bouncycastle.crypto.BufferedAsymmetricBlockCipher.processBytes()

                    c1.processBytes(bi, 1, bi.length - 1);
                }
                else
                {
                    System.arraycopy(bi, 0, tmp, tmp.length - bi.length, bi.length);
                    c1.processBytes(tmp, 0, tmp.length);
                }
            }

            return c1.doFinal();
        }
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.