Skip to content

Commit

Permalink
fix: Fix for DDCCGW-593 AND DDCCGW-667 (#40)
Browse files Browse the repository at this point in the history
* commit: Fix for DDCCGW-593 AND DDCCGW-667

Signed-off-by: dattatrayamote <[email protected]>

* commit: Fixed intendation

Signed-off-by: dattatrayamote <[email protected]>

* commit: Fixed testcases

Signed-off-by: dattatrayamote <[email protected]>

* chore: withoutPadding, fixed tests

---------

Signed-off-by: dattatrayamote <[email protected]>
Co-authored-by: Andreas Scheibal <[email protected]>
  • Loading branch information
dattatrayamote and ascheibal authored Jul 25, 2024
1 parent b506df8 commit 25cadb9
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 86 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,9 @@ private String generateTrustList(DidSpecification specification, boolean onlyRef

// Add Trusted Issuer (DID References)
// TODO: Add filtering for TrustedIssuers
trustedIssuerEntities.forEach(did -> trustList.getVerificationMethod().add(did.getUrl()));
if (onlyReferences) {
trustedIssuerEntities.forEach(did -> trustList.getVerificationMethod().add(did.getUrl()));
}

// Sign Document
JsonWebSignature2020LdSigner signer = new JsonWebSignature2020LdSigner(byteSigner);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ public static class EcPublicKeyJwk extends PublicKeyJwk {
*/
public EcPublicKeyJwk(ECPublicKey ecPublicKey, List<String> base64EncodedCertificates) {
super("EC", base64EncodedCertificates);
valueX = Base64.getUrlEncoder().encodeToString(ecPublicKey.getW().getAffineX().toByteArray());
valueY = Base64.getUrlEncoder().encodeToString(ecPublicKey.getW().getAffineY().toByteArray());
valueX = Base64.getUrlEncoder().withoutPadding()
.encodeToString(ecPublicKey.getW().getAffineX().toByteArray());
valueY = Base64.getUrlEncoder().withoutPadding()
.encodeToString(ecPublicKey.getW().getAffineY().toByteArray());

ECNamedCurveSpec curveSpec = (ECNamedCurveSpec) ecPublicKey.getParams();
switch (curveSpec.getName()) {
Expand Down Expand Up @@ -118,7 +120,8 @@ public static class RsaPublicKeyJwk extends PublicKeyJwk {
*/
public RsaPublicKeyJwk(RSAPublicKey rsaPublicKey, List<String> base64EncodedCertificates) {
super("RSA", base64EncodedCertificates);
valueN = Base64.getUrlEncoder().encodeToString(rsaPublicKey.getModulus().toByteArray());
valueN = Base64.getUrlEncoder().withoutPadding()
.encodeToString(rsaPublicKey.getModulus().toByteArray());
valueE = Base64.getUrlEncoder().encodeToString(rsaPublicKey.getPublicExponent().toByteArray());
}
}
Expand Down
Loading

0 comments on commit 25cadb9

Please sign in to comment.