public byte [ ] outputBytes ( ) { byte [ ] tmpBuf = buf ; int len = bufLimit ; int flags = 0 ; if ( useCompress ) { flags |= FLAG_COMPRESS ; tmpBuf = deflate ( tmpBuf , len ) ; len = tmpBuf . length ; } if ( aesKey != null ) { flags |= FLAG_AES ; try { tmpBuf = crypto ( tmpBuf , 0 , len , false ) ; } catch ( Exception e ) { throw new IllegalArgumentException ( "AES Encryption failed" , e ) ; } len = tmpBuf . length ; // if ( aesIV != null ) { switch ( aesTypeIV ) { case RANDOM_IV : { // useAES + randomIV flags |= FLAG_RANDOM_IV ; final byte [ ] ivBuf = aesIV . getIV ( ) ; tmpBuf = resizeBuffer ( tmpBuf , len + ivBuf . length ) ; System . arraycopy ( ivBuf , 0 , tmpBuf , len , ivBuf . length ) ; len = tmpBuf . length ; break ; } case RANDOM_INT_IV : { // useAES + integerIV flags |= FLAG_RANDOM_INT_IV ; final byte [ ] ivBuf = intToByteArray ( integerIV ) ; tmpBuf = resizeBuffer ( tmpBuf , len + ivBuf . length ) ; System . arraycopy ( ivBuf , 0 , tmpBuf , len , ivBuf . length ) ; len = tmpBuf . length ; break ; } } } } if ( rsaKeyForEncrypt != null ) { flags |= FLAG_RSA ; try { tmpBuf = cryptoAsym ( tmpBuf , 0 , len , false ) ; } catch ( Exception e ) { throw new IllegalArgumentException ( "RSA Encryption failed" , e ) ; } len = tmpBuf . length ; } if ( useCRC ) { flags |= FLAG_CRC ; tmpBuf = resizeBuffer ( tmpBuf , len + 1 ) ; tmpBuf [ len ] = ( byte ) crc8 ( tmpBuf , 0 , len ) ; len = tmpBuf . length ; } if ( mdHash != null ) { // useHASH flags |= FLAG_HASH ; final byte [ ] mdBuf = hash ( tmpBuf , 0 , len ) ; tmpBuf = resizeBuffer ( tmpBuf , len + mdBuf . length ) ; System . arraycopy ( mdBuf , 0 , tmpBuf , len , mdBuf . length ) ; len = tmpBuf . length ; } if ( hMac != null ) { // useHMAC flags |= FLAG_HMAC ; final byte [ ] hmacBuf = hmac ( tmpBuf , 0 , len ) ; tmpBuf = resizeBuffer ( tmpBuf , len + hmacBuf . length ) ; System . arraycopy ( hmacBuf , 0 , tmpBuf , len , hmacBuf . length ) ; len = tmpBuf . length ; } if ( useFlagFooter ) { tmpBuf = resizeBuffer ( tmpBuf , ++ len ) ; tmpBuf [ len - 1 ] = ( byte ) ( flags & 0xFF ) ; } else { tmpBuf = resizeBuffer ( tmpBuf , len ) ; } return tmpBuf ; }
Output bytes in raw format