Spongycastle is missing many algorithms when loaded on android

耗尽温柔 提交于 2019-12-08 02:05:50

问题


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:


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.**


来源:https://stackoverflow.com/questions/15706536/spongycastle-is-missing-many-algorithms-when-loaded-on-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!