public class Request extends java.lang.Object implements ASN1Type
Request
. Within a
OCSPRequest
a single request is included
for each certificate for which revocation information is shall be obtained.
Beside an identifier
for the certificate in
mind a request may contain some request extensions that may be processed by
the OCSP responder (see RFC 2560,
RFC 6960):
Request ::= SEQUENCE { reqCert ReqCert, singleRequestExtensions [0] EXPLICIT Extensions OPTIONAL }When
creating
a request, supply the
reqCert
for identifying the certificate for
which you want to get revocation status information, e.g.:
CertID certID = ...; ReqCert reqCert = new ReqCert(ReqCert.certID, certID); Request request = new Request(reqCert);After optionally adding any
extensions
the
Request may be included into a OCSPRequest
by calling method
setRequestList
:
OCSPRequest ocspRequest = ...; ... ocspRequest.setRequestList(new Request[] { request });
Constructor and Description |
---|
Request()
Default constructor.
|
Request(ASN1Object obj)
Creates Request from an ASN1Object.
|
Request(ReqCert reqCert)
Creates a Request for the given ReqCert.
|
Modifier and Type | Method and Description |
---|---|
void |
addExtension(V3Extension e)
Adds the given extension.
|
int |
countExtensions()
Returns the number of extensions included in this request.
|
void |
decode(ASN1Object obj)
Decodes a Request from an ASN1Object.
|
V3Extension |
getExtension(ObjectID oid)
Returns a specific extension, identified by its object identifier.
|
ReqCert |
getReqCert()
Returns the ReqCert.
|
ServiceLocator |
getServiceLocator()
A convenience method for getting the ServiceLocator extension, if included
in this request.
|
boolean |
hasExtensions()
Checks, if there are any extensions included in this request.
|
boolean |
hasUnsupportedCriticalExtension()
Returns true if there are unsupported critical extensions.
|
java.util.Enumeration |
listExtensions()
Returns an enumeration of all extensions included in this request.
|
void |
removeAllExtensions()
Removes all extensions from this request.
|
boolean |
removeExtension(ObjectID oid)
Removes the extension specified by its object identifier.
|
void |
setServiceLocator(ServiceLocator serviceLocator)
A convenience method for setting the ServiceLocator extension.
|
ASN1Object |
toASN1Object()
Returns this Request as an ASN1Object.
|
java.lang.String |
toString()
Returns a String representation of this Request.
|
java.lang.String |
toString(boolean detailed)
Returns a String representation of this Request.
|
public Request()
public Request(ReqCert reqCert)
reqCert
- the ReqCert identifying the certificate for which revocation
status information shall be obtainedpublic Request(ASN1Object obj) throws CodingException, X509ExtensionException
obj
- the request as ASN1ObjectCodingException
- if the ASN1Object has the wrong formatX509ExtensionException
- if there is a problem with a X.509 extension.public ReqCert getReqCert()
public void addExtension(V3Extension e) throws X509ExtensionException
The extension to be added shall be an implemented
V3Extension
. If an extension with the same
object ID already exists, it is replaced.
For reading back some extension use the getExtension(ObjectID)
method.
e
- the extension to be addedX509ExtensionException
- if the extension cannot be addedpublic boolean removeExtension(ObjectID oid)
oid
- the object ID of the extension to removetrue
if the extension has been successfully removed,
false
otherwisepublic void removeAllExtensions()
public java.util.Enumeration listExtensions()
The returned enumeration may contain unknown extensions (instances
of UnknownExtension
if there are any
extensions included in this request, for which there exists no registered
implementation, and it may contain error extensions (instances of
ErrorExtension
) indicating
extensions which cannot be parsed properly because of some kind of error.
null
if there are
no extensions present at allpublic boolean hasExtensions()
true
if there are extensions, false
if
notpublic boolean hasUnsupportedCriticalExtension()
public int countExtensions()
public V3Extension getExtension(ObjectID oid) throws X509ExtensionInitException
If the extension cannot be initialized for some reason, an
X509ExtensionInitException is thrown. If the requested extension is an
unknown extension, which is not supported by a registered
implementation, this method creates and returns an
UnknownExtension
which may be queried
for obtaining as much information as possible about the unknown extension.
oid
- the object ID of the extensionnull
if the requested
extension is not presentX509ExtensionInitException
- if the extension can not be initializedpublic void setServiceLocator(ServiceLocator serviceLocator) throws X509ExtensionException
This method provides an convenient alternative to method
addExtension
for including the
ServiceLocator
extension
in this request.
An OCSP server may be operated in a mode whereby the server receives a request and routes it to the OCSP server which is known to be authoritative for the identified certificate. The serviceLocator request extension is defined for this purpose. This extension is included as one of the singleRequestExtensions in requests. Values for these fields are obtained from the corresponding fields in the subject certificate.
serviceLocator
- the ServiceLocator extensionX509ExtensionException
- if the ServiceLocator extension cannot be addedpublic ServiceLocator getServiceLocator() throws X509ExtensionInitException
This method provides an convenient alternative to method
getExtension
for getting the
ServiceLocator
extension,
if included in this request.
An OCSP server may be operated in a mode whereby the server receives a request and routes it to the OCSP server which is known to be authoritative for the identified certificate. The serviceLocator request extension is defined for this purpose. This extension is included as one of the singleRequestExtensions in requests. Values for these fields are obtained from the corresponding fields in the subject certificate.
null
X509ExtensionInitException
- if the ServiceLocator extension cannot be initialized from its
encodingpublic ASN1Object toASN1Object() throws CodingException
toASN1Object
in interface ASN1Type
CodingException
- if an error occurs when creating the ASN.1 objectpublic void decode(ASN1Object obj) throws CodingException
decode
in interface ASN1Type
obj
- the Request as ASN1ObjectCodingException
- if the ASN1Object has the wrong formatpublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(boolean detailed)
detailed
- whether to print detailed information about the extensions