public String encrypt ( final String plainText , final String key ) { Objects . requireNonNull ( plainText , Required . PLAIN_TEXT . toString ( ) ) ; Objects . requireNonNull ( key , Required . KEY . toString ( ) ) ; CipherParameters cipherParameters = new ParametersWithRandom ( new KeyParameter ( getSizedSecret ( key ) . getBytes ( StandardCharsets . UTF_8 ) ) ) ; this . paddedBufferedBlockCipher . init ( true , cipherParameters ) ; return new String ( base64Encoder . encode ( cipherData ( plainText . getBytes ( StandardCharsets . UTF_8 ) ) ) , StandardCharsets . UTF_8 ) ; }
Encrypts a given plain text using the given key