public ByteSource encrypt(byte[] plaintext, byte[] key) { byte[] ivBytes = null; boolean generate = isGenerateInitializationVectors(false); if (generate) { ivBytes = generateInitializationVector(false); if (ivBytes == null || ivBytes.length == 0) { throw new IllegalStateException("Initialization vector generation is enabled - generated vector" + "cannot be null or empty."); } } return encrypt(plaintext, key, ivBytes, generate); }
public void encrypt(InputStream in, OutputStream out, byte[] key) throws CryptoException { byte[] iv = null; boolean generate = isGenerateInitializationVectors(true); if (generate) { iv = generateInitializationVector(true); if (iv == null || iv.length == 0) { throw new IllegalStateException("Initialization vector generation is enabled - generated vector" + "cannot be null or empty."); } } encrypt(in, out, key, iv, generate); }
public void encrypt(InputStream in, OutputStream out, byte[] key) throws CryptoException { byte[] iv = null; boolean generate = isGenerateInitializationVectors(true); if (generate) { iv = generateInitializationVector(true); if (iv == null || iv.length == 0) { throw new IllegalStateException("Initialization vector generation is enabled - generated vector" + "cannot be null or empty."); } } encrypt(in, out, key, iv, generate); }
public ByteSource encrypt(byte[] plaintext, byte[] key) { byte[] ivBytes = null; boolean generate = isGenerateInitializationVectors(false); if (generate) { ivBytes = generateInitializationVector(false); if (ivBytes == null || ivBytes.length == 0) { throw new IllegalStateException("Initialization vector generation is enabled - generated vector" + "cannot be null or empty."); } } return encrypt(plaintext, key, ivBytes, generate); }