Org.BouncyCastle.Ocsp.BasicOcspResp.Verify C# (CSharp) Method

Verify() public method

Verify the signature against the tbsResponseData object we contain.
public Verify ( AsymmetricKeyParameter publicKey ) : bool
publicKey Org.BouncyCastle.Crypto.AsymmetricKeyParameter
return bool
		public bool Verify(
			AsymmetricKeyParameter publicKey)
		{
			try
			{
				ISigner signature = SignerUtilities.GetSigner(this.SignatureAlgName);
				signature.Init(false, publicKey);
				byte[] bs = data.GetDerEncoded();
				signature.BlockUpdate(bs, 0, bs.Length);

				return signature.VerifySignature(this.GetSignature());
			}
			catch (Exception e)
			{
				throw new OcspException("exception processing sig: " + e, e);
			}
		}

Usage Example

Beispiel #1
0
	    /**
	     * Checks if an OCSP response is genuine
	     * @param ocspResp	the OCSP response
	     * @param responderCert	the responder certificate
	     * @return	true if the OCSP response verifies against the responder certificate
	     */
        public bool IsSignatureValid(BasicOcspResp ocspResp, X509Certificate responderCert) {
		    try {
			    return ocspResp.Verify(responderCert.GetPublicKey());
		    } catch (OcspException) {
			    return false;
		    }
	    }
All Usage Examples Of Org.BouncyCastle.Ocsp.BasicOcspResp::Verify