1 package jsdsi;
2
3 import jsdsi.sexp.SexpList;
4 import jsdsi.sexp.SexpParseException;
5
6 /***
7 * A subject of a certificate or an ACL entry.
8 *
9 * @author Sameer Ajmani
10 * @version $Revision: 1.1.6.1 $ $Date: 2005/11/08 03:12:52 $
11 */
12 public interface Subject {
13 public SexpList toSexp();
14 // TODO: boolean sameSubjectAs(Subject s);
15
16 static class Default {
17 static Subject parseSubject(SexpList l) throws SexpParseException {
18 return parseSubject(l, null);
19 }
20
21 static Subject parseSubject(SexpList l, Principal issuer)
22 throws SexpParseException {
23 // assumes already parsed outer "subject" block, if any
24 String type = l.getType();
25 if (type.equals("name"))
26 return Name.parseName(l, issuer);
27 if (type.equals("k-of-n"))
28 return Threshold.parseThreshold(l, issuer);
29 if (type.equals("object-hash"))
30 return ObjectHash.parseObjectHash(l);
31 // FIXME: defaulting to principal is confusing
32 return Principal.parsePrincipal(l);
33 }
34 }
35 }
This page was automatically generated by Maven