iaik.asn1.structures
Class GeneralNames

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

public class GeneralNames
extends Object
implements ASN1Type

This class implements the ASN1. type "GeneralNames". A GeneralNames structure is defined as Vector of GeneralName objects.

ASN.1 definition:

 GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName
 
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}
OtherName ::= SEQUENCE { type-id OBJECT IDENTIFIER, value [0] EXPLICIT ANY DEFINED BY type-id }
EDIPartyName ::= SEQUENCE { nameAssigner [0] DirectoryString OPTIONAL, partyName [1] DirectoryString }
DirectoryString ::= CHOICE { teletexString TeletexString (SIZE (1..maxSize), printableString PrintableString (SIZE (1..maxSize)), universalString UniversalString (SIZE (1..maxSize)), bmpString BMPString (SIZE(1..maxSIZE)) }

When creating a new GeneralNames structure, a GeneralName object immediatly may be supplied, e.g.:

 GeneralNames gNames = new GeneralNames(new GeneralName(...));
 
Further GeneralName objects may be added by means of the addName method, e.g.:
 gNames.addName(new GeneralName(...));
 

Version:
File Revision 17
See Also:
ASN1Type, GeneralName, IA5String, OCTET_STRING, ObjectID, Name, T61String, PrintableString, UNIString

Constructor Summary
GeneralNames()
          Default constructor.
GeneralNames(ASN1Object obj)
          Constructs a GeneralNames object from an ASN1Object.
GeneralNames(GeneralName generalName)
          Creates a GeneralNames structure from a GeneralName.
 
Method Summary
 void addName(GeneralName generalName)
          Adds a GeneralName to the list of general names.
 void decode(ASN1Object obj)
          Decodes a GeneralNames from the given ASN1Object.
 boolean equals(Object obj)
          Compares this GeneralNames with the given GeneralNames.
 Enumeration getNames()
          Returns an enumeration of the general names.
 int hashCode()
          Returns a hash code value for this object.
 void removeAllNames()
          Removes all genereal names from the list.
 ASN1Object toASN1Object()
          Returns this GeneralNames object as ASN1Object.
 String toString()
          Returns a string that represents the contents of this GeneralNames object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GeneralNames

public GeneralNames()
Default constructor. Creates an empty GeneralNames object.

Use the addName method for adding a GeneralName.


GeneralNames

public GeneralNames(GeneralName generalName)
Creates a GeneralNames structure from a GeneralName. Use the addName method for adding further GeneralName objects.
Parameters:
generalName - the GeneralName to add

GeneralNames

public GeneralNames(ASN1Object obj)
             throws CodingException
Constructs a GeneralNames object from an ASN1Object.

The given ASN1Object represents an already existing GeneralNames structure that may have been created by means of the toASN1Object method.

Parameters:
obj - the GeneralNames as ASN1Object
Throws:
CodingException - if an parsing error occurs
Method Detail

decode

public void decode(ASN1Object obj)
            throws CodingException
Decodes a GeneralNames from the given ASN1Object. The ASN1Object may represent a single GeneralName or may be composed of several GeneralName objects that have to be included into the new GeneralNames object.
Specified by:
decode in interface ASN1Type
Parameters:
obj - the GeneralNames ASN1Object consisting of one or more GeneralName objects
Throws:
CodingException - if the ASN1Object donīt realizes a GenaeralName structure

addName

public void addName(GeneralName generalName)
Adds a GeneralName to the list of general names.
Parameters:
generalName - the GeneralName to add

removeAllNames

public void removeAllNames()
Removes all genereal names from the list.

getNames

public Enumeration getNames()
Returns an enumeration of the general names.
Returns:
all the inherent general names as Enumeration

toASN1Object

public ASN1Object toASN1Object()
                        throws CodingException
Returns this GeneralNames object as ASN1Object.
Specified by:
toASN1Object in interface ASN1Type
Returns:
the value of this GeneralNames as SEQUENCE ASN1Object

equals

public boolean equals(Object obj)
Compares this GeneralNames with the given GeneralNames.

This method steps through all GeneralName objects included and compares them for equality.

Overrides:
equals in class Object
Parameters:
obj - the other GeneralNames
Returns:
true, if the two GeneralNames are equal, false otherwise

hashCode

public int hashCode()
Returns a hash code value for this object.
Overrides:
hashCode in class Object
Returns:
a hash code value for this object

toString

public String toString()
Returns a string that represents the contents of this GeneralNames object.
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