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 information about
the key agreement algorithm for deriving the encryption key.
-
Field Summary
FieldsFields inherited from class org.apache.xml.security.utils.ElementProxy
baseURI -
Constructor Summary
ConstructorsConstructorDescriptionAgreementMethodImpl(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
Modifier and TypeMethodDescriptionvoidAdds additionalAgreementMethodinformation.Returns additional information regarding theAgreementMethod.Returns the algorithm URI of thisCryptographicMethod.Returns the localname of the Elements of the sub-class.byte[]Returns abytearray.Returns KeyDerivationMethod information used in theAgreementMethod.Returns information relating to the originator's shared secret.Returns information relating to the recipient's shared secret.voidRemoves 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
getBaseNamespaceMethods 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 Details
-
LOG
-
-
Constructor Details
-
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
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
Constructor AgreementMethodImpl based on XMLElement.- Parameters:
element- the XMLElementcontaining AgreementMethod information- Throws:
XMLSecurityException- if the AgreementMethod element has invalid XML structure
-
-
Method Details
-
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- Parameters:
kanonce-
-
getAgreementMethodInformation
Returns additional information regarding theAgreementMethod.- Specified by:
getAgreementMethodInformationin interfaceAgreementMethod- Returns:
- additional information regarding the
AgreementMethod.
-
addAgreementMethodInformation
Adds additionalAgreementMethodinformation.- Specified by:
addAgreementMethodInformationin interfaceAgreementMethod- Parameters:
info- aElementthat represents additional information specified by
-
removeAgreementMethodInformation
Removes additionalAgreementMethodinformation.- Specified by:
removeAgreementMethodInformationin interfaceAgreementMethod- Parameters:
info- aElementthat represents additional information specified by
-
getKeyDerivationMethod
Returns KeyDerivationMethod information used in theAgreementMethod.- Specified by:
getKeyDerivationMethodin interfaceAgreementMethod- Returns:
- The KeyDerivationMethod information regarding the
AgreementMethod. - Throws:
XMLSecurityException
-
setKeyDerivationMethod
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- Parameters:
keyDerivationMethod-
-
getOriginatorKeyInfo
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
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
Sets the originator's PublicKey to generate the secret- Specified by:
setOriginatorPublicKeyin interfaceAgreementMethod- Parameters:
publicKey- originator's PublicKey
-
getRecipientKeyInfo
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
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
Returns the algorithm URI of thisCryptographicMethod.- Specified by:
getAlgorithmin interfaceAgreementMethod- Returns:
- the algorithm URI of this
CryptographicMethod
-
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.
-