NullCipher implements EncryptionCipher, DecryptionCipher { @Override public byte[] encrypt(byte[] someBytes) throws CryptoException { return someBytes; } NullCipher(); @Override int getBlocksize(); @Override byte[] encrypt(byte[] someBytes); @Override byte[] encrypt(byte[] iv, byte[] someBytes); @Override byte[] encrypt(byte[] iv, int tagLength, byte[] someBytes); @Override byte[] encrypt(byte[] iv, int tagLength, byte[] additionAuthenticatedData, byte[] someBytes); @Override byte[] getIv(); @Override void setIv(byte[] iv); @Override byte[] decrypt(byte[] someBytes); @Override byte[] decrypt(byte[] iv, byte[] someBytes); @Override byte[] decrypt(byte[] iv, int tagLength, byte[] someBytes); @Override byte[] decrypt(byte[] iv, int tagLength, byte[] additionAuthenticatedData, byte[] someBytes);  }
@Test public void testEncryption() throws CryptoException { NullCipher cipher = new NullCipher(); byte[] bEncrypted = cipher.encrypt(bKey, bMessage); assertArrayEquals(bMessage, bEncrypted); }
@Test public void testEncryptionWithIv() throws CryptoException { NullCipher cipher = new NullCipher(); byte[] bEncrypted = cipher.encrypt(bIV, bMessage); assertArrayEquals(bMessage, bEncrypted); }
@Test public void testEncryptionWithIvWithTagLength() throws CryptoException { NullCipher cipher = new NullCipher(); byte[] bEncrypted = cipher.encrypt(bIV, iTag, bMessage); assertArrayEquals(bMessage, bEncrypted); }
@Test public void testEncryptionWithIvWithTagLengthWithAdditionAuthenticatedData() throws CryptoException { NullCipher cipher = new NullCipher(); byte[] bEncrypted = cipher.encrypt(bIV, iTag, bAuth, bMessage); assertArrayEquals(bMessage, bEncrypted); }