public class AccessDescription extends java.lang.Object implements ASN1Type
Authority Information Access
and Subject Information Access
.
ASN.1 definition:
AuthorityInfoAccessSyntax ::= SEQUENCE SIZE (1..MAX) OF AccessDescription SubjectInfoAccessSyntax ::= SEQUENCE SIZE (1..MAX) OF AccessDescription AccessDescription ::= SEQUENCE { accessMethod OBJECT IDENTIFIER, accessLocation GeneralName }
When included in a Authority Information Access
extension, the AccessDescriptions describe
information and services for the issuer of the certificate to which the
AuthorityInfoAccess
extension belongs to.
When included in a Subject Information Access
extension, the AccessDescriptions describe
information and services for the subject of the certificate to which the
SubjectInfoAccess
extension belongs to.
The X.509 PKIX profile already defines four accessMethods, id-ad-caIssuers and id-ad-ocsp (to be used within an AuthorityInfoAccess extension), and id-ad-caRepository and id-ad-timeStamping (to be used within a SubjectInfoAccess extension).
id-ad-caIssuers may be used in an Authority Information Access
extension for referencing CAs that have
issued certificates superior to the CA that issued the certificate containing the
AuthorityInfoAccess extension.
id-as-ocsp may be used in an Authority Information Access
extension to indicate that revocation information
for the certificate may be obtained by OCSP.
id-ad-caRepository may be used in an Subject Information Access
extension if the subject is a CA and
publishes its certificates and CRLs (if issued) in a repository.
id-ad-timeStamping may be used in an Subject Information Access
extension to refer to a time stamp
service that is provided by the entity to which the subject of the certificate
belongs to.
More information can be found in the X.509 Certificate and CRL profile presented in RFC 3280, section 4.2.2.1 "AuthorityInfoAccess" and section 4.2.2.2 "SubjectInfoAccess".
When creating an AccessDescription, the accessMethod OID and the accessLocation GeneralName has to be specified, e.g.:
GeneralName caCertURL = new GeneralName(GeneralName.uniformResourceIdentifier, "http://test.ca.com/cert/caCert.cer"); AccessDescription ad = new AccessDescription(ObjectID.caIssuers, new GeneralName(caCertURL)); AuthorityInfoAccess authorityInfoAccess = new AuthorityInfoAccess(ad);However, since most commonly for all four predefined accessMethods the corresponding accessLocation may be referenced by a GeneralName of type
uniformResourceIdentifier
, alternatively the uri name may be immediately specified
as String object when creating
a new
AccessDescription, e.g.:
String caCertURL = "http://test.ca.com/cert/caCert.cer"; AccessDescription ad = new AccessDescription(ObjectID.caIssuers, caCertURL); AuthorityInfoAccess authorityInfoAccess = new AuthorityInfoAccess(ad);or (id-as-ocsp):
String ocspURL = "http://test.ca.com/ocsp"; AccessDescription ad = new AccessDescription(ObjectID.ocsp, ocspURL); AuthorityInfoAccess authorityInfoAccess = new AuthorityInfoAccess(ad); X509Certificate cert = new X509Certificate(); ... cert.addExtension(authorityInfoAccess); ...or (id-ad-caRepository)
String caRepositoryURL = "http://test.ca.com/caCert.cer"; AccessDescription ad = new AccessDescription(ObjectID.caRepository, caRepositoryURL); SubjectInfoAccess subjectInfoAccess = new SubjectInfoAccess(ad); X509Certificate cert = new X509Certificate(); ... cert.addExtension(subjectInfoAccess); ...or (id-ad-timeStamping)
String tspURL = "http://test.tsp.com/tsp"; AccessDescription ad = new AccessDescription(ObjectID.timeStamping, tspURL); SubjectInfoAccess subjectInfoAccess = new SubjectInfoAccess(ad); X509Certificate cert = new X509Certificate(); ... cert.addExtension(subjectInfoAccess); ...On the receiving side, method
getAccessLocation
or getUriAccessLocation
may be used
for querying for the accessLoaction, e.g.:
X509Certificate cert = ...; AuthorityInfoAccess authorityInfoAccess = (AuthorityInfoAccess)cert.getExtension(AuthorityInfoAccess.oid); if (authorityInfoAccess != null) { AccessDescription ad = authorityInfoAccess.getAccessDescription(ObjectID.ocsp); if (ad != null) { String ocspURL = ad.getUriAccessLocation(); ... } }
AuthorityInfoAccess
,
SubjectInfoAccess
,
X509Certificate
,
ObjectID
,
GeneralName
Constructor and Description |
---|
AccessDescription()
Default constructor.
|
AccessDescription(ASN1Object obj)
Creates a new
AccessDescription from an ASN1Object. |
AccessDescription(ObjectID accessMethod,
GeneralName accessLocation)
Creates a new AccessDescription from the given accessMethod oid
and accessLocation GeneralName.
|
AccessDescription(ObjectID accessMethod,
java.lang.String uri)
Creates a new AccessDescription from the given accessMethod OID and
accessLocation uri value.
|
Modifier and Type | Method and Description |
---|---|
void |
decode(ASN1Object obj)
Decodes the given ASN.1
AccessDescription object for parsing
the internal structure. |
GeneralName |
getAccessLocation()
Returns the access location.
|
ObjectID |
getAccessMethod()
Returns the access method OID.
|
java.lang.String |
getUriAccessLocation()
Gets the accessLocation field (if specified as uri name).
|
void |
setAccessLocation(GeneralName accessLocation)
Sets the access location.
|
void |
setAccessMethod(ObjectID accessMethod)
Sets the access method OID.
|
void |
setUriAccessLocation(java.lang.String uri)
Sets the accessLocation field to the specified uri name.
|
ASN1Object |
toASN1Object()
Returns this
AccessDescription as ASN1Object. |
java.lang.String |
toString()
Returns a string giving some information
about this
AccessDescription object. |
public AccessDescription()
public AccessDescription(ObjectID accessMethod, GeneralName accessLocation) throws java.lang.IllegalArgumentException
For instance:
GeneralName ocspURL = new GeneralName(GeneralName.uniformResourceIdentifier, "http://test.ca.com/ocsp"); AccessDescription ad = new AccessDescription(ObjectID.ocsp, new GeneralName(ocspURL));
accessMethod
- the accessMethod OIDaccessLocation
- the accessLocation GeneralNamejava.lang.IllegalArgumentException
- if one of the arguments is nullpublic AccessDescription(ObjectID accessMethod, java.lang.String uri) throws java.lang.IllegalArgumentException
The accessMethod
field of an AccessDescription is defined
as GeneralName
which can take
any form depending of the kind of service that may be referenced by the
particular accessMethod. However, for all pre-defined accessMethods
id-ad-caIssuers, id-ad-ocsp, id-ad-caRepository and id-ad-timeStamping
the most common way for refering an accessLocation may be a GeneralName
of type uniformResourceIdentifier
. In this case this constructor may be used
to immediately specify the uri as String value, e.g.:
String ocspURL = "http://test.ca.com/ocsp"; AccessDescription ad = new AccessDescription(ObjectID.ocsp, ocspURL);
accessMethod
- the accessMethod OIDuri
- the accessLocation uri as Stringjava.lang.IllegalArgumentException
- if one of the arguments is nullpublic AccessDescription(ASN1Object obj) throws CodingException
AccessDescription
from an ASN1Object.
The ASN1Object supplied to this constructor represents an
already existing AccessDescription
object that may
have been created by calling toASN1Object
obj
- the AccessDescription as ASN1ObjectCodingException
- if the object can not be parsedpublic void decode(ASN1Object obj) throws CodingException
AccessDescription
object for parsing
the internal structure.
decode
in interface ASN1Type
obj
- the AccessDescription as ASN1ObjectCodingException
- if the object can not be parsedpublic ASN1Object toASN1Object() throws CodingException
AccessDescription
as ASN1Object.
The ASN1Object returned by this method may be used as parameter value when
creating a AccessDescription
object using the
AccessDescription(ASN1Object obj)
constructor.
toASN1Object
in interface ASN1Type
AccessDescription
as ASN1Object.CodingException
- if an de/encoding error occurspublic ObjectID getAccessMethod()
null
if not setpublic GeneralName getAccessLocation()
null
if not setpublic void setAccessMethod(ObjectID accessMethod) throws java.lang.IllegalArgumentException
accessMethod
- the access method OIDjava.lang.IllegalArgumentException
- if the argument is nullpublic void setAccessLocation(GeneralName accessLocation) throws java.lang.IllegalArgumentException
accessLocation
- the access location as GeneralNamejava.lang.IllegalArgumentException
- if the argument is nullpublic void setUriAccessLocation(java.lang.String uri) throws java.lang.IllegalArgumentException
The accessMethod
field of an AccessDescription is defined
as GeneralName
which can take
any form depending of the kind of service that may be referenced by the
particular accessMethod. However, for all pre-defined accessMethods
id-ad-caIssuers, id-ad-ocsp, id-ad-caRepository and id-ad-timeStamping
the most common way for refering an accessLocation may be a GeneralName
of type uniformResourceIdentifier
. In this case this method may be used
to immediately specify the uri as String value, e.g.:
String ocspURL = "http://test.ca.com/ocsp"; AccessDescription ad = new AccessDescription(); ad.setAccessMethod(ObjectID.ocsp); ad.setAccessLocation(ocspURL);However, it may be more convenient to specify accessMethod and location immediately when
creating
the AccessDescription object:
String ocspURL = "http://test.ca.com/ocsp"; AccessDescription ad = new AccessDescription(ObjectID.ocsp, ocspURL);
uri
- the accessLocation uri as Stringjava.lang.IllegalArgumentException
- if accessLocation is nullpublic java.lang.String getUriAccessLocation()
The accessLocation
field of an AccessDescription is defined
as GeneralName
which can take
any form depending of the kind of service that may be referenced by the
particular accessMethod. However, for all pre-defined accessMethods
id-ad-caIssuers, id-ad-ocsp, id-ad-caRepository and id-ad-timeStamping
the most common way for refering an accessLocation may be a GeneralName
of type uniformResourceIdentifier
. In this case this method may be used
to immediately get the uri as String value.
null
if
the accessLocation field has not been set yet or does not
represent a GeneralName of type uniformResourceIdentifier
.public java.lang.String toString()
AccessDescription
object.toString
in class java.lang.Object