org.neuclear.commons.crypto.signers
Class SQLSigner

java.lang.Object
  extended by org.neuclear.commons.crypto.signers.SQLSigner
All Implemented Interfaces:
BrowsableSigner, PublicKeySource, Signer

public class SQLSigner
extends java.lang.Object
implements BrowsableSigner

Author:
DESHAH

To change the template for this generated type comment go to Window>Preferences>Java>Code Generation>Code and Comments


Field Summary
(package private)  SQLStoreAccess access
           
(package private)  PassPhraseAgent agent
           
 
Fields inherited from interface org.neuclear.commons.crypto.signers.Signer
KEY_DSA, KEY_NONE, KEY_OTHER, KEY_RSA
 
Constructor Summary
SQLSigner()
           
SQLSigner(java.lang.String passphrase)
           
 
Method Summary
 boolean canSignFor(java.lang.String name)
          Returns true if the Signer contains a signer for the given name
 void createKeyPair(java.lang.String alias, char[] passphrase)
           
 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.
 int getKeyType(java.lang.String name)
          Checks the key type of the given alias
 java.security.PublicKey getPublicKey(java.lang.String name)
           
 java.util.Iterator iterator()
           
static void main(java.lang.String[] args)
           
 void save()
           
 byte[] sign(byte[] data, SetPublicKeyCallBack callback)
           
 byte[] sign(java.lang.String name, byte[] data)
          Signs the data with the privatekey of the given name
 byte[] sign(java.lang.String name, byte[] data, boolean incorrect)
           
 byte[] sign(java.lang.String alias, char[] passphrase, byte[] data, SetPublicKeyCallBack callback)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

access

SQLStoreAccess access

agent

PassPhraseAgent agent
Constructor Detail

SQLSigner

public SQLSigner(java.lang.String passphrase)

SQLSigner

public SQLSigner()
Method Detail

iterator

public java.util.Iterator iterator()
                            throws java.security.KeyStoreException
Specified by:
iterator in interface BrowsableSigner
Throws:
java.security.KeyStoreException

sign

public byte[] sign(byte[] data,
                   SetPublicKeyCallBack callback)
            throws UserCancellationException
Specified by:
sign in interface BrowsableSigner
Throws:
UserCancellationException

sign

public byte[] sign(java.lang.String alias,
                   char[] passphrase,
                   byte[] data,
                   SetPublicKeyCallBack callback)
            throws InvalidPassphraseException
Specified by:
sign in interface BrowsableSigner
Throws:
InvalidPassphraseException

createKeyPair

public void createKeyPair(java.lang.String alias,
                          char[] passphrase)
                   throws CryptoException
Specified by:
createKeyPair in interface BrowsableSigner
Throws:
CryptoException

sign

public byte[] sign(java.lang.String name,
                   byte[] data)
            throws UserCancellationException,
                   NonExistingSignerException
Description copied from interface: Signer
Signs the data with the privatekey of the given name

Specified by:
sign in interface Signer
Parameters:
name - Alias of private key to be used within KeyStore
data - Data to be signed
Returns:
The signature
Throws:
UserCancellationException
NonExistingSignerException

sign

public final byte[] sign(java.lang.String name,
                         byte[] data,
                         boolean incorrect)
                  throws UserCancellationException,
                         NonExistingSignerException
Throws:
UserCancellationException
NonExistingSignerException

canSignFor

public boolean canSignFor(java.lang.String name)
Description copied from interface: Signer
Returns true if the Signer contains a signer for the given name

Specified by:
canSignFor in interface Signer
Returns:
true if signer is contained

getKeyType

public int getKeyType(java.lang.String name)
Description copied from interface: Signer
Checks the key type of the given alias

Specified by:
getKeyType in interface Signer
Returns:
KEY_NONE,KEY_RSA,KEY_DSA

generateKey

public java.security.PublicKey generateKey(java.lang.String alias)
                                    throws UserCancellationException
Description copied from interface: Signer
Creates a new KeyPair, stores the PrivateKey using the given alias and returns the PublicKey.

Specified by:
generateKey in interface Signer
Returns:
Generated PublicKey
Throws:
UserCancellationException

generateKey

public java.security.PublicKey generateKey()
                                    throws UserCancellationException
Description copied from interface: Signer
Creates a new KeyPair, stores the PrivateKey using the base32 sha1 of the public key as it's alias and returns the PublicKey.

Specified by:
generateKey in interface Signer
Returns:
Generated PublicKey
Throws:
UserCancellationException

save

public void save()
          throws UserCancellationException
Specified by:
save in interface Signer
Throws:
UserCancellationException

getPublicKey

public java.security.PublicKey getPublicKey(java.lang.String name)
                                     throws NonExistingSignerException
Specified by:
getPublicKey in interface PublicKeySource
Throws:
NonExistingSignerException

main

public static void main(java.lang.String[] args)


Copyright © 2003-2004 Antilles Software Ventures SA. All Rights Reserved.