Class PrintableConverter
- java.lang.Object
-
- org.mozilla.jss.netscape.security.x509.PrintableConverter
-
- All Implemented Interfaces:
AVAValueConverter
public class PrintableConverter extends java.lang.Object implements 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:
ASN1CharStrConvMap,AVAValueConverter
-
-
Constructor Summary
Constructors Constructor Description PrintableConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetAsString(DerValue avaValue)Converts a DerValue of PrintableString to a java string with PrintableString characters.DerValuegetValue(byte[] berStream)Converts a BER encoded value of PrintableString to a DER encoded value.DerValuegetValue(java.lang.String valueString)Converts a string with ASN.1 Printable characters to a DerValue.DerValuegetValue(java.lang.String valueString, byte[] tags)Converts a string to a DER encoded attribute value.
-
-
-
Method Detail
-
getValue
public DerValue getValue(java.lang.String valueString) throws java.io.IOException
Converts a string with ASN.1 Printable characters to a DerValue.- Specified by:
getValuein interfaceAVAValueConverter- Parameters:
valueString- a string with Printable characters.- Returns:
- a DerValue.
- Throws:
java.io.IOException- if a Printable encoder is not available for the conversion.
-
getValue
public DerValue getValue(java.lang.String valueString, byte[] tags) throws java.io.IOException
Description copied from interface:AVAValueConverterConverts 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:
getValuein interfaceAVAValueConverter- Parameters:
valueString- An AVA value string not encoded in any form.- Returns:
- A DerValue object.
- Throws:
java.io.IOException- if an error occurs during the conversion.
-
getValue
public DerValue getValue(byte[] berStream) throws java.io.IOException
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:
getValuein interfaceAVAValueConverter- Parameters:
berStream- A byte array of the BER encoded value.- Returns:
- A DerValue.
- Throws:
java.io.IOException- if the BER value cannot be converted to a PrintableString DER value.
-
getAsString
public java.lang.String getAsString(DerValue avaValue) throws java.io.IOException
Converts a DerValue of PrintableString to a java string with PrintableString characters.- Specified by:
getAsStringin interfaceAVAValueConverter- Parameters:
avaValue- a DerValue.- Returns:
- a string with PrintableString characters.
- Throws:
java.io.IOException- if the DerValue is not a PrintableString i.e. The DerValue cannot be converted to a string with PrintableString characters.
-
-