Автор: Евгений Афанасьев Здравствуйте.
1. Приведите полный стек ошибки. Какая задача выполняется с помощью данного ключа?
2. В некоторых случаях ключ подписи использовать нельзя. С каким алгоритмом вы генерите ключ? Приведите команду.
1.
ru.CryptoPro.CAdES.exception.EnvelopedException: Decoding of encrypted context into stream failed
at ru.CryptoPro.CAdES.EnvelopedSignature.a(Unknown Source)
at ru.CryptoPro.CAdES.EnvelopedSignature.decrypt(Unknown Source)
at ru.CryptoPro.CAdES.EnvelopedSignature.decrypt(Unknown Source)
at ru.xxxxxxx.CryptControl.decrypt(CryptControl.java:84)
at ru.xxxxxxx.CryptControl_ClientProxy.decrypt(Unknown Source)
at ru.xxxxxxx.CryptoResource.decrypt(CryptoResource.java:102)
at ru.xxxxxxx.CryptoResource$quarkusrestinvoker$decrypt_3ae74519d2fa6b211f434de54f0e3e950ce9ae57.invoke(Unknown Source)
at org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:29)
at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:141)
at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:145)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:576)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: ru.CryptoPro.CAdES.exception.EnvelopedException: Input cipher initiation failed
at ru.CryptoPro.CAdES.pc_1.pc_1.cl_0.<init>(Unknown Source)
at ru.CryptoPro.CAdES.pc_1.pc_1.cl_2.getRecipientOperator(Unknown Source)
at org.bouncycastle.cms.KeyTransRecipientInformation.getRecipientOperator(Unknown Source)
at org.bouncycastle.cms.RecipientInformation.getContentStream(Unknown Source)
... 17 more
Caused by: java.security.InvalidKeyException: Signature key is not allowed for this operation.
at ru.CryptoPro.Crypto.Cipher.TransportCipher.engineInit(Unknown Source)
at java.base/javax.crypto.Cipher.init(Cipher.java:1296)
at java.base/javax.crypto.Cipher.init(Cipher.java:1236)
... 21 more
2.
keytool -J-Dkeytool.compat=true -J-Duse.cert.stub=true \
-providerpath JCP.jar:ASN1P.jar:asn1rt.jar:forms_rt.jar \
-genkey -alias myKey
-keysize 512 \
-provider ru.CryptoPro.JCP.JCP \
-keypass 123456 \
-storetype HDImageStore \
-dname CN=MY_Test,O=CryptoPro,C=RU \
-keystore NONE \
-storepass 1234 \
-keyalg GOST3410_2012_256 \
-sigalg GOST3411_2012_256withGOST3410_2012_256
-ext KeyUsage=digitalSignature,nonRepudiation,keyEncipherment,dataEncipherment