Package org.mozilla.jss.pkix.primitive
Class Name
java.lang.Object
org.mozilla.jss.pkix.primitive.Name
- All Implemented Interfaces:
ASN1Value
An X.500 Name.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final OBJECT_IDENTIFIER
The OID for the common name (CN) attribute.static final OBJECT_IDENTIFIER
The OID for the country name (C) attribute.static final OBJECT_IDENTIFIER
The OID for the locality name (L) attribute.static final OBJECT_IDENTIFIER
The OID for the organizational unit name (OU) attribute.static final OBJECT_IDENTIFIER
The OID for the organization name (O) attribute.(package private) SEQUENCE
static final OBJECT_IDENTIFIER
The OID for the state or province name (S) attribute.static final Tag
private static final Name.Template
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCommonName
(String CN) Adds a common name (CN) to the Name.void
Adds a country name (C) to the Name.void
addElement
(AVA ava) Adds a relative distinguished name containing a single AVA.void
addElement
(RDN name) Adds a relative distinguished name to the Name.void
Adds a locality name (L) to the Name.void
Adds an organizational unit name (OU) to the Name.void
Adds an organization name (O) to the Name.void
Adds a state or province name (S) to the Name.private String
AVAToString
(AVA ava) elementAt
(int idx) Returns the RDN at the given index in the Name.void
encode
(OutputStream ostream) Write this value's DER encoding to an output stream using its own base tag.void
encode
(Tag implicit, OutputStream ostream) Write this value's DER encoding to an output stream using an implicit tag.getTag()
Returns the base tag for this type, not counting any tags that may be imposed on it by its context.static Name.Template
void
insertElementAt
(RDN name, int idx) Inserts the given RDN at the given index in the Name.static void
void
removeElementAt
(int idx) Removes the Name element at the given index.int
size()
Returns the number of RDNs in the Name.private String
-
Field Details
-
rdns
SEQUENCE rdns -
TAG
-
commonName
The OID for the common name (CN) attribute. -
countryName
The OID for the country name (C) attribute. -
localityName
The OID for the locality name (L) attribute. -
stateOrProvinceName
The OID for the state or province name (S) attribute. -
organizationName
The OID for the organization name (O) attribute. -
organizationalUnitName
The OID for the organizational unit name (OU) attribute. -
templateInstance
-
-
Constructor Details
-
Name
public Name()Creates an empty Name. -
Name
Name(SEQUENCE rdns) Creates a name from a sequence of relative distinguished names.
-
-
Method Details
-
addElement
Adds a relative distinguished name to the Name.- Parameters:
name
- A relative distinguished name (RDN) to be added to the Name.
-
addElement
Adds a relative distinguished name containing a single AVA.- Parameters:
ava
- An AttributeValueAssertion, which will be inserted as the sole element of a new RDN, which will be stored in the Name.
-
insertElementAt
Inserts the given RDN at the given index in the Name. -
elementAt
Returns the RDN at the given index in the Name. -
removeElementAt
public void removeElementAt(int idx) Removes the Name element at the given index. -
size
public int size()Returns the number of RDNs in the Name. -
getTag
Description copied from interface:ASN1Value
Returns the base tag for this type, not counting any tags that may be imposed on it by its context. -
encode
Description copied from interface:ASN1Value
Write this value's DER encoding to an output stream using its own base tag.- Specified by:
encode
in interfaceASN1Value
- Parameters:
ostream
- Output stream.- Throws:
IOException
- If an error occurred.
-
encode
Description copied from interface:ASN1Value
Write this value's DER encoding to an output stream using an implicit tag.- Specified by:
encode
in interfaceASN1Value
- Parameters:
implicit
- Implicit tag.ostream
- Output stream.- Throws:
IOException
- If an error occurred.
-
addCommonName
Adds a common name (CN) to the Name.- Parameters:
CN
- The common name. It will be formatted according to the IETF PKIX rules for directory strings.- Throws:
CharConversionException
-
addCountryName
Adds a country name (C) to the Name. It must be exactly two characters.- Parameters:
C
- The country name. It will be formatted according to the IETF PKIX rules for directory strings.- Throws:
IllegalArgumentException
- If C.length() != 2.CharConversionException
-
addLocalityName
Adds a locality name (L) to the Name.- Parameters:
L
- The locality name. It will be formatted according to the IETF PKIX rules for directory strings.- Throws:
CharConversionException
-
addStateOrProvinceName
Adds a state or province name (S) to the Name.- Parameters:
S
- The state or province name. It will be formatted according to the IETF PKIX rules for directory strings.- Throws:
CharConversionException
-
addOrganizationName
Adds an organization name (O) to the Name.- Parameters:
O
- The organization name. It will be formatted according to the IETF PKIX rules for directory strings.- Throws:
CharConversionException
-
addOrganizationalUnitName
Adds an organizational unit name (OU) to the Name.- Parameters:
OU
- The organizational unit name. It will be formatted according to the IETF PKIX rules for directory strings.- Throws:
CharConversionException
-
typeToString
-
AVAToString
- Throws:
InvalidBERException
-
getRFC1485
- Throws:
InvalidBERException
-
getTemplate
-
main
-