question: private boolean testPassword ( ) throws PdfSecurityException { int count = 32 ; final byte [ ] rawValue = new byte [ 32 ] ; byte [ ] keyValue ; for ( int i = 0 ; i < 32 ; i ++ ) { rawValue [ i ] = ( byte ) Integer . parseInt ( pad [ i ] , 16 ) ; } byte [ ] encrypted = ObjectCloneFactory . cloneArray ( rawValue ) ; if ( rev == 2 ) { encryptionKey = calculateKey ( O , P , ID ) ; encrypted = decrypt ( encrypted , "" , true , null , false , false ) ; } else if ( rev >= 3 ) { int keyLength = this . keyLength ; count = 16 ; encryptionKey = calculateKey ( O , P , ID ) ; final byte [ ] originalKey = ObjectCloneFactory . cloneArray ( encryptionKey ) ; MessageDigest md = null ; try { md = MessageDigest . getInstance ( "MD5" ) ; } catch ( final Exception e ) { LogWriter . writeLog ( "Exception " + e + " with digest" ) ; } md . update ( encrypted ) ; keyValue = md . digest ( ID ) ; keyValue = decrypt ( keyValue , "" , true , null , true , false ) ; final byte [ ] nextKey = new byte [ keyLength ] ; for ( int i = 1 ; i <= 19 ; i ++ ) { for ( int j = 0 ; j < keyLength ; j ++ ) { nextKey [ j ] = ( byte ) ( originalKey [ j ] ^ i ) ; } encryptionKey = nextKey ; keyValue = decrypt ( keyValue , "" , true , null , true , false ) ; } encryptionKey = originalKey ; encrypted = new byte [ 32 ] ; System . arraycopy ( keyValue , 0 , encrypted , 0 , 16 ) ; System . arraycopy ( rawValue , 0 , encrypted , 16 , 16 ) ; } return compareKeys ( U , encrypted , count ) ; }
target:  see if valid for password