Skip to content
This repository has been archived by the owner on Jan 20, 2025. It is now read-only.

Feature/support es256 k #274

Merged

Conversation

aleksandra-bel
Copy link
Contributor

This is implementation of Support ES256K/secp256k1
Closes: #266

Pre-review checks

Please ensure to do as many of the following checks as possible, before asking for committer review:

@aleksandra-bel aleksandra-bel force-pushed the feature/support-ES256K branch from 207f4fc to 9f50bc2 Compare March 15, 2024 11:24
} else {
JWSAlgorithm algorithm = JWSAlgorithm.ES256K;
JOSEObjectType type = JOSEObjectType.JWT;
JWSHeader header = new JWSHeader(algorithm, type, null, null, null, null, null, null, null, null, issuer, true, null, null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the JWSHeader.Builder as it is more expressive than the constructor.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the builder it looks much better, fixed 541a524

Copy link
Contributor

@borisrizov-zf borisrizov-zf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, will merge after manual tests pass.

@borisrizov-zf
Copy link
Contributor

@aleksandra-bel @andreibogus
Ok, I found something. We have to add the new key to the DID document.

Copy link
Contributor

@borisrizov-zf borisrizov-zf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update DID document, adding the newly issued key to the list of verificationMethod.

@andreibogus
Copy link
Contributor

added WalletKey for ES256K algorithm to DidDocument

Copy link
Contributor

@borisrizov-zf borisrizov-zf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok this time I think we're done 😆
Doing manual sweep and I'll merge when I'm done with that.

private JWKVerificationMethod getJwkVerificationMethod(ECKey ecKey, Did did) {
Map<String, Object> verificationMethodJson = new HashMap<>();
Map<String, String> publicKeyJwk = Map.of(JWK_KEK_TYPE, ecKey.getKeyType().toString(), JWK_CURVE,
ecKey.getCurve().getName(), JWK_X, ecKey.getX().toString());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing JWK_Y for EC key. EC keys have both "x" and "y" parameters in their JWK representation.

import org.eclipse.tractusx.ssi.lib.model.did.*;
import org.eclipse.tractusx.ssi.lib.model.did.Did;
import org.eclipse.tractusx.ssi.lib.model.did.DidDocument;
import org.eclipse.tractusx.ssi.lib.model.did.DidDocumentBuilder;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import.

import org.springframework.transaction.support.TransactionCallbackWithoutResult;
import org.springframework.transaction.support.TransactionTemplate;

import java.io.StringWriter;
import java.net.URI;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import

@borisrizov-zf
Copy link
Contributor

@andreibogus @aleksandra-bel some minor findings.

Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@borisrizov-zf borisrizov-zf merged commit 1b6b70b into eclipse-tractusx:develop Mar 21, 2024
8 checks passed
Copy link

🎉 This PR is included in version 0.5.0-develop.11 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Copy link

github-actions bot commented Jul 5, 2024

🎉 This issue has been resolved in version 0.5.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants