public class Holder
extends java.lang.Object
Holder
.
The Internet Attribute
Certificate Profile for Authorization (RFC 5755) specifies the
Holder
type for identifying the entity to which the
AttributeCertificate
belongs:
Holder ::= SEQUENCE { baseCertificateID [0] IssuerSerial OPTIONAL, -- the issuer and serial number of -- the holder's Public Key Certificate entityName [1] GeneralNames OPTIONAL, -- the name of the claimant or role objectDigestInfo [2] ObjectDigestInfo OPTIONAL -- used to directly authenticate the holder, -- for example, an executable }For any environment where the AC is passed in an authenticated message or session and where the authentication is based on the use of an X.509 public key certificate, the holder should be identified by means of a
baseCertificateID
pointing to the right
X.509 public key certificate by issuer name and issuer-specific serial
number, e.g.:
X509Certificate baseCert = ...; IssuerSerial baseCertificateID = new IssuerSerial(baseCert); Holder holder = new Holder(); holder.setBaseCertificateID(baseCertificateID); attributeCertificate.setHolder(holder);
entityName
option and the underlying authentication is based on a PKC, then
the entityName MUST be the same as the PKC subject field or one of the values
of the PKC subjectAltName field extension (if present), e.g.:
X509Certificate cert = ...; Name subject = (Name)cert.getSubjectDN(); GeneralName subjectName = new GeneralName(GeneralName.directoryName, subject); GeneralNames entityName = new GeneralNames(subjectName); Holder holder = new Holder(); holder.setEntityName(entityName); attributeCertificate.setHolder(holder);The
ObjectDigestInfo
component may be
used for linking the AC to an object by placing a hash of that object into
the holder field of the AC. For example, this allows production of ACs that
are linked to public keys rather than names (see RFC 5755 for more information):
// the public key to which to link the AC: PublicKey publicKey = ...; // the digest algorithm to use AlgorithmID digestAlgorithm = ...; ObjectDigestInfo odi = new ObjectDigestInfo(publicKey, digestAlgorithm); Holder holder = new Holder(); holder.setObjectDigestInfo(odi); attributeCertificate.setHolder(holder);
AttributeCertificate
,
IssuerSerial
,
ObjectDigestInfo
,
GeneralNames
Constructor and Description |
---|
Holder()
Default constructor.
|
Holder(ASN1Object obj)
Creates a Holder from its ASN.1 representation.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Compares this
Holder to the specified object. |
IssuerSerial |
getBaseCertificateID()
Gets the baseCertificateID of this Holder, if set.
|
GeneralNames |
getEntityName()
Gets the entityName of this Holder, if set.
|
ObjectDigestInfo |
getObjectDigestInfo()
Gets the objectDigestInfo of this Holder, if set.
|
int |
hashCode()
Returns a hashcode for this Holder.
|
boolean |
identifiesCert(X509Certificate cert)
Checks if this Holder identifies the certificate.
|
void |
setBaseCertificateID(IssuerSerial baseCertificateID)
Sets the baseCertificateID of this Holder.
|
void |
setBaseCertificateID(X509Certificate baseCertificate)
Uses the given public key certificate to calculate and set the
baseCertificateID of this Holder.
|
void |
setEntityName(GeneralNames entityName)
Sets the entityName of this Holder.
|
void |
setEntityName(X509Certificate certificate)
Sets the entityName of this Holder based on the given public key
certificate.
|
void |
setObjectDigestInfo(ObjectDigestInfo objectDigestInfo)
Sets the objectDigestInfo of this Holder.
|
ASN1Object |
toASN1Object()
Returns this Holder as ASN1Object.
|
java.lang.String |
toString()
Returns a string giving some information about this
Holder
object. |
public Holder()
Holder
object. Use the
several setXXX
method for setting the fields of this Holder
object.public Holder(ASN1Object obj) throws CodingException
obj
- the Holder as ASN1ObjectCodingException
- if an decoding/parsing error occurs or the the information
contained is not appropriate for a Holderpublic IssuerSerial getBaseCertificateID()
public void setBaseCertificateID(IssuerSerial baseCertificateID)
baseCertificateID
- the baseCertificateID IssuerSerial to be set.public void setBaseCertificateID(X509Certificate baseCertificate)
baseCertificate
- the base certificate from which to calculate the baseCertificateID
IssuerSerialpublic GeneralNames getEntityName()
public void setEntityName(GeneralNames entityName)
entityName
- the entityName GeneralNames to be set.public void setEntityName(X509Certificate certificate) throws java.lang.IllegalArgumentException
certificate
- the certificate from which to create the entityNamejava.lang.IllegalArgumentException
- if the given certificate contains an empty subject field, but
does not contain the SubjectAltName extensionpublic ObjectDigestInfo getObjectDigestInfo()
public void setObjectDigestInfo(ObjectDigestInfo objectDigestInfo)
objectDigestInfo
- the objectDigestInfo to be set.public ASN1Object toASN1Object()
public boolean equals(java.lang.Object obj)
Holder
to the specified object.equals
in class java.lang.Object
obj
- the object to compare this Holder
against.true
, if the given object is equal to this
Holder
, false
otherwisepublic int hashCode()
hashCode
in class java.lang.Object
public boolean identifiesCert(X509Certificate cert) throws java.security.NoSuchAlgorithmException, java.security.cert.CertificateEncodingException
In the case where the Holder of an AC is linked to particular certificate this method may be used for checking if the given cert "belongs" to this Holder by performing the following steps in the following order:
IssuerSerial
identifies
the given certificate, this method returns true
; if the
corresponding IssuerSerial does not identify the given certificate, this
method returns false
true
; if the entityName
does not correspond to the subject of the given certificate, this method
returns false
. ObjectDigestInfo
identifies the given certificate, this method returns true
; if
the corresponding ObjectDigestInfo does not identify the given certificate,
this method returns false
false
true
if this Holder "links" to the given certificate
according to the rules above, false
if notjava.security.NoSuchAlgorithmException
- if this Holder only contains the objectDigestInfo component,
but the digest algorithm (required for the check) used there
is not supportedjava.security.cert.CertificateEncodingException
- if this Holder only contains the objectDigestInfo and an error
occurs while encoding the certificate required for digest
calculationpublic java.lang.String toString()
Holder
object.toString
in class java.lang.Object