|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.avis.security.Key
public final class Key
A key value used to secure notifications. A key is simply an immutable block of bytes.
Elvin defines two types of key, private (or raw)
keys, and public (or prime) keys. A public
key is a one-way hash (e.g. using SHA-1) of a private key. A
private key may be any random data, or simply a password. A private
key is defined to match a public key if the corresponding hash of
its data matches the public key's data, e.g. if
sha1 (privateKey.data) == publicKey.data.
Note that this is not a public key system in the RSA sense but that, like RSA, public keys can be shared in the open without loss of security.
This class precomputes a hash code for the key data to accelerate equals () and hashCode ().
| Field Summary | |
|---|---|
byte[] |
data
The key's data block. |
| Constructor Summary | |
|---|---|
Key(byte[] data)
Create a key from a block of data. |
|
Key(String password)
Create a key from a password by using the password's UTF-8 representation as the data block. |
|
| Method Summary | |
|---|---|
boolean |
equals(Key key)
|
boolean |
equals(Object object)
|
int |
hashCode()
|
Key |
publicKeyFor(KeyScheme scheme)
Shortcut to generate the public (prime) key for a given scheme. |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final byte[] data
| Constructor Detail |
|---|
public Key(String password)
public Key(byte[] data)
| Method Detail |
|---|
public Key publicKeyFor(KeyScheme scheme)
KeyScheme.publicKeyFor(Key)public boolean equals(Object object)
equals in class Objectpublic boolean equals(Key key)
public int hashCode()
hashCode in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||