public byte[] decryptAES(byte[] cipher) {

        if (privKey == null) {
            throw new MissingPrivateKeyException();
        }
        if (!(privKey instanceof BCECPrivateKey)) {
            throw new UnsupportedOperationException("Cannot use the private key as an AES key");
        }

        AESFastEngine engine = new AESFastEngine();
        SICBlockCipher ctrEngine = new SICBlockCipher(engine);

        KeyParameter key = new KeyParameter(BigIntegers.asUnsignedByteArray(((BCECPrivateKey) privKey).getD()));
        ParametersWithIV params = new ParametersWithIV(key, new byte[16]);

        ctrEngine.init(false, params);

        int i = 0;
        byte[] out = new byte[cipher.length];
        while (i < cipher.length) {
            ctrEngine.processBlock(cipher, i, out, i);
            i += engine.getBlockSize();
            if (cipher.length - i < engine.getBlockSize())
                break;
        }

        // process left bytes
        if (cipher.length - i > 0) {
            byte[] tmpBlock = new byte[16];
            System.arraycopy(cipher, i, tmpBlock, 0, cipher.length - i);
            ctrEngine.processBlock(tmpBlock, 0, tmpBlock, 0);
            System.arraycopy(tmpBlock, 0, out, i, cipher.length - i);
        }

        return out;
    }
public byte [ ] decryptAES ( byte [ ] cipher ) { if ( privKey == null ) { throw new MissingPrivateKeyException ( ) ; } if ( ! ( privKey instanceof BCECPrivateKey ) ) { throw new UnsupportedOperationException ( "Cannot use the private key as an AES key" ) ; } AESFastEngine engine = new AESFastEngine ( ) ; SICBlockCipher ctrEngine = new SICBlockCipher ( engine ) ; KeyParameter key = new KeyParameter ( BigIntegers . asUnsignedByteArray ( ( ( BCECPrivateKey ) privKey ) . getD ( ) ) ) ; ParametersWithIV params = new ParametersWithIV ( key , new byte [ 16 ] ) ; ctrEngine . init ( false , params ) ; int i = 0 ; byte [ ] out = new byte [ cipher . length ] ; while ( i < cipher . length ) { ctrEngine . processBlock ( cipher , i , out , i ) ; i += engine . getBlockSize ( ) ; if ( cipher . length - i < engine . getBlockSize ( ) ) break ; } if ( cipher . length - i > 0 ) { byte [ ] tmpBlock = new byte [ 16 ] ; System . arraycopy ( cipher , i , tmpBlock , 0 , cipher . length - i ) ; ctrEngine . processBlock ( tmpBlock , 0 , tmpBlock , 0 ) ; System . arraycopy ( tmpBlock , 0 , out , i , cipher . length - i ) ; } return out ; }
Decrypt cipher by AES in SIC(also know as CTR) mode

@param cipher
-proper cipher
@return decrypted cipher, equal length to the cipher.
@deprecated should not use EC private scalar value as an AES key