iaik.me.security.dsa
Class DSASignature
java.lang.Object
|
+--iaik.me.security.Signature
|
+--iaik.me.security.dsa.DSASignature
- public class DSASignature
- extends Signature
Method Summary |
void |
initSign(PrivateKey privateKey,
SecureRandom random)
Initializes the signature instance for signing with a private key and a random number generator. |
void |
initVerify(PublicKey publicKey)
Initializes the signature instance for verifiying a signature. |
byte[] |
sign()
Creates a signature with the given data and private key. |
void |
update(byte[] input,
int offset,
int len)
Updates the signature instance with the data that shall be signed or the data whose signature shall be verified.
|
boolean |
verify(byte[] signature)
This method verifies a given signature.
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DSASignature
public DSASignature()
throws CryptoException
initSign
public void initSign(PrivateKey privateKey,
SecureRandom random)
throws CryptoException
- Description copied from class:
Signature
- Initializes the signature instance for signing with a private key and a random number generator.
- Overrides:
initSign
in class Signature
- Following copied from class:
iaik.me.security.Signature
- Parameters:
privateKey
- the signer's private keyrandom
- optional if you want to use your own random number generator (if not, set this value to null).- Throws:
CryptoException
-
initVerify
public void initVerify(PublicKey publicKey)
throws CryptoException
- Description copied from class:
Signature
- Initializes the signature instance for verifiying a signature.
- Overrides:
initVerify
in class Signature
- Following copied from class:
iaik.me.security.Signature
- Parameters:
publicKey
- the signer's public key- Throws:
CryptoException
-
update
public void update(byte[] input,
int offset,
int len)
throws CryptoException
- Description copied from class:
Signature
- Updates the signature instance with the data that shall be signed or the data whose signature shall be verified.
Use this method in case you don't want the whole byte array as input.
- Overrides:
update
in class Signature
- Following copied from class:
iaik.me.security.Signature
- Parameters:
input
- the input dataoffset
- starting index in the byte arraylen
- number of bytes to use as input beginnig from the starting index- Throws:
CryptoException
-
verify
public boolean verify(byte[] signature)
throws CryptoException
- Description copied from class:
Signature
- This method verifies a given signature.
After initializing the signature instance do this:
byte[] signature = rsa.sign();
to get the signature value.
- Overrides:
verify
in class Signature
- Following copied from class:
iaik.me.security.Signature
- Parameters:
signature
- the signature to be verified- Returns:
- true if the signature could be successfully verified.
- Throws:
CryptoException
-
sign
public byte[] sign()
throws CryptoException
- Description copied from class:
Signature
- Creates a signature with the given data and private key.
- Overrides:
sign
in class Signature
- Following copied from class:
iaik.me.security.Signature
- Returns:
- the signature as byte array
- Throws:
CryptoException
-
IAIK-JCE ME 3.04, (c) 2002 IAIK, (c) 2003 to 2006 Stiftung SIC