public class GeneralSubtree extends java.lang.Object implements ASN1Type
GeneralSubtree
as used within the
NameConstraints
extension.
The NameConstraints
is used within CA certifcates for indicating a name
space within which all subject names in subsequent certificates in a certification
path must be located (see x.509 Certificate and CRL profile presented in RFC 3280).
Restrictions may apply to the subject distinguished name or subject alternative
names. Restrictions are defined in terms of permitted or excluded name subtrees.
Any name matching a restriction in the excludedSubtrees field is invalid regardless
of information appearing in the permittedSubtrees. Both, excludedSubtrees and
permittedSubtrees are defined as GeneralSubtrees structures consisting of
a sequence of GeneralSubtree components, as implemented by this class:
NameConstraints ::= SEQUENCE { permittedSubtrees [0] GeneralSubtrees OPTIONAL, excludedSubtrees [1] GeneralSubtrees OPTIONAL } GeneralSubtrees ::= SEQUENCE SIZE (1..MAX) OF GeneralSubtree GeneralSubtree ::= SEQUENCE { base GeneralName, minimum [0] BaseDistance DEFAULT 0, maximum [1] BaseDistance OPTIONAL } BaseDistance ::= INTEGER (0..MAX) GeneralName ::= CHOICE { otherName [0] OtherName, rfc822Name [1] IA5String, dNSName [2] IA5String, x400Address [3] ORAddress, directoryName [4] Name, ediPartyName [5] EDIPartyName, uniformResourceIdentifier [6] IA5String, iPAddress [7] OCTET STRING, registeredID [8] OBJECT IDENTIFIER}
When creating a GeneralSubtree
object to be used for the NameConstraints
extension, specify the
base immediately, and subsequently use the setMinimum
and setMaximum
methods for setting the base distances,
e.g.:
GeneralSubtree generalSubtree = new GeneralSubtree(new GeneralName(GeneralName.rfc822Name, "*.tu-graz.ac.at")); generalSubtree.setMinimum(1); generalSubtree.setMaximum(3);
NameConstraints
,
GeneralName
Constructor and Description |
---|
GeneralSubtree()
Default constructor.
|
GeneralSubtree(GeneralName base)
Creates a new GeneralSubrtree from a base representing some
GeneralName.
|
Modifier and Type | Method and Description |
---|---|
void |
decode(ASN1Object obj)
Decodes a GeneralSubtree from the given ASN1Object.
|
GeneralName |
getBase()
Returns the base GeneralName.
|
int |
getMaximum()
Returns the maximum base distance or -1 if not set.
|
int |
getMinimum()
Returns the minimum base distance.
|
void |
setMaximum(int maximum)
Sets the maximum base distance.
|
void |
setMinimum(int minimum)
Sets the minimum base distance.
|
ASN1Object |
toASN1Object()
Returns this GeneralSubtree as (SEQUENCE) ASN1Object.
|
java.lang.String |
toString()
Returns a string that represents the contents of this GeneralSubtree.
|
public GeneralSubtree()
The minimum base distance per default is set to 0, and the maximum base
distance is set to -1 indicating that the maximum value is not set.
For explicitly setting the base distance values, use the setMinimum
and setMaximum
methods.
public GeneralSubtree(GeneralName base)
For Instance:
GeneralSubtree generalSubtree = new GeneralSubtree(new GeneralName(GeneralName.rfc822Name, "*.tu-graz.ac.at"));
The minimum base distance per default is set to 0, and the maximum base
distance is set to -1 indicating that the maximum value is not set.
For explicitly setting the base distance values, use the
setMinimum
and setMaximum
methods.
base
- the base GeneralNamepublic ASN1Object toASN1Object() throws CodingException
toASN1Object
in interface ASN1Type
CodingException
- if the ASN1Object cannot be createdpublic void decode(ASN1Object obj) throws CodingException
The given ASN1Object is parsed for the base GeneralName, minimum and maximum BaseDistance values.
decode
in interface ASN1Type
obj
- the GeneralSubtree as ASN1ObjectCodingException
- if a parsing error occurspublic void setMinimum(int minimum)
minimum
- the minimum base distance as intpublic void setMaximum(int maximum)
maximum
- the maximum base distance as intpublic GeneralName getBase()
public int getMinimum()
public int getMaximum()
public java.lang.String toString()
toString
in class java.lang.Object