1 package jsdsi;
2
3 /***
4 * Selects all name certificates issued by a specific principal to define
5 * a specific local name.
6 *
7 * @author Sameer Ajmani
8 * @version $Revision: 1.2.6.1 $ $Date: 2005/11/08 03:12:52 $
9 */
10 public class NameCertSelector extends CertSelector {
11 Principal issuer;
12 String name;
13
14 /***
15 * Creates a new <code>NameCertSelector</code> that matches
16 * certificates issued by <code>i</code> for the local name n.
17 */
18 public NameCertSelector(Principal i, String n) {
19 issuer = i;
20 name = n;
21 }
22
23 /***
24 * @see java.lang.Object#clone()
25 */
26 public Object clone() {
27 return new NameCertSelector(issuer, name);
28 }
29
30 /***
31 * @return true if cert.issuer is the same principal as this.issuer
32 * and if cert defined the local name this.name.
33 *
34 * @see java.security.cert.CertSelector#match(Certificate)
35 */
36 public boolean match(jsdsi.Certificate cert) {
37 return (cert.getCert() instanceof NameCert)
38 && cert.getCert().getIssuer().samePrincipalAs(issuer)
39 && ((NameCert) cert.getCert()).getName().equals(name);
40 }
41
42 /***
43 * @return the issuer matched by this selector
44 */
45 public Principal getIssuer() {
46 return issuer;
47 }
48
49 /***
50 * @return the local name matched by this selector
51 */
52 public String getName() {
53 return name;
54 }
55
56 /***
57 * @return the fully-qualified local name matched by this selector
58 */
59 public Name getFullName() {
60 return new Name(issuer, name);
61 }
62 }
This page was automatically generated by Maven