APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.security.provider.certpath

public final Class ResponderId

extends Object
Class Inheritance
Imports
java.util.Arrays, java.io.IOException, java.security.PublicKey, javax.security.auth.x500.X500Principal, sun.security.x509.KeyIdentifier, sun.security.util.DerValue

Class for ResponderId entities as described in RFC6960. ResponderId objects are used to uniquely identify OCSP responders.

The RFC 6960 defines a ResponderID structure as:

ResponderID ::= CHOICE {
     byName              [1] Name,
     byKey               [2] KeyHash }

KeyHash ::= OCTET STRING -- SHA-1 hash of responder's public key
(excluding the tag and length fields)

Name is defined in RFC 5280.
Since
9
See Also
ResponderId.Type

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
ResponderId.Type

A ResponderId enumeration describing the accepted forms for a ResponderId.

Field Summary

Modifier and TypeField and Description
private final byte[]
private KeyIdentifier
private X500Principal
private final ResponderId.Type

Constructor Summary

AccessConstructor and Description
public
ResponderId(X500Principal
the subject name of the certificate used to sign OCSP responses.
subjectName
)

Constructs a ResponderId object using an X500Principal.

public
ResponderId(PublicKey
the OCSP responder's public key
pubKey
)

Constructs a ResponderId object using a PublicKey.

public
ResponderId(byte[]
the DER-encoded bytes
encodedData
)

Constructs a ResponderId object from its DER-encoding.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the specified object is equal to this ResponderId
equals
(Object
the object to be compared against
obj
)

Overrides java.lang.Object.equals.

Compares the specified object with this ResponderId for equality.

public byte[]

Returns:

a byte array containing the DER-encoded representation for this ResponderId
getEncoded
()

Encode a ResponderId in DER form

public KeyIdentifier

Returns:

the KeyIdentifier for this ResponderId if it is a BY_KEY variant. If the ResponderId is a BY_NAME variant, this routine will return null.
getKeyIdentifier
()

Obtain the underlying key identifier from a ResponderId

public X500Principal

Returns:

the X500Principal for this ResponderId if it is a BY_NAME variant. If the ResponderId is a BY_KEY variant, this routine will return null.
getResponderName
()

Obtain the underlying X500Principal from a ResponderId

public ResponderId.Type

Returns:

a number corresponding to the context-specific tag number used in the DER-encoding for a ResponderId
getType
()

Return the type of ResponderId

public int

Returns:

the hash code value for this ResponderId
hashCode
()

Overrides java.lang.Object.hashCode.

Returns the hash code value for this ResponderId.

private byte[]

Returns:

the DER encoding for a responder ID byKey option, including explicit context-specific tagging.
keyIdToBytes
()

Convert the responderKeyId data member into its DER-encoded form

public int

Returns:

the length of the encoded ResponderId
length
()

Get the length of the encoded ResponderId (including the tag and length of the explicit tagging from the outer ASN.1 CHOICE).

private byte[]

Returns:

the DER encoding for a responder ID byName option, including explicit context-specific tagging.
principalToBytes
()

Convert the responderName data member into its DER-encoded form

public String

Returns:

a String representation of this ResponderId
toString
()

Overrides java.lang.Object.toString.

Create a String representation of this ResponderId

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

encodedRidback to summary
private final byte[] encodedRid
responderKeyIdback to summary
private KeyIdentifier responderKeyId
responderNameback to summary
private X500Principal responderName
typeback to summary
private final ResponderId.Type type

Constructor Detail

ResponderIdback to summary
public ResponderId(X500Principal subjectName) throws IOException

Constructs a ResponderId object using an X500Principal. When encoded in DER this object will use the BY_NAME option.

Parameters
subjectName:X500Principal

the subject name of the certificate used to sign OCSP responses.

Exceptions
IOException:
if the internal DER-encoding of the X500Principal fails.
ResponderIdback to summary
public ResponderId(PublicKey pubKey) throws IOException

Constructs a ResponderId object using a PublicKey. When encoded in DER this object will use the byKey option, a SHA-1 hash of the responder's public key.

Parameters
pubKey:PublicKey

the OCSP responder's public key

Exceptions
IOException:
if the internal DER-encoding of the KeyIdentifier fails.
ResponderIdback to summary
public ResponderId(byte[] encodedData) throws IOException

Constructs a ResponderId object from its DER-encoding.

Parameters
encodedData:byte[]

the DER-encoded bytes

