// some data where first entry is 0
byte[] data = { 10, 122, 12, 127, 35, 58, 87, 56, -6, 73, 10, -13, -78, 4, -122, -61 };
// encrypt data asymmetrically
AsymmetricBlockCipher cipher = new RSAEngine();
cipher = new PKCS1Encoding(cipher);
cipher.init(true, keyPair.getPublic());
byte[] rsaEncryptedData = cipher.processBlock(data, 0, data.length);
Assert.assertFalse(Arrays.equals(data, rsaEncryptedData));
// decrypt data asymmetrically
cipher.init(false, keyPair.getPrivate());
byte[] dataBack = cipher.processBlock(rsaEncryptedData, 0, rsaEncryptedData.length);
assertTrue(Arrays.equals(data, dataBack));
long stopTime = System.currentTimeMillis();
long elapsedTime = stopTime - startTime;