Module org.apache.santuario.xmlsec
Class AgreementMethodImpl
- java.lang.Object
-
- org.apache.xml.security.utils.ElementProxy
-
- org.apache.xml.security.utils.EncryptionElementProxy
-
- org.apache.xml.security.encryption.keys.content.AgreementMethodImpl
-
- All Implemented Interfaces:
AgreementMethod,KeyInfoContent
public class AgreementMethodImpl extends EncryptionElementProxy implements KeyInfoContent, AgreementMethod
The implementation of the AgreementMethod interface. The element contains a information about the key agreement algorithm for deriving the encryption key.
-
-
Field Summary
Fields Modifier and Type Field Description protected static System.LoggerLOG-
Fields inherited from class org.apache.xml.security.utils.ElementProxy
baseURI
-
-
Constructor Summary
Constructors Constructor Description AgreementMethodImpl(Document doc, String algorithm)Constructor AgreementMethodImpl for generating AgreementMethod from scratch based on algorithm URI.AgreementMethodImpl(Document doc, KeyAgreementParameters keyAgreementParameter)Constructor AgreementMethodImpl for generating AgreementMethod from scratch based onKeyAgreementParameters.AgreementMethodImpl(Element element)Constructor AgreementMethodImpl based on XMLElement.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAgreementMethodInformation(Element info)Adds additionalAgreementMethodinformation.Iterator<Element>getAgreementMethodInformation()Returns additional information regarding theAgreementMethod.StringgetAlgorithm()Returns the algorithm URI of thisCryptographicMethod.StringgetBaseLocalName()Returns the localname of the Elements of the sub-class.byte[]getKANonce()Returns abytearray.KeyDerivationMethodgetKeyDerivationMethod()Returns KeyDerivationMethod information used in theAgreementMethod.OriginatorKeyInfogetOriginatorKeyInfo()Returns information relating to the originator's shared secret.RecipientKeyInfogetRecipientKeyInfo()Returns information relating to the recipient's shared secret.voidremoveAgreementMethodInformation(Element info)Removes additionalAgreementMethodinformation.voidsetKANonce(byte[] kanonce)Sets the KANonce.jjvoidsetKeyDerivationMethod(KeyDerivationMethod keyDerivationMethod)This method is used to set theKeyDerivationMethodwhen theAgreementMethodis being used to derive a key.voidsetOriginatorKeyInfo(OriginatorKeyInfo keyInfo)Sets the information relating to the originator's shared secret.voidsetOriginatorPublicKey(PublicKey publicKey)Sets the originator's PublicKey to generate the secretvoidsetRecipientKeyInfo(RecipientKeyInfo keyInfo)Sets the information relating to the recipient's shared secret.-
Methods inherited from class org.apache.xml.security.utils.EncryptionElementProxy
getBaseNamespace
-
Methods inherited from class org.apache.xml.security.utils.ElementProxy
addBase64Element, addBase64Text, addBigIntegerElement, addReturnToSelf, addText, addTextElement, appendOther, appendSelf, appendSelf, createElementForFamily, createElementForFamilyLocal, createText, getBaseURI, getBigIntegerFromChildElement, getBytesFromTextChild, getDefaultPrefix, getDocument, getElement, getElementPlusReturns, getFirstChild, getLocalAttribute, getTextFromChildElement, getTextFromTextChild, length, registerDefaultPrefixes, setDefaultPrefix, setDocument, setElement, setElement, setLocalAttribute, setLocalIdAttribute, setXPathNamespaceContext
-
-
-
-
Field Detail
-
LOG
protected static final System.Logger LOG
-
-
Constructor Detail
-
AgreementMethodImpl
public AgreementMethodImpl(Document doc, KeyAgreementParameters keyAgreementParameter) throws XMLEncryptionException
Constructor AgreementMethodImpl for generating AgreementMethod from scratch based onKeyAgreementParameters. The constructor generatesKeyDerivationMethodif given andOriginatorKeyInfobased on originator public key for ECDH-ES key agreement. It generates a placeholder element for RecipientKeyInfo. The recipient key info value must be set later.- Parameters:
doc- theDocumentin whichAgreementMethodwill be placedkeyAgreementParameter- theKeyAgreementParametersfrom whichAgreementMethodwill be generated- Throws:
XMLEncryptionException- if the Key derivation algorithm is not supported or invalid parameters are given.
-
AgreementMethodImpl
public AgreementMethodImpl(Document doc, String algorithm)
Constructor AgreementMethodImpl for generating AgreementMethod from scratch based on algorithm URI. The constructor builds a placeholder element forKeyDerivationMethod,OriginatorKeyInfoandRecipientKeyInfo. The values for these elements must be set later.- Parameters:
algorithm- the algorithm URI for the key agreement algorithm
-
AgreementMethodImpl
public AgreementMethodImpl(Element element) throws XMLSecurityException
Constructor AgreementMethodImpl based on XMLElement.- Parameters:
element- the XMLElementcontaining AgreementMethod information- Throws:
XMLSecurityException- if the AgreementMethod element has invalid XML structure
-
-
Method Detail
-
getKANonce
public byte[] getKANonce()
Returns abytearray.- Specified by:
getKANoncein interfaceAgreementMethod- Returns:
- a
bytearray.
-
setKANonce
public void setKANonce(byte[] kanonce)
Sets the KANonce.jj- Specified by:
setKANoncein interfaceAgreementMethod
-
getAgreementMethodInformation
public Iterator<Element> getAgreementMethodInformation()
Returns additional information regarding theAgreementMethod.- Specified by:
getAgreementMethodInformationin interfaceAgreementMethod- Returns:
- additional information regarding the
AgreementMethod.
-
addAgreementMethodInformation
public void addAgreementMethodInformation(Element info)
Adds additionalAgreementMethodinformation.- Specified by:
addAgreementMethodInformationin interfaceAgreementMethod- Parameters:
info- aElementthat represents additional information specified by
-
removeAgreementMethodInformation
public void removeAgreementMethodInformation(Element info)
Removes additionalAgreementMethodinformation.- Specified by:
removeAgreementMethodInformationin interfaceAgreementMethod- Parameters:
info- aElementthat represents additional information specified by
-
getKeyDerivationMethod
public KeyDerivationMethod getKeyDerivationMethod() throws XMLSecurityException
Returns KeyDerivationMethod information used in theAgreementMethod.- Specified by:
getKeyDerivationMethodin interfaceAgreementMethod- Returns:
- The KeyDerivationMethod information regarding the
AgreementMethod. - Throws:
XMLSecurityException
-
setKeyDerivationMethod
public void setKeyDerivationMethod(KeyDerivationMethod keyDerivationMethod)
This method is used to set theKeyDerivationMethodwhen theAgreementMethodis being used to derive a key. TheKeyDerivationMethodis declared asbut is used in ECDH_ES - Specified by:
setKeyDerivationMethodin interfaceAgreementMethod
-
getOriginatorKeyInfo
public OriginatorKeyInfo getOriginatorKeyInfo() throws XMLSecurityException
Returns information relating to the originator's shared secret.- Specified by:
getOriginatorKeyInfoin interfaceAgreementMethod- Returns:
- information relating to the originator's shared secret.
- Throws:
XMLSecurityException
-
setOriginatorKeyInfo
public void setOriginatorKeyInfo(OriginatorKeyInfo keyInfo)
Sets the information relating to the originator's shared secret.- Specified by:
setOriginatorKeyInfoin interfaceAgreementMethod- Parameters:
keyInfo- information relating to the originator's shared secret.
-
setOriginatorPublicKey
public void setOriginatorPublicKey(PublicKey publicKey)
Sets the originator's PublicKey to generate the secret- Specified by:
setOriginatorPublicKeyin interfaceAgreementMethod- Parameters:
publicKey- originator's PublicKey
-
getRecipientKeyInfo
public RecipientKeyInfo getRecipientKeyInfo() throws XMLSecurityException
Returns information relating to the recipient's shared secret.- Specified by:
getRecipientKeyInfoin interfaceAgreementMethod- Returns:
- information relating to the recipient's shared secret.
- Throws:
XMLSecurityException
-
setRecipientKeyInfo
public void setRecipientKeyInfo(RecipientKeyInfo keyInfo)
Sets the information relating to the recipient's shared secret.- Specified by:
setRecipientKeyInfoin interfaceAgreementMethod- Parameters:
keyInfo- information relating to the recipient's shared secret.
-
getAlgorithm
public String getAlgorithm()
Returns the algorithm URI of thisCryptographicMethod.- Specified by:
getAlgorithmin interfaceAgreementMethod- Returns:
- the algorithm URI of this
CryptographicMethod
-
getBaseLocalName
public String getBaseLocalName()
Description copied from class:ElementProxyReturns the localname of the Elements of the sub-class.- Specified by:
getBaseLocalNamein classElementProxy- Returns:
- the localname of the Elements of the sub-class.
-
-