org.neuclear.commons.crypto.signers
Interface Signer

All Known Subinterfaces:
BrowsableSigner
All Known Implementing Classes:
DefaultSigner, JCESigner, PersonalSigner, SimpleSigner, SQLSigner, TestCaseSigner

public interface Signer

The Signer follows the following model:

                                  (Optional)
                               +---------------+
                               |PassPhraseAgent|
                               +-------+-------+
                                       |PassPhrase
     +-------------------+         +---+----+
     |Signing Application|--Data-->| Signer |
     +--------+----------+         +---+----+
              +-<-----Signature--------+


Field Summary
static int KEY_DSA
           
static int KEY_NONE
           
static int KEY_OTHER
           
static int KEY_RSA
           
 
Method Summary
 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.
 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
 

Field Detail

KEY_NONE

static final int KEY_NONE
See Also:
Constant Field Values

KEY_RSA

static final int KEY_RSA
See Also:
Constant Field Values

KEY_DSA

static final int KEY_DSA
See Also:
Constant Field Values

KEY_OTHER

static final int KEY_OTHER
See Also:
Constant Field Values
Method Detail

sign

byte[] sign(java.lang.String name,
            byte[] data)
            throws UserCancellationException,
                   NonExistingSignerException
Signs the data with the privatekey of the given name

Parameters:
name - Alias of private key to be used within KeyStore
data - Data to be signed
Returns:
The signature
Throws:
UserCancellationException
NonExistingSignerException

canSignFor

boolean canSignFor(java.lang.String name)
Returns true if the Signer contains a signer for the given name

Parameters:
name -
Returns:
true if signer is contained

getKeyType

int getKeyType(java.lang.String name)
Checks the key type of the given alias

Parameters:
name -
Returns:
KEY_NONE,KEY_RSA,KEY_DSA

generateKey

java.security.PublicKey generateKey(java.lang.String alias)
                                    throws UserCancellationException
Creates a new KeyPair, stores the PrivateKey using the given alias and returns the PublicKey.

Parameters:
alias -
Returns:
Generated PublicKey
Throws:
UserCancellationException

generateKey

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

Returns:
Generated PublicKey
Throws:
UserCancellationException

save

void save()
          throws UserCancellationException
Throws:
UserCancellationException


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