|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.neuclear.commons.crypto.signers.SimpleSigner
public final class SimpleSigner
Simple memory based implementation of Signer. Currently it doesnt even use the passphrase. However it does do a SHA1 digest on the name first.
| Field Summary |
|---|
| Fields inherited from interface org.neuclear.commons.crypto.signers.Signer |
|---|
KEY_DSA, KEY_NONE, KEY_OTHER, KEY_RSA |
| Constructor Summary | |
|---|---|
SimpleSigner(java.lang.String file,
PassPhraseAgent agent)
|
|
| Method Summary | |
|---|---|
void |
addKey(java.lang.String name,
char[] passphrase,
java.security.PrivateKey key)
Adds the given key to the store. |
void |
addKey(java.lang.String name,
java.security.PrivateKey key)
Adds the given key to the store. |
boolean |
canSignFor(java.lang.String name)
Returns true if the Signer contains a signer for the given name |
java.security.PublicKey |
generateKey()
Creates a new KeyPair, stores the PrivateKey using the base32 sha1 of the public key as it's alias and returns the PublicKey. |
java.security.PublicKey |
generateKey(java.lang.String alias)
Creates a new KeyPair, stores the PrivateKey using the given alias and returns the PublicKey. |
protected static java.lang.String |
getDigestedName(java.lang.String name)
|
int |
getKeyType(java.lang.String name)
Checks the key type of the given alias |
void |
save()
|
byte[] |
sign(java.lang.String name,
byte[] data)
Signs the data with the privatekey of the given name |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleSigner(java.lang.String file,
PassPhraseAgent agent)
| Method Detail |
|---|
public final void addKey(java.lang.String name,
java.security.PrivateKey key)
throws UserCancellationException
name - The name to store it askey - The PrivateKey itself.
UserCancellationException
public final void addKey(java.lang.String name,
char[] passphrase,
java.security.PrivateKey key)
name - The name to store it aspassphrase - The passphrase to encrypt the keykey - The PrivateKey itself.public final boolean canSignFor(java.lang.String name)
Signer
canSignFor in interface Signerpublic final int getKeyType(java.lang.String name)
getKeyType in interface Signername -
protected static final java.lang.String getDigestedName(java.lang.String name)
public final void save()
save in interface Signer
public final byte[] sign(java.lang.String name,
byte[] data)
throws UserCancellationException
sign in interface Signername - Alias of private key to be used within KeyStoredata - Data to be signed
UserCancellationException
public final java.security.PublicKey generateKey(java.lang.String alias)
throws UserCancellationException
Signer
generateKey in interface SignerUserCancellationException
public java.security.PublicKey generateKey()
throws UserCancellationException
Signer
generateKey in interface SignerUserCancellationException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||