10
Июн
2021

CryptoPro JCP не хочет запускаться из jar

Использую JCP, т.к делаю https клиент с использованием GostTLS. Проблема заключается в том, что из IDE (IDEA) код все отрабатывает корректно, стоит только мне собрать проект в jar файл все перестает работать. Может кто работал с JCP и сможет подсказать. Заранее благодарю. Ниже прикладываю логи:

июн. 10, 2021 3:34:54 PM ru.CryptoPro.ssl.Provider b
INFO: JCP license isServer:  true
июн. 10, 2021 3:34:55 PM ru.CryptoPro.ssl.Provider b
INFO: JCP license isServer:  true
JCP version 0.0
Crypto version 0.0
RevCheck version 0.0
июн. 10, 2021 3:34:55 PM ru.CryptoPro.ssl.SSLContextImpl engineInit
INFO: SSLContextImpl init.
июн. 10, 2021 3:34:55 PM ru.CryptoPro.ssl.SSLContextImpl engineInit
INFO: trigger seeding of SecureRandom
июн. 10, 2021 3:34:55 PM ru.CryptoPro.ssl.SSLContextImpl engineInit
INFO: done seeding SecureRandom
июн. 10, 2021 3:34:55 PM ru.CryptoPro.ssl.SSLContextImpl engineInit
INFO: SSLContextImpl initialized.
июн. 10, 2021 3:34:56 PM ru.CryptoPro.Crypto.Starter <init>
INFO: Loading Crypto 0.0.0.0.0 [crypto module]
июн. 10, 2021 3:34:56 PM ru.CryptoPro.Crypto.Starter <init>
INFO: Crypto has been loaded.
июн. 10, 2021 3:35:05 PM ru.CryptoPro.JCP.tools.SelfTesterBase c
SEVERE: [main] :: [ru.CryptoPro.Crypto.tools.SelfTester_Crypt] :: test 11 crashed twice!
июн. 10, 2021 3:35:05 PM ru.CryptoPro.JCP.tools.SelfTesterBase checkClassInternal
SEVERE: [main] :: [ru.CryptoPro.Crypto.tools.SelfTester_Crypt] :: Corrupted: ru.CryptoPro.Crypto.Key.GostKeyGenerator
ru.CryptoPro.JCP.tools.SelfTesterException
        at ru.CryptoPro.JCP.tools.TestVerifyClassJar.run(Unknown Source)
        at ru.CryptoPro.JCP.tools.SelfTesterBase.b(Unknown Source)
        at ru.CryptoPro.JCP.tools.SelfTesterBase.a(Unknown Source)
        at ru.CryptoPro.JCP.tools.SelfTesterBase.checkClassInternal(Unknown Source)
        at ru.CryptoPro.Crypto.tools.SelfTester_Crypt.checkClass(Unknown Source)
        at ru.CryptoPro.Crypto.Starter.a(Unknown Source)
        at ru.CryptoPro.Crypto.Starter.check(Unknown Source)
        at ru.CryptoPro.Crypto.Key.GostKeyGenerator.<init>(Unknown Source)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:64)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
        at java.base/java.security.Provider.newInstanceUtil(Provider.java:155)
        at java.base/java.security.Provider$Service.newInstance(Provider.java:1893)
        at java.base/sun.security.jca.GetInstance.getInstance(GetInstance.java:236)
        at java.base/javax.crypto.JceSecurity.getInstance(JceSecurity.java:136)
        at java.base/javax.crypto.KeyGenerator.getInstance(KeyGenerator.java:286)
        at ru.CryptoPro.ssl.cl_36.<init>(Unknown Source)
        at ru.CryptoPro.ssl.cl_18.a(Unknown Source)
        at ru.CryptoPro.ssl.cl_18.a(Unknown Source)
        at ru.CryptoPro.ssl.cl_60.t(Unknown Source)
        at ru.CryptoPro.ssl.cl_60.a(Unknown Source)
        at ru.CryptoPro.ssl.SSLSocketImpl.a(Unknown Source)
        at ru.CryptoPro.ssl.SSLSocketImpl.o(Unknown Source)
        at ru.CryptoPro.ssl.SSLSocketImpl.b(Unknown Source)
        at ru.CryptoPro.ssl.SSLSocketImpl.startHandshake(Unknown Source)
        at java.base/sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:567)
        at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:183)
        at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:142)
        at ru.rs.registerextract.client.HttpsClient.doGet(HttpsClient.java:41)
        at ru.rs.registerextract.requester.ZakupkiRequester.getFormLinkFromSearch(ZakupkiRequester.java:40)
        at ru.rs.registerextract.controller.Controller.main(Controller.java:78)
