You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by "Joze Rihtarsic (Jira)" <ji...@apache.org> on 2023/10/18 08:07:00 UTC
[jira] [Commented] (SANTUARIO-511) Support for Key Agreement using ECDH-ES
[ https://issues.apache.org/jira/browse/SANTUARIO-511?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17776544#comment-17776544 ]
Joze Rihtarsic commented on SANTUARIO-511:
------------------------------------------
Hi All
I have prepared a PR [here|https://github.com/apache/santuario-xml-security-java/pull/223] for this feature.
The goal was to implement ECDH-ES for EC key types "secp256r1", "secp384r1", "secp521r1", and also for X(EC) keys: "x25519", "x448".
I also want it to work with java version, that is why the implementation is made for branch branch 2.3.x.
The current implementation work only with ConcatKDF function (parameters chould be used without padding). But I made the implementation in a way that it can be extended in the future also with PBKDF2.
The to verify correctness of the implementation the tests cases from the [w3c test cases from 1-6|https://www.w3.org/2008/xmlsec/Drafts/xmlenc-core-11/test-cases/#sec-KeyAgreement] are executed as unit tests in class [XMLEncryption11Test.java|https://github.com/apache/santuario-xml-security-java/pull/223/files#diff-61f31a887d04d10221519ae27b7c8e0e43202f6934c0e0e3043530fafbe40330]
I also want to bring the attention to "originator keys" serialization. For the EC key types the {color:#871094}dsig11{color}{color:#0033b3}:ECKeyValue {color}is used. But for XEC key I used {color:#871094}dsig11{color}{color:#0033b3}:DEREncodedKeyValue
{color}because the [W3C documentation|{color:#000000}{color:#000000}{color:#000000}{color:#000000}[https://www.w3.org/TR/xmldsig-core2/]{color}{color}{color}{color}] does not specify how to serialize xec keys using {color:#871094}dsig11{color}{color:#0033b3}:ECKeyValue {color}
> Support for Key Agreement using ECDH-ES
> ---------------------------------------
>
> Key: SANTUARIO-511
> URL: https://issues.apache.org/jira/browse/SANTUARIO-511
> Project: Santuario
> Issue Type: New Feature
> Reporter: Cosmin Baciu
> Priority: Major
>
> Hi,
> We are using CXF 3.2.6 and WS-Security for encryption.
> We would like to use ECDH-ES for the Key Agreement. We did an investigation to check if CXF/WSS4J supports it and the result was negative. We could only find references to ECDH in the Jose modue.
> Would it be possible to confirm the result of our investigation?
> If indeed it's not yet supported would it be possible to give us some hints how to support it?
> Please find below an example of the <ds:KeyInfo> section(extracted from [https://www.w3.org/TR/xmlenc-core1/#sec-ECDH-ES]) using ECDH-ES for the Key Agreement.
>
> {code:java}
> <ds:KeyInfo>
> <xenc:EncryptedKey>
> <xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#kw-aes128"/>
> <!-- describes the key encryption key -->
> <ds:KeyInfo>
> <xenc:AgreementMethod Algorithm="http://www.w3.org/2009/xmlenc11#ECDH-ES">
> <xenc11:KeyDerivationMethod Algorithm="http://www.w3.org/2009/xmlenc11#ConcatKDF">
> <xenc11:ConcatKDFParams AlgorithmID="00" PartyUInfo="" PartyVInfo="">
> <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
> </xenc11:ConcatKDFParams>
> </xenc11:KeyDerivationMethod>
> <xenc:OriginatorKeyInfo>
> <ds:KeyValue>
> <dsig11:ECKeyValue>
> <!-- ephemeral ECC public key of the originator -->
> </dsig11:ECKeyValue>
> </ds:KeyValue>
> </xenc:OriginatorKeyInfo>
> <xenc:RecipientKeyInfo>
> <ds:X509Data>
> <ds:X509SKI></ds:X509SKI>
> <!-- hint for the recipient's private key -->
> </ds:X509Data>
> </xenc:RecipientKeyInfo>
> </xenc:AgreementMethod>
> </ds:KeyInfo>
> <xenc:CipherData>
> <xenc:CipherValue><!-- encrypted AES content encryption key --></xenc:CipherValue>
> </xenc:CipherData>
> </xenc:EncryptedKey>
> </ds:KeyInfo>{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)