ClassNotFoundException: org.bouncycastle.jcajce.provider.asymmetric.rsa.DigestSignatureSpi$SHA256

Key error message:

 

 

 

[Illegal access: this web application instance has been stopped already. Could not load [org.bouncycastle.jcajce.provider.asymmetric.rsa.DigestSignatureSpi$SHA256]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.]
java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [org.bouncycastle.jcajce.provider.asymmetric.rsa.DigestSignatureSpi$SHA256]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
…
com.ntko.docsign.sdk.gm.GMDigitalSeal    : SealValidationErr:SEAL_SIGNATURE_INIT_ERR

java.security.NoSuchAlgorithmException: class configured for Signature (provider: BC) cannot be found.
…
Caused by: java.lang.ClassNotFoundException: org.bouncycastle.jcajce.provider.asymmetric.rsa.DigestSignatureSpi$SHA256

Of course, there are other information in the application error report. Here I extract the key information:

1、 Could not load [org.bouncycastle.jcajce.provider.asymmetric.rsa.DigestSignatureSpi$SHA256].

2、java.security.NoSuchAlgorithmException: class configured for Signature (provider: BC) cannot be found.

3、Caused by: java.lang.ClassNotFoundException: org.bouncycastle.jcajce.provider.asymmetric.rsa.DigestSignatureSpi$SHA256

You can see that the entire application reports an error, which actually points to org.bouncycastle.jcajce.provider.asymmetric.rsa.DigestSignatureSpi$SHA256 and prompts java.security.NoSuchAlgorithmException: caused by no such encryption algorithm. 

It means: the JCE of the currently used java jdk environment does not support the encryption algorithm of RSA SHA256. And the app itself is useful, but I can't find it. Sorry, I'm going to report an error to you.

For this kind of problem, we refer to the official information: https://www.oracle.com/java/technologies/javase-jce-all-downloads.html , we can see that the JDK8 and 7 versions earlier than 8u161, 7u171, and 6u181 By default, RSA256 and above algorithms are not supported. 

In actual use, we can find that both Oracle's JDK8 and OpenJDK8 versions may have such problems. The enhanced encryption algorithm is not supported by default. If it is a 128-bit encryption algorithm, such problems may not occur. 

 

For this type of problem, we can also modify java's JCE security policy to enable it to support enhanced encryption algorithms.

Observing the corresponding JDK directory structure, we can find that there are limited and unlimited folders in jre/lib/security/policy under the jdk installation directory , and the file names in these two folders are the same: local_policy.jar and US_export_policy.jar

 

According to the official information, we can know that the policy configuration in the limited supports the enhanced encryption algorithm. We copy the files in the limited folder to the policy directory:

cp policy/limited/local_policy.jar /usr/local/java/jdk1.8.0_311/jre/lib/security/policy/local_policy.jar

sudo cp policy/limited/US_export_policy.jar /usr/local/java/jdk1.8.0_311/jre/lib/security/policy/US_export_policy.jar #Under limited under jre/lib/jre/lib/security/policy/ jar copied to the policy folder

 

Then restart the Tongweb application server, and then try to stamp, and you will find that stamping applications such as office have been stamped normally. Other application servers can be handled in the same way.

If the version you are using is not the case like mine, just refer to the official information to download the jar file, and then put it away, it should be fine.

Guess you like

Origin blog.csdn.net/yeyuningzi/article/details/127547375