public class AgreementMethodImpl extends AlgorithmMethodImpl implements AgreementMethod
AgreementMethod element that supports
the DOM XML representation and processing mechanism.DOMStructure.NodeWrapper| Modifier and Type | Field and Description |
|---|---|
protected DigestMethodImpl |
digestMethod_
The
DigestMethod |
protected KANonceImpl |
kaNonce_
The
KA-Nonce. |
protected KeyInfoImpl |
originiatorKeyInfo_
The
OriginatorKeyInfo. |
protected KeyInfoImpl |
recipientKeyInfo_
The
RecipientKeyInfo. |
algorithm_, params_, spec_implMap_, state_, STATE_CREATED, STATE_MARSHALED, STATE_UNINITIALIZED, STATE_UNMARSHALEDDH| Constructor and Description |
|---|
AgreementMethodImpl(DOMCryptoContext context,
Node node)
Creates a new instance of this
AgreementMethodImpl with the
specified context and node to unmarshal from. |
AgreementMethodImpl(String algorithm,
byte[] kaNonce,
KeyInfoImpl originiatorKeyInfo,
KeyInfoImpl recipientKeyInfo,
AgreementMethodParameterSpec params)
Creates a new instance of this
AgreementMethodImpl with the
specified algorithm URI, agreement method parameters, originator KeyInfo,
recipient KeyInfo and KA-Nonce. |
| Modifier and Type | Method and Description |
|---|---|
protected byte[] |
generateAgreedSecret(PrivateKey privKey,
PublicKey pubKey,
String algorithm) |
SecretKey |
generateSecretKey(EncryptionMethod em,
PublicKey pubKey)
Generates a secret key of the type specified in
EncrpytionMethod |
protected void |
getAlgorithmInstanceUncaught(XSecProvider.Purpose purpose) |
protected List |
getChildStructures()
Returns the list of child structures of this
DOMStructure. |
byte[] |
getKANonce()
Returns a nonce that assures different key materials are generated.
|
String |
getLocalName()
Returns the local name of the represented XML element.
|
String |
getNamespace()
Returns the namespace URI of the represented XML element.
|
XMLStructure |
getOriginatorKeyInfo()
Returns key information from the originator used to determine the secret
key.
|
protected Class |
getParameterSpecClass() |
XMLStructure |
getRecipientKeyInfo()
Returns key information from the recipient used to determine the secret
key.
|
protected void |
putChildStructure(DOMStructure childStructure)
Put an unmarshalled child structure.
|
void |
setPrivateKey(PrivateKey key) |
protected void |
unmarshalStructures(NodeList nodes,
DOMCryptoContext context)
Unmarshals
DOMStructures from the given nodes. |
containsElements, getAlgorithm, getAlgorithmInstance, getParameterSpec, getParamInstanceUncaught, marshal, marshalAttributes, unmarshalAttributesaddBytesToElement, addBytesToElement, clearMarshalling, clearMarshalling, getBytesFromElement, getBytesFromElementStream, getChildStructureVersion, getHere, getImplClass, getInstance, getInstance, getNode, getParentStructure, getParentStructureOf, getQualifiedName, getQualifiedName, hasNSDeclAttrInScope, isFeatureSupported, isNSDeclInScope, marshalElement, marshalIDAttribute, newIDforLookUp, putImplClass, setBackToCompatibilityPrior1_14, setNode, setParentStructure, toString, unmarshal, unmarshalElement, unmarshalIDAttribute, wrapNodeclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetParameterSpecgetAlgorithmisFeatureSupportedprotected KeyInfoImpl originiatorKeyInfo_
OriginatorKeyInfo.protected KeyInfoImpl recipientKeyInfo_
RecipientKeyInfo.protected KANonceImpl kaNonce_
KA-Nonce.protected DigestMethodImpl digestMethod_
DigestMethodpublic AgreementMethodImpl(DOMCryptoContext context, Node node) throws MarshalException
AgreementMethodImpl with the
specified context and node to unmarshal from.context - the contextnode - the node to unmarshal fromMarshalException - if an exception occurs during unmarshalingpublic AgreementMethodImpl(String algorithm, byte[] kaNonce, KeyInfoImpl originiatorKeyInfo, KeyInfoImpl recipientKeyInfo, AgreementMethodParameterSpec params) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException
AgreementMethodImpl with the
specified algorithm URI, agreement method parameters, originator KeyInfo,
recipient KeyInfo and KA-Nonce.algorithm - the algorithm URI (must be RFC 2396 compliant)kaNonce - the KA-Nonce (may be null)originiatorKeyInfo - the originator KeyInfo (may be null)recipientKeyInfo - the recipient KeyInfo (may be null)params - the agreement method parameters (may be null)NullPointerException - if config or algorithm is
nullNoSuchAlgorithmException - if algorithm is not supportedInvalidAlgorithmParameterExceptionInvalidAlgorithmParameterException - if the given algorithm specific parameters are not appropriate for
the specified algorithmprotected void getAlgorithmInstanceUncaught(XSecProvider.Purpose purpose) throws NoSuchAlgorithmException
getAlgorithmInstanceUncaught in class AlgorithmMethodImplNoSuchAlgorithmExceptionpublic String getLocalName()
DOMStructuregetLocalName in class DOMStructureDOMStructure.getLocalName()public byte[] getKANonce()
javax.xml.crypto.enc.keyinfo.AgreementMethodgetKANonce in interface AgreementMethodnull if not specifiedAgreementMethod.getKANonce()public XMLStructure getOriginatorKeyInfo()
javax.xml.crypto.enc.keyinfo.AgreementMethodgetOriginatorKeyInfo in interface AgreementMethodnull if not specifiedAgreementMethod.getOriginatorKeyInfo()public XMLStructure getRecipientKeyInfo()
javax.xml.crypto.enc.keyinfo.AgreementMethodgetRecipientKeyInfo in interface AgreementMethodnull if not specifiedAgreementMethod.getRecipientKeyInfo()public String getNamespace()
DOMStructuregetNamespace in class DOMStructureDOMStructure.getNamespace()protected void unmarshalStructures(NodeList nodes, DOMCryptoContext context) throws MarshalException
DOMStructureDOMStructures from the given nodes.
This method is called by DOMStructure.unmarshal(DOMCryptoContext).
This method calls DOMStructure.getInstance(Node, DOMCryptoContext) for every
Element in the list of nodes. If
DOMStructure.getInstance(Node, DOMCryptoContext) returns a
DOMStructure DOMStructure.putChildStructure(DOMStructure) is
called with the returned DOMStructure as parameter.
unmarshalStructures in class AlgorithmMethodImplnodes - the nodes to unmarshal fromcontext - the marshal contextMarshalException - if an exception occurs during marshalingDOMStructure.unmarshalStructures(NodeList,
DOMCryptoContext)protected List getChildStructures()
DOMStructureDOMStructure.
This method is called by DOMStructure.marshal(DOMCryptoContext, Node, Node).
A subclass has to overwrite this method to return a list of
DOMStrucutres represented by this subclass.
getChildStructures in class DOMStructureDOMStructures (may be empty, but never
null)DOMStructure.getChildStructures()protected void putChildStructure(DOMStructure childStructure) throws MarshalException
DOMStructure
This method is called by
DOMStructure.unmarshalStructures(NodeList, DOMCryptoContext) for every
unmarshalled child structure.
A subclass has to overwrite this method to store the given child structure in its the corresponding field.
putChildStructure in class DOMStructurechildStructure - the unmarshalled child structureMarshalExceptionDOMStructure.putChildStructure(iaik.xml.crypto.dom.DOMStructure)public SecretKey generateSecretKey(EncryptionMethod em, PublicKey pubKey) throws XMLEncryptionException
EncrpytionMethodem - The EncryptionMethod, the generated key will be used
withpubKey - XMLEncryptionExceptionprotected byte[] generateAgreedSecret(PrivateKey privKey, PublicKey pubKey, String algorithm) throws XMLEncryptionException
XMLEncryptionExceptionpublic void setPrivateKey(PrivateKey key)
protected Class getParameterSpecClass()
getParameterSpecClass in class AlgorithmMethodImplClass of the concrete parameter spec to be returned by
AlgorithmMethodImpl.getParameterSpec().AlgorithmMethodImpl.getParameterSpecClass()© 2002-2005 IAIK, © 2004, 2006 - 2019 Stiftung SIC