Exceptions
IOException:
if the encodedData is not properly DER encoded

Method Detail

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Compares the specified object with this ResponderId for equality. A ResponderId will only be considered equivalent if both the type and data value are equal. Two ResponderIds initialized by name and key ID, respectively, will not be equal even if the ResponderId objects are created from the same source certificate.

Parameters
obj:Object

the object to be compared against

Returns:boolean

true if the specified object is equal to this ResponderId

Annotations
@Override
getEncodedback to summary
public byte[] getEncoded()

Encode a ResponderId in DER form

Returns:byte[]

a byte array containing the DER-encoded representation for this ResponderId

getKeyIdentifierback to summary
public KeyIdentifier getKeyIdentifier()

Obtain the underlying key identifier from a ResponderId

Returns:KeyIdentifier

the KeyIdentifier for this ResponderId if it is a BY_KEY variant. If the ResponderId is a BY_NAME variant, this routine will return null.

getResponderNameback to summary
public X500Principal getResponderName()

Obtain the underlying X500Principal from a ResponderId

Returns:X500Principal

the X500Principal for this ResponderId if it is a BY_NAME variant. If the ResponderId is a BY_KEY variant, this routine will return null.

getTypeback to summary
public ResponderId.Type getType()

Return the type of ResponderId

Returns:ResponderId.Type

a number corresponding to the context-specific tag number used in the DER-encoding for a ResponderId

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Returns the hash code value for this ResponderId.

Returns:int

the hash code value for this ResponderId

Annotations
@Override
keyIdToBytesback to summary
private byte[] keyIdToBytes() throws IOException

Convert the responderKeyId data member into its DER-encoded form

Returns:byte[]

the DER encoding for a responder ID byKey option, including explicit context-specific tagging.

Exceptions
IOException:
if any encoding error occurs
lengthback to summary
public int length()

Get the length of the encoded ResponderId (including the tag and length of the explicit tagging from the outer ASN.1 CHOICE).

Returns:int

the length of the encoded ResponderId

principalToBytesback to summary
private byte[] principalToBytes() throws IOException

Convert the responderName data member into its DER-encoded form

Returns:byte[]

the DER encoding for a responder ID byName option, including explicit context-specific tagging.

Exceptions
IOException:
if any encoding error occurs
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Create a String representation of this ResponderId

Returns:String

a String representation of this ResponderId

Annotations
@Override
sun.security.provider.certpath back to summary

public final Enum ResponderId.Type

extends Enum<ResponderId.Type>
Class Inheritance

A ResponderId enumeration describing the accepted forms for a ResponderId.
Since
9
See Also
ResponderId

Field Summary

Modifier and TypeField and Description
public static final ResponderId.Type
BY_KEY

A BY_KEY ResponderId will be built from a public key identifier, either derived from a PublicKey or directly from a DER-encoded byte array containing the key identifier.

public static final ResponderId.Type
BY_NAME

A BY_NAME ResponderId will be built from a subject name, either as an X500Principal or a DER-encoded byte array.

private final String
private final int

Constructor Summary

AccessConstructor and Description
private
Type(int value, String name)

Method Summary

Modifier and TypeMethod and Description
public String
toString()

Overrides java.lang.Enum.toString.

Returns the name of this enum constant, as contained in the declaration.

public int
public static ResponderId.Type
public static ResponderId.Type[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinalvalueOf

Field Detail

BY_KEYback to summary
public static final ResponderId.Type BY_KEY

A BY_KEY ResponderId will be built from a public key identifier, either derived from a PublicKey or directly from a DER-encoded byte array containing the key identifier.

BY_NAMEback to summary
public static final ResponderId.Type BY_NAME

A BY_NAME ResponderId will be built from a subject name, either as an X500Principal or a DER-encoded byte array.

ridTypeNameback to summary
private final String ridTypeName
tagNumberback to summary
private final int tagNumber

Constructor Detail

Typeback to summary
private Type(int value, String name)

Method Detail

toStringback to summary
public String toString()

Overrides java.lang.Enum.toString.

Doc from java.lang.Enum.toString.

Returns the name of this enum constant, as contained in the declaration. This method may be overridden, though it typically isn't necessary or desirable. An enum class should override this method when a more "programmer-friendly" string form exists.

Annotations
@Override
valueback to summary
public int value()
valueOfback to summary
public static ResponderId.Type valueOf(String name)
valuesback to summary
public static ResponderId.Type[] values()