Buggy code:
public class Aes256Cryptor extends AbstractCryptor implements AesCryptographicConfiguration , FileNamingConventions { private static final SecureRandom SECURE_PRNG ; private static final int AES_KEY_LENGTH_IN_BITS ; private final ObjectMapper objectMapper = new ObjectMapper ( ) ; private SecretKey primaryMasterKey ; private SecretKey hMacMasterKey ; private static final int SIZE_OF_LONG = Long . BYTES ; public Aes256Cryptor ( ) { } Aes256Cryptor ( Random prng ) { } @ Override public void encryptMasterKey ( OutputStream out , CharSequence password ) throws IOException { } @ Override public void decryptMasterKey ( InputStream in , CharSequence password ) throws IOException , DecryptFailedException , UnsupportedKeyLengthException , WrongPasswordException { try { final KeyFile keyfile = objectMapper . readValue ( in , KeyFile . class ) ; final int maxKeyLen = Cipher . getMaxAllowedKeyLength ( AES_KEY_ALGORITHM ) ; if ( ( keyfile . getKeyLength ( ) ) > maxKeyLen ) { throw new UnsupportedKeyLengthException ( keyfile . getKeyLength ( ) , maxKeyLen ) ; } final SecretKey kek = scrypt ( password , keyfile . getScryptSalt ( ) , keyfile . getScryptCostParam ( ) , keyfile . getScryptBlockSize ( ) , Aes256Cryptor . AES_KEY_LENGTH_IN_BITS ) ; final Cipher decCipher = aesKeyWrapCipher ( kek , Cipher . UNWRAP_MODE ) ; SecretKey primary = ( ( SecretKey ) ( decCipher . unwrap ( keyfile . getPrimaryMasterKey ( ) , AES_KEY_ALGORITHM , Cipher . SECRET_KEY ) ) ) ; <START_BUG> SecretKey secondary = ( ( SecretKey ) ( decCipher . unwrap ( keyfile . getPrimaryMasterKey ( ) , HMAC_KEY_ALGORITHM , Cipher . SECRET_KEY ) ) ) ; <END_BUG> this . primaryMasterKey = primary ; this . hMacMasterKey = secondary ; } catch ( NoSuchAlgorithmException ex ) { throw new IllegalStateException ( "Algorithm<seq2seq4repair_space>should<seq2seq4repair_space>exist." , ex ) ; } catch ( InvalidKeyException e ) { throw new WrongPasswordException ( ) ; } } @ Override public void swipeSensitiveDataInternal ( ) { } private void destroyQuietly ( Destroyable d ) { } private Cipher aesKeyWrapCipher ( SecretKey key , int cipherMode ) { } private Cipher aesCtrCipher ( SecretKey key , byte [ ] iv , int cipherMode ) { } private byte [ ] randomData ( int length ) { } private SecretKey scrypt ( CharSequence password , byte [ ] salt , int costParam , int blockSize , int keyLengthInBits ) { } private long crc32Sum ( byte [ ] source ) { } private byte [ ] hmacSha256 ( byte [ ] data ) { } @ Override public String encryptPath ( String cleartextPath , char encryptedPathSep , char cleartextPathSep , CryptorIOSupport ioSupport ) { } private String encryptPathComponent ( final String cleartext , final SecretKey key , CryptorIOSupport ioSupport ) throws IOException , BadPaddingException , IllegalBlockSizeException { } @ Override public String decryptPath ( String encryptedPath , char encryptedPathSep , char cleartextPathSep , CryptorIOSupport ioSupport ) { } private String decryptPathComponent ( final String encrypted , final SecretKey key , CryptorIOSupport ioSupport ) throws IOException , BadPaddingException , IllegalBlockSizeException { } private LongFilenameMetadata getMetadata ( CryptorIOSupport ioSupport , String metadataFile ) throws IOException { } private void storeMetadata ( CryptorIOSupport ioSupport , String metadataFile , LongFilenameMetadata metadata ) throws JsonProcessingException , IOException { } @ Override public Long decryptedContentLength ( SeekableByteChannel encryptedFile ) throws IOException { } @ Override public Long decryptedFile ( SeekableByteChannel encryptedFile , OutputStream plaintextFile ) throws IOException { } @ Override public Long decryptRange ( SeekableByteChannel encryptedFile , OutputStream plaintextFile , long pos , long length ) throws IOException { } @ Override public Long encryptFile ( InputStream plaintextFile , SeekableByteChannel encryptedFile ) throws IOException { } @ Override public DirectoryStream . Filter < Path > getPayloadFilesFilter ( ) { } }

Fix:
SecretKey secondary = ( ( SecretKey ) ( decCipher . unwrap ( keyfile . getHMacMasterKey ( ) , HMAC_KEY_ALGORITHM , Cipher . SECRET_KEY ) ) ) ;