version-1.30
Last change
on this file since 7321a43 was
8780cbec,
checked in by Jay Jacobs <Jay.Jacobs@…>, 15 years ago
|
ABAC sources from Cobham
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[8780cbec] | 1 | /* |
---|
| 2 | * Entity.java |
---|
| 3 | */ |
---|
| 4 | |
---|
| 5 | package edu.stanford.peer.rbtm.credential; |
---|
| 6 | |
---|
| 7 | import java.io.*; |
---|
| 8 | //import java.security.*; |
---|
| 9 | |
---|
| 10 | /** |
---|
| 11 | * An object of the Entity class represents an entity (or a principal) in RBTM. |
---|
| 12 | */ |
---|
| 13 | public class SimpleEntity implements Entity |
---|
| 14 | { |
---|
| 15 | private String _name; |
---|
| 16 | |
---|
| 17 | public SimpleEntity(String n) |
---|
| 18 | { |
---|
| 19 | _name = n; |
---|
| 20 | /* |
---|
| 21 | // code to gegerate public key |
---|
| 22 | KeyPairGenerator keyGen = KeyPairGenerator.getInstance("DSA", "SUN"); |
---|
| 23 | SecureRandom random = SecureRandom.getInstance("SHA1PRNG", "SUN"); |
---|
| 24 | |
---|
| 25 | keyGen.initialize(1024, random); |
---|
| 26 | |
---|
| 27 | KeyPair pair = keyGen.generateKeyPair(); |
---|
| 28 | PrivateKey priv = pair.getPrivate(); |
---|
| 29 | PublicKey pub = pair.getPublic(); |
---|
| 30 | */ |
---|
| 31 | } |
---|
| 32 | |
---|
| 33 | public String getName() { return _name; } |
---|
| 34 | |
---|
| 35 | public String toString() { return _name; } |
---|
| 36 | |
---|
| 37 | public int hashCode() { return _name.hashCode(); } |
---|
| 38 | |
---|
| 39 | public boolean equals(Object o) { |
---|
| 40 | return ((o instanceof SimpleEntity) |
---|
| 41 | && _name.equals(((SimpleEntity)o)._name)); |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | public int compareTo(Object o) { |
---|
| 45 | return _name.compareTo(((SimpleEntity)o)._name); |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | //public java.security.PublicKey getPublicKey() { return null; } |
---|
| 49 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.