public abstract class InfoAccess extends V3Extension
AuthorityInfoAccess and
SubjectInfoAccess extensions.
The X.509 Certificate and CRL profile presented in RFC 3280 specifies the
AuthorityInfoAccess
extension for identifiying how to access CA
information and services for the issuer of the certificate in
which the extension appears. The SubjectInfoAccess extensions is specified
by RFC 3280 for indicating how to access information and services for the
subject of the certificate in which the extension appears.
The ASN.1 syntax is almost identical:
AuthorityInfoAccessSyntax ::=
SEQUENCE SIZE (1..MAX) OF AccessDescription
AccessDescription ::= SEQUENCE {
accessMethod OBJECT IDENTIFIER,
accessLocation GeneralName }
respectively:
SubjectInfoAccessSyntax ::=
SEQUENCE SIZE (1..MAX) OF AccessDescription
AccessDescription ::= SEQUENCE {
accessMethod OBJECT IDENTIFIER,
accessLocation GeneralName }
This class provides the base functionality for setting/getting AccessDescription
objects for both, AuthorityInfoAccess
and SubjectInfoAccess extensions, e.g.:
String ocspURL = "http://test.ca.com/ocsp"; AccessDescription accessDescription = new AccessDescription(ObjectID.ocsp, ocspURL); AuthorityInfoAccess authorityInfoAccess = new AuthorityInfoAccess(); authorityInfoAccess.addAccessDescription(accessDescription);
respectively:
String tspURL = "http://test.tsp.com/tsp"; AccessDescription accessDescription = new AccessDescription(ObjectID.timeStamping, tspURL); SubjectInfoAccess subjectInfoAccess = new SubjectInfoAccess() subjectInfoAccess.addAccessDescription(accessDescription);
For adding a AuthorityInfoAccess/SubjectInfoAccess extension object
to a X509Certificate, use the addExtension method of the X509Certificate class:
X505Certificate cert = new X509Certificate(); ... cert.addExtension(authorityInfoAccess);
On the receiving side, you may step through
all AccessDescription objects that are included in a AuthorityInfoAccess/SubjectInfoAccess
extension of a certificate, or query for
some specific AccessDescription based on its accessMethod oid, 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();
...
}
}
AccessDescription,
GeneralName,
ObjectID,
V3Extension,
X509Extensions,
X509Certificate,
AuthorityInfoAccess,
SubjectInfoAccesscritical| Constructor and Description |
|---|
InfoAccess()
Default constructor.
|
InfoAccess(AccessDescription accessDescription)
Creates an
InfoAccess object and adds a AccessDescription. |
| Modifier and Type | Method and Description |
|---|---|
void |
addAccessDescription(AccessDescription accessDescription)
Adds a accessDescription to this
InfoAccess
extension. |
AccessDescription |
getAccessDescription(ObjectID accessMethod)
Returns the AccessDescription with the requested AccessMethod, if inlcuded.
|
java.util.Enumeration |
getAccessDescriptions()
Returns an enumeration of the access descriptions included into this
InfoAccess object. |
void |
init(ASN1Object obj)
Inits this
InfoAccess implementation with an ASN1object
representing the value of this extension. |
void |
removeAllAccessDescriptions()
Removes all access descriptions from this
InfoAccess
extension. |
ASN1Object |
toASN1Object()
Returns an ASN1Object representing the value of this
InfoAccess
object. |
java.lang.String |
toString()
Returns a string that represents the contents of
this
InfoAccess object. |
getName, getObjectID, hashCode, isCritical, setCriticalpublic InfoAccess()
InfoAccess object.
For adding a access description use the addAccessDescription method. Any AccessDescription to be
added has to be of type iaik.asn1.structures.AccessDescription, e.g.:
String caCertURL = "http://test.ca.com/cert/caCert.cer"; AccessDescription ad = new AccessDescription(ObjectID.caIssuers, caCertURL); AuthorityInfoAccess authorityInfoAccess = new AuthorityInfoAccess(); authorityInfoAccess.addAccessDescription(ad); ...
AccessDescriptionpublic InfoAccess(AccessDescription accessDescription) throws java.lang.IllegalArgumentException
InfoAccess object and adds a AccessDescription.
The AccessDescription to be added has to be of type
iaik.asn1.structures.AccessDescription, e.g.:
String caCertURL = "http://test.ca.com/cert/caCert.cer"; AccessDescription ad = new AccessDescription(ObjectID.caIssuers, caCertURL); AuthorityInfoAccess authorityInfoAccess = new AuthorityInfoAccess(ad); ...
accessDescription - the AccessDescription to addjava.lang.IllegalArgumentException - if a null object is suppliedAccessDescriptionpublic void init(ASN1Object obj) throws X509ExtensionException
InfoAccess implementation with an ASN1object
representing the value of this extension.
The given ASN1Object consists of a Sequence of access descriptions included in
the InfoAccess object.
The given ASN1Object is the one created by toASN1Object().
This method is used by the X509Extensions class when parsing the ASN.1 representation
of a certificate for properly initializing an included
AuthorityInfoAccess/SubjectInfoAcsess extension. This method initializes the
extension only with its value, but not with its critical
specification. For that reason, this method shall not be
explicitly called by an application.
init in class V3Extensionobj - the InfoAccess as ASN1ObjectX509ExtensionException - if the extension could not be parsedpublic ASN1Object toASN1Object() throws X509ExtensionException
InfoAccess
object.
The ASN1Object is an ASN.1 Sequence including any access description that has been
added to this InfoAccess object.
toASN1Object in class V3ExtensionInfoAccess as ASN1ObjectX509ExtensionException - if the extension could not be createdpublic void addAccessDescription(AccessDescription accessDescription) throws java.lang.IllegalArgumentException
InfoAccess
extension.
The accessDescription to be added has to be of type
iaik.asn1.structures.AccessDescription, e.g.:
String caCertURL = "http://test.ca.com/cert/caCert.cer"; AccessDescription ad = new AccessDescription(ObjectID.caIssuers, caCertURL); AuthorityInfoAccess authorityInfoAccess = new AuthorityInfoAccess(); authorityInfoAccess.addAccessDescription(ad); ... ...
accessDescription - the access description to addjava.lang.IllegalArgumentException - if a null object is suppliedAccessDescriptionpublic void removeAllAccessDescriptions()
InfoAccess
extension.public java.util.Enumeration getAccessDescriptions()
InfoAccess object.public AccessDescription getAccessDescription(ObjectID accessMethod)
nullpublic java.lang.String toString()
InfoAccess object.toString in class java.lang.Object