public byte [ ] encryptData ( byte [ ] data ) throws SymmetricKeyException { Encryptor encryptor = createEncryptor ( ) ; byte [ ] encrypted = encryptor . encrypt ( data ) ; byte [ ] trailer = encryptor . encrypt ( null ) ; if ( encrypted == null || trailer == null ) throw new SymmetricKeyException ( "Cannot encrypt data" ) ; byte [ ] result = ArrayUtils . concat ( encrypted , trailer ) ; return result ; }
Encrypt the byte array data