java.lang.Object
org.mozilla.jss.netscape.security.x509.AVA
All Implemented Interfaces:
DerEncoder

public final class AVA extends Object implements DerEncoder
X.500 Attribute-Value-Assertion (AVA): an attribute, as identified by some attribute ID, has some particular value. Values are as a rule ASN.1 printable strings. A conventional set of type IDs is recognized when parsing (and generating) RFC 1779 syntax strings.

AVAs are components of X.500 relative names. Think of them as being individual fields of a database record. The attribute ID is how you identify the field, and the value is part of a particular record.

Version:
1.14
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) ObjectIdentifier
     
    (package private) DerValue
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs an AVA from an input stream of UTF8 bytes that form a Ldap DN string.
    AVA(String avaString)
    Constructs an AVA from a Ldap DN string with one AVA component using the global default LdapDNStrConverter.
    AVA(String avaString, byte[] tags)
    Like AVA(String) with a DER encoding order given for Directory Strings.
    AVA(String avaString, LdapDNStrConverter ldapDNStrConverter)
    Constructs an AVA from a Ldap DN string containing one AVA component using the specified LdapDNStrConverter.
    Constructs an AVA from a Der Input Stream.
    Constructs an AVA from an OID and DerValue.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    DER encode this object onto an output stream.
    void
    Encodes the AVA to a Der output stream.
    boolean
    equals(Object other)
    Compares the AVA with an Object, returns true if the object is an AVA and has the same OID and value.
    boolean
    equals(AVA other)
    Returns true if another AVA has the same OID and DerValue.
    Returns the OID in the AVA.
    Returns the value in this AVA as a DerValue
    int
     
    Returns a Ldap DN string with one AVA component using the global default LdapDNStrConverter.
    toLdapDNString(LdapDNStrConverter ldapDNStrConverter)
    Returns a Ldap DN string with one AVA component using the specified LdapDNStrConverter.
    Returns a Ldap DN string with the AVA component using the global default LdapDNStrConverter, or null if an error occurs in conversion.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • AVA

      public AVA(String avaString) throws IOException
      Constructs an AVA from a Ldap DN string with one AVA component using the global default LdapDNStrConverter.
      Parameters:
      avaString - a Ldap DN string with one AVA component.
      Throws:
      IOException
      See Also:
    • AVA

      public AVA(String avaString, byte[] tags) throws IOException
      Like AVA(String) with a DER encoding order given for Directory Strings.
      Throws:
      IOException
    • AVA

      public AVA(String avaString, LdapDNStrConverter ldapDNStrConverter) throws IOException
      Constructs an AVA from a Ldap DN string containing one AVA component using the specified LdapDNStrConverter.
      Parameters:
      avaString - a Ldap DN string containing one AVA.
      ldapDNStrConverter - a LdapDNStrConverter
      Throws:
      IOException
      See Also:
    • AVA

      public AVA(ObjectIdentifier type, DerValue val)
      Constructs an AVA from an OID and DerValue.
      Parameters:
      type - an ObjectIdentifier
      val - a DerValue
    • AVA

      public AVA(InputStream in) throws IOException
      Constructs an AVA from an input stream of UTF8 bytes that form a Ldap DN string. Then parse the Ldap DN string using the global default LdapDNStrConverter.
      Parses an RFC 1779 style AVA string: CN=fee fie foe fum or perhaps with quotes. Not all defined AVA tags are supported; of current note are X.400 related ones (PRMD, ADMD, etc). This terminates at unescaped AVA separators ("+") or RDN separators (",", ";"), or DN terminators (">"), and removes cosmetic whitespace at the end of values.
      Parameters:
      in - the input stream.
      Throws:
      IOException
      See Also:
    • AVA

      public AVA(DerInputStream in) throws IOException
      Constructs an AVA from a Der Input Stream.
      Parameters:
      in - the Der Input Stream.
      Throws:
      IOException
  • Method Details

    • equals

      public boolean equals(AVA other)
      Returns true if another AVA has the same OID and DerValue.
      Parameters:
      other - the other AVA.
      Returns:
      ture iff other AVA has same oid and value.
    • equals

      public boolean equals(Object other)
      Compares the AVA with an Object, returns true if the object is an AVA and has the same OID and value.
      Overrides:
      equals in class Object
      Parameters:
      other - the other object.
      Returns:
      true iff other object is an AVA and has same oid and value.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • encode

      public void encode(DerOutputStream out) throws IOException
      Encodes the AVA to a Der output stream. AVAs are encoded as a SEQUENCE of two elements.
      Parameters:
      out - The Der output stream.
      Throws:
      IOException
    • derEncode

      public void derEncode(OutputStream out) throws IOException
      DER encode this object onto an output stream. Implements the DerEncoder interface.
      Specified by:
      derEncode in interface DerEncoder
      Parameters:
      out - the output stream on which to write the DER encoding.
      Throws:
      IOException - on encoding error.
    • toLdapDNString

      public String toLdapDNString() throws IOException
      Returns a Ldap DN string with one AVA component using the global default LdapDNStrConverter.
      Returns:
      a Ldap DN string
      Throws:
      IOException - if an error occurs during conversion.
      See Also:
    • toLdapDNString

      public String toLdapDNString(LdapDNStrConverter ldapDNStrConverter) throws IOException
      Returns a Ldap DN string with one AVA component using the specified LdapDNStrConverter.
      Parameters:
      ldapDNStrConverter - a Ldap DN String Converter
      Returns:
      a Ldap DN string
      Throws:
      IOException - if an error occurs during the conversion.
      See Also:
    • toString

      public String toString()
      Returns a Ldap DN string with the AVA component using the global default LdapDNStrConverter, or null if an error occurs in conversion.
      Overrides:
      toString in class Object
      Returns:
      a Ldap DN string containing the AVA, or null if an error occurs in the conversion.
    • getOid

      public ObjectIdentifier getOid()
      Returns the OID in the AVA.
      Returns:
      the ObjectIdentifier in this AVA.
    • getValue

      public DerValue getValue()
      Returns the value in this AVA as a DerValue
      Returns:
      attribute value in this AVA.