public class KeyProviderImplKeyValue extends java.lang.Object implements KeyProviderInterface
KeyProviderInterface for KeyValue key information hints. A KeyValue key
information hint contains the encoded public key fitting for the public key cryptography algorithm used
as the signature algorithm for the XML signature. Public keys for the RSA, DSA and EC algorithm are
supported by this implementation.| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
DSA_JCA_ALGID_
The identifier used for DSA keys within the Java Cryptography Architecture.
|
protected static java.lang.String |
EC_JCA_ALGID_
The identifier used for EC keys within the Java Cryptography Architecture.
|
protected static java.lang.String |
RSA_JCA_ALGID_
The identifier used for RSA keys within the Java Cryptography Architecture.
|
protected org.w3c.dom.Document |
signatureDOMDoc_
The DOM document bearing the XML signature.
|
protected java.security.Key |
verifierKey_
The key to be used for verification.
|
| Constructor and Description |
|---|
KeyProviderImplKeyValue()
This constructor will be used by the
KeyManagerImpl class in the verification use case. |
KeyProviderImplKeyValue(org.w3c.dom.Document signatureDOMDoc)
This constructor can be used by the application in the signature creation use case to create a new
instance of this key provider.
|
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.String |
bigInteger2Base64(java.math.BigInteger bigPositiveInt)
Gets the base64 encoded byte representation of a
BigInteger, excluding the sign bit. |
protected byte[] |
getBase64DecodedText(org.w3c.dom.Element parent)
Gets the base64 decoded bytes from the first DOM Text child of the specified DOM element.
|
protected org.w3c.dom.Element |
getChildElement(org.w3c.dom.Element parent,
java.lang.String localName)
Gets the child DOM element with the specified local name of the specified parent DOM element.
|
protected org.w3c.dom.Element |
getChildElement(org.w3c.dom.Element parent,
java.lang.String namespaceURI,
java.lang.String localName)
Gets the child DOM element with the specified name space and local name of the specified parent DOM element.
|
org.w3c.dom.Element[] |
getKeyInfoSubelements()
Produdes a single key information hint (KeyValue subelement) as representation of the verification key,
which has been set previously by the application.
|
java.security.Key |
getVerifierKey()
Provides the key to be used for verification.
|
void |
setKeyInfoSubelements(org.w3c.dom.Element[] keyValueSubelements)
Analyzes the first of the specified KeyInfo subelements of type KeyValue and tries to create either a
RSAPublicKey, DSAPublicKey or a ECPublicKey from that info. |
void |
setURIResolverParameters(URIResolverParameters params)
Sets the parameters to be used by the key provider when resolving URIs.
|
void |
setVerifierKey(java.security.Key verifierKey)
Can be used by the application in the signature creation use case, in order to provide the verification
key, for which a key information hint (KeyValue subelement of the KeyInfo element) should be
incorporated into the XML signature.
|
protected static final java.lang.String DSA_JCA_ALGID_
protected static final java.lang.String RSA_JCA_ALGID_
protected static final java.lang.String EC_JCA_ALGID_
protected java.security.Key verifierKey_
protected org.w3c.dom.Document signatureDOMDoc_
getKeyInfoSubelements() to create DOM
nodes.public KeyProviderImplKeyValue()
KeyManagerImpl class in the verification use case.public KeyProviderImplKeyValue(org.w3c.dom.Document signatureDOMDoc)
signatureDOMDoc - The DOM document bearing the XML signature. Used in method getKeyInfoSubelements() to create DOM nodes. Must not be null.public java.security.Key getVerifierKey()
throws KeyProviderException
getVerifierKey in interface KeyProviderInterfaceKeyProviderException - if the verification key cannot be deduced from the key information
hint.public org.w3c.dom.Element[] getKeyInfoSubelements()
throws KeyProviderException
getKeyInfoSubelements in interface KeyProviderInterfaceKeyProviderException - if the wrong constructor has been used by the application, and therefore
no DOM Document has been specified.public void setURIResolverParameters(URIResolverParameters params)
setURIResolverParameters in interface KeyProviderInterfaceparams - The parameters to be set. May be null to indicate a restore of the default
values.public void setKeyInfoSubelements(org.w3c.dom.Element[] keyValueSubelements)
throws KeyProviderException
RSAPublicKey, DSAPublicKey or a ECPublicKey from that info. If more than one
KeyValue subelements have been specified, all but the first will be ignored.
If non of RSAPublicKey , DSAPublicKey or ECPublicKey can be created from the
first KeyValue element, this method will have no effect.
setKeyInfoSubelements in interface KeyProviderInterfacekeyValueSubelements - an array of KeyValue elements. The array must contain at least one entry.KeyProviderException - if neither a RSAPublicKey nor DSAPublicKey nore a
nor ECPublicKey can be deduced from the information given in the first element of the array.public void setVerifierKey(java.security.Key verifierKey)
verifierKey - The verification key. May be null. If not null, it must be
an instance of either RSAPublicKey or DSAPublicKey or ECPublicKey.protected java.lang.String bigInteger2Base64(java.math.BigInteger bigPositiveInt)
BigInteger, excluding the sign bit.bigPositiveInt - A positive BigInteger.BigInteger.protected org.w3c.dom.Element getChildElement(org.w3c.dom.Element parent,
java.lang.String localName)
throws KeyProviderException
parent - The parent DOM element.localName - The local tag name of the element, which must be in the XML Signature namespace.KeyProviderException - if the specified child DOM element cannot be found.protected org.w3c.dom.Element getChildElement(org.w3c.dom.Element parent,
java.lang.String namespaceURI,
java.lang.String localName)
throws KeyProviderException
parent - The parent DOM element.namespaceURI - The XML Signature namespace.localName - The local tag name of the element.KeyProviderException - if the specified child DOM element cannot be found.protected byte[] getBase64DecodedText(org.w3c.dom.Element parent)
throws KeyProviderException
parent - The DOM element containing the DOM Text child.KeyProviderException - if no Text child can be found, or if the content of the Text child
cannot be base64 decoded.