|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--iaik.x509.ocsp.Response | +--iaik.x509.ocsp.BasicOCSPResponse
This class implements the OCSP type BasicOCSPResponse
.
When sending an OCSPResponse
in
response to an OCSPRequest
, a successful
response may include ResponseBytes
giving more detailed information about the status of the certificates
asked for. ResponseBytes may include Response
information of any type, identified by its object identifier
(see RFC 2560):
OCSPResponse ::= SEQUENCE { responseStatus OCSPResponseStatus, responseBytes [0] EXPLICIT ResponseBytes OPTIONAL } OCSPResponseStatus ::= ENUMERATED { successful (0), --Response has valid confirmations malformedRequest (1), --Illegal confirmation request internalError (2), --Internal error in issuer tryLater (3), --Try again later --(4) is not used sigRequired (5), --Must sign the request unauthorized (6) --Request unauthorized } ResponseBytes ::= SEQUENCE { responseType OBJECT IDENTIFIER, response OCTET STRING }This class implements the only one response type predefined by RFC 2560,
BasicOCSResponse
which shall be supported by all
OCSP clients and servers:
BasicOCSPResponse ::= SEQUENCE { tbsResponseData ResponseData, signatureAlgorithm AlgorithmIdentifier, signature BIT STRING, certs [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL } ResponseData ::= SEQUENCE { version [0] EXPLICIT Version DEFAULT v1, responderID ResponderID, producedAt GeneralizedTime, responses SEQUENCE OF SingleResponse, responseExtensions [1] EXPLICIT Extensions OPTIONAL }After
creating
a BasicOCSPResponse and
setting ResponderID
and
producedAt
date, add
single responses
for any single
request included in the OCSPRequest
received, e.g.:
// the ocsp request received OCSPrequest ocspRequest = ...; Request[] requests = ocspRequest.getRequestList(); SingleResponse[] singleResponses = new SingleResponse[requests.length]; // create a single response for any request included: for (int i = 0; i < requests.length; i++) { ... singleResponses[i] = ...; ... } // create the BasicOCSPResponse: BasicOCSPresponse basicOCSPResponse = new BasicOCSPResponse(); // set the ResponderID: ResponderID responderID = ...; basicOCSPResponse.setResponderID(responderID); // set the producedAt date: basicOCSPResponse.setProducedAt(new Date()); // add the single responses: basicOCSPResponse.setSingleResponses(singleResponses);Before
signing
the BasicOCSPResponse
extensions may be added
and the certificates
of the signer may be
included to help the OCSP requestor to verify
the signature,
e.g.:
// the certificates of the responder X509Certificate[] responderCerts = ...; // the private key of the responder, used for signing: PrivateKey responderKey = ...; // set the certificates: basicOCSPResponse.setCertificates(responderCerts); // sign the response: ocspResponse.sign(AlgorithmID.sha1WithRSAEncryption, responderKey);Finally the BasicOCSPResponse has to be included into an
OCSPResponse
message for being sent
back to the requestor:
OCSPResponse ocspResponse = new OCSPResponse(basicOCSPResponse); OutputStream os = ...; // encode the OCSP response ocspResponse.writeTo(os);
A requestor receiving an ocsp response, checks
the response
status and -- if successful -- gets
the BasicOCSPResponse included:
// the stream supplying the encoded OCSP response: InputStream is = ...; OCSPResponse ocspResponse = new OCSPResponse(is); // get the response status: int responseStatus = ocspResponse.getResponseStatus(); if (responseStatus != OCSPResponse.successful) { System.out.println("Not successful; got response status: " + ocspResponse.getResponseStatusName()); ... } else { // get the basicOCSPResponse BasicOCSPResponse basicOCSPResponse = (BasicOCSPResponse)ocspResponse.getResponse();After
verifying
the signature of the responder
the basicOCSPResponse may be searched
for the single response given for a particular certificate
request sent to the server:
// verify the response try { if (basicOCSPResponse.containsCertificates()) { X509Certificate signerCert = basicOCSPResponse.verify(); System.out.println("Signature ok from response signer " + signerCert.getSubjectDN()); } else { basicOCSPResponse.verify(responderCerts[0].getPublicKey()); System.out.println("Signature ok!"); } } catch (SignatureException ex) { System.out.println("Signature verification error!!!"); } // is there a single response for our request? SingleResponse singleResponse = null; try { singleResponse = basicOCSPResponse.getSingleResponse(reqCert); } catch (OCSPException ex) { singleResponse = basicOCSPResponse.getSingleResponse(targetCerts[0], targetCerts[1], null); } if (singleResponse != null) { System.out.println("Status information got for cert: "); System.out.println(singleResponse.getCertStatus()); ... } else { System.out.println("No response got!");
OCSPRequest
,
Request
,
OCSPResponse
,
ResponseBytes
,
SingleResponse
,
ReqCert
,
CertStatus
Field Summary | |
static ObjectID |
responseType
The response type of the BasicOCSPResponse. |
Constructor Summary | |
BasicOCSPResponse()
Default constructor for creating a new empty BasicOCSPResponse. |
|
BasicOCSPResponse(byte[] array)
Creates a BasicOCSPResponse form a PEM or DER byte array. |
|
BasicOCSPResponse(InputStream is)
Creates a BasicOCSPResponse from an input stream. |
Method Summary | |
void |
addExtension(V3Extension e)
Adds the given extension. |
boolean |
containsCertificates()
Checks if certificates are included. |
int |
countExtensions()
Returns the number of extensions included in this basic ocsp response. |
int |
countSingleResponses()
Returns the number of single responses included. |
void |
decode(ASN1Object obj)
Decodes a BasicOCSPResponse from an ASN1Object. |
void |
decode(byte[] enc)
Decodes a BasicOCSPResponse from an byte array. |
void |
decode(InputStream is)
Decodes a BasicOCSPResponse from an InputStream. |
CertificateResponse |
getCertificateResponse(ReqCert reqCert)
Searches for the certificate response corresponding to the certificate identified by the given reqCert. |
CertificateResponse |
getCertificateResponse(X509Certificate targetCert,
X509Certificate issuerCert,
GeneralName generalName)
Searches this BasicOCSPReponse for status information about the certificate identified by the given certificate information. |
X509Certificate[] |
getCertificates()
Returns the signer certificates that may be included in this response. |
byte[] |
getEncoded()
Returns this BasicOCSPResponse as DER encoded ASN.1 data structure |
V3Extension |
getExtension(ObjectID oid)
Returns a specific extension, identified by its object identifier. |
byte[] |
getNonce()
A convenience method for getting the value of the Nonce extension, if included in this response. |
Date |
getProducedAt()
Returns the producedAt date of this BasicOCSPResponse.
|
ResponderID |
getResponderID()
Returns the responderID. |
ObjectID |
getResponseType()
Returns the response type identifying this BasicOCSPResponse
The corresponding OID string is "1.3.6.1.5.5.7.1.11.1". |
byte[] |
getSignature()
Returns the signature of this BasicOCSPResponse. |
AlgorithmID |
getSignatureAlgorithm()
Returns the signature algorithm of this BasicOCSPResponse. |
SingleResponse |
getSingleResponse(ReqCert reqCert)
Searches for the single response corresponding to the certificate identified by the given reqCert. |
SingleResponse |
getSingleResponse(X509Certificate targetCert,
X509Certificate issuerCert,
GeneralName generalName)
Searches this BasicOCSPReponse for status information about the certificate identified by the given certificate information. |
SingleResponse[] |
getSingleResponses()
Returns all single responses included in this BasicOCSPResponse. |
byte[] |
getTBSResponseData()
Returns the DER encoded TBSResponseData ASN.1 data structure
specifying response data to be signed.
|
int |
getVersion()
Returns the version number of this BasicOCSPResponse as int .
|
boolean |
hasExtensions()
Checks, if there are any extensions included in this basic ocsp response. |
boolean |
hasUnsupportedCriticalExtension()
Returns true if there are unsupported critical extensions. |
Enumeration |
listExtensions()
Returns an enumeration of all extensions included in this basic ocsp response. |
void |
removeAllExtensions()
Removes all extensions from this basic ocsp response. |
boolean |
removeExtension(ObjectID oid)
Removes the extension specified by its object identifier. |
void |
setCertificates(X509Certificate[] signerCerts)
Sets the certificates to be included into this BasicOCSPResponse. |
void |
setNonce(byte[] nonce)
A convenience method for setting the value of the Nonce extension. |
void |
setProducedAt(Date producedAtDate)
Sets the producedAt date of this certificate.
|
void |
setResponderID(ResponderID responderID)
Sets the responderID. |
void |
setSignature(AlgorithmID signatureAlg,
byte[] signature)
Sets the signature value of this BasicOCSPResponse. |
void |
setSingleResponses(SingleResponse[] singleResponses)
Sets the single responses of this BasicOCSPResponse. |
void |
sign(AlgorithmID signatureAlg,
PrivateKey issuerPK)
Signs the BasicOCSPResponse with the private key of the issuer. |
void |
sign(AlgorithmID signatureAlg,
PrivateKey issuerPK,
String provider)
Signs the BasicOCSPResponse with the private key of the issuer. |
ASN1Object |
toASN1Object()
Returns the BasicOCSPResponse as an ASN1Object. |
String |
toString()
Returns a string that represents the contents of this BasicOCSPResponse. |
String |
toString(boolean detailed)
Returns a string that represents the contents of this BasicOCSPResponse. |
X509Certificate |
verify()
Verifies this BasicOCSPResponse using the included signer certificates. |
void |
verify(PublicKey key)
Uses the given public key to verify this BasicOCSPResponse. |
void |
verify(PublicKey key,
String sigProvider)
Uses the given public key to verify this BasicOCSPResponse. |
void |
writeTo(OutputStream os)
Writes this BasicOCSPResponse DER encoded to the given output stream. |
Methods inherited from class iaik.x509.ocsp.Response |
getName |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final ObjectID responseType
Constructor Detail |
public BasicOCSPResponse()
Any value may be set using the corrseponding set<Value>
method.
The version number per default is set to 0
indicating a
v1
response.
public BasicOCSPResponse(InputStream is) throws IOException, CodingException
The supplied BasicOCSPResponse can be in PEM or DER format.
This constructor reads a BasicOCSPResponse previously written with
method writeTo(OutputStream)
.
For instance:
InputStream is = ...; BasicOCSPResponse response = new BasicOCSPResponse(is); is.close();
is
- InputStream from which to create the BasicOCSPResponseIOException
- if the response could not be readCodingException
- if there is a problem with the responsepublic BasicOCSPResponse(byte[] array) throws CodingException
This constructor may be used for parsing an already exisiting
BasicOCSPResponse
ASN.1 object, supplied as DER encoded
byte array, which may have been created by calling method
getEncoded
.
array
- the byte array containing the DER encoded responseCodingException
- if the response cannot be decodedMethod Detail |
public void decode(ASN1Object obj) throws CodingException
The given ASN1Object represents an already existing BasicOCSPResponse
which may have been created by calling the toASN1Object
method.
obj
- the ASN1Object which representing the responseCodingException
- if there is a problem when parsing the responsepublic void decode(byte[] enc) throws CodingException
decode
in class Response
is
- the byte array from where the response should be readCodingException
- if an decoding/parsing error occurspublic void decode(InputStream is) throws IOException
is
- the InputStream from where the response should be readIOException
- if something is wrong with the InputStreampublic void sign(AlgorithmID signatureAlg, PrivateKey issuerPK) throws OCSPException, InvalidKeyException, NoSuchAlgorithmException
signatureAlg
- the AlgorithmID of the signature algorithmissuerPK
- the private key of the issuerOCSPException
- if the response could not be signedInvalidKeyException
- if the format of the key is wrongNoSuchAlgorithmException
- if there is no implementation for the
specified algorithmpublic void sign(AlgorithmID signatureAlg, PrivateKey issuerPK, String provider) throws OCSPException, InvalidKeyException, NoSuchAlgorithmException
signatureAlg
- the AlgorithmID of the signature algorithmissuerPK
- the private key of the issuerprovider
- the name of the provider supplying the Signature engine
to be usedOCSPException
- if the response could not be signedInvalidKeyException
- if the format of the key is wrongNoSuchAlgorithmException
- if there is no implementation for the
specified algorithmpublic void setSignature(AlgorithmID signatureAlg, byte[] signature) throws OCSPException
This method provides an alternative way to method sign
for "signing" this
basic OCSP response with a precalculated signature value.
If using this method please make sure that the signature
value provided actually has beeb calculated over the
TBS responseData.
signatureAlg
- the AlgorithmID of the signature algorithmsignature
- the (precalculated) signature valueOCSPException
- if the response could not be signedpublic byte[] getEncoded()
getEncoded
in class Response
public int getVersion()
int
.
Default version: v1.
ASN.1 definition:
Version ::= INTEGER { v1(0), v2(1) }
int
,
1 for v1, 2 for v2.public ObjectID getResponseType()
BasicOCSPResponse
The corresponding OID string is "1.3.6.1.5.5.7.1.11.1".getResponseType
in class Response
BasicOCSPResponse
public ResponderID getResponderID()
public SingleResponse[] getSingleResponses()
public int countSingleResponses()
public SingleResponse getSingleResponse(X509Certificate targetCert, X509Certificate issuerCert, GeneralName generalName) throws OCSPException
This method only calls method getCertificateResponse
and casts the result
to SingleResponse
.
Each particular single response included is expected to be
identified by its reqCert
identifying
the corresponding certificate by one of the following id types:
ReqCert ::= CHOICE { certID CertID, issuerSerial [0] IssuerandSerialNumber, pKCert [1] Certificate, name [2] GeneralName, certHash [3] OCTET STRING}When searching an OCSP response for a
SingleResponse
the search has to be done by checking the ReqCert
identifiers of the single responses included.
Since OCSP v2-01 (see draft-ietf-pkix-ocspv2-01) uses not less
than five alternatives (certID, issuerSerial, pKCert, name, certHash)
to identify the target cert for which status information shall be
obtained, it might be the -- hopefully not very probable -- case that
an OCSP server responds by using a different reqCert type (namely when
maintaining precompted responses) as the one sent with the client
request.
If method getSingleResponse
does not find a single response for a given ReqCert
thereby throwing an OCSPException there maybe single
responses included having a different ReqCert type (or -- in the case of
certIDs
-- using different hash algorithms} as
the one queried for. In this case this method can be used for stepping
through the single responses
included and using their ReqCert types for searching for a single
response for the cert identified by the given certificate data. For each
certifcate response included the given certificate information is tried
to be "translated" in a ReqCert of appropriate type according to the
follwoing rules:
targetCert
and issuerCert
are required;
generalName
is ignored. From the given certs,
a certID is created and checked for equality with the certID of the
reqCert of the particular single response.
targetCert
is required; issuerCert
and generalName
are ignored. From the given target cert, an
IssuerAndSerialNumber object is created and checked for equality with the
issuerSerial of the reqCert of the particular single response.
targetCert
is required; issuerCert
and
generalName
are ignored. The given target cert is checked
for equality with the pKCert of the reqCert of the particular single
response.
targetCert
or generalName
are required;
issuerCert
is ignored. If generalName
is present,
it is compared with the GeneralName of the reqCert of the particular response.
If generalName
is null, but targetCert
is present,
a GeneralName of type directoryName is created from the target certīs
SubjectDN and checked for equality with the generalName of the reqCert of
the particular single response.
targetCert
is required; issuerCert
and
generalName
are ignored. From the given target cert a SHA-1
hash is computed and compared with the certHash of the reqCert of the
particular single response.
Assuming, for instance, that you have used method getSingleResponse
for asking if
a response for your request is included. The search has stopped by
throwing an OCSPException indicating that no single response for
your ReqCert is included, but there are single responses present having
a different ReqCert type. Now you may start a second search using the
ReqCert types of the single responses included, e.g.:
// the target cert chain X509Certificate[] targetCerts = ...; // the ReqCert used in the request: ReqCert reqCert ...; ... // search the response by ReqCert ID: SingleResponse singleResponse = null; try { singleResponse = basicOCSPResponse.getSingleResponse(reqCert); } catch (OCSPException ex) { // not found, but cert responses with different types are present System.out.println("Not found: " + ex.getMessage()); System.out.println("Seraching again..."); singleResponse = basicOCSPResponse.getSingleResponse(targetCerts[0], targetCerts[1], null); } if (singleResponse != null) { ... } else { System.out.println("Got no response!"); }
targetCert
- the target cert, if requiredissuerCert
- the cert of the target cert issuer, if requiredgeneralName
- a general name (if required for reqCert type "name")null
if no single response for the certificate
in mind is includedOCSPException
- if some processing error occurs, e.g. if the ReqCert
of some response represents a CertID but the certIDīs hash algorithm
is not supported by the installed providerspublic SingleResponse getSingleResponse(ReqCert reqCert) throws OCSPException
This method only calls method getCertificateResponse
and casts the result
to SingleResponse
.
Each single response included in this BasicOCSPResponse is
identified by its reqCert
ID.
This method steps through all the single responses included in this
BasicOCSPResponse and compares their reqCert IDs with the given reqCert.
reqCert
- the reqCert of the certificate for which status information
shall be obtainednull
if no single response for the certificate in mind is includedOCSPException
- if a single response for the given reqCert
cannot be found, but single responses included
having a different reqCert type or -- in the case
of certIDs -- using a hash algorithms different to
the given certIDīs one; in this case you may try method
getSingleResponse
to use the reqCert
types of the single responses includedpublic CertificateResponse getCertificateResponse(X509Certificate targetCert, X509Certificate issuerCert, GeneralName generalName) throws OCSPException
This method overrides the corresponding method of the parent Response
class.
Each particular certificate response included is expected to be
identified by its reqCert
identifying
the corresponding certificate by one of the following id types:
ReqCert ::= CHOICE { certID CertID, issuerSerial [0] IssuerandSerialNumber, pKCert [1] Certificate, name [2] GeneralName, certHash [3] OCTET STRING}When searching an OCSP response for a
CertificateResponse
the search has to be done by checking the ReqCert
identifiers of the certificate responses included.
Since OCSP v2-01 (see draft-ietf-pkix-ocspv2-01) uses not less
than five alternatives (certID, issuerSerial, pKCert, name, certHash)
to identify the target cert for which status information shall be
obtained, it might be the -- hopefully not very probable -- case that
an OCSP server responds by using a different reqCert type (namely when
maintaining precompted responses) as the one sent with the client
request.
If method getCertificateResponse
does not find a certificate response for a given ReqCert
thereby throwing an OCSPException there maybe certificate
responses included having a different ReqCert type (or -- in the case of
certIDs
-- using different hash algorithms} as
the one queried for. In this case this method can be used for stepping
through the certificate responses
included and using their ReqCert types for searching for a certificate
response for the cert identified by the given certificate data. For each
certifcate response included the given certificate information is tried
to be "translated" in a ReqCert of appropriate type according to the
follwoing rules:
targetCert
and issuerCert
are required;
generalName
is ignored. From the given certs,
a certID is created and checked for equality with the certID of the
reqCert of the particular certificate response.
targetCert
is required; issuerCert
and generalName
are ignored. From the given target cert, an
IssuerAndSerialNumber object is created and checked for equality with the
issuerSerial of the reqCert of the particular certificate response.
targetCert
is required; issuerCert
and
generalName
are ignored. The given target cert is checked
for equality with the pKCert of the reqCert of the particular certificate
response.
targetCert
or generalName
are required;
issuerCert
is ignored. If generalName
is present,
it is compared with the GeneralName of the reqCert of the particular response.
If generalName
is null, but targetCert
is present,
a GeneralName of type directoryName is created from the target certīs
SubjectDN and checked for equality with the generalName of the reqCert of
the particular certificate response.
targetCert
is required; issuerCert
and
generalName
are ignored. From the given target cert a SHA-1
hash is computed and compared with the certHash of the reqCert of the
particular certificate response.
Assumimg, for instance, that you have used method getCertificateResponse
for asking if
a response for your request is included. The search has stopped by
throwing an OCSPException indicating that no certificate response for
your ReqCert is included, but there are certificate responses present having
a different ReqCert type. Now you may start a second search using the
ReqCert types of the certificate responses included, e.g.:
// the target cert chain
X509Certificate[] targetCerts = ...;
// the ReqCert used in the request:
ReqCert reqCert ...;
...
// search the response by ReqCert ID:
CertificateResponse certificateResponse = null;
try {
certificateResponse = basicOCSPResponse.getCertificateResponse(reqCert);
} catch (OCSPException ex) {
// not found, but cert responses with different types are present
System.out.println("Not found: " + ex.getMessage());
System.out.println("Seraching again...");
certificateResponse = basicOCSPResponse.getCertificateResponse(targetCerts[0],
targetCerts[1],
null);
}
if (certificateResponse != null) {
...
} else {
System.out.println("Got no response!");
}
getCertificateResponse
in class Response
targetCert
- the target cert, if requiredissuerCert
- the cert of the target cert issuer, if requiredgeneralName
- a general name (if required for reqCert type "name")null
if no certificate response for the certificate
in mind is includedOCSPException
- if some processing error occurs, e.g. if the ReqCert
of some response represents a CertID but the certIDīs hash algorithm
is not supported by the installed providerspublic CertificateResponse getCertificateResponse(ReqCert reqCert) throws OCSPException
This method overrides the corresponding method of the parent Response
class.
Each single response included in this BasicOCSPResponse is
identified by its reqCert
ID.
This method steps through all the single responses included in this
BasicOCSPResponse and compares their reqCert IDs with the given reqCert.
getCertificateResponse
in class Response
reqCert
- the reqCert of the certificate for which status information
shall be obtainednull
if no certificate response for the certificate in mind is includedOCSPException
- if a certificate response for the given reqCert
cannot be found, but certificate responses included
having a different reqCert type or -- in the case
of certIDs -- using a hash algorithms different to
the given certIDīs one; in this case you may try method
getCertificateResponse
to use the reqCert
types of the certificate responses includedpublic Date getProducedAt()
producedAt
date of this BasicOCSPResponse.
The producedAt
value denotes the time at which the
response was produced and can be set using the setProducedAt
method.
null
if the producedAt date has yet not been setpublic byte[] getTBSResponseData() throws CodingException
TBSResponseData
ASN.1 data structure
specifying response data to be signed.
ResponseData ::= SEQUENCE { version [0] EXPLICIT Version DEFAULT v1, responderID ResponderID, producedAt GeneralizedTime, responses SEQUENCE OF SingleResponse, responseExtensions [1] EXPLICIT Extensions OPTIONAL }
TBSResponseData
as DER encoded ASN.1 structureCodingException
- if an encoding error occurspublic byte[] getSignature()
public AlgorithmID getSignatureAlgorithm()
AlgorithmID
public void verify(PublicKey key) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException
key
- the public key (of the issuer) to verify the responseNoSuchAlgorithmException
- if there is no implementation for the algorithm that has been
used to sign this responseInvalidKeyException
- if the format of the public key is wrongSignatureException
- if the signature does not verifypublic void verify(PublicKey key, String sigProvider) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException
key
- the public key (of the issuer) to verify the responsesigProvider
- the crypto provider supplying the Signature engine
to be usedNoSuchAlgorithmException
- if there is no implementation for the algorithm that has been
used to sign this responseInvalidKeyException
- if the format of the public key is wrongSignatureException
- if the signature does not verifypublic X509Certificate verify() throws NoSuchAlgorithmException, InvalidKeyException, SignatureException, OCSPException
This method only can be used for verifying this response if
signer certificates are included. If so, this method assumes
that all certificates included belong to same chain. It tries
to sort the chain to get the signer certificate public key
for verifying the response. If no certificates are included
or the chain cannot be sorted, an OCSPException is thrown. In
this case you may use method verify
for verifying the response with the right public key supplied by
other means.
NoSuchAlgorithmException
- if there is no implementation for the algorithm that has been
used to sign this responseInvalidKeyException
- if the format of the public key is wrongSignatureException
- if the signature does not verifyOCSPException
- if no certs are included or the signer cert cannot
be found in the certificate list includedpublic boolean containsCertificates()
true
if certificates are included, false
otherwisepublic ASN1Object toASN1Object()
public void writeTo(OutputStream os) throws IOException
os
- the output stream where the response shall be written toIOException
- if an I/O error occurspublic void setResponderID(ResponderID responderID)
responderID
- the responderID identifying the responder by name or keypublic void setProducedAt(Date producedAtDate)
producedAt
date of this certificate.
For instance:
GregorianCalendar date = (GregorianCalendar)Calendar.getInstance(); response.setProducedAt(date.getTime());
producedAt
- the Date at which this response is producedpublic void setSingleResponses(SingleResponse[] singleResponses)
singleResponses
- the single responses to be setpublic void setCertificates(X509Certificate[] signerCerts)
signerCerts
- the certificates of the signer to be includedpublic X509Certificate[] getCertificates()
null
otherwisepublic 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)
objectID
- the object ID of the extension to removetrue
if the extension has been successfully removed,
false
otherwisepublic void removeAllExtensions()
public Enumeration listExtensions()
The returned enumeration may contain unknown extensions (instances of
UnknownExtension
if there are any extensions included in basic response, 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.
objectID
- the object ID of the extensionnull
if the requested
extension is not presentX509ExtensionInitException
- if the extension can not be initializedpublic void setNonce(byte[] nonce) throws X509ExtensionException
This method provides an convenient alternative to method addExtension
for including the Nonce
extension in this
response. From the given nonce value a Nonce extension object
is created an added to the list of response extensions.
The Nonce extension can be used for cryptographically binding a request and a response to prevent replay attacks.
nonce
- the nonce valueX509ExtensionException
- if the Nonce extension cannot be createdpublic byte[] getNonce() throws X509ExtensionInitException
This method provides an convenient alternative to method getExtension
for getting the value of the
Nonce
extension, if included
in this response.
The Nonce extension can be used for cryptographically binding a request and a response to prevent replay attacks.
null
X509ExtensionInitException
- if the Nonce extension cannot be
initialized from its encodingpublic String toString()
toString
in class Response
public String toString(boolean detailed)
detailed
- whether or not to give detailed information about the
included single responses and extensions
|
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). | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |