this is exception
Exception in thread \"main\" java.security.NoSuchAlgorithmException: RSA Signature not available at java.security.Signature.getInstance(Signatu
If you run the following code, you will get a list of signature algorithms supported by your Java installation.
TreeSet<String> algorithms = new TreeSet<>();
for (Provider provider : Security.getProviders())
for (Service service : provider.getServices())
if (service.getType().equals("Signature"))
algorithms.add(service.getAlgorithm());
for (String algorithm : algorithms)
System.out.println(algorithm);
When I run it (Windows, Java 1.8.0_65), I get:
MD2withRSA
MD5andSHA1withRSA
MD5withRSA
NONEwithDSA
NONEwithECDSA
NONEwithRSA
SHA1withDSA
SHA1withECDSA
SHA1withRSA
SHA224withDSA
SHA224withECDSA
SHA224withRSA
SHA256withDSA
SHA256withECDSA
SHA256withRSA
SHA384withECDSA
SHA384withRSA
SHA512withECDSA
SHA512withRSA
As you can see, RSA
is not a valid signature algorithm.
Maybe NONEwithRSA
is what you're after?
Specify a valid algorithm. The hash algorithm needs to be specified. For example, SHA256withRSA
.
I've checked the algorithms supported by java versions(1.7) & (1.8) in my machine. One of my project runs on jdk 1.7.0_80, which doesn't support SHA224withRSA algorithm, if you're in same situation then upgrade to newer version of java atleast to (Java SE 7 Update 131)as I've read it should have similar algorithms as java 8. If no option to update java then try adding org.bouncycastle bcprov-jdk15on maven dependency in pom or a jar file to your project & also in java code add where you build SSLContext/HttpClient include below line:
Security.addProvider(new BouncyCastleProvider());
Also tried installing Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 7, but it hasn't worked !!
Please always refer to the documentation
Documentation