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_IDENTIFIERThe OID for the common name (CN) attribute.static final OBJECT_IDENTIFIERThe OID for the country name (C) attribute.static final OBJECT_IDENTIFIERThe OID for the locality name (L) attribute.static final OBJECT_IDENTIFIERThe OID for the organizational unit name (OU) attribute.static final OBJECT_IDENTIFIERThe OID for the organization name (O) attribute.(package private) SEQUENCEstatic final OBJECT_IDENTIFIERThe OID for the state or province name (S) attribute.static final Tagprivate static final Name.Template -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCommonName(String CN) Adds a common name (CN) to the Name.voidAdds a country name (C) to the Name.voidaddElement(AVA ava) Adds a relative distinguished name containing a single AVA.voidaddElement(RDN name) Adds a relative distinguished name to the Name.voidAdds a locality name (L) to the Name.voidAdds an organizational unit name (OU) to the Name.voidAdds an organization name (O) to the Name.voidAdds a state or province name (S) to the Name.private StringAVAToString(AVA ava) elementAt(int idx) Returns the RDN at the given index in the Name.voidencode(OutputStream ostream) Write this value's DER encoding to an output stream using its own base tag.voidencode(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.TemplatevoidinsertElementAt(RDN name, int idx) Inserts the given RDN at the given index in the Name.static voidvoidremoveElementAt(int idx) Removes the Name element at the given index.intsize()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:ASN1ValueReturns the base tag for this type, not counting any tags that may be imposed on it by its context. -
encode
Description copied from interface:ASN1ValueWrite this value's DER encoding to an output stream using its own base tag.- Specified by:
encodein interfaceASN1Value- Parameters:
ostream- Output stream.- Throws:
IOException- If an error occurred.
-
encode
Description copied from interface:ASN1ValueWrite this value's DER encoding to an output stream using an implicit tag.- Specified by:
encodein 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
-