Overview | Package | Class | Tree | Deprecated | Index | Help
| JSS 3.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mozilla.jss.pkix.primitive
Class DirectoryString

    java.lang.Object
      |
      +--org.mozilla.jss.pkix.primitive.DirectoryString

All Implemented Interfaces:
  ASN1Value

public class DirectoryString
extends java.lang.Object
implements 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
`static class` | `DirectoryString.Template` A Template for decoding DirectoryStrings from their BER encoding.

Field Summary
`private CharacterString` | `asn1String`
`private static DirectoryString.Template` | `templateInstance`

Constructor Summary
`private` | `DirectoryString()`
`` | `DirectoryString(CharacterString s)` Creates a DirectoryString from an ASN.1 string.
`` | `DirectoryString(java.lang.String s)` Encodes a Java String into a Directory String.

Method Summary
`void` | `encode(java.io.OutputStream ostream)` Write this value's DER encoding to an output stream using its own base tag.
`void` | `encode(Tag implicitTag, java.io.OutputStream ostream)` Write this value's DER encoding to an output stream using an implicit tag.
`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` | `getTemplate()` Returns a singleton instance of the decoding template for this class.
`java.lang.String` | `toString()` Converts an ASN.1 DirectoryString to a Java string.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### asn1String

    private CharacterString asn1String

### templateInstance

    private static final DirectoryString.Template templateInstance

Constructor Detail

### DirectoryString

    private DirectoryString()

### DirectoryString

    public DirectoryString(java.lang.String s)
                    throws java.io.CharConversionException

  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.
  This is all very nice, but for backwards compatibility, what we really do is:
  - Try PrintableString
  - Try TeletexString
  - Try UniversalString

### DirectoryString

    public DirectoryString(CharacterString s)

  Creates a DirectoryString from an ASN.1 string.

Parameters:
  `s` - Must be a TeletexString, PrintableString, UniversalString, UTF8String, or BMPString.

Method Detail

### toString

    public java.lang.String toString()

  Converts an ASN.1 DirectoryString to a Java string.

  Overrides:
    `toString` in class `java.lang.Object`
  Throws:
    `InvalidBERException` - If the encoding does not contain a valid DirectoryString.

### getTag

    public Tag 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.

  Specified by:
    `getTag` in interface `ASN1Value`

### encode

    public void encode(java.io.OutputStream ostream)
                throws java.io.IOException

  Description copied from interface: `ASN1Value`
  Write this value's DER encoding to an output stream using its own base tag.

  Specified by:
    `encode` in interface `ASN1Value`
    `java.io.IOException`

### encode

    public void encode(Tag implicitTag,
                       java.io.OutputStream ostream)
                throws java.io.IOException

  Description copied from interface: `ASN1Value`
  Write this value's DER encoding to an output stream using an implicit tag.

  Specified by:
    `encode` in interface `ASN1Value`
    `java.io.IOException`

### getTemplate

    public static DirectoryString.Template getTemplate()

  Returns a singleton instance of the decoding template for this class.

Overview | Package | Class | Tree | Deprecated | Index | Help
| JSS 3.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD