private static class FrameworkUtil.DNChainMatching
extends java.lang.Object
The format of DNs are given in RFC 2253. We represent a signature chain for an X.509 certificate as a semicolon separated list of DNs. This is what we refer to as the DN chain. Each DN is made up of relative distinguished names (RDN) which in turn are made up of key value pairs. For example:
cn=ben+ou=research,o=ACME,c=us;ou=Super CA,c=CAis made up of two DNs: "
cn=ben+ou=research,o=ACME,c=us
" and " ou=Super CA,c=CA
". The first DN is made of of three RDNs: "
cn=ben+ou=research
" and "o=ACME
" and "
c=us
". The first RDN has two name value pairs: "
cn=ben
" and "ou=research
".
A chain pattern makes use of wildcards ('*' or '-') to match against DNs, and wildcards ('*') to match againts DN prefixes, and value. If a DN in a match pattern chain is made up of a wildcard ("*"), that wildcard will match zero or one DNs in the chain. If a DN in a match pattern chain is made up of a wildcard ("-"), that wildcard will match zero or more DNs in the chain. If the first RDN of a DN is the wildcard ("*"), that DN will match any other DN with the same suffix (the DN with the wildcard RDN removed). If a value of a name/value pair is a wildcard ("*"), the value will match any value for that name.
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
MINUS_WILDCARD |
private static java.lang.String |
STAR_WILDCARD |
Modifier | Constructor and Description |
---|---|
private |
DNChainMatching() |
Modifier and Type | Method and Description |
---|---|
private static boolean |
dnChainMatch(java.util.List dnChain,
int dnChainIndex,
java.util.List dnChainPattern,
int dnChainPatternIndex)
recursively attempt to match the DNChain, and the DNChainPattern
where DNChain is of the format: "DN;DN;DN;" and DNChainPattern is of
the format: "DNPattern;*;DNPattern" (or combinations of this)
|
private static boolean |
dnmatch(java.util.List dn,
java.util.List dnPattern) |
(package private) static boolean |
match(java.lang.String pattern,
java.util.List dnChain)
Matches a distinguished name chain against a pattern of a
distinguished name chain.
|
private static void |
parseDN(java.lang.String dn,
java.util.List rdn)
Takes a distinguished name in canonical form and fills in the
rdnArray with the extracted RDNs.
|
private static java.util.List |
parseDNchain(java.util.List chain) |
private static java.util.List |
parseDNchainPattern(java.lang.String dnChain)
Parses a distinguished name chain pattern and returns a List where
each element represents a distinguished name (DN) in the chain of
DNs.
|
private static boolean |
rdnmatch(java.util.List rdn,
java.util.List rdnPattern)
Check the name/value pairs of the rdn against the pattern.
|
private static int |
skipSpaces(java.lang.String dnChain,
int startIndex)
Increment startIndex until the end of dnChain is hit or until it is
the index of a non-space character.
|
private static int |
skipWildCards(java.util.List dnChainPattern,
int dnChainPatternIndex)
This method will return an 'index' which points to a non-wildcard DN
or the end-of-list.
|
private static java.lang.String |
toString(java.util.List dnChain) |
private static final java.lang.String MINUS_WILDCARD
private static final java.lang.String STAR_WILDCARD
private static boolean rdnmatch(java.util.List rdn, java.util.List rdnPattern)
rdn
- List of name value pairs for a given RDN.rdnPattern
- List of name value pattern pairs.private static boolean dnmatch(java.util.List dn, java.util.List dnPattern)
private static java.util.List parseDNchainPattern(java.lang.String dnChain)
dnChain
- java.lang.IllegalArgumentException
private static java.util.List parseDNchain(java.util.List chain)
private static int skipSpaces(java.lang.String dnChain, int startIndex)
private static void parseDN(java.lang.String dn, java.util.List rdn)
dn
- the distinguished name in canonical form.rdn
- the list to fill in with RDNs extracted from the dnjava.lang.IllegalArgumentException
- if a formatting error is found.private static int skipWildCards(java.util.List dnChainPattern, int dnChainPatternIndex)
private static boolean dnChainMatch(java.util.List dnChain, int dnChainIndex, java.util.List dnChainPattern, int dnChainPatternIndex) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
static boolean match(java.lang.String pattern, java.util.List dnChain)
dnChain
- pattern
- the pattern of distinguished name (DN) chains to match
against the dnChain. Wildcards ("*" or "-") can be used in
three cases:
java.lang.IllegalArgumentException
private static java.lang.String toString(java.util.List dnChain)