src/test/java/com/hedera/hashgraph/identity/hcs/AesEncryptionUtil.java
/**
   * Encrypts the given message with AES using a defined secret phrase.
   *
   * @param messageToEncrypt Message to encrypt.
   * @param secret           The encryption secret.
   * @return The encrypted message.
   */
Encrypts the given message with AES using a defined secret phrase.
@param messageToEncrypt Message to encrypt.
@param secret           The encryption secret.
@return The encrypted message.
Encrypts the given message with AES using a defined secret phrase . @param messageToEncrypt Message to encrypt . @param secret The encryption secret . @return The encrypted message .
public static byte[] encrypt(byte[] messageToEncrypt, String secret) {
    try {
      SecretKeySpec secretKey = secretToKey(secret);
      Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
      cipher.init(Cipher.ENCRYPT_MODE, secretKey);
      return cipher.doFinal(messageToEncrypt);
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
public static byte [ ] encrypt ( byte [ ] messageToEncrypt , String secret ) { try { SecretKeySpec secretKey = secretToKey ( secret ) ; Cipher cipher = Cipher . getInstance ( "AES/ECB/PKCS5Padding" ) ; cipher . init ( Cipher . ENCRYPT_MODE , secretKey ) ; return cipher . doFinal ( messageToEncrypt ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } }
Encrypts the given message with AES using a defined secret phrase.
Encrypts the given message with AES using a defined secret phrase .