question: private VerificationResult verifySignature ( AuthSuccess authResp , DiscoveryInformation discovered , VerificationResult result ) throws AssociationException , MessageException , DiscoveryException { if ( discovered == null || authResp == null ) { _log . error ( "Can't verify signature: " + "null assertion or discovered information." ) ; result . setStatusMsg ( "Can't verify signature: " + "null assertion or discovered information." ) ; return result ; } Identifier claimedId = discovered . isVersion2 ( ) ? _discovery . parseIdentifier ( authResp . getClaimed ( ) ) : discovered . getClaimedIdentifier ( ) ; String handle = authResp . getHandle ( ) ; URL op = discovered . getOPEndpoint ( ) ; Association assoc = _associations . load ( op . toString ( ) , handle ) ; if ( assoc != null ) { _log . info ( "Found association: " + assoc . getHandle ( ) + " verifying signature locally..." ) ; String text = authResp . getSignedText ( ) ; String signature = authResp . getSignature ( ) ; if ( assoc . verifySignature ( text , signature ) ) { result . setVerifiedId ( claimedId ) ; if ( DEBUG ) _log . debug ( "Local signature verification succeeded." ) ; } else { result . setStatusMsg ( "Local signature verification failed" ) ; if ( DEBUG ) _log . debug ( "Local signature verification failed." ) ; } } else { _log . info ( "No association found, " + "contacting the OP for direct verification..." ) ; VerifyRequest vrfy = VerifyRequest . createVerifyRequest ( authResp ) ; ParameterList responseParams = new ParameterList ( ) ; int respCode = call ( op . toString ( ) , vrfy , responseParams ) ; if ( HttpStatus . SC_OK == respCode ) { VerifyResponse vrfyResp = VerifyResponse . createVerifyResponse ( responseParams ) ; vrfyResp . validate ( ) ; if ( vrfyResp . isSignatureVerified ( ) ) { String invalidateHandle = vrfyResp . getInvalidateHandle ( ) ; if ( invalidateHandle != null ) _associations . remove ( op . toString ( ) , invalidateHandle ) ; result . setVerifiedId ( claimedId ) ; if ( DEBUG ) _log . debug ( "Direct signature verification succeeded " + "with OP: " + op ) ; } else { if ( DEBUG ) _log . debug ( "Direct signature verification failed " + "with OP: " + op ) ; result . setStatusMsg ( "Direct signature verification failed." ) ; } } else { DirectError err = DirectError . createDirectError ( responseParams ) ; if ( DEBUG ) _log . debug ( "Error verifying signature with the OP: " + op + " error message: " + err . keyValueFormEncoding ( ) ) ; result . setStatusMsg ( "Error verifying signature with the OP: " + err . getErrorMsg ( ) ) ; } } Identifier verifiedID = result . getVerifiedId ( ) ; if ( verifiedID != null ) _log . info ( "Verification succeeded for: " + verifiedID ) ; else _log . error ( "Verification failed for: " + authResp . getClaimed ( ) + " reason: " + result . getStatusMsg ( ) ) ; return result ; }
target:  Verifies the signature in a authentication response message.