public static long decryptECB(final byte[] concatenatedHashValue,final String base64EncryptedTurnOverValue,final SecretKey symmetricKey) throws NoSuchAlgorithmException, NoSuchProviderException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException {
  final ByteBuffer byteBufferIV=ByteBuffer.allocate(16);
  byteBufferIV.put(concatenatedHashValue);
  final byte[] IV=byteBufferIV.array();
  final byte[] encryptedTurnOverValue=CashBoxUtils.base64Decode(base64EncryptedTurnOverValue,false);
  final Cipher cipher=Cipher.getInstance("AES/ECB/NoPadding","BC");
  cipher.init(Cipher.ENCRYPT_MODE,symmetricKey);
  final byte[] intermediateResult=cipher.doFinal(IV);
  final byte[] result=new byte[encryptedTurnOverValue.length];
  for (int i=0; i < encryptedTurnOverValue.length; i++) {
    result[i]=(byte)((encryptedTurnOverValue[i]) ^ (intermediateResult[i]));
  }
  return getLong(result);
}

public static long decryptECB ( final byte [ ] concatenatedHashValue , final String base64EncryptedTurnOverValue , final SecretKey symmetricKey ) throws NoSuchAlgorithmException , NoSuchProviderException , NoSuchPaddingException , InvalidKeyException , InvalidAlgorithmParameterException , IllegalBlockSizeException , BadPaddingException { final ByteBuffer byteBufferIV = ByteBuffer . allocate ( 16 ) ; byteBufferIV . put ( concatenatedHashValue ) ; final byte [ ] IV = byteBufferIV . array ( ) ; final byte [ ] encryptedTurnOverValue = CashBoxUtils . base64Decode ( base64EncryptedTurnOverValue , false ) ; final Cipher cipher = Cipher . getInstance ( "AES/ECB/NoPadding" , "BC" ) ; cipher . init ( Cipher . ENCRYPT_MODE , symmetricKey ) ; final byte [ ] intermediateResult = cipher . doFinal ( IV ) ; final byte [ ] result = new byte [ encryptedTurnOverValue . length ] ; for ( int i = 0 ; i < encryptedTurnOverValue . length ; i ++ ) { result [ i ] = ( byte ) ( ( encryptedTurnOverValue [ i ] ) ^ ( intermediateResult [ i ] ) ) ; } return getLong ( result ) ; }
method for aes decryption in ecb mode
