public class SignatureAlgorithmImplDSA extends SignatureAlgorithm
| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
DEFAULT_ALGORITHM_URI_
The default algorithm URI for this algorithm implementation.
|
protected static java.lang.String |
DSA_JCA_ALGID_
The identifier used for the DSA algorithm within the Java Cryptography Architecture.
|
protected java.security.interfaces.DSAPublicKey |
publicKey_
The public key used to verify the signature.
|
input_, jCEProviderName_, privateKey_| Constructor and Description |
|---|
SignatureAlgorithmImplDSA()
Standard constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected byte[] |
removeSignumAndAlign20(byte[] signedInteger)
Receives the byte representation of a POSITIVE integer value as two's-complement representation.
|
void |
setSignerKey(java.security.interfaces.DSAPrivateKey signerKey)
Sets the private key, which is used to compute the signature for the algorithm's input.
|
void |
setVerifierKey(java.security.Key verifierKey)
Sets the public key, which is used to verify the signature for the algorithm's input.
|
java.io.InputStream |
sign()
Computes the signature value for the input previously provided by means of method
SignatureAlgorithm.setInput(java.io.InputStream). |
org.w3c.dom.Element |
toElement(org.w3c.dom.Document signatureDOMDoc)
Returns the DOM element representation of the algorithm.
|
boolean |
verifierKeyUnknown()
Gets the information, if this signature algorithm knows about the verification key.
|
boolean |
verify(java.io.InputStream signature)
Verifies the specified signature for the input data previously set with method
SignatureAlgorithm.setInput(java.io.InputStream). |
setInput, setJCEProviderName, setSignerKeygetURI, setParameters, setURIprotected static final java.lang.String DEFAULT_ALGORITHM_URI_
protected static final java.lang.String DSA_JCA_ALGID_
protected java.security.interfaces.DSAPublicKey publicKey_
public SignatureAlgorithmImplDSA()
http://www.w3.org/2000/09/xmldsig#dsa-sha1.public org.w3c.dom.Element toElement(org.w3c.dom.Document signatureDOMDoc)
throws AlgorithmException
toElement in class AlgorithmsignatureDOMDoc - The DOM document which should be used to create necessary DOM nodes. Must not
be null.AlgorithmException - if no identifying URI has been specified for this algorithm.public java.io.InputStream sign()
throws AlgorithmException
SignatureAlgorithm.setInput(java.io.InputStream).sign in class SignatureAlgorithmSignatureAlgorithm.setInput(java.io.InputStream). This value will NOT
be base64 encoded.AlgorithmException - if the signer key or the input data have not been set, or if computing
the signature value fails for any reason.public boolean verify(java.io.InputStream signature)
throws AlgorithmException
SignatureAlgorithm.setInput(java.io.InputStream).verify in class SignatureAlgorithmsignature - The bytes representing the signature to be verified. Must not be null.true, if the signature is valid, false otherwise.AlgorithmException - if the verifier key or the input data have not been set, or if the
signature does not consist of exactly 40 bytes, or if verifying the
signature fails for any reason.public void setSignerKey(java.security.interfaces.DSAPrivateKey signerKey)
signerKey - The private key for computing the signature. Must not be null.public void setVerifierKey(java.security.Key verifierKey)
throws AlgorithmException
setVerifierKey in class SignatureAlgorithmverifierKey - The public key for verifying the signature. Must be an instance of DSAPublicKey and must not be null.AlgorithmException - if the specified key is not an instance of DSAPublicKey.public boolean verifierKeyUnknown()
setVerifierKey(java.security.Key) or not.verifierKeyUnknown in class SignatureAlgorithmtrue, if this signature algorithm does not know about the verification key.protected byte[] removeSignumAndAlign20(byte[] signedInteger)
Please note:
signedInteger must not contain more than 21 bytes.signedInteger must not represent a negative integer.signedInteger - The two's-complement byte representation of a POSITIVE integer value.