Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8248782

JDK 14 : java.security.NoSuchProviderException: no such provider: BC when set statically

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      Linux/JDK14

      A DESCRIPTION OF THE PROBLEM :
      Able to configure Bouncy Castle dynamically by adding below:
        

           Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());

      but when done statically by adding entry in $JAVA_HOME/conf/security/java.security properties file

          security.provider.1=SUN
          security.provider.2=SunRsaSign
          security.provider.3=SunEC
          security.provider.4=SunJSSE
          security.provider.5=SunJCE
          security.provider.6=SunJGSS
          security.provider.7=SunSASL
          security.provider.8=XMLDSig
          security.provider.9=SunPCSC
          security.provider.10=JdkLDAP
          security.provider.11=JdkSASL
          security.provider.12=SunPKCS11
          security.provider.13=org.bouncycastle.jce.provider.BouncyCastleProvider

      also added the jar via classpath like

          exec java -cp "/opt/app/lib/bcprov-jdk15on-165.jar;/opt/app/lib/*" -jar ${JAR_FILE} &

      Error is:

          Caused by: java.security.NoSuchProviderException: no such provider: BC
                  at java.base/sun.security.jca.GetInstance.getService(GetInstance.java:83)
                  at java.base/javax.crypto.JceSecurity.getInstance(JceSecurity.java:129)
                  at java.base/javax.crypto.SecretKeyFactory.getInstance(SecretKeyFactory.java:208)
                  at org.jasypt.encryption.pbe.StandardPBEByteEncryptor.initialize(StandardPBEByteEncryptor.java:689)



      REGRESSION : Last worked in version 14.0.1

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      when done statically by adding entry in $JAVA_HOME/conf/security/java.security properties file

          security.provider.1=SUN
          security.provider.2=SunRsaSign
          security.provider.3=SunEC
          security.provider.4=SunJSSE
          security.provider.5=SunJCE
          security.provider.6=SunJGSS
          security.provider.7=SunSASL
          security.provider.8=XMLDSig
          security.provider.9=SunPCSC
          security.provider.10=JdkLDAP
          security.provider.11=JdkSASL
          security.provider.12=SunPKCS11
          security.provider.13=org.bouncycastle.jce.provider.BouncyCastleProvider

      also added the jar via classpath like

          exec java -cp "/opt/app/lib/bcprov-jdk15on-165.jar;/opt/app/lib/*" -jar ${JAR_FILE} &


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Bouncy Castle should be statically up and no exception should come with
       Caused by: java.security.NoSuchProviderException: no such provider: BC
                  at java.base/sun.security.jca.GetInstance.getService(GetInstance.java:83)
                  at java.base/javax.crypto.JceSecurity.getInstance(JceSecurity.java:129)
                  at java.base/javax.crypto.SecretKeyFactory.getInstance(SecretKeyFactory.java:208)
                  at org.jasypt.encryption.pbe.StandardPBEByteEncryptor.initialize(StandardPBEByteEncryptor.java:689)



      FREQUENCY : always


            valeriep Valerie Peng
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: