use of javax.crypto.NullCipher in project robovm by robovm.
the class NullCipherTest method testDoFinalbyteArrayintintbyteArray3.
/*
* Class under test for int doFinal(byte[], int, int, byte[])
*/
public void testDoFinalbyteArrayintintbyteArray3() throws Exception {
//Regression for HARMONY-758
try {
new NullCipher().update(new byte[1], 0, 1, new byte[0]);
fail("Expected IndexOutOfBoundsException was not thrown");
} catch (IndexOutOfBoundsException e) {
}
}
use of javax.crypto.NullCipher in project robovm by robovm.
the class NullCipherTest method testDoFinalbyteArrayintintbyteArrayint3.
/*
* Class under test for int doFinal(byte[], int, int, byte[], int)
*/
public void testDoFinalbyteArrayintintbyteArrayint3() throws Exception {
//Regression for HARMONY-758
try {
new NullCipher().update(new byte[1], 0, 1, new byte[0], 0);
fail("Expected IndexOutOfBoundsException was not thrown");
} catch (IndexOutOfBoundsException e) {
}
}
use of javax.crypto.NullCipher in project robovm by robovm.
the class NullCipherTest method setUp.
protected void setUp() throws Exception {
super.setUp();
c = new NullCipher();
}
use of javax.crypto.NullCipher in project robovm by robovm.
the class NullCipherTest method testDoFinalbyteArrayintintbyteArrayint2.
/*
* Class under test for int doFinal(byte[], int, int, byte[], int)
*/
public void testDoFinalbyteArrayintintbyteArrayint2() throws Exception {
//Regression for HARMONY-758
try {
new NullCipher().update(new byte[1], 1, Integer.MAX_VALUE, new byte[1], 0);
fail("Expected IllegalArgumentException was not thrown");
} catch (IllegalArgumentException e) {
}
}
use of javax.crypto.NullCipher in project jdk8u_jdk by JetBrains.
the class CipherNCFuncTest method main.
public static void main(String[] args) throws ShortBufferException, IllegalBlockSizeException, BadPaddingException {
byte[] plainText = new byte[801];
// Initialization
RandomFactory.getRandom().nextBytes(plainText);
Cipher ci = new NullCipher();
// Encryption
byte[] cipherText = new byte[ci.getOutputSize(plainText.length)];
int offset = ci.update(plainText, 0, plainText.length, cipherText, 0);
ci.doFinal(cipherText, offset);
// Decryption
byte[] recoveredText = new byte[ci.getOutputSize(cipherText.length)];
int len = ci.doFinal(cipherText, 0, cipherText.length, recoveredText);
// Comparison
if (len != plainText.length || !TestUtilities.equalsBlock(plainText, cipherText, len) || !TestUtilities.equalsBlock(plainText, recoveredText, len)) {
throw new RuntimeException("Test failed because plainText not equal to cipherText and revoveredText");
}
}
Aggregations