question: public byte [ ] encrypt ( FacesContext context , byte [ ] plaindata ) { try { byte [ ] rawKey = convertPasswordToKey ( getPasswordToSecureState ( context ) ) ; Cipher cipher = getBlockCipherForEncryption ( rawKey ) ; byte [ ] encdata = cipher . doFinal ( plaindata ) ; Mac mac = getMac ( rawKey ) ; byte [ ] iv = cipher . getIV ( ) ; mac . update ( iv ) ; mac . update ( encdata ) ; byte [ ] macBytes = mac . doFinal ( ) ; byte [ ] tmp = concatBytes ( macBytes , iv ) ; byte [ ] securedata = concatBytes ( tmp , encdata ) ; return securedata ; } catch ( Exception e ) { if ( logger . isLoggable ( Level . SEVERE ) ) { logger . log ( Level . SEVERE , e . getMessage ( ) , e . getCause ( ) ) ; } throw new RuntimeException ( e ) ; } }
target:  Encrypts the specified plaindata using the specified password. It also stores the MAC and the IV in the output. The 20-byte MAC is stored first, followed by the 8-byte IV, followed by the encrypted contents of the file.