From 2375d5cbd652af13799982fbe63739a17c3099ce Mon Sep 17 00:00:00 2001 From: AssahBismarkabah Date: Mon, 29 Jul 2024 10:41:14 +0100 Subject: [PATCH 1/4] fix: : java.lang.IllegalArgumentException: missing provider --- .../datasafe/encrypiton/impl/utils/ProviderUtils.java | 3 ++- datasafe-encryption/pom.xml | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/datasafe-encryption/datasafe-encryption-impl/src/main/java/de/adorsys/datasafe/encrypiton/impl/utils/ProviderUtils.java b/datasafe-encryption/datasafe-encryption-impl/src/main/java/de/adorsys/datasafe/encrypiton/impl/utils/ProviderUtils.java index fef4cb165..15f1b95c6 100644 --- a/datasafe-encryption/datasafe-encryption-impl/src/main/java/de/adorsys/datasafe/encrypiton/impl/utils/ProviderUtils.java +++ b/datasafe-encryption/datasafe-encryption-impl/src/main/java/de/adorsys/datasafe/encrypiton/impl/utils/ProviderUtils.java @@ -1,5 +1,6 @@ package de.adorsys.datasafe.encrypiton.impl.utils; +import de.adorsys.keymanagement.adapter.modules.generator.GeneratorModule_ProviderFactory; import lombok.experimental.UtilityClass; import org.bouncycastle.jce.provider.BouncyCastleProvider; @@ -9,5 +10,5 @@ @UtilityClass public class ProviderUtils { - public static final Provider bcProvider = Security.getProvider(BouncyCastleProvider.PROVIDER_NAME); + public static final Provider bcProvider = GeneratorModule_ProviderFactory.provider(); } diff --git a/datasafe-encryption/pom.xml b/datasafe-encryption/pom.xml index b7ac67034..7386f31c6 100644 --- a/datasafe-encryption/pom.xml +++ b/datasafe-encryption/pom.xml @@ -15,4 +15,11 @@ datasafe-encryption-api datasafe-encryption-impl + + + de.adorsys.keymanagement + bouncycastle-adapter + 0.0.11 + + From 9bb5a3b1542fb9c3d8212ec9a6085ec4f6a0f2ad Mon Sep 17 00:00:00 2001 From: AssahBismarkabah Date: Mon, 29 Jul 2024 16:58:10 +0100 Subject: [PATCH 2/4] update: pom.xml to ignore de.adorsys.keymanagement:bouncycastle-adapter --- datasafe-encryption/datasafe-encryption-impl/pom.xml | 1 + .../datasafe/encrypiton/impl/utils/ProviderUtils.java | 2 -- datasafe-encryption/pom.xml | 7 ------- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/datasafe-encryption/datasafe-encryption-impl/pom.xml b/datasafe-encryption/datasafe-encryption-impl/pom.xml index fac2cbe00..89cf99f66 100644 --- a/datasafe-encryption/datasafe-encryption-impl/pom.xml +++ b/datasafe-encryption/datasafe-encryption-impl/pom.xml @@ -142,6 +142,7 @@ org.bouncycastle javax.inject:javax.inject + de.adorsys.keymanagement:bouncycastle-adapter diff --git a/datasafe-encryption/datasafe-encryption-impl/src/main/java/de/adorsys/datasafe/encrypiton/impl/utils/ProviderUtils.java b/datasafe-encryption/datasafe-encryption-impl/src/main/java/de/adorsys/datasafe/encrypiton/impl/utils/ProviderUtils.java index 15f1b95c6..ebb15abd4 100644 --- a/datasafe-encryption/datasafe-encryption-impl/src/main/java/de/adorsys/datasafe/encrypiton/impl/utils/ProviderUtils.java +++ b/datasafe-encryption/datasafe-encryption-impl/src/main/java/de/adorsys/datasafe/encrypiton/impl/utils/ProviderUtils.java @@ -2,10 +2,8 @@ import de.adorsys.keymanagement.adapter.modules.generator.GeneratorModule_ProviderFactory; import lombok.experimental.UtilityClass; -import org.bouncycastle.jce.provider.BouncyCastleProvider; import java.security.Provider; -import java.security.Security; @UtilityClass public class ProviderUtils { diff --git a/datasafe-encryption/pom.xml b/datasafe-encryption/pom.xml index 7386f31c6..b7ac67034 100644 --- a/datasafe-encryption/pom.xml +++ b/datasafe-encryption/pom.xml @@ -15,11 +15,4 @@ datasafe-encryption-api datasafe-encryption-impl - - - de.adorsys.keymanagement - bouncycastle-adapter - 0.0.11 - - From ebfacbc406bd329009aa22b7a70febe42c6124d9 Mon Sep 17 00:00:00 2001 From: AssahBismarkabah Date: Mon, 29 Jul 2024 17:32:04 +0100 Subject: [PATCH 3/4] fix: sonarQube failure --- .../impl/cmsencryption/CMSEncryptionServiceImpl.java | 4 ++-- .../encrypiton/impl/utils/ProviderUtils.java | 12 ------------ .../impl/keystore/KeyStoreServiceTest.java | 5 ++--- 3 files changed, 4 insertions(+), 17 deletions(-) delete mode 100644 datasafe-encryption/datasafe-encryption-impl/src/main/java/de/adorsys/datasafe/encrypiton/impl/utils/ProviderUtils.java diff --git a/datasafe-encryption/datasafe-encryption-impl/src/main/java/de/adorsys/datasafe/encrypiton/impl/cmsencryption/CMSEncryptionServiceImpl.java b/datasafe-encryption/datasafe-encryption-impl/src/main/java/de/adorsys/datasafe/encrypiton/impl/cmsencryption/CMSEncryptionServiceImpl.java index 6833b667f..82819e4ec 100644 --- a/datasafe-encryption/datasafe-encryption-impl/src/main/java/de/adorsys/datasafe/encrypiton/impl/cmsencryption/CMSEncryptionServiceImpl.java +++ b/datasafe-encryption/datasafe-encryption-impl/src/main/java/de/adorsys/datasafe/encrypiton/impl/cmsencryption/CMSEncryptionServiceImpl.java @@ -6,8 +6,8 @@ import de.adorsys.datasafe.encrypiton.impl.cmsencryption.decryptors.Decryptor; import de.adorsys.datasafe.encrypiton.impl.cmsencryption.decryptors.DecryptorFactory; import de.adorsys.datasafe.encrypiton.impl.cmsencryption.exceptions.DecryptionException; -import de.adorsys.datasafe.encrypiton.impl.utils.ProviderUtils; import de.adorsys.datasafe.types.api.context.annotations.RuntimeDelegate; +import de.adorsys.keymanagement.adapter.modules.generator.GeneratorModule_ProviderFactory; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.bouncycastle.asn1.ASN1ObjectIdentifier; @@ -145,7 +145,7 @@ private OutputStream streamEncrypt(OutputStream dataContentStream, Set Date: Mon, 29 Jul 2024 17:43:26 +0100 Subject: [PATCH 4/4] Revert "fix: sonarQube failure" This reverts commit ebfacbc406bd329009aa22b7a70febe42c6124d9. --- .../datasafe/encrypiton/impl/keystore/KeyStoreServiceTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/datasafe-encryption/datasafe-encryption-impl/src/test/java/de/adorsys/datasafe/encrypiton/impl/keystore/KeyStoreServiceTest.java b/datasafe-encryption/datasafe-encryption-impl/src/test/java/de/adorsys/datasafe/encrypiton/impl/keystore/KeyStoreServiceTest.java index a28e8f1ce..bf8f4f800 100644 --- a/datasafe-encryption/datasafe-encryption-impl/src/test/java/de/adorsys/datasafe/encrypiton/impl/keystore/KeyStoreServiceTest.java +++ b/datasafe-encryption/datasafe-encryption-impl/src/test/java/de/adorsys/datasafe/encrypiton/impl/keystore/KeyStoreServiceTest.java @@ -26,6 +26,7 @@ import javax.crypto.SecretKey; import java.security.KeyStore; import java.security.PrivateKey; +import java.util.Arrays; import java.util.Collections; import java.util.List;