Spongycastle is missing many algorithms when loade

2019-06-04 04:20发布

In this stackoverflow answer you can see a code to print all available providers and corresponding algorithms: How to find out what algorithm [ encryption ] are supported by my JVM?

I am using latest version of spongycastle and when I ask to get the algorithms of Spongycastle ("SC") on android I get only a handful of algorithm. In fact I get this very limited list:

provider: SC
algorithm: PBEWITHMD5ANDDES
algorithm: PBEWITHSHA256AND192BITAES-CBC-BC
algorithm: OLDHMACSHA384
algorithm: PBEWITHHMACSHA
algorithm: PBEWITHMD5ANDDES
algorithm: PKCS12PBE
algorithm: PBEWITHSHAAND128BITAES-CBC-BC
algorithm: IES
algorithm: PKIX
algorithm: RFC3280
algorithm: ISO9797ALG3MAC
algorithm: PBEWITHHMACSHA1
algorithm: CERTIFICATE
algorithm: PBEWITHSHAAND40BITRC2-CBC
algorithm: PBEWITHSHA1ANDDES
algorithm: PBEWITHMD5AND256BITA

On the other hand, when I ask to get the algos of SC on my linux machine I get a lot more algorithms. I haven't counted them but it is a list 10 times longer that the once you see above.

Where all the rest of the algorithms have gone ??

Because this project is not a typical android-java project but an Android-Scala project I have to use Proguard on every execution. Does this plays any role for the missing algorithms or is it something else?

Note1: I am using SC to generate a keypair, encrypt and decrypt with OpenPGP

Note2: Source code is tested to work perfectly on linux machine using OpenJDK-6, RSA algorithm for public key encryption and BLOWFISH algorithm as the random symmetric key

1条回答
成全新的幸福
2楼-- · 2019-06-04 04:51

You may need to include the SpongyCastle OpenPGP API jar, so check you're including that:

http://rtyley.github.com/spongycastle/#downloads

Other than that, a ProGuard configuration issue would be the obvious contender. Try specifying something like this in your proguard config file:

-keep class org.spongycastle.**
查看更多
登录 后发表回答