Caused by: java.security.PrivilegedActionException: java.io.IOException
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:558)
        ... 33 more
Caused by: java.io.IOException
        at ru.CryptoPro.JCP.tools.JarChecker.checkURLSign(Unknown Source)
        at ru.CryptoPro.JCP.tools.cl_34.run(Unknown Source)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:554)
        ... 33 more
Caused by: java.io.IOException: Хэш на содержимое jar файла отсутствует или неверный.Файл манифеста искажен
        at ru.CryptoPro.JCP.tools.JarChecker.b(Unknown Source)
        at ru.CryptoPro.JCP.tools.JarChecker.c(Unknown Source)
        at ru.CryptoPro.JCP.tools.JarChecker.checkJARSign(Unknown Source)
        ... 36 more

июн. 10, 2021 3:35:05 PM ru.CryptoPro.ssl.SSLSocketImpl a
WARNING: main, handling exception: java.security.ProviderException: Encryption/Decryption provider not installed
2021-06-10 15:35:05 ERROR Controller:main - Message: java.security.ProviderException: Encryption/Decryption provider not installed
июн. 10, 2021 3:35:05 PM ru.CryptoPro.JCP.tools.SelfTesterBase c
SEVERE: [SelfTester-JCP] :: [ru.CryptoPro.JCP.tools.SelfTester_JCP] :: test 29 crashed twice!
июн. 10, 2021 3:35:05 PM ru.CryptoPro.JCP.tools.SelfTesterBase run
WARNING: [SelfTester-JCP] :: [ru.CryptoPro.JCP.tools.SelfTester_JCP] :: test №29 failed!
июн. 10, 2021 3:35:05 PM ru.CryptoPro.JCP.tools.SelfTesterBase run
WARNING: ERROR
ru.CryptoPro.JCP.tools.SelfTesterException
        at ru.CryptoPro.JCP.tools.TestVerifyClassJar.run(Unknown Source)
        at ru.CryptoPro.JCP.tools.SelfTesterBase.b(Unknown Source)
        at ru.CryptoPro.JCP.tools.SelfTesterBase.a(Unknown Source)
        at ru.CryptoPro.JCP.tools.SelfTesterBase.run(Unknown Source)
        at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.security.PrivilegedActionException: java.io.IOException
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:558)
        ... 5 more
Caused by: java.io.IOException
        at ru.CryptoPro.JCP.tools.JarChecker.checkURLSign(Unknown Source)
        at ru.CryptoPro.JCP.tools.cl_34.run(Unknown Source)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:554)
        ... 5 more
Caused by: java.io.IOException: Хэш на содержимое jar файла отсутствует или неверный.Файл манифеста искажен
        at ru.CryptoPro.JCP.tools.JarChecker.b(Unknown Source)
        at ru.CryptoPro.JCP.tools.JarChecker.c(Unknown Source)
        at ru.CryptoPro.JCP.tools.JarChecker.checkJARSign(Unknown Source)
        ... 8 more

июн. 10, 2021 3:35:05 PM ru.CryptoPro.JCP.tools.SelfTesterBase c
SEVERE: [SelfTester-Crypt] :: [ru.CryptoPro.Crypto.tools.SelfTester_Crypt] :: test 11 crashed twice!
июн. 10, 2021 3:35:05 PM ru.CryptoPro.JCP.tools.SelfTesterBase run
WARNING: [SelfTester-Crypt] :: [ru.CryptoPro.Crypto.tools.SelfTester_Crypt] :: test №11 failed!
июн. 10, 2021 3:35:05 PM ru.CryptoPro.JCP.tools.SelfTesterBase run
WARNING: ERROR
ru.CryptoPro.JCP.tools.SelfTesterException: [SelfTester-Crypt] :: [ru.CryptoPro.JCP.tools.SelfTester_JCP] :: SelfTester Error: some test crashed twice in a row, usage of class ru.CryptoPro.JCP.tools.SelfTester_JCP is no longer available!
        at ru.CryptoPro.JCP.tools.TestVerifyClassJar.run(Unknown Source)
        at ru.CryptoPro.JCP.tools.SelfTesterBase.b(Unknown Source)
        at ru.CryptoPro.JCP.tools.SelfTesterBase.a(Unknown Source)
        at ru.CryptoPro.JCP.tools.SelfTesterBase.run(Unknown Source)
        at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: ru.CryptoPro.JCP.tools.SelfTesterException: [SelfTester-Crypt] :: [ru.CryptoPro.JCP.tools.SelfTester_JCP] :: SelfTester Error: some test crashed twice in a row, usage of class ru.CryptoPro.JCP.tools.SelfTester_JCP is no longer available!
        at ru.CryptoPro.JCP.tools.SelfTesterBase.checkInternal(Unknown Source)
        at ru.CryptoPro.JCP.tools.SelfTester_JCP.check(Unknown Source)
        at ru.CryptoPro.JCP.tools.SelfTester_JCP.check(Unknown Source)
        at ru.CryptoPro.JCP.Digest.GostDigest.engineDigest(Unknown Source)
        at java.base/java.security.MessageDigest.digest(MessageDigest.java:391)
        at ru.CryptoPro.JCP.tools.JarChecker.a(Unknown Source)
        at ru.CryptoPro.JCP.tools.JarChecker.a(Unknown Source)
        at ru.CryptoPro.JCP.tools.JarChecker.c(Unknown Source)
        at ru.CryptoPro.JCP.tools.JarChecker.checkJARSign(Unknown Source)
        at ru.CryptoPro.JCP.tools.JarChecker.checkURLSign(Unknown Source)
        at ru.CryptoPro.JCP.tools.cl_34.run(Unknown Source)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:554)
        ... 5 more

