public class DigestAlgorithmImpl extends DigestAlgorithm
| 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 |
JCA_ALGID_
The identifier used for the SHA-1 algorithm within the
Java Cryptography
Architecture.
|
input_| Constructor and Description |
|---|
DigestAlgorithmImpl()
Standard constructor.
|
DigestAlgorithmImpl(java.lang.String DigestAlg)
Constructor that allows specific digest algorithms to be defined
by JCE Algorithm ID.
|
DigestAlgorithmImpl(java.lang.String URI,
java.lang.String DigestAlg)
Constructor that allows specific digest algorithms to be defined.
|
| Modifier and Type | Method and Description |
|---|---|
java.io.InputStream |
digest()
Computes the digest for the input data previously specified by means of method
DigestAlgorithm.setInput(java.io.InputStream). |
java.lang.String |
getUriByAlgID(java.lang.String DigestAlg)
Returns a digest algorithm URI string based on
|
org.w3c.dom.Element |
toElement(org.w3c.dom.Document signatureDOMDoc)
Returns the DOM element representation of the algorithm.
|
setInputgetURI, setParameters, setURIprotected java.lang.String DEFAULT_ALGORITHM_URI_
protected java.lang.String JCA_ALGID_
public DigestAlgorithmImpl()
http://www.w3.org/2000/09/xmldsig#sha1.public DigestAlgorithmImpl(java.lang.String URI,
java.lang.String DigestAlg)
For example, the default constructor uses SHA-1
URI: http://www.w3.org/2000/09/xmldsig#sha1 JCE AlgID: SHA-1Note: This constructor does not take any parameters, so only digest algorithms that do not require parameters may be used
URI - The URI to use for the specified digest algorithmDigestAlg - The JCA/JCE digest algorithm String which identifies the digest algorithmpublic DigestAlgorithmImpl(java.lang.String DigestAlg)
The following mappings are supported:
"SHA-1" , "http://www.w3.org/2000/09/xmldsig#sha1"
"SHA-224", "http://www.w3.org/2001/04/xmldsig-more#sha224"
"SHA-256", "http://www.w3.org/2001/04/xmlenc#sha256"
"SHA-384", "http://www.w3.org/2001/04/xmldsig-more#sha384"
"SHA-512", "http://www.w3.org/2001/04/xmlenc#sha512"
For example, the default constructor uses SHA-1
URI: http://www.w3.org/2000/09/xmldsig#sha1 JCE AlgID: SHA-1Note: This constructor does not take any parameters, so only digest algorithms that do not require parameters may be used
DigestAlg - The JCA/JCE digest algorithm String which identifies the digest algorithmpublic 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.AlgorithmException - if no identifying URI has been specified for this algorithm.public java.io.InputStream digest()
throws AlgorithmException
DigestAlgorithm.setInput(java.io.InputStream).digest in class DigestAlgorithmAlgorithmException - if no input has been specified for the digest algorithm, or if computing
the message digest fails for any reason.public java.lang.String getUriByAlgID(java.lang.String DigestAlg)
throws AlgorithmException
DigestAlg - the digest algorithm ID. For example "SHA-256"AlgorithmException - if the algorithm ID is invalid or does
not have an associated URI