View Javadoc
1 package jsdsi; 2 3 /*** 4 * Selects all certificates whose subject is a name that starts with the 5 * specified issuer and local name. That is, if the issuer is 6 * <code>K</code> and the local name is <code>S</code>, this selects all 7 * certificates of the form <code>(LHS -> "K S ...")</code>, 8 * where <code>LHS</code> is the left-hand-side of the certificate and 9 * <code>"K S ..."</code> is a name. 10 * 11 * @author Sameer Ajmani 12 * @version $Revision: 1.2.6.1 $ $Date: 2005/11/08 03:12:52 $ 13 */ 14 public class CompatibleCertSelector extends CertSelector { 15 Principal issuer; 16 String name; 17 18 /*** 19 * Creates a new <code>CompatibleCertSelector</code> that matches 20 * certificates whose subject is a name issued by <code>i</code> 21 * whose first local name is <code>n</code>. 22 */ 23 public CompatibleCertSelector(Principal i, String n) { 24 issuer = i; 25 name = n; 26 } 27 28 /*** 29 * @see java.lang.Object#clone() 30 */ 31 public Object clone() { 32 return new CompatibleCertSelector(issuer, name); 33 } 34 35 /*** 36 * @return true if cert.subject is a Name whose issuer 37 * is the same principal as this.issuer and whose first 38 * local name is this.name. 39 * 40 * @see java.security.cert.CertSelector#match(Certificate) 41 */ 42 public boolean match(jsdsi.Certificate cert) { 43 return (cert.getCert().getSubject() instanceof Name) 44 && ((Name) cert.getCert().getSubject()) 45 .getIssuer().samePrincipalAs(issuer) 46 && ((Name) cert.getCert().getSubject()) 47 .getNames()[0].equals(name); 48 } 49 50 /*** 51 * @return the issuer matched by this selector. 52 */ 53 public Principal getIssuer() { 54 return issuer; 55 } 56 57 /*** 58 * @return the local name matched by this selector. 59 */ 60 public String getName() { 61 return name; 62 } 63 64 /*** 65 * @return the fully-qualified name matched by this selector. 66 */ 67 public Name getFullName() { 68 return new Name(issuer, name); 69 } 70 }

This page was automatically generated by Maven