Class AVA
- java.lang.Object
-
- org.mozilla.jss.netscape.security.x509.AVA
-
- All Implemented Interfaces:
DerEncoder
public final class AVA extends java.lang.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.
- See Also:
X500Name
,RDN
,LdapDNStrConverter
-
-
Constructor Summary
Constructors Constructor Description AVA(java.io.InputStream in)
Constructs an AVA from an input stream of UTF8 bytes that form a Ldap DN string.AVA(java.lang.String avaString)
Constructs an AVA from a Ldap DN string with one AVA component using the global default LdapDNStrConverter.AVA(java.lang.String avaString, byte[] tags)
Like AVA(String) with a DER encoding order given for Directory Strings.AVA(java.lang.String avaString, LdapDNStrConverter ldapDNStrConverter)
Constructs an AVA from a Ldap DN string containing one AVA component using the specified LdapDNStrConverter.AVA(DerInputStream in)
Constructs an AVA from a Der Input Stream.AVA(ObjectIdentifier type, DerValue val)
Constructs an AVA from an OID and DerValue.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
derEncode(java.io.OutputStream out)
DER encode this object onto an output stream.void
encode(DerOutputStream out)
Encodes the AVA to a Der output stream.boolean
equals(java.lang.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.ObjectIdentifier
getOid()
Returns the OID in the AVA.DerValue
getValue()
Returns the value in this AVA as a DerValueint
hashCode()
java.lang.String
toLdapDNString()
Returns a Ldap DN string with one AVA component using the global default LdapDNStrConverter.java.lang.String
toLdapDNString(LdapDNStrConverter ldapDNStrConverter)
Returns a Ldap DN string with one AVA component using the specified LdapDNStrConverter.java.lang.String
toString()
Returns a Ldap DN string with the AVA component using the global default LdapDNStrConverter, or null if an error occurs in conversion.
-
-
-
Constructor Detail
-
AVA
public AVA(java.lang.String avaString) throws java.io.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:
java.io.IOException
- See Also:
LdapDNStrConverter
-
AVA
public AVA(java.lang.String avaString, byte[] tags) throws java.io.IOException
Like AVA(String) with a DER encoding order given for Directory Strings.- Throws:
java.io.IOException
-
AVA
public AVA(java.lang.String avaString, LdapDNStrConverter ldapDNStrConverter) throws java.io.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:
java.io.IOException
- See Also:
LdapDNStrConverter
-
AVA
public AVA(ObjectIdentifier type, DerValue val) throws java.io.IOException
Constructs an AVA from an OID and DerValue.- Parameters:
type
- an ObjectIdentifierval
- a DerValue- Throws:
java.io.IOException
-
AVA
public AVA(java.io.InputStream in) throws java.io.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:
java.io.IOException
- See Also:
LdapDNStrConverter
-
AVA
public AVA(DerInputStream in) throws java.io.IOException
Constructs an AVA from a Der Input Stream.- Parameters:
in
- the Der Input Stream.- Throws:
java.io.IOException
-
-
Method Detail
-
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(java.lang.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 classjava.lang.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 classjava.lang.Object
-
encode
public void encode(DerOutputStream out) throws java.io.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:
java.io.IOException
-
derEncode
public void derEncode(java.io.OutputStream out) throws java.io.IOException
DER encode this object onto an output stream. Implements theDerEncoder
interface.- Specified by:
derEncode
in interfaceDerEncoder
- Parameters:
out
- the output stream on which to write the DER encoding.- Throws:
java.io.IOException
- on encoding error.
-
toLdapDNString
public java.lang.String toLdapDNString() throws java.io.IOException
Returns a Ldap DN string with one AVA component using the global default LdapDNStrConverter.- Returns:
- a Ldap DN string
- Throws:
java.io.IOException
- if an error occurs during conversion.- See Also:
LdapDNStrConverter
-
toLdapDNString
public java.lang.String toLdapDNString(LdapDNStrConverter ldapDNStrConverter) throws java.io.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:
java.io.IOException
- if an error occurs during the conversion.- See Also:
LdapDNStrConverter
-
toString
public java.lang.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 classjava.lang.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.
-
-