iaik.asn1.structures
Class GeneralSubtree

java.lang.Object
  |
  +--iaik.asn1.structures.GeneralSubtree
All Implemented Interfaces:
ASN1Type

public class GeneralSubtree
extends Object
implements ASN1Type

An implementation of the ASN.1 structure 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 2459). 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);
 

Version:
File Revision 16
See Also:
NameConstraints, GeneralName

Constructor Summary
GeneralSubtree()
          Default constructor.
GeneralSubtree(GeneralName base)
          Creates a new GeneralSubrtree from a base representing some GeneralName.
 
Method Summary
 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.
 String toString()
          Returns a string that represents the contents of this GeneralSubtree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GeneralSubtree

public GeneralSubtree()
Default constructor.

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.


GeneralSubtree

public GeneralSubtree(GeneralName base)
Creates a new GeneralSubrtree from a base representing some GeneralName.

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.

Parameters:
base - the base GeneralName
Method Detail

toASN1Object

public ASN1Object toASN1Object()
                        throws CodingException
Returns this GeneralSubtree as (SEQUENCE) ASN1Object.
Specified by:
toASN1Object in interface ASN1Type
Returns:
this GeneralSubtree as ASN1Object
Throws:
CodingException - if the ASN1Object cannot be created

decode

public void decode(ASN1Object obj)
            throws CodingException
Decodes a GeneralSubtree from the given ASN1Object.

The given ASN1Object is parsed for the base GeneralName, minimum and maximum BaseDistance values.

Specified by:
decode in interface ASN1Type
Parameters:
obj - the GeneralSubtree as ASN1Object
Throws:
CodingException - if a parsing error occurs

setMinimum

public void setMinimum(int minimum)
Sets the minimum base distance.
Parameters:
minimum - the minimum base distance as int

setMaximum

public void setMaximum(int maximum)
Sets the maximum base distance.
Parameters:
maximum - the maximum base distance as int

getBase

public GeneralName getBase()
Returns the base GeneralName.
Returns:
the base

getMinimum

public int getMinimum()
Returns the minimum base distance.
Returns:
the minimum base distance

getMaximum

public int getMaximum()
Returns the maximum base distance or -1 if not set.
Returns:
the maximum base distance or -1 if not set

toString

public String toString()
Returns a string that represents the contents of this GeneralSubtree.
Overrides:
toString in class Object
Returns:
the string representation

This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note).

IAIK-JCE 3.1 with IAIK-JCE CC Core 3.1, (c) 1997-2004 IAIK