public class SignatureAlgorithmImplECDSA extends SignatureAlgorithm
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
DEFAULT_ALGORITHM_URI_
The default algorithm URI for this algorithm implementation.
|
protected java.lang.String |
ECDSA_JCA_ALGID_
The identifier used for the ECDSA algorithm within the Java Cryptography Architecture.
|
protected java.security.interfaces.ECPublicKey |
publicKey_
The public key used to verify the signature.
|
input_, jCEProviderName_, privateKey_| Constructor and Description |
|---|
SignatureAlgorithmImplECDSA()
Standard constructor.
|
SignatureAlgorithmImplECDSA(java.lang.String URI,
java.lang.String EcDsaAlg)
Constructor that allows specific ECDSA algorithms to be defined.
|
| Modifier and Type | Method and Description |
|---|---|
void |
setSignerKey(java.security.interfaces.ECPrivateKey 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 java.lang.String DEFAULT_ALGORITHM_URI_
protected java.lang.String ECDSA_JCA_ALGID_
protected java.security.interfaces.ECPublicKey publicKey_
public SignatureAlgorithmImplECDSA()
http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha256.public SignatureAlgorithmImplECDSA(java.lang.String URI,
java.lang.String EcDsaAlg)
For example, the default constructor uses ECDSA-SHA256
URI: http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha256 JCE AlgID: SHA/ECDSANote: This constructor does not take any parameters, so only ECDSA based algorithms that do not require parameters may be used
URI - The URI to use for the specified signature algorithmEcDsaAlg - The ECDSA JCA/JCE algorithm String which identifies the algorithm to usepublic 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 verifying
the signature fails for any reason.public void setSignerKey(java.security.interfaces.ECPrivateKey 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 ECPublicKey and must not be null.AlgorithmException - if the specified key is not an instance of ECPublicKey.public boolean verifierKeyUnknown()
setVerifierKey(java.security.Key) or not.verifierKeyUnknown in class SignatureAlgorithmtrue, if this signature algorithm does not know about the verification key.