июн. 10, 2021 3:35:05 PM ru.CryptoPro.ssl.SSLContextImpl engineInit
INFO: SSLContextImpl init.
Exception in thread "main" java.security.KeyManagementException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: CPRandom, provider: JCP, class: ru.CryptoPro.JCP.Random.CPRandom)
        at ru.CryptoPro.ssl.cl_68.d(Unknown Source)
        at ru.CryptoPro.ssl.SSLContextImpl.engineInit(Unknown Source)
        at java.base/javax.net.ssl.SSLContext.init(SSLContext.java:313)
        at ru.rs.registerextract.client.HttpsClient.setSslSetting(HttpsClient.java:102)
        at ru.rs.registerextract.client.HttpsClient.getConnection(HttpsClient.java:31)
        at ru.rs.registerextract.requester.ZakupkiRequester.getFormLinkFromSearch(ZakupkiRequester.java:36)
        at ru.rs.registerextract.controller.Controller.main(Controller.java:78)
Caused by: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: CPRandom, provider: JCP, class: ru.CryptoPro.JCP.Random.CPRandom)
        at java.base/java.security.Provider$Service.newInstance(Provider.java:1900)
        at java.base/sun.security.jca.GetInstance.getInstance(GetInstance.java:236)
        at java.base/sun.security.jca.GetInstance.getInstance(GetInstance.java:206)
        at java.base/java.security.SecureRandom.getInstance(SecureRandom.java:428)
        ... 7 more
Caused by: ru.CryptoPro.JCP.Random.RandomRefuseException
        at ru.CryptoPro.JCP.Random.CertifiedRandom.b(Unknown Source)
        at ru.CryptoPro.JCP.Random.CertifiedRandom.a(Unknown Source)
        at ru.CryptoPro.JCP.Random.CertifiedRandom.<init>(Unknown Source)
        at ru.CryptoPro.JCP.Random.CPRandom.<init>(Unknown Source)
        at ru.CryptoPro.JCP.Random.CPRandom.<init>(Unknown Source)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:64)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
        at java.base/java.security.Provider.newInstanceUtil(Provider.java:177)
        at java.base/java.security.Provider$Service.newInstance(Provider.java:1893)
        ... 10 more
Caused by: ru.CryptoPro.JCP.tools.SelfTesterException: [main] :: [ru.CryptoPro.JCP.tools.SelfTester_JCP] :: SelfTester Error: some test crashed twice in a row, usage of class ru.CryptoPro.JCP.tools.SelfTester_JCP is no longer available!
        at ru.CryptoPro.JCP.tools.SelfTesterBase.checkInternal(Unknown Source)
        at ru.CryptoPro.JCP.tools.SelfTester_JCP.check(Unknown Source)
        at ru.CryptoPro.JCP.tools.SelfTester_JCP.check(Unknown Source)
        ... 22 more

Источник: https://ru.stackoverflow.com/questions/1293883/cryptopro-jcp-%D0%BD%D0%B5-%D1%85%D0%BE%D1%87%D0%B5%D1%82-%D0%B7%D0%B0%D0%BF%D1%83%D1%81%D0%BA%D0%B0%D1%82%D1%8C%D1%81%D1%8F-%D0%B8%D0%B7-jar

Тебе может это понравится...

Добавить комментарий