public class UnknownResponseException extends OCSPException
The X.509
Online Certificate Status Protocol (RFC 2560) allows OCSP responses to be of
various type. RFC 2560 itself only specifies one basic response type
(BasicOCSPResponse) that has to be
supported by any conforming implementation.
Other response types may be identified by their object identifier to be included
into the optional responseBytes field of an OCSPResponse message:
OCSPResponse ::= SEQUENCE {
responseStatus OCSPResponseStatus,
responseBytes [0] EXPLICIT ResponseBytes OPTIONAL }
ResponseBytes ::= SEQUENCE {
responseType OBJECT IDENTIFIER,
response OCTET STRING }
When parsing the response sent by a server, class ResponseBytes tries to find an implementation
for the response identified by the responseType OID. If no implementation for
the particular response type is registered, an UnknownResponseException is thrown allowing an application
to query for the response type oid and an ASN.1 epresentation of the unknown response, e.g.
(reading in a DER encoded OCSPResponse
from an input stream):
try {
// the input stream supplying a DER encoded OCSP response:
InputStream is = ...;
OCSPResponse ocspResponse = new OCSPResponse(is);
...
} catch (UnknownResponseException ex) {
System.out.println("This response is successful but contains an unknown response type:");
UnknownResponseException unknown = (UnknownResponseException)ex;
System.out.println("Unknown type: " + unknown.getResponseType());
System.out.println("ASN.1 structure:");
System.out.println(unknown.getUnknownResponse().toString());
}
OCSPResponse,
ResponseBytes,
Response,
BasicOCSPResponse,
Serialized Form| Constructor and Description |
|---|
UnknownResponseException(ObjectID responseType,
ASN1 unknownResponse)
Constructs an UnknownResponseException with no specified detail message.
|
UnknownResponseException(java.lang.String msg,
ObjectID responseType,
ASN1 unknownResponse)
Constructs an UnknownResponseException with the specified detail message.
|
| Modifier and Type | Method and Description |
|---|---|
ObjectID |
getResponseType()
Returns the reponse type of the unknown response.
|
ASN1 |
getUnknownResponse()
Returns an ASN.1 representation of the unknown response.
|
public UnknownResponseException(ObjectID responseType, ASN1 unknownResponse)
responseType - the type oid of the unknown responseunknownResponse - the unknown response as ASN.1 objectpublic UnknownResponseException(java.lang.String msg,
ObjectID responseType,
ASN1 unknownResponse)
responseType - the type oid of the unknown responseunknownResponse - the unknown response as ASN.1 objectpublic ObjectID getResponseType()
public ASN1 getUnknownResponse()