View Javadoc
1 package jsdsi; 2 3 import java.security.cert.CertificateEncodingException; 4 import java.util.Arrays; 5 import java.util.Iterator; 6 import java.util.List; 7 8 /*** 9 * A SPKI certification path: essentially a wrapper around the 10 * <code>Proof</code> class. 11 * 12 * @see Proof 13 * 14 * @author Sameer Ajmani 15 * @author Sean Radford 16 * @version $Revision: 1.3.2.1 $ $Date: 2005/11/08 03:12:52 $ 17 */ 18 public class CertPath extends java.security.cert.CertPath { 19 20 private static final long serialVersionUID = -2732249332091399979L; 21 22 /*** 23 * The <code>Proof</code> of this <code>CertPath</code>. 24 */ 25 private transient Proof proof; 26 27 /*** 28 * Creates a new <code>CertPath</code> from a given proof. 29 * 30 * @param p <code>Proof</code> to create the <code>CertPath</code> from. 31 */ 32 public CertPath(Proof p) { 33 super("SPKI"); 34 assert(p != null) : "null proof"; 35 proof = p; 36 } 37 38 /*** 39 * Returns the <code>Proof</code> of this <code>CertPath</code>. 40 * 41 * @return the <code>Poof</code> of this <code>CertPath</code>. 42 */ 43 public Proof getProof() { 44 return proof; 45 } 46 47 /*** 48 * Returns the type of this <code>CertPath</code>, namely 49 * <code>"SPKI"</code>. 50 * 51 * @see java.security.cert.CertPath#getType() 52 * 53 * @return the type of this <code>CertPath</code>, namely 54 * <code>"SPKI"</code>. 55 */ 56 public String getType() { 57 return "SPKI"; 58 } 59 60 /*** 61 * @see java.security.cert.CertPath#getEncodings() 62 */ 63 public Iterator getEncodings() { 64 return Arrays.asList(new String[] { "SEXP" }).iterator(); 65 } 66 67 /*** 68 * @see java.lang.Object#equals(Object) 69 */ 70 public boolean equals(Object o) { 71 return (o instanceof CertPath) && proof.equals(((CertPath) o).proof); 72 } 73 74 /*** 75 * @see java.lang.Object#hashCode() 76 */ 77 public int hashCode() { 78 return proof.hashCode(); 79 } 80 81 /*** 82 * @see java.lang.Object#toString() 83 */ 84 public String toString() { 85 return proof.toString(); 86 } 87 88 /*** 89 * @see java.security.cert.CertPath#getEncoded() 90 */ 91 public byte[] getEncoded() throws CertificateEncodingException { 92 return proof.toByteArray(); 93 } 94 95 /*** 96 * @see java.security.cert.CertPath#getEncoded(String) 97 */ 98 public byte[] getEncoded(String encoding) 99 throws CertificateEncodingException { 100 if (encoding.equals("SEXP")) { 101 return getEncoded(); 102 } 103 throw new CertificateEncodingException("unsupported encoding: " 104 + encoding); 105 } 106 107 /*** 108 * @see java.security.cert.CertPath#getCertificates() 109 */ 110 public List getCertificates() { 111 return Arrays.asList(proof.getCertificates()); 112 } 113 }

This page was automatically generated by Maven