iaik.x509.ocsp
Class ResponderID

java.lang.Object
  |
  +--iaik.x509.ocsp.ResponderID

public class ResponderID
extends Object

This class implements the OCSP type ResponderID.

Within a BasicOCSPResponse the ResponderID identifies the responder either by its name or by a SHA-1 hash calculated from the responderīs public key (see RFC 2560):

 ResponderID ::= CHOICE {
   byName   [1] Name,
   byKey    [2] KeyHash } 
 
After having created a new ResponderID, add it to BasicOCSPResponse by calling the setResponderID method, e.g.:
 // the key of the responder:
 PublicKey responderKey = ...;
 ResponderID responderID = new ResponderID(responderKey);
 ...
 BasicOCSPResponse basicOCSPresponse = ...;
 ...
 basicOCSPResponse.setResponderID(responderID);
 
As you can see from the example above, you immediately may supply the responderīs key to the corresponding constructor of this call to let it do the hash calcualtion for a keyHash responder id.

Version:
File Revision 11
See Also:
BasicOCSPResponse

Constructor Summary
ResponderID(ASN1Object obj)
          Creates ResponderID from an ASN1Object.
ResponderID(byte[] keyHash)
          Creates a responder ID from a hash of itīs public key.
ResponderID(Name name)
          Creates a responder ID from its name.
ResponderID(PublicKey responderKey)
          Creates a responder ID from itīs public key.
 
Method Summary
 boolean byName()
          Checks whether this ResponderID represents the byName choice.
 boolean equals(Object obj)
          Compares this ResponderID with the given ResponderID.
 byte[] getKeyHash()
          Returns the hash of the responderīs public key.
 Name getName()
          Returns the Name of the responder.
 int hashCode()
          Returns a hash code value for this object.
 boolean isResponderIdFor(X509Certificate responderCert)
          Checks if this is a responder id for the given certificate.
 ASN1Object toASN1Object()
          Returns this ResponderID as an ASN1Object.
 String toString()
          Gives a String representation of this ResponderID.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ResponderID

public ResponderID(Name name)
Creates a responder ID from its name.
Parameters:
name - the name of the responder

ResponderID

public ResponderID(byte[] keyHash)
Creates a responder ID from a hash of itīs public key.
Parameters:
keyHash - the hash of the responderīs public key

ResponderID

public ResponderID(PublicKey responderKey)
            throws NoSuchAlgorithmException
Creates a responder ID from itīs public key. The SHA-1 hash of the key will be automatically calculated.
Parameters:
keyHash - responderKey the public key of the reponder from which a SHA-1 hash has to be calculated for giving the value of this "byKey" responder ID
Throws:
NoSuchAlgorithmException - if SHA-1 is not supported by the installed providers

ResponderID

public ResponderID(ASN1Object obj)
            throws CodingException
Creates ResponderID from an ASN1Object.
Parameters:
the - ResponderID as ASN1Object
Throws:
CodingException - if the ASN1Object has the wrong format
Method Detail

isResponderIdFor

public boolean isResponderIdFor(X509Certificate responderCert)
                         throws NoSuchAlgorithmException
Checks if this is a responder id for the given certificate.
Parameters:
responderCert - the cert of the responder
Returns:
true if this responderID identifies the responder
Throws:
NoSuchAlgorithmException - if SHA-1 is not supported by the installed providers

getName

public Name getName()
Returns the Name of the responder.
Returns:
the Name of the responder if this ResponderID represents the byName choice

getKeyHash

public byte[] getKeyHash()
Returns the hash of the responderīs public key.
Returns:
the hash of the responderīs public key if this ResponderID represents the byKey choice

byName

public boolean byName()
Checks whether this ResponderID represents the byName choice.
Returns:
true if this ID identifies the responder by Name false if this ID identifies the responder by Key

toASN1Object

public ASN1Object toASN1Object()
Returns this ResponderID as an ASN1Object.
Returns:
this ResponderID as ASN1Object

equals

public boolean equals(Object obj)
Compares this ResponderID with the given ResponderID.
Overrides:
equals in class Object
Parameters:
obj - the other ResponderID
Returns:
true, if the two ResponderID are equal, false otherwise

hashCode

public int hashCode()
Returns a hash code value for this object.
Overrides:
hashCode in class Object
Returns:
a hash code value for this object

toString

public String toString()
Gives a String representation of this ResponderID.
Overrides:
toString in class Object
Returns:
a String representation of this responder IS.

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