phax / as2-lib

A generic Java AS2 library, servlet and server
107 stars 43 forks source link

BC Provider in AS2 framework #151

Open ihudedi opened 1 month ago

ihudedi commented 1 month ago

Hi @phax I saw that you add manually provider org.bouncycastle.jce.provider.BouncyCastleProvider or org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider in BCCryptoHelper class. I have a question. Is there an option to use the jca/jce provider via the provider list loaded in the java run time and not specfiying the providerName as BC/BCFIPS I wonder if we can use all encryption/sign using Sun Provider and not BC provider. If we won't add the BC provider hard coded we can use the BC classes with default provider used by the jvm.ONly need to find the relevant provider from the provider list when application is running.

Thanks, Itay

phax commented 1 month ago

@ihudedi the BouncyCastle providers are just set as defaults. Via BCCryptoHelper.setSecurityProviderName(String) you can set a different security provider to use. So ((BCCryptoHelper) AS2Helper.getCryptoHelper ()).setSecurityProviderName (...) should do the trick for you.

Please try this and let me know if it works for you. Thanks