Java >> Programma Java >  >> Java

java.security.NoSuchAlgorithmException:firma RSA non disponibile

Se esegui il codice seguente, otterrai un elenco di algoritmi di firma supportati dalla tua installazione Java.

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);

Quando lo eseguo (Windows, Java 1.8.0_65), ottengo:

MD2withRSA
MD5andSHA1withRSA
MD5withRSA
NONEwithDSA
NONEwithECDSA
NONEwithRSA
SHA1withDSA
SHA1withECDSA
SHA1withRSA
SHA224withDSA
SHA224withECDSA
SHA224withRSA
SHA256withDSA
SHA256withECDSA
SHA256withRSA
SHA384withECDSA
SHA384withRSA
SHA512withECDSA
SHA512withRSA

Come puoi vedere, RSA non è un algoritmo di firma valido.
Forse NONEwithRSA è quello che stai cercando?


Si prega di fare sempre riferimento alla documentazione

Documentazione


Etichetta Java