All Packages Class Hierarchy This Package Previous Next Index
Class netscape.security.x509.DirStrConverter
netscape.security.x509.DirStrConverter
- public class DirStrConverter
- implements AVAValueConverter
A DirStrConverter converts a string to a DerValue of ASN.1 Directory String,
which is a CHOICE of Printable (subset of ASCII), T.61 (Teletex) or
Universal String (UCS-4), and vice versa.
The string to DerValue conversion is done as follows.
If the string has only PrintableString characters it is converted
to a ASN.1 Printable String using the PrintableString
CharToByteConverter from the global default ASN1CharStrConvMap.
If it has only characters covered in the PrintableString or T.61
character set it is converted to a ASN.1 T.61 string using the T.61
CharToByteConverter from the ASN1CharStrCovnMap.
Otherwise it is converted to a ASN.1 UniversalString (UCS-4 character set)
which covers all characters.
- See Also:
- AVAValueConverter, ASN1CharStrConvMap
-
DirStrConverter()
- Constructs a DirStrConverter.
-
getAsString(DerValue)
- Converts a DerValue to a string.
-
getValue(byte[])
- Creates a DerValue from a BER encoded value, obtained from for example
a attribute value in octothorpe form of a Ldap DN string.
-
getValue(String)
- Converts a string to a DER encoded ASN1 Directory String, which is a
CHOICE of PrintableString, T.61String or UniversalString.
DirStrConverter
public DirStrConverter()
- Constructs a DirStrConverter.
getValue
public DerValue getValue(String ds) throws IOException
- Converts a string to a DER encoded ASN1 Directory String, which is a
CHOICE of PrintableString, T.61String or UniversalString.
The string is taken as is i.e. should not be in Ldap DN string syntax.
- Parameters:
- ds - a string representing a directory string value.
- Returns:
- a DerValue
- Throws: IOException
- if the string cannot be converted, such as
when a UniversalString CharToByteConverter
isn't available and the string contains
characters covered only in the universal
string (or UCS-4) character set.
getValue
public DerValue getValue(byte berByteStream[]) throws IOException
- Creates a DerValue from a BER encoded value, obtained from for example
a attribute value in octothorpe form of a Ldap DN string.
Checks if the BER encoded value is legal for a DirectoryString.
NOTE: currently only supports DER encoding for the BER encoded value.
- Parameters:
- berStream - Byte array of a BER encoded value.
- Returns:
- DerValue object.
- Throws: IOException
- If the BER value cannot be converted to a
valid Directory String DER value.
getAsString
public String getAsString(DerValue avaValue) throws IOException
- Converts a DerValue to a string.
The string is not in any syntax, such as RFC1779 string syntax.
- Parameters:
- avaValue - a DerValue
- Returns:
- a string if the value can be converted.
- Throws: IOException
- if a ByteToCharConverter needed for the
conversion is not available.
All Packages Class Hierarchy This Package Previous Next Index