0

I am using Bouncy Castle Provider downloaded from https://www.bouncycastle.org/latest_releases.html. I am packaging the executable jar as an .exe file using jar2exe The bouncy castle jar files are in same folder as exe file. They are not inside executable jar. Will adding source code for these files to main project help?

2023-05-27 22:18:10:724 [ERROR] [main:ID=1]:[OpcUaServerServiceImpl.java:297] org.bouncycastle.openssl.PEMException: Unable to create OpenSSL PBDKF: JCE cannot authenticate the provider BC
    at org.bouncycastle.openssl.jcajce.PEMUtilities.getKey(Unknown Source)
    at org.bouncycastle.openssl.jcajce.PEMUtilities.getKey(Unknown Source)
    at org.bouncycastle.openssl.jcajce.PEMUtilities.crypt(Unknown Source)
    at org.bouncycastle.openssl.jcajce.JcePEMEncryptorBuilder$1.encrypt(Unknown Source)
    at org.bouncycastle.openssl.MiscPEMGenerator.createPemObject(Unknown Source)
    at org.bouncycastle.openssl.MiscPEMGenerator.generate(Unknown Source)
    at org.bouncycastle.util.io.pem.PemWriter.writeObject(Unknown Source)
    at org.bouncycastle.openssl.jcajce.JcaPEMWriter.writeObject(Unknown Source)
    at com.prosysopc.ua.stack.transport.security.BcCertificateProvider.writePrivateKey(SourceFile:271)
    at com.prosysopc.ua.stack.utils.CertificateUtils.writePrivateKey(SourceFile:1080)
    at com.prosysopc.ua.stack.utils.CertificateUtils.writePrivateKey(SourceFile:1064)
    at com.prosysopc.ua.stack.transport.security.PrivKey.save(SourceFile:380)
    at com.prosysopc.ua.ApplicationIdentity.saveCertificate(SourceFile:1358)
    at com.prosysopc.ua.ApplicationIdentity.loadOrCreateIssuerCertificate(SourceFile:872)
    at opcuaserver.services.OpcUaServerServiceImpl.initialize(OpcUaServerServiceImpl.java:592)
    at opcuaserver.services.OpcUaServerServiceImpl.startServer(OpcUaServerServiceImpl.java:276)
    at opcuaserver.OpcUaServerApplication.run(OpcUaServerApplication.java:54)
    at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:771)
    at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:755)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295)
    at opcuaserver.OpcUaServerApplication.main(OpcUaServerApplication.java:35)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65)
Caused by: java.security.NoSuchProviderException: JCE cannot authenticate the provider BC
    at java.base/javax.crypto.JceSecurity.getInstance(JceSecurity.java:131)
    at java.base/javax.crypto.SecretKeyFactory.getInstance(SecretKeyFactory.java:208)
    at org.bouncycastle.jcajce.util.NamedJcaJceHelper.createSecretKeyFactory(Unknown Source)
    at org.bouncycastle.openssl.jcajce.PEMUtilities.getKey(Unknown Source)
    at org.bouncycastle.openssl.jcajce.PEMUtilities.getKey(Unknown Source)
    at org.bouncycastle.openssl.jcajce.PEMUtilities.crypt(Unknown Source)
    at org.bouncycastle.openssl.jcajce.JcePEMEncryptorBuilder$1.encrypt(Unknown Source)
    at org.bouncycastle.openssl.MiscPEMGenerator.createPemObject(Unknown Source)
    at org.bouncycastle.openssl.MiscPEMGenerator.generate(Unknown Source)
    ...
Ram
  • 1,225
  • 2
  • 24
  • 48
  • Does this answer your question? [JCE cannot authenticate the provider BC in java swing application](https://stackoverflow.com/questions/13721579/jce-cannot-authenticate-the-provider-bc-in-java-swing-application) – not2savvy May 28 '23 at 22:46

0 Answers0