source: fedd/abac-src/rtml/src/edu/stanford/rt/credential/PublicKeyPrincipal.java @ 59f3d1f

version-1.30
Last change on this file since 59f3d1f was 8780cbec, checked in by Jay Jacobs <Jay.Jacobs@…>, 15 years ago

ABAC sources from Cobham

  • Property mode set to 100644
File size: 1.3 KB
Line 
1package edu.stanford.rt.credential;
2/**
3 * @author Ninghui Li, Sandra Qiu<br>
4 *
5 * This class handles <code>Principal</code> element which consists of
6 * ds:KeyValue. Instead of storing the key vlaue, we store the
7 * hashValue of the key value. The key value is stored in
8 * <code>PublicKeyPrincipalInfo</code>.
9 */
10public class PublicKeyPrincipal extends Principal
11{
12        /**
13         * Hash value for the public key stored in this principal
14         */
15        private String hashValue;
16        /** Contructor of PublicKeyPrincipal */
17        public PublicKeyPrincipal(String hashValue)
18        {
19                this.hashValue = hashValue;
20        }
21        /* (non-Javadoc)
22         * @see java.lang.Object#equals(Object)
23         */
24        public boolean equals(Object principal)
25        {
26                if (!(principal instanceof PublicKeyPrincipal))
27                        return false;
28                return this.hashCode() == principal.hashCode();
29        }
30        /* (non-Javadoc)
31         * @see java.lang.Object#hashCode()
32         */
33        public int hashCode()
34        {
35                return hashValue.hashCode();
36        }
37   
38        /* (non-Javadoc)
39         * @see edu.stanford.rt.credential.PrincipalExpression#toString(String)
40         */
41    public String toString(String indent)
42    {
43        String thisIndent = indent + "  ";
44        return thisIndent + "PublicKeyPrincipal: " + hashValue;
45    }
46
47    /** pretty printing for debugging */
48    public String toString() { return hashValue; }
49}
Note: See TracBrowser for help on using the repository browser.