Package org.mozilla.jss.pkix.primitive
Class DirectoryString
java.lang.Object
org.mozilla.jss.pkix.primitive.DirectoryString
- All Implemented Interfaces:
ASN1Value
An X.500 DirectoryString.
DirectoryString is defined as follows:
DirectoryString ::= CHOICE { teletexString TeletexString (SIZE (1..MAX)), printableString PrintableString (SIZE (1..MAX)), universalString UniversalString (SIZE (1..MAX)), utf8String UTF8String (SIZE (1..MAX)), bmpString BMPString (SIZE (1..MAX)) }
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A Template for decoding DirectoryStrings from their BER encoding. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate CharacterString
private static final DirectoryString.Template
-
Constructor Summary
ConstructorsConstructorDescriptionEncodes a Java String into a Directory String.Creates a DirectoryString from an ASN.1 string. -
Method Summary
Modifier and TypeMethodDescriptionvoid
encode
(OutputStream ostream) Write this value's DER encoding to an output stream using its own base tag.void
encode
(Tag implicitTag, 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 DirectoryString.Template
Returns a singleton instance of the decoding template for this class.toString()
Converts an ASN.1 DirectoryString to a Java string.
-
Field Details
-
asn1String
-
templateInstance
-
-
Constructor Details
-
DirectoryString
Encodes a Java String into a Directory String. The following rules for choosing an encoding are from the IETF PKIX document Internet X.509 Public Key Infrastructure: Certificate and CRL Profile:- The preferred encoding is UTF8String, and all certificates issued after December 31, 2003, MUST use UTF8String encoding, with a few exceptions.
- Until December 31, 2003, strings that fit in the PrintableString character set MAY use PrintableString.
- Until December 31, 2003, string that fit in the BMPString character set MAY use BMPString.
- Strings that fit in neither the PrintableString nor the BMPString character set MUST use UTF8String.
- Try PrintableString
- Try TeletexString
- Try UniversalString
- Throws:
CharConversionException
-
DirectoryString
Creates a DirectoryString from an ASN.1 string.- Parameters:
s
- Must be a TeletexString, PrintableString, UniversalString, UTF8String, or BMPString.
-
-
Method Details
-
toString
Converts an ASN.1 DirectoryString to a Java string. -
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:
implicitTag
- Implicit tag.ostream
- Output stream.- Throws:
IOException
- If an error occurred.
-
getTemplate
Returns a singleton instance of the decoding template for this class.
-