public class X500PrincipalTest extends TestCase (Code)
Tests X500Principal class
Distinguished name(DN) strings follows
BNF syntax specified in RFC 2253 and RFC 1779
See Also: http://www.ietf.org/rfc/rfc2253.txt See Also: http://www.ietf.org/rfc/rfc1779.txt See Also: http://asn1.elibel.tm.fr/en/standards/index.htm
Inner Class :public static class TestList extends ArrayList
Inits X500Principal with byte array
gets Name in CANONICAL format
compares with expected value of name
testGetName_CANONICAL_SortOrder
public void testGetName_CANONICAL_SortOrder() throws Exception(Code)
Inits X500Principal with a string, there are multiple AVAs
gets string in CANONICAL format
compares with expected value paying attention on sorting order of AVAs
testGetName_CANONICAL_SortOrder_01
public void testGetName_CANONICAL_SortOrder_01() throws Exception(Code)
Inits X500Principal with a string, there are multiple AVAs and Oid which does not fall into any keyword
gets string in CANONICAL format
compares with expected value paying attention on sorting order of AVAs
testGetName_CANONICAL_SortOrder_02
public void testGetName_CANONICAL_SortOrder_02() throws Exception(Code)
Inits X500Principal with a string, there are multiple AVAs and Oid which does not fall into any keyword, and value given in hex format
gets string in CANONICAL format
compares with expected value paying attention on sorting order of AVAs
testGetName_CANONICAL_SortOrder_03
public void testGetName_CANONICAL_SortOrder_03() throws Exception(Code)
Inits X500Principal with a string, there are multiple AVAs and 2 Oids which do not fall into any keyword
gets string in CANONICAL format
compares with expected value paying attention on sorting order of AVAs
testGetName_CANONICAL_SortOrder_04
public void testGetName_CANONICAL_SortOrder_04() throws Exception(Code)
Inits X500Principal with a string, there are multiple AVAs and 2 Oids which do not fall into any keyword
gets string in CANONICAL format
compares with expected value paying attention on sorting order of AVAs
testGetName_CANONICAL_SortOrder_05
public void testGetName_CANONICAL_SortOrder_05() throws Exception(Code)
Inits X500Principal with a string, there are multiple AVAs and 2 Oids which do not fall into any keyword
gets string in CANONICAL format
compares with expected value paying attention on sorting order of AVAs
testGetName_CANONICAL_SortOrder_06
public void testGetName_CANONICAL_SortOrder_06() throws Exception(Code)
Inits X500Principal with a string, there are multiple AVAs and 2 Oids which do not fall into any keyword
gets string in CANONICAL format
compares with expected value paying attention on sorting order of AVAs
testGetName_CANONICAL_SortOrder_07
public void testGetName_CANONICAL_SortOrder_07() throws Exception(Code)
Inits X500Principal with a string, there are multiple AVAs and 2 Oids which do not fall into any keyword
gets string in CANONICAL format
compares with expected value paying attention on sorting order of AVAs
public void testGetName_EncodingWithWrongOidButGoodName_MultAVA_CANONICAL() throws Exception(Code)
Inits X500Principal with a string, there are multiple AVAs and Oid which does not fall into any keyword
Gets encoding
Inits other X500Principal with the encoding
gets string in CANONICAL format
compares with expected value paying attention on sorting order of AVAs
public void testGetName_EncodingWithWrongOidButGoodName_MultAVA_RFC1779() throws Exception(Code)
Inits X500Principal with a string, there are multiple AVAs and Oid which does not fall into any keyword
Gets encoding
Inits other X500Principal with the encoding
gets string in RFC1779 format
compares with expected value paying attention on sorting order of AVAs
public void testGetName_EncodingWithWrongOidButGoodName_MultAVA_RFC2253() throws Exception(Code)
Inits X500Principal with a string, there are multiple AVAs and Oid which does not fall into any keyword
Gets encoding
Inits other X500Principal with the encoding
gets string in RFC2253 format
compares with expected value paying attention on sorting order of AVAs
public void testGetName_EncodingWithWrongOidButGoodName_SeveralRDNs_CANONICAL() throws Exception(Code)
Inits X500Principal with a string, where OID does not fall into any keyword
gets encoded form
inits new X500Principal with the encoding
gets string in CANONICAL format
compares with expected value
public void testGetName_EncodingWithWrongOidButGoodName_SeveralRDNs_RFC1779() throws Exception(Code)
Inits X500Principal with a string, where OID does not fall into any keyword
gets encoded form
inits new X500Principal with the encoding
gets string in RFC1779 format
compares with expected value
public void testGetName_EncodingWithWrongOidButGoodName_SeveralRDNs_RFC2253() throws Exception(Code)
Inits X500Principal with a string, where OID does not fall into any keyword
gets encoded form
inits new X500Principal with the encoding
gets string in RFC2253 format
compares with expected value
Inits X500Principal with string, where value is given with special chars
Compatibility issue: according RFC 2253 such string is invalid
but we accept it, not string char is escaped
Inits X500Principal with string, where value is given with not string chars
Compatibility issue: according RFC 2253 such string is invalid
but we accept it, not string char is escaped
Inits X500Principal with string, where value is given with special chars
Compatibility issue: according RFC 2253 such string is invalid
but we accept it, special char is escaped
Inits X500Principal with byte array, where Oid does fall into any keyword, but not given as a keyword
Value is given as hex value
(extra spaces are given)
gets Name in CANONICAL format
compares with expected value of name
Inits X500Principal with byte array, where Oid does fall into any keyword, but not given as a keyword
Value is given as hex value
(extra spaces are given)
gets Name in RFC1779 format
compares with expected value of name
Inits X500Principal with byte array, where Oid does fall into any keyword, but not given as a keyword
Value is given as hex value
(extra spaces are given)
gets Name in RFC2253 format
compares with expected value of name
Inits X500Principal with string with only spaces,
gets Name in CANONICAL format:leading and trailing white space
chars are removed even string doesn't have other chars (bug???)
Inits X500Principal with the string with special characters - CN="A\\", C=B
gets Name in RFC1779 format
compares with expected value of name - CN="A\\", C=B
Inits X500Principal with string as single escaped space
gets encoding
compares with expected encoding
testNameSpaceFromEncoding_CANONICAL
public void testNameSpaceFromEncoding_CANONICAL() throws Exception(Code)
Inits X500Principal with byte array, where there are leading and tailing spaces
gets Name in CANONICAL format
compares with expected value of name
testNameSpaceFromEncoding_RFC1779
public void testNameSpaceFromEncoding_RFC1779() throws Exception(Code)
Inits X500Principal with byte array, where there are leading and tailing spaces
gets Name in RFC1779 format
compares with expected value of name
testNameSpaceFromEncoding_RFC2253
public void testNameSpaceFromEncoding_RFC2253() throws Exception(Code)
Inits X500Principal with byte array, where there are leading and tailing spaces
gets Name in RFC2253 format
compares with expected value of name
testNameSpaces_CANONICAL
public void testNameSpaces_CANONICAL() throws Exception(Code)
Inits X500Principal with the string with special characters - B\'space'
gets Name in CANONICAL format
compares with expected value of name - B\
testNameSpaces_CANONICAL_01
public void testNameSpaces_CANONICAL_01() throws Exception(Code)
Inits X500Principal with the string with special characters - "B'space''space''space'A"
gets Name in CANONICAL format
compares with expected value of name - b'space'a
testNameSpaces_CANONICAL_02
public void testNameSpaces_CANONICAL_02() throws Exception(Code)
Inits X500Principal with the string with special characters - \\'space''space'B
gets Name in CANONICAL format
compares with expected value of name - \'space''space'b
Inits X500Principal with the string with special characters - B\'space'
gets Name in RFC1779 format
compares with expected value of name - "B "
testNameSpaces_RFC1779_01
public void testNameSpaces_RFC1779_01() throws Exception(Code)
Inits X500Principal with the string with special characters - "B'space''space''space'A"
gets Name in RFC1779 format
compares with expected value of name - "B A"
testNameSpaces_RFC1779_02
public void testNameSpaces_RFC1779_02() throws Exception(Code)
Inits X500Principal with the string with special characters - \\'space''space'B
gets Name in RFC1779 format
compares with expected value of name - " B"
Inits X500Principal with the string with special characters - B\'space'
gets Name in RFC2253 format
compares with expected value of name - B\'space'
testNameSpaces_RFC2253_01
public void testNameSpaces_RFC2253_01() throws Exception(Code)
Inits X500Principal with the string with special characters - "B'space''space''space'A"
gets Name in 2253 format
compares with expected value of name - B'space''space''space'A
testNameSpaces_RFC2253_02
public void testNameSpaces_RFC2253_02() throws Exception(Code)
Inits X500Principal with the string with special characters - \\'space''space'B
gets Name in RFC1779 format
compares with expected value of name - \'space''space'B
testNameSpecialCharsFromEncoding_CANONICAL
public void testNameSpecialCharsFromEncoding_CANONICAL() throws Exception(Code)
Inits X500Principal with byte array, where there are special characters
gets Name in CANONICAL format
compares with expected value of name, checks if the characters are escaped
testNameSpecialCharsFromEncoding_RFC1779
public void testNameSpecialCharsFromEncoding_RFC1779() throws Exception(Code)
Inits X500Principal with byte array, where there are special characters
gets Name in RFC1779 format
compares with expected value of name, checks if the string is in quotes
testNameSpecialCharsFromEncoding_RFC2253
public void testNameSpecialCharsFromEncoding_RFC2253() throws Exception(Code)
Inits X500Principal with byte array, where there are special characters
gets Name in RFC1779 format
compares with expected value of name, checks if the characters are escaped
testNameSpecialChars_CANONICAL
public void testNameSpecialChars_CANONICAL() throws Exception(Code)
Inits X500Principal with the string with special characters - \"B
gets Name in CANONICAL format
compares with expected value of name - "\b"
testNameSpecialChars_CANONICAL_01
public void testNameSpecialChars_CANONICAL_01() throws Exception(Code)
Inits X500Principal with the string with special characters - \\nB
gets Name in CANONICAL format
compares with expected value of name - \\nb
testNameSpecialChars_CANONICAL_02
public void testNameSpecialChars_CANONICAL_02() throws Exception(Code)
Inits X500Principal with the string with special characters - \\B
gets Name in CANONICAL format
compares with expected value of name - \\b
testNameSpecialChars_CANONICAL_03
public void testNameSpecialChars_CANONICAL_03() throws Exception(Code)
Inits X500Principal with the string with special characters - ABC"DEF"
gets Name in CANONICAL format
compares with expected value of name - abc"def"
testNameSpecialChars_CANONICAL_04
public void testNameSpecialChars_CANONICAL_04() throws Exception(Code)
Inits X500Principal with the string with special characters - ABC"D#EF"
gets Name in RFC1779 format
compares with expected value of name - abc"d#ef"
testNameSpecialChars_CANONICAL_05
public void testNameSpecialChars_CANONICAL_05()(Code)
Inits X500Principal with the string with special characters - X#YZ
gets Name in CANONICAL format
compares with expected value of name - x#yz
testNameSpecialChars_CANONICAL_6
public void testNameSpecialChars_CANONICAL_6() throws Exception(Code)
Inits X500Principal with the string with special characters - CN=\#XYZ
gets Name in CANONICAL format
compares with expected value of name - cn=\#xyz
testNameSpecialChars_RFC1779
public void testNameSpecialChars_RFC1779() throws Exception(Code)
Inits X500Principal with the string with special characters - \"B
gets Name in RFC1779 format
compares with expected value of name - "\B"
testNameSpecialChars_RFC1779_01
public void testNameSpecialChars_RFC1779_01() throws Exception(Code)
Inits X500Principal with the string with special characters - \\nB
gets Name in RFC1779 format
compares with expected value of name - "\nB"
testNameSpecialChars_RFC1779_02
public void testNameSpecialChars_RFC1779_02() throws Exception(Code)
Inits X500Principal with the string with special characters - \\B
gets Name in RFC1779 format
compares with expected value of name - "\B"
testNameSpecialChars_RFC1779_03
public void testNameSpecialChars_RFC1779_03() throws Exception(Code)
Inits X500Principal with the string with special characters - ABC"DEF"
gets Name in RFC1779 format
compares with expected value of name - "ABCDEF"
testNameSpecialChars_RFC1779_04
public void testNameSpecialChars_RFC1779_04() throws Exception(Code)
Inits X500Principal with the string with special characters - ABC"D#EF"
gets Name in RFC1779 format
compares with expected value of name - "ABCD#EF"
testNameSpecialChars_RFC1779_05
public void testNameSpecialChars_RFC1779_05()(Code)
Inits X500Principal with the string with special characters - X#YZ
gets Name in RFC1779 format
compares with expected value of name - "X#YZ"
testNameSpecialChars_RFC1779_6
public void testNameSpecialChars_RFC1779_6() throws Exception(Code)
Inits X500Principal with the string with special characters - CN=\#XYZ
gets Name in RFC1779 format
compares with expected value of name - CN="#XYZ"
testNameSpecialChars_RFC2253
public void testNameSpecialChars_RFC2253() throws Exception(Code)
Inits X500Principal with the string with special characters - \"B
gets Name in RFC2253 format
compares with expected value of name - "\B"
testNameSpecialChars_RFC2253_01
public void testNameSpecialChars_RFC2253_01() throws Exception(Code)
Inits X500Principal with the string with special characters - \\nB
gets Name in RFC2253 format
compares with expected value of name - \\nB
testNameSpecialChars_RFC2253_02
public void testNameSpecialChars_RFC2253_02() throws Exception(Code)
Inits X500Principal with the string with special characters - \\B
gets Name in RFC2253 format
compares with expected value of name - \\B
testNameSpecialChars_RFC2253_03
public void testNameSpecialChars_RFC2253_03() throws Exception(Code)
Inits X500Principal with the string with special characters - ABC"DEF"
gets Name in RFC2253 format
compares with expected value of name - ABC"DEF"
testNameSpecialChars_RFC2253_04
public void testNameSpecialChars_RFC2253_04() throws Exception(Code)
Inits X500Principal with the string with special characters - ABC"D#EF"
gets Name in RFC1779 format
compares with expected value of name - ABCD\#EF
testNameSpecialChars_RFC2253_05
public void testNameSpecialChars_RFC2253_05()(Code)
Inits X500Principal with the string with special characters - X#YZ
gets Name in RFC2253 format
compares with expected value of name - X\#YZ
testNameSpecialChars_RFC2253_6
public void testNameSpecialChars_RFC2253_6() throws Exception(Code)
Inits X500Principal with the string with special characters - CN=\#XYZ
gets Name in RFC2253 format
compares with expected value of name - CN=\#XYZ
Inits X500Principal with the string with special characters - ABC"DEF"
gets encoding
compares with expected encoding
testNameWithQuotation_01
public void testNameWithQuotation_01() throws Exception(Code)
Inits X500Principal with the string with special characters - "ABCDEF
checks if the proper exception is thrown
testNameWithQuotation_02
public void testNameWithQuotation_02() throws Exception(Code)
Inits X500Principal with the string with special characters - ABC"D#EF"
gets encoding
compares with expected encoding
testNameWithQuotation_03
public void testNameWithQuotation_03() throws Exception(Code)
Inits X500Principal with the string with special characters - ABC"DEF"
Compatibility issue: according RFC 2253 such string is invalid
but we accept it, not string char is escaped