Class PrintableConverter
java.lang.Object
org.mozilla.jss.netscape.security.x509.PrintableConverter
- All Implemented Interfaces:
AVAValueConverter
A AVAValueConverter that converts a Printable String attribute to a DerValue
and vice versa. An example an attribute that is a printable string is "C".
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAsString
(DerValue avaValue) Converts a DerValue of PrintableString to a java string with PrintableString characters.getValue
(byte[] berStream) Converts a BER encoded value of PrintableString to a DER encoded value.Converts a string with ASN.1 Printable characters to a DerValue.Converts a string to a DER encoded attribute value.
-
Constructor Details
-
PrintableConverter
public PrintableConverter()
-
-
Method Details
-
getValue
Converts a string with ASN.1 Printable characters to a DerValue.- Specified by:
getValue
in interfaceAVAValueConverter
- Parameters:
valueString
- a string with Printable characters.- Returns:
- a DerValue.
- Throws:
IOException
- if a Printable encoder is not available for the conversion.
-
getValue
Description copied from interface:AVAValueConverter
Converts a string to a DER encoded attribute value. Specify the order of DER tags to use if more than one encoding is possible. Currently Directory Strings can have different order for backwards compatibility. By 2003 all should be UTF8String.- Specified by:
getValue
in interfaceAVAValueConverter
- Parameters:
valueString
- An AVA value string not encoded in any form.- Returns:
- A DerValue object.
- Throws:
IOException
- if an error occurs during the conversion.
-
getValue
Converts a BER encoded value of PrintableString to a DER encoded value. Checks if the BER encoded value is a PrintableString. NOTE only DER encoded values are currently accepted on input.- Specified by:
getValue
in interfaceAVAValueConverter
- Parameters:
berStream
- A byte array of the BER encoded value.- Returns:
- A DerValue.
- Throws:
IOException
- if the BER value cannot be converted to a PrintableString DER value.
-
getAsString
Converts a DerValue of PrintableString to a java string with PrintableString characters.- Specified by:
getAsString
in interfaceAVAValueConverter
- Parameters:
avaValue
- a DerValue.- Returns:
- a string with PrintableString characters.
- Throws:
IOException
- if the DerValue is not a PrintableString i.e. The DerValue cannot be converted to a string with PrintableString characters.
-