@Test public void testCreateSecret() throws Exception { final byte[] password = randomUUID().toString().getBytes(); assertNotNull(CryptoUtils.createSecret(password, password.length)); }
public static SecretKeySpec createSecret(final byte[] password, final int length) { final byte[] fixedLengthPassword = new byte[length]; Arrays.fill(fixedLengthPassword, (byte) 0); arraycopy(password, 0, fixedLengthPassword, 0, Math.min(fixedLengthPassword.length, password.length)); return new SecretKeySpec(fixedLengthPassword, "AES"); }
CryptoUtils { public static SecretKeySpec createSecret(final byte[] password, final int length) { final byte[] fixedLengthPassword = new byte[length]; Arrays.fill(fixedLengthPassword, (byte) 0); arraycopy(password, 0, fixedLengthPassword, 0, Math.min(fixedLengthPassword.length, password.length)); return new SecretKeySpec(fixedLengthPassword, "AES"); } }
CryptoUtils { public static SecretKeySpec createSecret(final byte[] password, final int length) { final byte[] fixedLengthPassword = new byte[length]; Arrays.fill(fixedLengthPassword, (byte) 0); arraycopy(password, 0, fixedLengthPassword, 0, Math.min(fixedLengthPassword.length, password.length)); return new SecretKeySpec(fixedLengthPassword, "AES"); }  }
CryptoUtils { public static SecretKeySpec createSecret(final byte[] password, final int length) { final byte[] fixedLengthPassword = new byte[length]; Arrays.fill(fixedLengthPassword, (byte) 0); arraycopy(password, 0, fixedLengthPassword, 0, Math.min(fixedLengthPassword.length, password.length)); return new SecretKeySpec(fixedLengthPassword, "AES"); }  static SecretKeySpec createSecret(final byte[] password, final int length); static String encryptToAes128EcbWithBase64(final String source); static String encryptToAes128EcbWithBase64(final String source, final String password); static String encryptToAes128EcbWithBase64(final byte[] message,
      final SecretKeySpec secretKeySpec); static byte[] encryptToAesGcm(final byte[] message, final byte[] password,
      final byte[] nonce); static byte[] decryptFromAes128EcbWithBase64(final String source); static byte[] decryptFromAes128EcbWithBase64(final String source, final String password); static byte[] decryptFromAes128EcbWithBase64(final String source,
      final SecretKeySpec secretKeySpec); static byte[] decryptFromAesGcm(final byte[] source, final byte[] password,
      final byte[] nonce); }
CryptoUtils { public static SecretKeySpec createSecret(final byte[] password, final int length) { final byte[] fixedLengthPassword = new byte[length]; Arrays.fill(fixedLengthPassword, (byte) 0); arraycopy(password, 0, fixedLengthPassword, 0, Math.min(fixedLengthPassword.length, password.length)); return new SecretKeySpec(fixedLengthPassword, "AES"); }  static SecretKeySpec createSecret(final byte[] password, final int length); static String encryptToAes128EcbWithBase64(final String source); static String encryptToAes128EcbWithBase64(final String source, final String password); static String encryptToAes128EcbWithBase64(final byte[] message,
      final SecretKeySpec secretKeySpec); static byte[] encryptToAesGcm(final byte[] message, final byte[] password,
      final byte[] nonce); static byte[] decryptFromAes128EcbWithBase64(final String source); static byte[] decryptFromAes128EcbWithBase64(final String source, final String password); static byte[] decryptFromAes128EcbWithBase64(final String source,
      final SecretKeySpec secretKeySpec); static byte[] decryptFromAesGcm(final byte[] source, final byte[] password,
      final byte[] nonce); static final String CIPHER_CHARSET; static final String CIPHER_NAME; }