Class RDN
- java.lang.Object
-
- org.mozilla.jss.netscape.security.x509.RDN
-
public class RDN extends java.lang.Object
RDNs are a set of {attribute = value} assertions. Some of those attributes are "distinguished" (unique w/in context). Order is never relevant. Some X.500 names include only a single distinguished attribute per RDN. This style is currently common. Note that DER-encoded RDNs sort AVAs by assertion OID ... so that when we parse this data we don't have to worry about canonicalizing it, but we'll need to sort them when we expose the RDN class more.- See Also:
X500Name
,AVA
,LdapDNStrConverter
-
-
Constructor Summary
Constructors Constructor Description RDN(java.lang.String rdnString)
Constructs a RDN from a Ldap DN String with one RDN component using the global default LdapDNStrConverter.RDN(java.lang.String rdnString, byte[] tags)
Like RDN(String) with a DER encoding order given as argument for Directory Strings.RDN(java.lang.String rdnString, LdapDNStrConverter ldapDNStrConverter)
Constructs a RDN from a Ldap DN string with one RDN component using the specified Ldap DN Str converter.RDN(java.util.Vector<AVA> avaVector)
convenience method.RDN(DerInputStream in)
Constructs a RDN from a Der Input Stream.RDN(DerValue set)
Constructs a RDN from a DerValue.RDN(AVA[] avas)
Constructs a RDN from an array of AVA.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
encode(DerOutputStream out)
Encodes this RDN to a Der output stream.boolean
equals(java.lang.Object obj)
AVA[]
getAssertion()
returns an array of AVA in the RDN.int
getAssertionLength()
returns the number of AVAs in the RDN.java.util.Enumeration<AVA>
getAVAs()
returns an enumeration of AVAs that make up this RDN.int
hashCode()
java.lang.String
toLdapDNString()
Returns a Ldap DN string with one RDN component using the global default LdapDNStrConverter.java.lang.String
toLdapDNString(LdapDNStrConverter ldapDNStrConverter)
Returns a Ldap DN String with this RDN component using the specified LdapDNStrConverter.java.lang.String
toString()
Returns a Ldap DN string with this RDN component using the global default LdapDNStrConverter.
-
-
-
Constructor Detail
-
RDN
public RDN(java.lang.String rdnString) throws java.io.IOException
Constructs a RDN from a Ldap DN String with one RDN component using the global default LdapDNStrConverter.- Parameters:
rdnString
- a Ldap DN string with one RDN component, e.g. as defined in RFC1779.- Throws:
java.io.IOException
- if error occurs while parsing the string.- See Also:
LdapDNStrConverter
-
RDN
public RDN(java.lang.String rdnString, byte[] tags) throws java.io.IOException
Like RDN(String) with a DER encoding order given as argument for Directory Strings.- Throws:
java.io.IOException
-
RDN
public RDN(java.lang.String rdnString, LdapDNStrConverter ldapDNStrConverter) throws java.io.IOException
Constructs a RDN from a Ldap DN string with one RDN component using the specified Ldap DN Str converter. For example, RFC1779StrConverter can be passed to parse a Ldap DN string in RFC1779 format.- Parameters:
rdnString
- Ldap DN string.ldapDNStrConverter
- a LdapDNStrConverter.- Throws:
java.io.IOException
- See Also:
LdapDNStrConverter
-
RDN
public RDN(DerValue set) throws java.io.IOException
Constructs a RDN from a DerValue.- Parameters:
set
- Der value of a set of AVAs.- Throws:
java.io.IOException
-
RDN
public RDN(DerInputStream in) throws java.io.IOException
Constructs a RDN from a Der Input Stream.- Parameters:
in
- a Der Input Stream.- Throws:
java.io.IOException
-
RDN
public RDN(AVA[] avas)
Constructs a RDN from an array of AVA.- Parameters:
avas
- a AVA Array.
-
RDN
public RDN(java.util.Vector<AVA> avaVector)
convenience method.
-
-
Method Detail
-
getAssertion
public AVA[] getAssertion()
returns an array of AVA in the RDN.- Returns:
- array of AVA in this RDN.
-
getAssertionLength
public int getAssertionLength()
returns the number of AVAs in the RDN.- Returns:
- number of AVAs in this RDN.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
encode
public void encode(DerOutputStream out) throws java.io.IOException
Encodes this RDN to a Der output stream.- Parameters:
out
- the Der Output Stream.- Throws:
java.io.IOException
-
getAVAs
public java.util.Enumeration<AVA> getAVAs()
returns an enumeration of AVAs that make up this RDN.- Returns:
- an enumeration of AVAs that make up this RDN.
-
toLdapDNString
public java.lang.String toLdapDNString() throws java.io.IOException
Returns a Ldap DN string with one RDN component using the global default LdapDNStrConverter.- Returns:
- the Ldap DN String of this RDN.
- Throws:
java.io.IOException
- if an error occurs during the conversion.- See Also:
LdapDNStrConverter
-
toLdapDNString
public java.lang.String toLdapDNString(LdapDNStrConverter ldapDNStrConverter) throws java.io.IOException
Returns a Ldap DN String with this RDN component using the specified LdapDNStrConverter.- Parameters:
ldapDNStrConverter
- a LdapDNStrConverter.- Returns:
- a Ldap DN String.
- Throws:
java.io.IOException
- if an error occurs in the conversion.- See Also:
LdapDNStrConverter
-
toString
public java.lang.String toString()
Returns a Ldap DN string with this RDN component using the global default LdapDNStrConverter.- Overrides:
toString
in classjava.lang.Object
- Returns:
- the Ldap DN String with this RDN component, null if an error occurs in the conversion.
- See Also:
LdapDNStrConverter
-
-