question: public void readEncryptionObject ( final PdfObject encyptionObj , final PdfFileReader pdfFileReader ) throws PdfSecurityException { stringsEncoded = false ; isMetaDataEncypted = true ; StmFObj = null ; StrFObj = null ; isAES = false ; if ( ! isInitialised ) { isInitialised = true ; SetSecurity . init ( ) ; } if ( SetSecurity . useBouncyCastle ) { decryptionMethods = new BouncyCastleDecryption ( ) ; } else { decryptionMethods = new JCADecryption ( ) ; } final int v = encyptionObj . getInt ( PdfDictionary . V ) ; final PdfArrayIterator filters = encyptionObj . getMixedArray ( PdfDictionary . Filter ) ; int firstValue = PdfDictionary . Standard ; if ( filters != null && filters . hasMoreTokens ( ) ) { firstValue = filters . getNextValueAsConstant ( false ) ; } if ( v == 3 ) { throw new PdfSecurityException ( "Unsupported Custom Adobe Encryption method" ) ; } else if ( ( v > 4 ) && ( firstValue != PdfDictionary . Standard ) ) { throw new PdfSecurityException ( "Unsupported Encryption method" ) ; } final int newLength = encyptionObj . getInt ( PdfDictionary . Length ) > > 3 ; if ( newLength != - 1 ) { this . keyLength = newLength ; } rev = encyptionObj . getInt ( PdfDictionary . R ) ; P = encyptionObj . getInt ( PdfDictionary . P ) ; O = encyptionObj . getTextStreamValueAsByte ( PdfDictionary . O ) ; U = encyptionObj . getTextStreamValueAsByte ( PdfDictionary . U ) ; OE = encyptionObj . getTextStreamValueAsByte ( PdfDictionary . OE ) ; UE = encyptionObj . getTextStreamValueAsByte ( PdfDictionary . UE ) ; Perms = encyptionObj . getTextStreamValueAsByte ( PdfDictionary . Perms ) ; if ( v >= 4 ) { isAES = true ; String CFkey ; final PdfObject CF = encyptionObj . getDictionary ( PdfDictionary . CF ) ; if ( v == 4 ) { isMetaDataEncypted = encyptionObj . getBoolean ( PdfDictionary . EncryptMetadata ) ; } isAESIdentity = false ; String key = encyptionObj . getName ( PdfDictionary . StrF ) ; if ( key != null ) { isAESIdentity = key . equals ( "Identity" ) ; stringsEncoded = true ; final PdfKeyPairsIterator keyPairs = CF . getKeyPairsIterator ( ) ; while ( keyPairs . hasMorePairs ( ) ) { CFkey = keyPairs . getNextKeyAsString ( ) ; if ( CFkey . equals ( key ) ) { StrFObj = PdfObjectFactory . getPDFObjectObjectFromRefOrDirect ( new EncryptionObject ( encyptionObj . getObjectRefAsString ( ) ) , pdfFileReader , keyPairs . getNextValueAsBytes ( ) , PdfDictionary . CF ) ; } keyPairs . nextPair ( ) ; } } key = encyptionObj . getName ( PdfDictionary . StmF ) ; if ( key != null ) { isAESIdentity = key . equals ( "Identity" ) ; final PdfKeyPairsIterator keyPairs = CF . getKeyPairsIterator ( ) ; while ( keyPairs . hasMorePairs ( ) ) { CFkey = keyPairs . getNextKeyAsString ( ) ; if ( CFkey . equals ( key ) ) { StmFObj = PdfObjectFactory . getPDFObjectObjectFromRefOrDirect ( new EncryptionObject ( encyptionObj . getObjectRefAsString ( ) ) , pdfFileReader , keyPairs . getNextValueAsBytes ( ) , PdfDictionary . CF ) ; } keyPairs . nextPair ( ) ; } } } isEncrypted = true ; isFileViewable = false ; LogWriter . writeLog ( "File has encryption settings" ) ; if ( firstValue == PdfDictionary . Standard ) { try { verifyAccess ( ) ; } catch ( final PdfSecurityException e ) { LogWriter . writeLog ( "File requires password " + e ) ; } } else if ( certificate != null ) { isFileViewable = true ; isPasswordSupplied = true ; extractionIsAllowed = true ; passwordStatus = PDFflags . VALID_OWNER_PASSWORD ; } if ( rev == 5 ) { Perms = v5Decrypt ( Perms , encryptionKey ) ; isMetaDataEncypted = Perms [ 8 ] == 'T' ; P = ( Perms [ 0 ] & 255 ) | ( ( Perms [ 1 ] & 255 ) << 8 ) | ( ( Perms [ 2 ] & 255 ) << 16 ) | ( ( Perms [ 2 ] & 255 ) << 24 ) ; } }
target:  extract  metadata for  encryption object