All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class netscape.security.x509.LdapV3DNStrConverter

netscape.security.x509.LdapDNStrConverter
   |
   +----netscape.security.x509.LdapV3DNStrConverter

public class LdapV3DNStrConverter
extends LdapDNStrConverter
A converter that converts Ldap v3 DN strings as specified in draft-ietf-asid-ldapv3-dn-03.txt to a X500Name, RDN or AVA and vice versa.

See Also:
LdapDNStrConverter, X500Name, RDN, AVA, X500NameAttrMap

Variable Index

 o acceptUnknownOids
 o attrMap
 o hexDigits
 o octoEndChars
 o quotedEndChars
 o specialChars
 o valueEndChars

Constructor Index

 o LdapV3DNStrConverter()
Constructs a LdapV3DNStrConverter using the global default X500NameAttrMap and accept OIDs not in the default X500NameAttrMap.
 o LdapV3DNStrConverter(X500NameAttrMap, boolean)
Constructs a LdapV3DNStrConverter using the specified X500NameAttrMap and a boolean indicating whether to accept OIDs not listed in the X500NameAttrMap.

Method Index

 o encodeAVA(AVA)
Converts a AVA to a Ldap v3 DN String (except in unicode).
 o encodeDN(X500Name)
Converts a X500Name object to a Ldap v3 DN string (except in unicode).
 o encodeOID(ObjectIdentifier)
Converts an OID to a attribute keyword in a Ldap v3 DN string - either a keyword if known or a string of "1.2.3.4" syntax.
 o encodeRDN(RDN)
Converts a RDN to a Ldap v3 DN string (except in unicode).
 o encodeString(String)
converts a raw value string to a string in Ldap V3 DN string format.
 o encodeValue(DerValue, ObjectIdentifier)
Converts a value as a DerValue to a string in a Ldap V3 DN String.
 o getAcceptUnknownOids()
returns true if the converter accepts unregistered attributes i.e.
 o getAttrMap()
gets the X500NameAttrMap used by the converter.
 o getStringFromHexpairs(char[])
Parse a sequence of hex pairs, each pair a UTF8 byte to a java string.
 o parseAVA(PushbackReader)
Parses a Ldap DN string with a AVA component from a string reader to an AVA.
 o parseAVA(String)
Parse a Ldap v3 DN string with a AVA component to a AVA.
 o parseAVAKeyword(String)
Converts a AVA keyword from a Ldap DN string to an ObjectIdentifier from the attribute map or, if this keyword is an OID not in the attribute map, create a new ObjectIdentifier for the keyword if acceptUnknownOids is true.
 o parseAVAValue(byte[], ObjectIdentifier)
Converts a value in BER encoding, for example given in octothorpe form in a Ldap v3 dn string, to a DerValue.
 o parseAVAValue(String, ObjectIdentifier)
Converts a AVA value from a Ldap dn string to a DerValue according the attribute type.
 o parseDN(PushbackReader)
Parses a Ldap DN string in a string reader to a X500Name.
 o parseDN(String)
Parse a Ldap v3 DN string to a X500Name.
 o parseRDN(PushbackReader)
Parses Ldap DN string with a rdn component from a string reader to a RDN.
 o parseRDN(String)
Parse a Ldap v3 DN string with a RDN component to a RDN

Variables

 o attrMap
 protected X500NameAttrMap attrMap
 o acceptUnknownOids
 protected boolean acceptUnknownOids
 o specialChars
 protected static final String specialChars
 o valueEndChars
 protected static final String valueEndChars
 o quotedEndChars
 protected static final String quotedEndChars
 o octoEndChars
 protected static final String octoEndChars
 o hexDigits
 protected static final String hexDigits

Constructors

 o LdapV3DNStrConverter
 public LdapV3DNStrConverter()
Constructs a LdapV3DNStrConverter using the global default X500NameAttrMap and accept OIDs not in the default X500NameAttrMap.

See Also:
X500NameAttrMap
 o LdapV3DNStrConverter
 public LdapV3DNStrConverter(X500NameAttrMap attributeMap,
                             boolean doAcceptUnknownOids)
Constructs a LdapV3DNStrConverter using the specified X500NameAttrMap and a boolean indicating whether to accept OIDs not listed in the X500NameAttrMap.

Parameters:
attributeMap - a X500NameAttrMap
doAcceptUnknownOids - whether to convert unregistered OIDs (oids not in the X500NameAttrMap)
See Also:
X500NameAttrMap

Methods

 o parseDN
 public X500Name parseDN(String dn) throws IOException
Parse a Ldap v3 DN string to a X500Name.

Parameters:
dn - a LDAP v3 DN String
Returns:
a X500Name
Throws: IOException
if an error occurs during the conversion.
Overrides:
parseDN in class LdapDNStrConverter
 o parseRDN
 public RDN parseRDN(String rdn) throws IOException
Parse a Ldap v3 DN string with a RDN component to a RDN

Parameters:
rdn - a LDAP v3 DN String
Returns:
a RDN
Throws: IOException
if an error occurs during the conversion.
Overrides:
parseRDN in class LdapDNStrConverter
 o parseAVA
 public AVA parseAVA(String ava) throws IOException
Parse a Ldap v3 DN string with a AVA component to a AVA.

Parameters:
ava - a LDAP v3 DN string
Returns:
a AVA
Overrides:
parseAVA in class LdapDNStrConverter
 o parseDN
 public X500Name parseDN(PushbackReader in) throws IOException
Parses a Ldap DN string in a string reader to a X500Name.

