Статус: Новичок
Группы: Участники
Зарегистрирован: 12.08.2022(UTC) Сообщений: 1
|
Коллеги, привет! Подскажите пожалуйста почему падает тестовый код? Пример взят из документации Код:
Security.addProvider(new JCP());
Security.addProvider(new Provider());
try {
String certPath = "/Users/alexivo/Downloads/root2.cer";
KeyStore ks = KeyStore.getInstance(JCP.CERT_STORE_NAME);
ks.load(null, null);
CertificateFactory cf = CertificateFactory.getInstance("X509");
FileOutputStream fos = null;
FileInputStream fis = new FileInputStream(certPath);
java.security.cert.Certificate cert = cf.generateCertificate(new
BufferedInputStream(fis));
ks.setCertificateEntry("certificate", cert);
fos = new FileOutputStream("/Users/alexivo/trust");
ks.store(fos, "123".toCharArray());
fos.close();
System.setProperty("javax.net.ssl.trustStoreType", JCP.CERT_STORE_NAME);
System.setProperty("javax.net.ssl.trustStore", "/Users/alexivo/trust");
System.setProperty("javax.net.ssl.trustStorePassword", "123");
String CA20_ADDRESS = "https://testca2012.cryptopro.ru/ui";
Certificate[] rootCerts = CA20GostCertificateRequest.getRootCertList(CA20_ADDRESS);
} catch (Exception e) {
e.printStackTrace();
}
}
StackTrace: Код:
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.pref.JCPPref getOID
CONFIG: User Preference Node: /ru/CryptoPro/JCP/params.DigestParamsSpec_class_default=null
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.pref.JCPPref getOID
CONFIG: User Preference Node: /ru/CryptoPro/JCP/params.DigestParamsSpec_2012_256_class_default=null
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.pref.JCPPref getOID
CONFIG: User Preference Node: /ru/CryptoPro/JCP/params.DigestParamsSpec_2012_512_class_default=null
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.pref.JCPPref getOID
CONFIG: User Preference Node: /ru/CryptoPro/JCP/params.AlgIdSpec_class_default=null
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.pref.JCPPref getOID
CONFIG: User Preference Node: /ru/CryptoPro/JCP/params.AlgIdSpec_class_defaultDH=null
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.pref.JCPPref getOID
CONFIG: User Preference Node: /ru/CryptoPro/JCP/params.AlgIdSpec_2012_256_class_default=null
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.pref.JCPPref getOID
CONFIG: User Preference Node: /ru/CryptoPro/JCP/params.AlgIdSpec_2012_256_dh_class_defaultDH=null
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.pref.JCPPref getOID
CONFIG: User Preference Node: /ru/CryptoPro/JCP/params.AlgIdSpec_2012_512_class_default=null
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.pref.JCPPref getOID
CONFIG: User Preference Node: /ru/CryptoPro/JCP/params.AlgIdSpec_2012_512_dh_class_defaultDH=null
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.KeyStore.Rutoken.RutokenReader <init>
FINE: Reader name is null
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.KeyStore.Rutoken.RutokenStore <init>
FINE: RutokenStore (000) loaded. Store name null
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.KeyStore.Rutoken.RutokenReader <init>
FINE: Reader name is null
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.KeyStore.Rutoken.RutokenStore <init>
FINE: RutokenStore (001) loaded. Store name null
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.KeyStore.Rutoken.RutokenReader <init>
FINE: Reader name is null
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.KeyStore.Rutoken.RutokenStore <init>
FINE: RutokenStore (002) loaded. Store name null
авг. 19, 2023 1:59:08 AM ru.CryptoPro.ssl.Provider b
INFO: JCP license isServer: true
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.Key.GostKeyFactory engineGeneratePublic
FINER: ENTRY
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.pref.JCPPref getBoolean
CONFIG: User Preference Node: /ru/CryptoPro/JCP/tools/Control.StrengthenedKeyUsageControl=false
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.pref.JCPPref getOID
CONFIG: User Preference Node: /ru/CryptoPro/JCP/params.EllipticParamsSpecDH_class_defaultDH=null
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.pref.JCPPref getOID
CONFIG: User Preference Node: /ru/CryptoPro/JCP/params.EllipticParamsSpecDH_2012_256_class_defaultDH=null
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.pref.JCPPref getOID
CONFIG: User Preference Node: /ru/CryptoPro/JCP/params.EllipticParamsSpec_class_defaultECC=null
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.pref.JCPPref getOID
CONFIG: User Preference Node: /ru/CryptoPro/JCP/params.EllipticParamsSpec_2012_256_class_defaultECC=null
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.pref.JCPPref getOID
CONFIG: User Preference Node: /ru/CryptoPro/JCP/params.CryptParamsSpec_class_default=null
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.pref.JCPPref getOID
CONFIG: User Preference Node: /ru/CryptoPro/JCP/params.CryptParamsSpec_2012_256_class_default=null
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.pref.JCPPref getOID
CONFIG: User Preference Node: /ru/CryptoPro/JCP/params.CryptParamsSpec_2012_512_class_default=null
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.Key.GostKeyFactory engineGeneratePublic
FINER: RETURN
авг. 19, 2023 1:59:08 AM jdk.internal.event.EventHelper logX509CertificateEvent
FINE: X509Certificate: Alg:1.2.643.7.1.1.3.2, Serial:49831b60025afd3a24b058f5b83cba5e5, Subject:CN="Тестовый головной УЦ ООО \"КРИПТО-ПРО\" ГОСТ 2012 (УЦ 2.0)", O="ООО \"КРИПТО-ПРО\"", STREET=ул. Сущёвский вал д. 18, L=Москва, ST=77 Москва, OID.1.2.643.100.1=#120D31303337373030303835343434, EMAILADDRESS=info@cryptopro.ru, OID.1.2.643.100.4=#120A37373137313037393931, C=RU, Issuer:CN="Тестовый головной УЦ ООО \"КРИПТО-ПРО\" ГОСТ 2012 (УЦ 2.0)", O="ООО \"КРИПТО-ПРО\"", STREET=ул. Сущёвский вал д. 18, L=Москва, ST=77 Москва, OID.1.2.643.100.1=#120D31303337373030303835343434, EMAILADDRESS=info@cryptopro.ru, OID.1.2.643.100.4=#120A37373137313037393931, C=RU, Key type:GOST3410_2012_256, Length:-1, Cert Id:-1429451750, Valid from:05.10.2022, 18:53, Valid until:05.10.2037, 18:53
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.pref.JCPPref getBoolean
CONFIG: User Preference Node: /ru/CryptoPro/JCP/Random.CertifiedRandom_class_RequirePhysical=true
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.tools.SelfTesterBase <init>
FINE: [main] :: [ru.CryptoPro.JCP.tools.SelfTester_JCP] :: SelfTester constructor.
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.pref.JCPPref get
CONFIG: User Preference Node: /ru/CryptoPro/JCP/tools.SelfTester_jar_classes_jcp25=null
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.tools.SelfTesterBase a
FINE: [main] :: [ru.CryptoPro.JCP.tools.SelfTester_JCP] :: initiating of jar list...
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.tools.SelfTesterBase a
FINE: [main] :: [ru.CryptoPro.JCP.tools.SelfTester_JCP] :: jar classes: ru.CryptoPro.JCP.JCP
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.tools.SelfTesterBase a
FINE: [main] :: [ru.CryptoPro.JCP.tools.SelfTester_JCP] :: getting class url for class name: ru.CryptoPro.JCP.JCP
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.tools.SelfTesterBase a
FINE: [main] :: [ru.CryptoPro.JCP.tools.SelfTester_JCP] :: jar file:/Users/alexivo/.m2/repository/ru/cryptopro/jcp/jcp-jcp/5.0.42119-A/jcp-jcp-5.0.42119-A.jar has been added to self-tester.
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.tools.SelfTesterBase a
FINE: [main] :: [ru.CryptoPro.JCP.tools.SelfTester_JCP] :: initiating of jar list completed.
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.tools.SelfTesterBase b
FINE: [main] :: [ru.CryptoPro.JCP.tools.SelfTester_JCP] :: building of test list...
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.pref.JCPPref get
CONFIG: User Preference Node: /ru/CryptoPro/JCP/tools.SelfTester_external_classNames_jcp25=null
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.tools.SelfTesterBase b
FINE: [main] :: [ru.CryptoPro.JCP.tools.SelfTester_JCP] :: building of test list completed.
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.tools.SelfTesterBase a
FINE: [main] :: [ru.CryptoPro.JCP.tools.SelfTester_JCP] :: initiating...
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.tools.SelfTesterBase a
FINE: [main] :: [ru.CryptoPro.JCP.tools.SelfTester_JCP] :: initiating completed.
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.tools.SelfTesterBase <init>
FINE: [main] :: [ru.CryptoPro.JCP.tools.SelfTester_JCP] :: SelfTester constructor OK.
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.tools.SelfTesterBase b
FINE: [main] :: [ru.CryptoPro.JCP.tools.SelfTester_JCP] :: starting tester thread...
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.tools.SelfTesterBase run
FINE: [SelfTester-JCP] :: [ru.CryptoPro.JCP.tools.SelfTester_JCP] :: SelfTester run.
авг. 19, 2023 1:59:08 AM ru.CryptoPro.JCP.pref.JCPPref get
CONFIG: User Preference Node: /ru/CryptoPro/JCP/tools.UnixMutex_class_pathToLocks=/var/opt/cprocsp/tmp
авг. 19, 2023 1:59:09 AM ru.CryptoPro.JCPRequest.pc_0.cl_3 a
FINE: Submit request (GET).
авг. 19, 2023 1:59:09 AM sun.net.www.protocol.http.HttpURLConnection plainConnect0
FINEST: ProxySelector Request for https://testca2012.cryptopro.ru/ui/api/cacertificate
авг. 19, 2023 1:59:09 AM sun.net.www.protocol.https.HttpsClient New
FINEST: Looking for HttpClient for URL https://testca2012.cryptopro.ru/ui/api/cacertificate and proxy value of DIRECT
авг. 19, 2023 1:59:09 AM sun.net.www.protocol.https.HttpsClient <init>
FINEST: Creating new HttpsClient with url:https://testca2012.cryptopro.ru/ui/api/cacertificate and proxy:DIRECT with connect timeout:-1
авг. 19, 2023 1:59:09 AM ru.CryptoPro.JCP.pref.JCPPref getOID
CONFIG: User Preference Node: /ru/CryptoPro/JCP/params.EllipticParamsSpecDH2012_512_class_defaultECC2012=null
авг. 19, 2023 1:59:09 AM ru.CryptoPro.JCP.pref.JCPPref getOID
CONFIG: User Preference Node: /ru/CryptoPro/JCP/params.EllipticParamsSpec2012_512_class_defaultECC2012=null
авг. 19, 2023 1:59:09 AM sun.net.www.protocol.http.HttpURLConnection plainConnect0
FINEST: Proxy used: DIRECT
авг. 19, 2023 1:59:09 AM ru.CryptoPro.JCP.pref.JCPPref getInt
CONFIG: User Preference Node: /ru/CryptoPro/JCP/tools/CPVerify.DigestStoreDefaultCPVerify_class_WhatRepositoryKeyName=-1
авг. 19, 2023 1:59:09 AM ru.CryptoPro.JCP.pref.JCPPref getInt
CONFIG: User Preference Node: /ru/CryptoPro/JCP/tools/CPVerify.DigestStoreDefaultCPVerify_class_WhatRepositoryKeyName=-1
java.net.SocketException: Connection reset
at java.base/java.net.SocketInputStream.read(SocketInputStream.java:186)
at java.base/java.net.SocketInputStream.read(SocketInputStream.java:140)
at java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:484)
at java.base/sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:478)
at java.base/sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:160)
at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:111)
at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1511)
at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1421)
at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:456)
at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:427)
at java.base/sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:572)
at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:201)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1592)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520)
at java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:527)
at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:334)
at ru.CryptoPro.JCPRequest.pc_0.cl_3.f(Unknown Source)
at ru.CryptoPro.JCPRequest.pc_0.cl_0.a(Unknown Source)
at ru.CryptoPro.JCPRequest.pc_0.cl_3.a(Unknown Source)
at ru.CryptoPro.JCPRequest.GostCertificateRequest.httpGetFile(Unknown Source)
at ru.CryptoPro.JCPRequest.GostCertificateRequest.httpGetFile(Unknown Source)
at ru.CryptoPro.JCPRequest.ca15.request.CA15RootRequest.getRootCertList(Unknown Source)
at ru.CryptoPro.JCPRequest.ca20.request.CA20GostCertificateRequest.getRootCertList(Unknown Source)
at com.alexivo.Main.testGetRootCertList(Main.java:85)
at com.alexivo.Main.main(Main.java:18)
|