iaik.x509.ocsp
Class Request

java.lang.Object
  |
  +--iaik.x509.ocsp.Request
All Implemented Interfaces:
ASN1Type

public class Request
extends Object
implements ASN1Type

This class implements the OCSP type 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:

 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 });
 

Version:
File Revision 7

Constructor Summary
Request()
          Default constructor.
Request(ASN1Object obj)
          Creates Request from an ASN1Object.
Request(ReqCert reqCert)
          Creates a Request for the given ReqCert.
 
Method Summary
 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.
 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.
 String toString()
          Returns a String representation of this Request.
 String toString(boolean detailed)
          Returns a String representation of this Request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Request

public Request()
Default constructor. Creates an empty Request object. Only used for dynamic object creation. Shall not be called by an application!.

Request

public Request(ReqCert reqCert)
Creates a Request for the given ReqCert.
Parameters:
reqCert - the ReqCert identifying the certificate for which revocation status information shall be obtained

Request

public Request(ASN1Object obj)
        throws CodingException,
               X509ExtensionException
Creates Request from an ASN1Object.
Parameters:
obj - the request as ASN1Object
Throws:
CodingException - if the ASN1Object has the wrong format
X509ExtensionException - if there is a problem with a X.509 extension.
Method Detail

getReqCert

public ReqCert getReqCert()
Returns the ReqCert.
Returns:
the ReqCert identifying the certificate for which revocation information shall be requested

addExtension

public void addExtension(V3Extension e)
                  throws X509ExtensionException
Adds the given extension.

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.

Parameters:
e - the extension to be added
Throws:
X509ExtensionException - if the extension cannot be added

removeExtension

public boolean removeExtension(ObjectID oid)
Removes the extension specified by its object identifier.
Parameters:
objectID - the object ID of the extension to remove
Returns:
true if the extension has been successfully removed, false otherwise

removeAllExtensions

public void removeAllExtensions()
Removes all extensions from this request.

listExtensions

public Enumeration listExtensions()
Returns an enumeration of all extensions included in this request.

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.

Returns:
an enumeration of the extensions, or null if there are no extensions present at all

hasExtensions

public boolean hasExtensions()
Checks, if there are any extensions included in this request.
Returns:
true if there are extensions, false if not

hasUnsupportedCriticalExtension

public boolean hasUnsupportedCriticalExtension()
Returns true if there are unsupported critical extensions.
Returns:
true, if there are unsupported critical extensions

countExtensions

public int countExtensions()
Returns the number of extensions included in this request.
Returns:
the number of extensions

getExtension

public V3Extension getExtension(ObjectID oid)
                         throws X509ExtensionInitException
Returns a specific extension, identified by its object identifier.

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.

Parameters:
objectID - the object ID of the extension
Returns:
the desired extension or null if the requested extension is not present
Throws:
X509ExtensionInitException - if the extension can not be initialized

setServiceLocator

public void setServiceLocator(ServiceLocator serviceLocator)
                       throws X509ExtensionException
A convenience method for setting the ServiceLocator extension.

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.

Parameters:
serviceLocator - the ServiceLocator extension
Throws:
X509ExtensionException - if the ServiceLocator extension cannot be added

getServiceLocator

public ServiceLocator getServiceLocator()
                                 throws X509ExtensionInitException
A convenience method for getting the ServiceLocator extension, if included in this request.

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.

Returns:
the ServiceLocator extension, if included in this requeste; otherwise null
Throws:
X509ExtensionInitException - if the ServiceLocator extension cannot be initialized from its encoding

toASN1Object

public ASN1Object toASN1Object()
                        throws CodingException
Returns this Request as an ASN1Object.
Specified by:
toASN1Object in interface ASN1Type
Returns:
this Request as an ASN1Object
Throws:
CodingException - if an error occurs when creating the ASN.1 object

decode

public void decode(ASN1Object obj)
            throws CodingException
Decodes a Request from an ASN1Object.
Specified by:
decode in interface ASN1Type
Parameters:
the - Request as ASN1Object
Throws:
CodingException - if the ASN1Object has the wrong format

toString

public String toString()
Returns a String representation of this Request.
Overrides:
toString in class Object
Returns:
a String representation

toString

public String toString(boolean detailed)
Returns a String representation of this Request.
Parameters:
detailed - whether to print detailed information about the extensions
Returns:
a String representation

This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note).

IAIK-JCE 3.1 with IAIK-JCE CC Core 3.1, (c) 1997-2004 IAIK