src/main/java/io/github/sleroy/aes/Encryption.java
/**
	 * Encrypt a plain text using the default to a base-64 text.
	 * 
	 * @param plainText
	 *            the plain text
	 * @return the Base64 encrypted text
	 */
Encrypt a plain text using the default to a base-64 text.

@param plainText
the plain text
@return the Base64 encrypted text
Encrypt a plain text using the default to a base - 64 text . @param plainText the plain text @return the Base64 encrypted text
public String encrypt(String plainText) {
		try {
			Cipher cipher = Cipher.getInstance(CIPHER_ALGO);
			SecretKey secretKey = new SecretKeySpec(encodingKey, CIPHER_ALGO_NAME);
			cipher.init(Cipher.ENCRYPT_MODE, secretKey);
			byte[] cipherText = cipher.doFinal(plainText.getBytes(DEFAULT_ENCODING));
			String encryptedString = new String(Base64.getEncoder().encode(cipherText), DEFAULT_ENCODING);
			return encryptedString;
		} catch (Exception e) {
			LOGGER.error("Could not encrypt a encodingKey for the reason {}", e.getMessage(), e);
		}
		return null;
	}
public String encrypt ( String plainText ) { try { Cipher cipher = Cipher . getInstance ( CIPHER_ALGO ) ; SecretKey secretKey = new SecretKeySpec ( encodingKey , CIPHER_ALGO_NAME ) ; cipher . init ( Cipher . ENCRYPT_MODE , secretKey ) ; byte [ ] cipherText = cipher . doFinal ( plainText . getBytes ( DEFAULT_ENCODING ) ) ; String encryptedString = new String ( Base64 . getEncoder ( ) . encode ( cipherText ) , DEFAULT_ENCODING ) ; return encryptedString ; } catch ( Exception e ) { LOGGER . error ( "Could not encrypt a encodingKey for the reason {}" , e . getMessage ( ) , e ) ; } return null ; }
Encrypt a plain text using the default to a base-64 text.
Encrypt a plain text using the default to a base - 64 text .