Class LdapV3DNStrConverter
java.lang.Object
org.mozilla.jss.netscape.security.x509.LdapDNStrConverter
org.mozilla.jss.netscape.security.x509.LdapV3DNStrConverter
- Direct Known Subclasses:
RFC1779StrConverter
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:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a LdapV3DNStrConverter using the global default X500NameAttrMap and accept OIDs not in the default X500NameAttrMap.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. -
Method Summary
Modifier and TypeMethodDescriptionConverts a AVA to a Ldap v3 DN String (except in unicode).Converts a X500Name object to a Ldap v3 DN string (except in unicode).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.Converts a RDN to a Ldap v3 DN string (except in unicode).encodeString
(String valueStr) converts a raw value string to a string in Ldap V3 DN string format.encodeValue
(DerValue attrValue, ObjectIdentifier oid) Converts a value as a DerValue to a string in a Ldap V3 DN String.boolean
returns true if the converter accepts unregistered attributes i.e.gets the X500NameAttrMap used by the converter.protected static char[]
getStringFromHexpairs
(char[] hexPairs) Parse a sequence of hex pairs, each pair a UTF8 byte to a java string.Parses a Ldap DN string with a AVA component from a string reader to an AVA.parseAVA
(PushbackReader in, byte[] encodingOrder) Like parseAVA(PushbackReader) with a DER encoding order given as argument for Directory Strings.Parse a Ldap v3 DN string with a AVA component to a AVA.Like parseDN(String) with a DER encoding order given as argument for Directory Strings.parseAVAKeyword
(String avaKeyword) 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.parseAVAValue
(byte[] berValue, ObjectIdentifier oid) Converts a value in BER encoding, for example given in octothorpe form in a Ldap v3 dn string, to a DerValue.parseAVAValue
(String avaValueString, ObjectIdentifier oid) Converts a AVA value from a Ldap dn string to a DerValue according the attribute type.parseAVAValue
(String avaValueString, ObjectIdentifier oid, byte[] encodingOrder) Like parseAVAValue(String) with a DER encoding order given as argument for Directory Strings.Parses a Ldap DN string in a string reader to a X500Name.parseDN
(PushbackReader in, byte[] encodingOrder) Like parseDN(PushbackReader in) with a DER encoding order given as argument for Directory Strings.Parse a Ldap v3 DN string to a X500Name.Like parseDN(String) with a DER encoding order given as argument for Directory Strings.Parses Ldap DN string with a rdn component from a string reader to a RDN.parseRDN
(PushbackReader in, byte[] encodingOrder) Like parseRDN(PushbackReader) with a DER encoding order given as argument for Directory Strings.Parse a Ldap v3 DN string with a RDN component to a RDNLike parseRDN(String) with a DER encoding order given as argument for Directory Strings.Methods inherited from class org.mozilla.jss.netscape.security.x509.LdapDNStrConverter
getDefault, setDefault
-
Field Details
-
attrMap
-
acceptUnknownOids
protected boolean acceptUnknownOids -
specialChars
- See Also:
-
valueEndChars
- See Also:
-
quotedEndChars
- See Also:
-
octoEndChars
- See Also:
-
hexDigits
- See Also:
-
-
Constructor Details
-
LdapV3DNStrConverter
public LdapV3DNStrConverter()Constructs a LdapV3DNStrConverter using the global default X500NameAttrMap and accept OIDs not in the default X500NameAttrMap.- See Also:
-
LdapV3DNStrConverter
Constructs a LdapV3DNStrConverter using the specified X500NameAttrMap and a boolean indicating whether to accept OIDs not listed in the X500NameAttrMap.- Parameters:
attributeMap
- a X500NameAttrMapdoAcceptUnknownOids
- whether to convert unregistered OIDs (oids not in the X500NameAttrMap)- See Also:
-
-
Method Details
-
parseDN
Parse a Ldap v3 DN string to a X500Name.- Specified by:
parseDN
in classLdapDNStrConverter
- Parameters:
dn
- a LDAP v3 DN String- Returns:
- a X500Name
- Throws:
IOException
- if an error occurs during the conversion.
-
parseDN
Like parseDN(String) with a DER encoding order given as argument for Directory Strings.- Specified by:
parseDN
in classLdapDNStrConverter
- Throws:
IOException
-
parseRDN
Parse a Ldap v3 DN string with a RDN component to a RDN- Specified by:
parseRDN
in classLdapDNStrConverter
- Parameters:
rdn
- a LDAP v3 DN String- Returns:
- a RDN
- Throws:
IOException
- if an error occurs during the conversion.
-
parseRDN
Like parseRDN(String) with a DER encoding order given as argument for Directory Strings.- Specified by:
parseRDN
in classLdapDNStrConverter
- Throws:
IOException
-
parseAVA
Parse a Ldap v3 DN string with a AVA component to a AVA.- Specified by:
parseAVA
in classLdapDNStrConverter
- Parameters:
ava
- a LDAP v3 DN string- Returns:
- a AVA
- Throws:
IOException
-
parseAVA
Like parseDN(String) with a DER encoding order given as argument for Directory Strings.- Specified by:
parseAVA
in classLdapDNStrConverter
- Throws:
IOException
-
parseDN
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.
-
parseDN
Like parseDN(PushbackReader in) with a DER encoding order given as argument for Directory Strings.- Throws:
IOException
-
parseRDN
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.
-
parseRDN
Like parseRDN(PushbackReader) with a DER encoding order given as argument for Directory Strings.- Throws:
IOException
-
parseAVA
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.
- Throws:
IOException
-
parseAVA
Like parseAVA(PushbackReader) with a DER encoding order given as argument for Directory Strings.- Throws:
IOException
-
parseAVAKeyword
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.
-
parseAVAValue
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:
-
parseAVAValue
public DerValue parseAVAValue(String avaValueString, ObjectIdentifier oid, byte[] encodingOrder) throws IOException Like parseAVAValue(String) with a DER encoding order given as argument for Directory Strings.- Throws:
IOException
-
parseAVAValue
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 encodingoid
- ObjectIdentifier of the attribute.- Returns:
- DerValue for the BER encoded value
- Throws:
IOException
- if an error occurs during conversion.
-
encodeDN
Converts a X500Name object to a Ldap v3 DN string (except in unicode).- Specified by:
encodeDN
in classLdapDNStrConverter
- Parameters:
x500name
- a X500Name- Returns:
- a Ldap v3 DN String (except in unicode).
- Throws:
IOException
- if an error is encountered during conversion.
-
encodeRDN
Converts a RDN to a Ldap v3 DN string (except in unicode).- Specified by:
encodeRDN
in classLdapDNStrConverter
- Parameters:
rdn
- a RDN- Returns:
- a LDAP v3 DN string (except in unicode).
- Throws:
IOException
- if an error is encountered during conversion.
-
encodeAVA
Converts a AVA to a Ldap v3 DN String (except in unicode).- Specified by:
encodeAVA
in classLdapDNStrConverter
- Parameters:
ava
- an AVA- Returns:
- a Ldap v3 DN string (except in unicode).
- Throws:
IOException
- If an error is encountered during exception.
-
encodeOID
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.
-
encodeValue
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.
-
encodeString
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.
-
getAttrMap
gets the X500NameAttrMap used by the converter.- Returns:
- X500NameAttrMap used by this converter.
-
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.
-
getStringFromHexpairs
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.- Throws:
UnsupportedEncodingException
-