If you want the former behavior, i.e. the OCSP response retrieved by the OcspClientBouncyCastle
is trusted without further ado, you can simply use null
as argument:
IOcspClient ocspClient = new OcspClientBouncyCastle(null);
But if you want the retrieved OCSP response to be checked, you have to supply an OCSPVerifier
instance.
How this instance has to be initialized, depends on the CA's PKI from which the OCSP response is queried. If it supplies sufficient information in the OCSP response and the response is signed with a certificate not requiring further checks (e.g. if it has the id-pkix-ocsp-nocheck extension), you can initialize it with null
arguments:
OCSPVerifier ocspVerifier = new OCSPVerifier(null, null);
IOcspClient ocspClient = new OcspClientBouncyCastle(ocspVerifier);
But a CA may choose not to specify any method of revocation checking for the responder's certificate (RFC 2560). In the worst case this might require an initialization of the verifier which is specific to that very CA.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…