Parameters:
in - Pushback string reader for a Ldap DN string. The pushback reader must have a pushback buffer size > 2.
Returns:
a X500Name
Throws: IOException
if any reading or parsing error occurs.
 o parseRDN
 public RDN parseRDN(PushbackReader in) throws IOException
Parses Ldap DN string with a rdn component from a string reader to a RDN. The string reader will point to the separator after the rdn component or -1 if at end of string.

Parameters:
in - Pushback string reader containing a Ldap DN string with at least one rdn component. The pushback reader must have a pushback buffer size > 2.
Returns:
RDN object of the first rdn component in the Ldap DN string.
Throws: IOException
if any read or parse error occurs.
 o parseAVA
 public AVA parseAVA(PushbackReader in) throws IOException
Parses a Ldap DN string with a AVA component from a string reader to an AVA. The string reader will point to the AVA separator after the ava string or -1 if end of string.

Parameters:
in - a Pushback reader containg a Ldap string with at least one AVA component. The Pushback reader must have a pushback buffer size > 2.
Returns:
AVA object of the first AVA component in the Ldap DN string.
 o parseAVAKeyword
 public ObjectIdentifier parseAVAKeyword(String avaKeyword) throws IOException
Converts a AVA keyword from a Ldap DN string to an ObjectIdentifier from the attribute map or, if this keyword is an OID not in the attribute map, create a new ObjectIdentifier for the keyword if acceptUnknownOids is true.

Parameters:
avaKeyword - AVA keyword from a Ldap DN string.
Returns:
a ObjectIdentifier object
Throws: IOException
if the keyword is an OID not in the attribute map and acceptUnknownOids is false, or if an error occurs during conversion.
 o parseAVAValue
 public DerValue parseAVAValue(String avaValueString,
                               ObjectIdentifier oid) throws IOException
Converts a AVA value from a Ldap dn string to a DerValue according the attribute type. For example, a value for CN, OU or O is expected to be a Directory String and will be converted to a DerValue of ASN.1 type PrintableString, T61String or UniversalString. A Directory String is a ASN.1 CHOICE of Printable, T.61 or Universal string.

Parameters:
avaValueString - a attribute value from a Ldap DN string.
oid - OID of the attribute.
Returns:
DerValue for the value.
Throws: IOException
if an error occurs during conversion.
See Also:
AVAValueConverter
 o parseAVAValue
 public DerValue parseAVAValue(byte berValue[],
                               ObjectIdentifier oid) throws IOException
Converts a value in BER encoding, for example given in octothorpe form in a Ldap v3 dn string, to a DerValue. Checks if the BER encoded value is a legal value for the attribute.

NOTE: only DER encoded values are supported for the BER encoded value.

Parameters:
berValue - a value in BER encoding
oid - ObjectIdentifier of the attribute.
Returns:
DerValue for the BER encoded value
Throws: IOException
if an error occurs during conversion.
 o encodeDN
 public String encodeDN(X500Name x500name) throws IOException
Converts a X500Name object to a Ldap v3 DN string (except in unicode).

Parameters:
x500name - a X500Name
Returns:
a Ldap v3 DN String (except in unicode).
Throws: IOException
if an error is encountered during conversion.
Overrides:
encodeDN in class LdapDNStrConverter
 o encodeRDN
 public String encodeRDN(RDN rdn) throws IOException
Converts a RDN to a Ldap v3 DN string (except in unicode).

Parameters:
rdn - a RDN
Returns:
a LDAP v3 DN string (except in unicode).
Throws: IOException
if an error is encountered during conversion.
Overrides:
encodeRDN in class LdapDNStrConverter
 o encodeAVA
 public String encodeAVA(AVA ava) throws IOException
Converts a AVA to a Ldap v3 DN String (except in unicode).

Parameters:
ava - an AVA
Returns:
a Ldap v3 DN string (except in unicode).
Throws: IOException
If an error is encountered during exception.
Overrides:
encodeAVA in class LdapDNStrConverter
 o encodeOID
 public String encodeOID(ObjectIdentifier oid) throws IOException
Converts an OID to a attribute keyword in a Ldap v3 DN string - either a keyword if known or a string of "1.2.3.4" syntax.

Parameters:
oid - a ObjectIdentifier
Returns:
a keyword to use in a Ldap V3 DN string.
Throws: IOException
if an error is encountered during conversion.
 o encodeValue
 public String encodeValue(DerValue attrValue,
                           ObjectIdentifier oid) throws IOException
Converts a value as a DerValue to a string in a Ldap V3 DN String. If the value cannot be converted to a string it will be encoded in octothorpe form.

Parameters:
attrValue - a value as a DerValue.
oid - OID for the attribute.
Returns:
a string for the value in a LDAP v3 DN String
Throws: IOException
if an error occurs during conversion.
 o encodeString
 public String encodeString(String valueStr)
converts a raw value string to a string in Ldap V3 DN string format.

Parameters:
valueStr - a 'raw' value string.
Returns:
a attribute value string in Ldap V3 DN string format.
 o getAttrMap
 public X500NameAttrMap getAttrMap()
gets the X500NameAttrMap used by the converter.

Returns:
X500NameAttrMap used by this converter.
 o getAcceptUnknownOids
 public boolean getAcceptUnknownOids()
returns true if the converter accepts unregistered attributes i.e. OIDS not in the X500NameAttrMap.

Returns:
true if converter converts attributes not in the X500NameAttrMap.
 o getStringFromHexpairs
 protected static char[] getStringFromHexpairs(char hexPairs[]) throws UnsupportedEncodingException
Parse a sequence of hex pairs, each pair a UTF8 byte to a java string. For example, "4C75C48D" is "Luc", the last c with caron.


All Packages  Class Hierarchy  This Package  Previous  Next  Index