private byte [ ] dropPadding ( byte [ ] plainpad ) { byte plain [ ] = null ; int drop = plainpad [ plainpad . length - 1 ] ; // last byte gives number of // bytes to drop // reallocate array smaller, dropping the pad bytes. plain = new byte [ plainpad . length - drop ] ; for ( int i = 0 ; i < plain . length ; i ++ ) { plain [ i ] = plainpad [ i ] ; plainpad [ i ] = 0 ; // don't keep a copy of the decrypt } return plain ; }
This method removes the padding bytes