public abstract class Signer extends CryptoService
| Modifier and Type | Field and Description |
|---|---|
protected KeyRing |
keyring
The key ring (as a wrapper and helper to access the key store).
|
protected Provider |
provider
The security provider.
|
| Modifier | Constructor and Description |
|---|---|
protected |
Signer(String alias,
KeyRing keyring,
Provider provider)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected String |
getAlias()
Returns the alias of the certificate to be used for signing.
|
protected KeyRing |
getKeyRing()
Returns the key ring containing the signature key.
|
protected Provider |
getProvider()
Returns the security provider backing up the key store.
|
abstract void |
initialise()
Initialises the object.
|
boolean |
isEncapsulateData()
Returns whether the data is going to be encapsulated along with the signature.
|
abstract byte[] |
sign(byte[] data)
Signs the given set of data.
|
abstract boolean |
verify(byte[] signed)
Verifies the signature of the given set of encapsulated data.
|
abstract boolean |
verify(byte[] signed,
byte[] data)
Verifies the signature of the given set of detached data.
|
protected KeyRing keyring
protected Provider provider
protected Signer(String alias, KeyRing keyring, Provider provider) throws CryptoException
alias - the alias of the certificate to be used for signing.keyring - the key ring, as a wrapper and helper to acces the key store.provider - the security provider supporting and exposing the key store capabilities.CryptoException - if any of the input parameters is null.protected String getAlias()
protected KeyRing getKeyRing()
protected Provider getProvider()
public boolean isEncapsulateData()
public abstract void initialise()
throws CryptoException
CryptoException - if anything went wrong accessing, opening or interpreting the keystore.public abstract byte[] sign(byte[] data)
throws CryptoException
data - the data to be signed.CryptoExceptionpublic abstract boolean verify(byte[] signed)
throws CryptoException
signed - the encapsulated data.CryptoExceptionpublic abstract boolean verify(byte[] signed,
byte[] data)
throws CryptoException
signed - the detached data whose signature is to be verified.data - the original, plain text data.CryptoExceptionCopyright © 2012-2014 Andrea Funtò. See here for terms and conditions.