public class DataSigner extends Object
| Constructor and Description |
|---|
DataSigner()
Constructor.
|
DataSigner(KeyPair keyPair)
Constructor from key pair.
|
DataSigner(PrivateKey privateKey)
Constructor from private key.
|
DataSigner(PrivateKey privateKey,
PublicKey publicKey)
Constructor from key pair.
|
DataSigner(PublicKey publicKey)
Constructor from public key.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
getByteSignature(byte[] bytes)
Creates a signature for the given bytes.
|
byte[] |
getByteSignature(InputStream in)
Creates a signature for the given stream.
|
byte[] |
getByteSignature(Reader reader)
Creates a signature for the given stream.
|
byte[] |
getByteSignature(String str)
Creates a signature for the given string.
|
PrivateKey |
getPrivateKey()
Returns the privateKey.
|
PublicKey |
getPublicKey()
Returns the publicKey.
|
void |
setPrivateKey(PrivateKey privateKey)
Sets the privateKey.
|
void |
setPrivateKey(String privateKey)
Sets the privateKey.
|
void |
setPublicKey(PublicKey publicKey)
Sets the publicKey.
|
void |
setPublicKey(String publicKey)
Sets the publicKey.
|
String |
sign(byte[] bytes)
Creates a signature for the given bytes.
|
String |
sign(InputStream in)
Creates a signature for the given stream.
|
String |
sign(Reader reader)
Creates a signature for the given stream.
|
String |
sign(String str)
Creates a signature for the given string.
|
void |
update(Signature signature,
InputStream in)
Updates the DSA with the bytes from this stream.
|
protected void |
update(Signature signature,
Reader reader)
Updates the DSA with the bytes from this stream.
|
boolean |
verify(byte[] signature,
byte[] data)
Verifies the signature on the given bytes.
|
boolean |
verify(byte[] signature,
InputStream in)
Verifies the signature on the given stream.
|
boolean |
verify(byte[] signature,
Reader in)
Verifies the signature on the given stream.
|
boolean |
verify(String signature,
InputStream in)
Verifies the signature on the given stream.
|
boolean |
verify(String signature,
Reader in)
Verifies the signature on the given stream.
|
boolean |
verify(String signature,
String str)
Verifies the signature on the given string.
|
public DataSigner()
throws DecryptionException
DecryptionExceptionpublic DataSigner(KeyPair keyPair) throws DecryptionException
keyPair - the key pair to be usedDecryptionExceptionpublic DataSigner(PrivateKey privateKey, PublicKey publicKey) throws DecryptionException
privateKey - private keypublicKey - public keyDecryptionExceptionpublic DataSigner(PrivateKey privateKey) throws DecryptionException
privateKey - the private key to be usedDecryptionExceptionpublic DataSigner(PublicKey publicKey) throws DecryptionException
publicKey - the public key to be usedDecryptionExceptionpublic PrivateKey getPrivateKey()
public void setPrivateKey(PrivateKey privateKey)
privateKey - the privateKey to setpublic void setPrivateKey(String privateKey) throws SigningException
privateKey - the privateKey to setSigningExceptionpublic PublicKey getPublicKey()
public void setPublicKey(PublicKey publicKey)
publicKey - the publicKey to setpublic void setPublicKey(String publicKey) throws SigningException
publicKey - the publicKey to setSigningExceptionpublic String sign(Reader reader) throws SigningException
reader - stream to be signedSigningExceptionpublic byte[] getByteSignature(Reader reader) throws SigningException
reader - stream to be signedSigningExceptionpublic String sign(InputStream in) throws SigningException
in - stream to be signedSigningExceptionpublic byte[] getByteSignature(InputStream in) throws SigningException
in - stream to be signedSigningExceptionpublic void update(Signature signature, InputStream in) throws SigningException
signature - signaturein - input streamSigningException - when the stream cannot be signedprotected void update(Signature signature, Reader reader) throws SigningException
signature - signaturereader - reader for the input streamSigningException - when the signing process failspublic String sign(String str) throws SigningException
str - string to be signedSigningException - when the stream cannot be signedpublic byte[] getByteSignature(String str) throws SigningException
str - string to be signedSigningException - when the stream cannot be signedpublic String sign(byte[] bytes) throws SigningException
bytes - bytes to be signedSigningException - when the bytes cannot be signedpublic byte[] getByteSignature(byte[] bytes)
throws SigningException
bytes - bytes to be signedSigningException - when the bytes cannot be signedpublic boolean verify(String signature, InputStream in) throws SigningException
signature - signaturein - stream to be verifiedSigningException - when the signature cannot be verifiedpublic boolean verify(byte[] signature,
InputStream in)
throws SigningException
signature - signaturein - stream to be verifiedSigningException - when the signature cannot be verifiedpublic boolean verify(String signature, Reader in) throws SigningException
signature - signaturein - stream to be verifiedSigningException - when the signature cannot be verifiedpublic boolean verify(byte[] signature,
Reader in)
throws SigningException
signature - signaturein - stream to be verifiedSigningException - when the signature cannot be verifiedpublic boolean verify(String signature, String str) throws SigningException
signature - signaturestr - string to be verifiedSigningException - when the signature cannot be verifiedpublic boolean verify(byte[] signature,
byte[] data)
throws SigningException
signature - signaturedata - bytes to be verifiedSigningException - when the signature cannot be verifiedCopyright © 2014. All rights reserved.