From 2acda0174f24fbf17b6e2efd937997d9b0e72c8d Mon Sep 17 00:00:00 2001 From: Stefan Wiedemann Date: Thu, 14 Dec 2023 13:13:59 +0100 Subject: [PATCH] rename --- .../oidc4vp/OIDC4VPWellKnownProvider.java | 81 ++++++++----------- .../{sdjwt => sd_jwt_vc}/ArrayDigest.java | 2 +- .../ArrayDisclosureClaim.java | 4 +- .../{sdjwt => sd_jwt_vc}/ArrayElement.java | 4 +- .../{sdjwt => sd_jwt_vc}/DisclosureClaim.java | 4 +- .../model/{sdjwt => sd_jwt_vc}/SdClaim.java | 8 +- .../{sdjwt => sd_jwt_vc}/SdCredential.java | 2 +- .../oidc4vp/signing/JwtSigningService.java | 5 +- .../oidc4vp/signing/LDSigningService.java | 6 +- .../oidc4vp/signing/SdJwtSigningService.java | 3 +- .../EdDSASignatureSignerContext.java | 4 +- .../signing/signatures/SecuritySuite.java | 29 ------- .../Ed255192018Suite.java | 2 +- .../signing/{ => vcdm}/LDSignatureType.java | 2 +- .../RsaSignature2018Suite.java | 16 +--- .../oidc4vp/signing/vcdm/SecuritySuite.java | 15 ++++ .../oidc4vp/signing/LDSigningServiceTest.java | 7 +- 17 files changed, 68 insertions(+), 126 deletions(-) rename services/src/main/java/org/keycloak/protocol/oidc4vp/model/{sdjwt => sd_jwt_vc}/ArrayDigest.java (87%) rename services/src/main/java/org/keycloak/protocol/oidc4vp/model/{sdjwt => sd_jwt_vc}/ArrayDisclosureClaim.java (85%) rename services/src/main/java/org/keycloak/protocol/oidc4vp/model/{sdjwt => sd_jwt_vc}/ArrayElement.java (92%) rename services/src/main/java/org/keycloak/protocol/oidc4vp/model/{sdjwt => sd_jwt_vc}/DisclosureClaim.java (89%) rename services/src/main/java/org/keycloak/protocol/oidc4vp/model/{sdjwt => sd_jwt_vc}/SdClaim.java (76%) rename services/src/main/java/org/keycloak/protocol/oidc4vp/model/{sdjwt => sd_jwt_vc}/SdCredential.java (89%) rename services/src/main/java/org/keycloak/protocol/oidc4vp/signing/{signatures => jwt_vc}/EdDSASignatureSignerContext.java (87%) delete mode 100644 services/src/main/java/org/keycloak/protocol/oidc4vp/signing/signatures/SecuritySuite.java rename services/src/main/java/org/keycloak/protocol/oidc4vp/signing/{signatures => vcdm}/Ed255192018Suite.java (98%) rename services/src/main/java/org/keycloak/protocol/oidc4vp/signing/{ => vcdm}/LDSignatureType.java (93%) rename services/src/main/java/org/keycloak/protocol/oidc4vp/signing/{signatures => vcdm}/RsaSignature2018Suite.java (60%) create mode 100644 services/src/main/java/org/keycloak/protocol/oidc4vp/signing/vcdm/SecuritySuite.java diff --git a/services/src/main/java/org/keycloak/protocol/oidc4vp/OIDC4VPWellKnownProvider.java b/services/src/main/java/org/keycloak/protocol/oidc4vp/OIDC4VPWellKnownProvider.java index e65429746173..663cfcd788cd 100644 --- a/services/src/main/java/org/keycloak/protocol/oidc4vp/OIDC4VPWellKnownProvider.java +++ b/services/src/main/java/org/keycloak/protocol/oidc4vp/OIDC4VPWellKnownProvider.java @@ -21,55 +21,44 @@ public class OIDC4VPWellKnownProvider extends OIDC4VPAbstractWellKnownProvider { - public OIDC4VPWellKnownProvider(KeycloakSession keycloakSession, ObjectMapper objectMapper) { - super(keycloakSession, objectMapper); - } + public OIDC4VPWellKnownProvider(KeycloakSession keycloakSession, ObjectMapper objectMapper) { + super(keycloakSession, objectMapper); + } - @Override public void close() { - // no-op - } + @Override + public void close() { + // no-op + } - @Override public Object getConfig() { - // some wallets use the openid-config well-known to also gather the issuer metadata. In - // the future(when everyone uses .well-known/openid-credential-issuer), that can be removed. - Map configAsMap = objectMapper.convertValue( - new OIDCWellKnownProvider(keycloakSession, null, false).getConfig(), - Map.class); + @Override + public Object getConfig() { + // some wallets use the openid-config well-known to also gather the issuer metadata. In + // the future(when everyone uses .well-known/openid-credential-issuer), that can be removed. + Map configAsMap = objectMapper.convertValue( + new OIDCWellKnownProvider(keycloakSession, null, false).getConfig(), + Map.class); - List supportedGrantTypes = Optional.ofNullable(configAsMap.get("grant_types_supported")) - .map(grantTypesObject -> objectMapper.convertValue( - grantTypesObject, new TypeReference>() { - })).orElse(new ArrayList<>()); - // newly invented by OIDC4VCI and supported by this implementation - supportedGrantTypes.add(GRANT_TYPE_PRE_AUTHORIZED_CODE); - configAsMap.put("grant_types_supported", supportedGrantTypes); - configAsMap.put("credential_endpoint", getCredentialsEndpoint(keycloakSession.getContext())); + List supportedGrantTypes = Optional.ofNullable(configAsMap.get("grant_types_supported")) + .map(grantTypesObject -> objectMapper.convertValue( + grantTypesObject, new TypeReference>() { + })).orElse(new ArrayList<>()); + // newly invented by OIDC4VCI and supported by this implementation + supportedGrantTypes.add(GRANT_TYPE_PRE_AUTHORIZED_CODE); + configAsMap.put("grant_types_supported", supportedGrantTypes); + configAsMap.put("credential_endpoint", getCredentialsEndpoint(keycloakSession.getContext())); + + return configAsMap; + } - FormatObject ldpVC = new FormatObject(new ArrayList<>()); - FormatObject jwtVC = new FormatObject(new ArrayList<>()); - - getCredentialsFromModels( - keycloakSession.getContext().getRealm().getClientsStream().toList()) - .forEach(supportedCredential -> { - if (supportedCredential.getFormat() == LDP_VC) { - ldpVC.getTypes().addAll(supportedCredential.getTypes()); - } else { - jwtVC.getTypes().addAll(supportedCredential.getTypes()); - } - }); - - return configAsMap; - } - - // filter the client models for supported verifable credentials - private List getCredentialsFromModels(List clientModels) { - return List.copyOf(clientModels.stream() - .map(ClientModel::getAttributes) - .filter(Objects::nonNull) - .flatMap(attrs -> attrs.entrySet().stream()) - .filter(attr -> attr.getKey().startsWith(VC_TYPES_PREFIX)) - .flatMap(entry -> mapAttributeEntryToSc(entry).stream()) - .collect(Collectors.toSet())); - } + // filter the client models for supported verifable credentials + private List getCredentialsFromModels(List clientModels) { + return List.copyOf(clientModels.stream() + .map(ClientModel::getAttributes) + .filter(Objects::nonNull) + .flatMap(attrs -> attrs.entrySet().stream()) + .filter(attr -> attr.getKey().startsWith(VC_TYPES_PREFIX)) + .flatMap(entry -> mapAttributeEntryToSc(entry).stream()) + .collect(Collectors.toSet())); + } } diff --git a/services/src/main/java/org/keycloak/protocol/oidc4vp/model/sdjwt/ArrayDigest.java b/services/src/main/java/org/keycloak/protocol/oidc4vp/model/sd_jwt_vc/ArrayDigest.java similarity index 87% rename from services/src/main/java/org/keycloak/protocol/oidc4vp/model/sdjwt/ArrayDigest.java rename to services/src/main/java/org/keycloak/protocol/oidc4vp/model/sd_jwt_vc/ArrayDigest.java index 4affaa5de29b..2ffe5c72c48f 100644 --- a/services/src/main/java/org/keycloak/protocol/oidc4vp/model/sdjwt/ArrayDigest.java +++ b/services/src/main/java/org/keycloak/protocol/oidc4vp/model/sd_jwt_vc/ArrayDigest.java @@ -1,4 +1,4 @@ -package org.keycloak.protocol.oidc4vp.model.sdjwt; +package org.keycloak.protocol.oidc4vp.model.sd_jwt_vc; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/services/src/main/java/org/keycloak/protocol/oidc4vp/model/sdjwt/ArrayDisclosureClaim.java b/services/src/main/java/org/keycloak/protocol/oidc4vp/model/sd_jwt_vc/ArrayDisclosureClaim.java similarity index 85% rename from services/src/main/java/org/keycloak/protocol/oidc4vp/model/sdjwt/ArrayDisclosureClaim.java rename to services/src/main/java/org/keycloak/protocol/oidc4vp/model/sd_jwt_vc/ArrayDisclosureClaim.java index 016c3fe05d71..faf7e9dfef40 100644 --- a/services/src/main/java/org/keycloak/protocol/oidc4vp/model/sdjwt/ArrayDisclosureClaim.java +++ b/services/src/main/java/org/keycloak/protocol/oidc4vp/model/sd_jwt_vc/ArrayDisclosureClaim.java @@ -1,6 +1,4 @@ -package org.keycloak.protocol.oidc4vp.model.sdjwt; - -import com.fasterxml.jackson.databind.annotation.JsonSerialize; +package org.keycloak.protocol.oidc4vp.model.sd_jwt_vc; import java.util.ArrayList; import java.util.List; diff --git a/services/src/main/java/org/keycloak/protocol/oidc4vp/model/sdjwt/ArrayElement.java b/services/src/main/java/org/keycloak/protocol/oidc4vp/model/sd_jwt_vc/ArrayElement.java similarity index 92% rename from services/src/main/java/org/keycloak/protocol/oidc4vp/model/sdjwt/ArrayElement.java rename to services/src/main/java/org/keycloak/protocol/oidc4vp/model/sd_jwt_vc/ArrayElement.java index 700e365706f7..a6f813350974 100644 --- a/services/src/main/java/org/keycloak/protocol/oidc4vp/model/sdjwt/ArrayElement.java +++ b/services/src/main/java/org/keycloak/protocol/oidc4vp/model/sd_jwt_vc/ArrayElement.java @@ -1,6 +1,4 @@ -package org.keycloak.protocol.oidc4vp.model.sdjwt; - -import java.util.Map; +package org.keycloak.protocol.oidc4vp.model.sd_jwt_vc; public class ArrayElement { diff --git a/services/src/main/java/org/keycloak/protocol/oidc4vp/model/sdjwt/DisclosureClaim.java b/services/src/main/java/org/keycloak/protocol/oidc4vp/model/sd_jwt_vc/DisclosureClaim.java similarity index 89% rename from services/src/main/java/org/keycloak/protocol/oidc4vp/model/sdjwt/DisclosureClaim.java rename to services/src/main/java/org/keycloak/protocol/oidc4vp/model/sd_jwt_vc/DisclosureClaim.java index 5159d90a7702..d56d4808f8b5 100644 --- a/services/src/main/java/org/keycloak/protocol/oidc4vp/model/sdjwt/DisclosureClaim.java +++ b/services/src/main/java/org/keycloak/protocol/oidc4vp/model/sd_jwt_vc/DisclosureClaim.java @@ -1,6 +1,4 @@ -package org.keycloak.protocol.oidc4vp.model.sdjwt; - -import com.fasterxml.jackson.databind.annotation.JsonSerialize; +package org.keycloak.protocol.oidc4vp.model.sd_jwt_vc; public class DisclosureClaim { diff --git a/services/src/main/java/org/keycloak/protocol/oidc4vp/model/sdjwt/SdClaim.java b/services/src/main/java/org/keycloak/protocol/oidc4vp/model/sd_jwt_vc/SdClaim.java similarity index 76% rename from services/src/main/java/org/keycloak/protocol/oidc4vp/model/sdjwt/SdClaim.java rename to services/src/main/java/org/keycloak/protocol/oidc4vp/model/sd_jwt_vc/SdClaim.java index 6333241d8d73..348c4083f610 100644 --- a/services/src/main/java/org/keycloak/protocol/oidc4vp/model/sdjwt/SdClaim.java +++ b/services/src/main/java/org/keycloak/protocol/oidc4vp/model/sd_jwt_vc/SdClaim.java @@ -1,10 +1,4 @@ -package org.keycloak.protocol.oidc4vp.model.sdjwt; - -import org.keycloak.common.util.Base64; -import org.keycloak.protocol.oidc4vp.signing.SigningServiceException; - -import java.io.IOException; -import java.security.SecureRandom; +package org.keycloak.protocol.oidc4vp.model.sd_jwt_vc; import static org.keycloak.protocol.oidc4vp.signing.SdJwtSigningService.generateSalt; diff --git a/services/src/main/java/org/keycloak/protocol/oidc4vp/model/sdjwt/SdCredential.java b/services/src/main/java/org/keycloak/protocol/oidc4vp/model/sd_jwt_vc/SdCredential.java similarity index 89% rename from services/src/main/java/org/keycloak/protocol/oidc4vp/model/sdjwt/SdCredential.java rename to services/src/main/java/org/keycloak/protocol/oidc4vp/model/sd_jwt_vc/SdCredential.java index 088b64bf1d1a..fe869fc203bd 100644 --- a/services/src/main/java/org/keycloak/protocol/oidc4vp/model/sdjwt/SdCredential.java +++ b/services/src/main/java/org/keycloak/protocol/oidc4vp/model/sd_jwt_vc/SdCredential.java @@ -1,4 +1,4 @@ -package org.keycloak.protocol.oidc4vp.model.sdjwt; +package org.keycloak.protocol.oidc4vp.model.sd_jwt_vc; import com.fasterxml.jackson.annotation.JsonIgnore; diff --git a/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/JwtSigningService.java b/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/JwtSigningService.java index 401171e12696..cff82ba283fd 100644 --- a/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/JwtSigningService.java +++ b/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/JwtSigningService.java @@ -9,7 +9,7 @@ import org.keycloak.crypto.*; import org.keycloak.jose.jws.JWSBuilder; import org.keycloak.protocol.oidc4vp.model.VerifiableCredential; -import org.keycloak.protocol.oidc4vp.signing.signatures.EdDSASignatureSignerContext; +import org.keycloak.protocol.oidc4vp.signing.jwt_vc.EdDSASignatureSignerContext; import org.keycloak.representations.JsonWebToken; import java.io.IOException; @@ -20,13 +20,12 @@ import java.security.spec.PKCS8EncodedKeySpec; import java.security.spec.X509EncodedKeySpec; import java.time.Clock; -import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.UUID; -import static org.keycloak.protocol.oidc4vp.signing.signatures.EdDSASignatureSignerContext.ED_25519; +import static org.keycloak.protocol.oidc4vp.signing.jwt_vc.EdDSASignatureSignerContext.ED_25519; public class JwtSigningService extends SigningService { diff --git a/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/LDSigningService.java b/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/LDSigningService.java index 755cf71e05fc..eb599ba7b762 100644 --- a/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/LDSigningService.java +++ b/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/LDSigningService.java @@ -6,9 +6,9 @@ import org.keycloak.common.util.Base64; import org.keycloak.protocol.oidc4vp.model.vcdm.LdProof; import org.keycloak.protocol.oidc4vp.model.VerifiableCredential; -import org.keycloak.protocol.oidc4vp.signing.signatures.Ed255192018Suite; -import org.keycloak.protocol.oidc4vp.signing.signatures.RsaSignature2018Suite; -import org.keycloak.protocol.oidc4vp.signing.signatures.SecuritySuite; +import org.keycloak.protocol.oidc4vp.signing.vcdm.Ed255192018Suite; +import org.keycloak.protocol.oidc4vp.signing.vcdm.RsaSignature2018Suite; +import org.keycloak.protocol.oidc4vp.signing.vcdm.SecuritySuite; import java.io.IOException; import java.time.Clock; diff --git a/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/SdJwtSigningService.java b/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/SdJwtSigningService.java index 66de1838a550..4f793c9c6cfa 100644 --- a/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/SdJwtSigningService.java +++ b/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/SdJwtSigningService.java @@ -7,10 +7,9 @@ import org.keycloak.crypto.JavaAlgorithmHashProvider; import org.keycloak.protocol.oidc4vp.model.CredentialSubject; import org.keycloak.protocol.oidc4vp.model.VerifiableCredential; -import org.keycloak.protocol.oidc4vp.model.sdjwt.*; +import org.keycloak.protocol.oidc4vp.model.sd_jwt_vc.*; import org.keycloak.representations.JsonWebToken; -import java.io.IOException; import java.nio.charset.StandardCharsets; import java.security.SecureRandom; import java.time.Clock; diff --git a/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/signatures/EdDSASignatureSignerContext.java b/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/jwt_vc/EdDSASignatureSignerContext.java similarity index 87% rename from services/src/main/java/org/keycloak/protocol/oidc4vp/signing/signatures/EdDSASignatureSignerContext.java rename to services/src/main/java/org/keycloak/protocol/oidc4vp/signing/jwt_vc/EdDSASignatureSignerContext.java index b6dbe60d1641..f9d9a901ff45 100644 --- a/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/signatures/EdDSASignatureSignerContext.java +++ b/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/jwt_vc/EdDSASignatureSignerContext.java @@ -1,11 +1,9 @@ -package org.keycloak.protocol.oidc4vp.signing.signatures; +package org.keycloak.protocol.oidc4vp.signing.jwt_vc; -import org.bouncycastle.jcajce.interfaces.EdDSAPrivateKey; import org.keycloak.crypto.KeyWrapper; import org.keycloak.crypto.SignatureException; import org.keycloak.crypto.SignatureSignerContext; -import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; import java.security.Signature; diff --git a/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/signatures/SecuritySuite.java b/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/signatures/SecuritySuite.java deleted file mode 100644 index 06bf48b5bae7..000000000000 --- a/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/signatures/SecuritySuite.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.keycloak.protocol.oidc4vp.signing.signatures; - -import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; -import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo; -import org.bouncycastle.openssl.PEMKeyPair; -import org.bouncycastle.openssl.PEMParser; -import org.keycloak.protocol.oidc4vp.model.VerifiableCredential; -import org.keycloak.protocol.oidc4vp.signing.SigningServiceException; - -import java.io.IOException; -import java.io.StringReader; -import java.security.*; -import java.security.spec.InvalidKeySpecException; -import java.security.spec.PKCS8EncodedKeySpec; -import java.security.spec.X509EncodedKeySpec; -import java.util.ArrayList; -import java.util.List; - -public interface SecuritySuite { - - byte[] transform(VerifiableCredential verifiableCredential); - - byte[] digest(byte[] transformedData); - - byte[] sign(byte[] hashData, String key); - - String getProofType(); - -} diff --git a/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/signatures/Ed255192018Suite.java b/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/vcdm/Ed255192018Suite.java similarity index 98% rename from services/src/main/java/org/keycloak/protocol/oidc4vp/signing/signatures/Ed255192018Suite.java rename to services/src/main/java/org/keycloak/protocol/oidc4vp/signing/vcdm/Ed255192018Suite.java index e5f26fc62d77..56dcb02940f2 100644 --- a/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/signatures/Ed255192018Suite.java +++ b/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/vcdm/Ed255192018Suite.java @@ -1,4 +1,4 @@ -package org.keycloak.protocol.oidc4vp.signing.signatures; +package org.keycloak.protocol.oidc4vp.signing.vcdm; import com.apicatalog.jsonld.JsonLd; import com.apicatalog.jsonld.JsonLdError; diff --git a/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/LDSignatureType.java b/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/vcdm/LDSignatureType.java similarity index 93% rename from services/src/main/java/org/keycloak/protocol/oidc4vp/signing/LDSignatureType.java rename to services/src/main/java/org/keycloak/protocol/oidc4vp/signing/vcdm/LDSignatureType.java index d7f722651c6a..80d93861cf0f 100644 --- a/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/LDSignatureType.java +++ b/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/vcdm/LDSignatureType.java @@ -1,4 +1,4 @@ -package org.keycloak.protocol.oidc4vp.signing; +package org.keycloak.protocol.oidc4vp.signing.vcdm; public enum LDSignatureType { diff --git a/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/signatures/RsaSignature2018Suite.java b/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/vcdm/RsaSignature2018Suite.java similarity index 60% rename from services/src/main/java/org/keycloak/protocol/oidc4vp/signing/signatures/RsaSignature2018Suite.java rename to services/src/main/java/org/keycloak/protocol/oidc4vp/signing/vcdm/RsaSignature2018Suite.java index 2670be7913c8..34d53fc0ac54 100644 --- a/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/signatures/RsaSignature2018Suite.java +++ b/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/vcdm/RsaSignature2018Suite.java @@ -1,20 +1,6 @@ -package org.keycloak.protocol.oidc4vp.signing.signatures; +package org.keycloak.protocol.oidc4vp.signing.vcdm; -import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; -import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo; -import org.bouncycastle.openssl.PEMKeyPair; -import org.bouncycastle.openssl.PEMParser; import org.keycloak.protocol.oidc4vp.model.VerifiableCredential; -import org.keycloak.protocol.oidc4vp.signing.SigningServiceException; - -import java.io.IOException; -import java.io.StringReader; -import java.security.*; -import java.security.spec.InvalidKeySpecException; -import java.security.spec.PKCS8EncodedKeySpec; -import java.security.spec.X509EncodedKeySpec; -import java.util.ArrayList; -import java.util.List; public class RsaSignature2018Suite implements SecuritySuite { diff --git a/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/vcdm/SecuritySuite.java b/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/vcdm/SecuritySuite.java new file mode 100644 index 000000000000..e1ff0e11116a --- /dev/null +++ b/services/src/main/java/org/keycloak/protocol/oidc4vp/signing/vcdm/SecuritySuite.java @@ -0,0 +1,15 @@ +package org.keycloak.protocol.oidc4vp.signing.vcdm; + +import org.keycloak.protocol.oidc4vp.model.VerifiableCredential; + +public interface SecuritySuite { + + byte[] transform(VerifiableCredential verifiableCredential); + + byte[] digest(byte[] transformedData); + + byte[] sign(byte[] hashData, String key); + + String getProofType(); + +} diff --git a/services/src/test/java/org/keycloak/protocol/oidc4vp/signing/LDSigningServiceTest.java b/services/src/test/java/org/keycloak/protocol/oidc4vp/signing/LDSigningServiceTest.java index 48bfc127e3b8..0c8a90c4f451 100644 --- a/services/src/test/java/org/keycloak/protocol/oidc4vp/signing/LDSigningServiceTest.java +++ b/services/src/test/java/org/keycloak/protocol/oidc4vp/signing/LDSigningServiceTest.java @@ -1,20 +1,17 @@ package org.keycloak.protocol.oidc4vp.signing; import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; -import com.fasterxml.jackson.databind.util.StdDateFormat; import org.bouncycastle.crypto.generators.Ed25519KeyPairGenerator; import org.bouncycastle.crypto.params.AsymmetricKeyParameter; import org.bouncycastle.crypto.params.Ed25519KeyGenerationParameters; import org.bouncycastle.crypto.signers.Ed25519Signer; import org.bouncycastle.crypto.util.PrivateKeyInfoFactory; import org.bouncycastle.openssl.jcajce.JcaPEMWriter; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.keycloak.common.util.Base64; import org.keycloak.protocol.oidc4vp.model.VerifiableCredential; -import org.keycloak.protocol.oidc4vp.signing.signatures.Ed255192018Suite; -import org.keycloak.protocol.oidc4vp.signing.signatures.SecuritySuite; +import org.keycloak.protocol.oidc4vp.signing.vcdm.Ed255192018Suite; +import org.keycloak.protocol.oidc4vp.signing.vcdm.SecuritySuite; import java.io.IOException; import java.io.StringWriter;