@Test(expectedExceptions = SakuliCipherException.class, expectedExceptionsMessageRegExp = "Empty secret can not en-/decrypted!") public void testSecretEmpty() throws Exception { AesCbcCipher.encryptString("", AesKeyHelper.createRandomKey()); }
public static String encryptString(String secret, SecretKey aesKey) throws SakuliCipherException { final SecureRandom rng = new SecureRandom(); final byte[] ciphertext = encryptBytes(rng, aesKey, convertStringToBytes(secret)); return new BASE64Encoder().encode(ciphertext); }
AesCbcCipher { public static String encryptString(String secret, SecretKey aesKey) throws SakuliCipherException { final SecureRandom rng = new SecureRandom(); final byte[] ciphertext = encryptBytes(rng, aesKey, convertStringToBytes(secret)); return new BASE64Encoder().encode(ciphertext); } }
AesCbcCipher { public static String encryptString(String secret, SecretKey aesKey) throws SakuliCipherException { final SecureRandom rng = new SecureRandom(); final byte[] ciphertext = encryptBytes(rng, aesKey, convertStringToBytes(secret)); return new BASE64Encoder().encode(ciphertext); }  }
AesCbcCipher { public static String encryptString(String secret, SecretKey aesKey) throws SakuliCipherException { final SecureRandom rng = new SecureRandom(); final byte[] ciphertext = encryptBytes(rng, aesKey, convertStringToBytes(secret)); return new BASE64Encoder().encode(ciphertext); }  static IvParameterSpec createIV(final int ivSizeBytes, final Optional<SecureRandom> rng); static IvParameterSpec readIV(final int ivSizeBytes, final InputStream is); static byte[] decryptBytes(SecretKey aesKey, byte[] ciphertext); static byte[] encryptBytes(SecureRandom rng, SecretKey aesKey, byte[] plaintext); static String encryptString(String secret, SecretKey aesKey); static String decryptString(String encryptedStringBase64, SecretKey aesKey); }
AesCbcCipher { public static String encryptString(String secret, SecretKey aesKey) throws SakuliCipherException { final SecureRandom rng = new SecureRandom(); final byte[] ciphertext = encryptBytes(rng, aesKey, convertStringToBytes(secret)); return new BASE64Encoder().encode(ciphertext); }  static IvParameterSpec createIV(final int ivSizeBytes, final Optional<SecureRandom> rng); static IvParameterSpec readIV(final int ivSizeBytes, final InputStream is); static byte[] decryptBytes(SecretKey aesKey, byte[] ciphertext); static byte[] encryptBytes(SecureRandom rng, SecretKey aesKey, byte[] plaintext); static String encryptString(String secret, SecretKey aesKey); static String decryptString(String encryptedStringBase64, SecretKey aesKey); static final String CBC_ALGORITHM; }