To resolve issue
java.security.InvalidKeyException: No installed provider supports this key:
sun.security.rsa.RSAPrivateCrtKeyImpl
Tried with the url <to uri="crypto:sign://basic?privateKey=#myPrivateKey" />
but that doesn't worked.
Then changed the url to
.to("crypto:sign://provider?privateKey=#myPrivateKey&provider=SUN")
which worked up to some extent but thrown the below error.
*java.security.InvalidKeyException: not a DSA private key: Sun RSA private
CRT key, 2048 bits*
Any suggestion/direction guys what I suppose to try.
Tried with below option not worked.
<to
uri="crypto:sign://rsa?algorithm=MD5withRSA&privateKey=#rsaPrivateKey"
/>
<to uri="crypto:sign://rsa?algorithm=
SHA1withRSA&privateKey=#rsaPrivateKey" />
This is what did the trick
keyPair = getKeyPair("RSA");
PrivateKey privateKey = keyPair.getPrivate();
PublicKey publicKey = keyPair.getPublic();
CamelContext context = getContext();
// we can set the keys explicitly on the endpoint instances.
context.getEndpoint("crypto:sign://rsa?algorithm=SHA1withRSA",
DigitalSignatureEndpoint.class).setPrivateKey(privateKey);
context.getEndpoint("crypto:verify://rsa?algorithm=SHA1withRSA",
DigitalSignatureEndpoint.class).setPublicKey(publicKey);
from("direct:sign")
.log("Signing message")
.to("crypto:sign://rsa?algorithm=SHA1withRSA")
Anybody know how to see the signed message.?
--
View this message in context:
http://camel.465427.n5.nabble.com/Issue-with-Camel-Crypto-Signing-tp5764289p5764380.html
Sent from the Camel - Users mailing list archive at Nabble.com.