private byte[] crypt(javax.crypto.Cipher cipher, byte[] bytes) throws CryptoException {
        try {
            return cipher.doFinal(bytes);
        } catch (Exception e) {
            String msg = "Unable to execute 'doFinal' with cipher instance [" + cipher + "].";
            throw new CryptoException(msg, e);
        }
    }
Calls the {@link javax.crypto.Cipher#doFinal(byte[]) doFinal(bytes)} method, propagating any exception that
might arise in an {@link CryptoException}

@param cipher the JDK Cipher to finalize (perform the actual encryption)
@param bytes  the bytes to crypt
@return the resulting crypted byte array.
@throws CryptoException if there is an illegal block size or bad padding
src/main/java/org/apache/shiro/crypto/cipher/JcaCipherService.java