public class PolicyMappings extends V3Extension
PolicyMappings
Extension.
The PolicyMappings
extension is a non critical standard X509v3
extension for being used in CA certificates.
Each extension is associated with a specific certificateExtension
object identifier, derived from:
certificateExtension OBJECT IDENTIFIER ::= {joint-iso-ccitt(2) ds(5) 29} id-ce OBJECT IDENTIFIER ::= certificateExtension
The object identifier for the PolicyMappings
extension
is defined as:
id-ce-policyMappings OBJECT IDENTIFIER ::= { id-ce 33 }
which corresponds to the OID string "2.5.29.33".
The X.509 Certificate and CRL profile presented in RFC 3280 specifies the policy mappings extension to be used within CA certificates for listing one or more pairs of object identifiers, each of them including an issuerDomainPolicy and a subjectDomainPolicy. The pairing indicates the issuing CA considers its issuerDomainPolicy equivalent to the subject CA's subjectDomainPolicy.
The issuing CA's users may accept an issuerDomainPolicy for certain applications. The policy mapping tells the issuing CA's users which policies associated with the subject CA are comparable to the policy they accept.
ASN.1 definition:
PolicyMappings ::= SEQUENCE SIZE (1..MAX) OF SEQUENCE { issuerDomainPolicy CertPolicyId, subjectDomainPolicy CertPolicyId }
CertPolicyId ::= OBJECT IDENTIFIER
More information can be found in RFC 3280, section 4.2.1.6 "Policy Mappings".
This class only provides one constructor, the empty default constructor for creating
a PolicyMappings
extension. Particular issuerDomainPolicy - subjectDomainPolicy
pairs can be added by using the addMapping(PolicyMapping policyMapping)
method, where the supplied parameter value
has to be of type iaik.asn1.structures.PolicyMapping
, e.g.:
ObjectID iaikPolicy1 = new ObjectID("1.2.3.4.5.1", "iaikPolicy1"); ObjectID iaikPolicy2 = new ObjectID("1.2.3.4.5.2", "iaikPolicy2"); PolicyMapping policyMap = new PolicyMapping(iaikPolicy1, iaikPolicy2); PolicyMappings policyMaps = new PolicyMappings(); policyMaps.addMapping(policyMap);
For adding a PolicyMappings
extension object to a X509Certificate, use
the addExtension
method of the iaik.x509.X509Certificate
class:
X505Certificate cert = new X509Certificate(); ... cert.addExtension(policyMaps);
PolicyMapping
,
ObjectID
,
V3Extension
,
X509Extensions
,
X509Certificate
Modifier and Type | Field and Description |
---|---|
static ObjectID |
oid
The object identifier of this
PolicyMappings extension. |
critical
Constructor and Description |
---|
PolicyMappings()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addMapping(PolicyMapping policyMapping)
Adds one mapping of type
iaik.asn1.structures.PolicyMapping representing an
an issuerDomainPolicy - subjectDomainPolicy pair. |
PolicyMapping[] |
getMappings()
Returns the policy mappings this extension contains.
|
ObjectID |
getObjectID()
Returns the object ID of this
PolicyMappings extension |
int |
hashCode()
Returns a hashcode for this identity.
|
void |
init(ASN1Object obj)
Inits this
PolicyMappings implementation with an ASN1object
representing the value of this extension. |
ASN1Object |
toASN1Object()
Returns an ASN1Object representing the value of this
PolicyMappings
extension object. |
java.lang.String |
toString()
Returns a string that represents the contents of this
PolicyMappings
extension. |
getName, isCritical, setCritical
public static final ObjectID oid
PolicyMappings
extension.
The corresponding OID string is "2.5.29.33".public PolicyMappings()
Creates an empty PolicyMappings
object.
Use addMapping
for adding some policy mapping
of type PolicyMapping
representing an
an issuerDomainPolicy - subjectDomainPolicy pair, e.g:
e.g.:
ObjectID iaikPolicy1 = new ObjectID("1.2.3.4.5.1", "iaikPolicy1"); ObjectID iaikPolicy2 = new ObjectID("1.2.3.4.5.2", "iaikPolicy2"); PolicyMapping policyMap = new PolicyMapping(iaikPolicy1, iaikPolicy2); PolicyMappings policyMaps = new PolicyMappings(); policyMaps.addMapping(policyMap);
public void addMapping(PolicyMapping policyMapping)
iaik.asn1.structures.PolicyMapping
representing an
an issuerDomainPolicy - subjectDomainPolicy pair.
For instance:
ObjectID iaikPolicy1 = new ObjectID("1.2.3.4.5.1", "iaikPolicy1"); ObjectID iaikPolicy2 = new ObjectID("1.2.3.4.5.2", "iaikPolicy2"); PolicyMapping policyMap = new PolicyMapping(iaikPolicy1, iaikPolicy2); PolicyMappings policyMaps = new PolicyMappings(); policyMaps.addMapping(policyMap);
policyMapping
- the policy mapping to addPolicyMapping
public PolicyMapping[] getMappings()
This method returns an array of iaik.asn1.structures.PolicyMapping
objects:
PolicyMapping[] policyMapping = policyMaps.getMappings();
public ASN1Object toASN1Object() throws X509ExtensionException
PolicyMappings
extension object.
The returned ASN1Object represents a sequence of PolicyMapping pairs:
PolicyMappings ::= SEQUENCE SIZE (1..MAX) OF SEQUENCE { issuerDomainPolicy CertPolicyId, subjectDomainPolicy CertPolicyId }
toASN1Object
in class V3Extension
PolicyMappings
as ASN1ObjectX509ExtensionException
- if the extension could not be createdpublic void init(ASN1Object obj) throws X509ExtensionException
PolicyMappings
implementation with an ASN1object
representing the value of this extension.
The given ASN1Object represents a sequence of PolicyMapping pairs.
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
PolicyMappings 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 V3Extension
obj
- the PolicyMappings as ASN1ObjectX509ExtensionException
- if the extension could not be parsedpublic int hashCode()
hashCode
in class V3Extension
public ObjectID getObjectID()
PolicyMappings
extensiongetObjectID
in class V3Extension
public java.lang.String toString()
PolicyMappings
extension.toString
in class java.lang.Object