Class PrintableConverter

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getAsString​(DerValue avaValue)
      Converts a DerValue of PrintableString to a java string with PrintableString characters.
      DerValue getValue​(byte[] berStream)
      Converts a BER encoded value of PrintableString to a DER encoded value.
      DerValue getValue​(java.lang.String valueString)
      Converts a string with ASN.1 Printable characters to a DerValue.
      DerValue getValue​(java.lang.String valueString, byte[] tags)
      Converts a string to a DER encoded attribute value.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PrintableConverter

        public PrintableConverter()
    • 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:
        getValue in interface AVAValueConverter
        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: 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 interface AVAValueConverter
        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:
        getValue in interface AVAValueConverter
        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:
        getAsString in interface AVAValueConverter
        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.