我怎么知道我是从jar中使用Bouncy Castle还是在Android中实现的? [英] How I know if I using Bouncy Castle from jar or the one implemented in Android?

查看:132
本文介绍了我怎么知道我是从jar中使用Bouncy Castle还是在Android中实现的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么知道我是从jar中使用Bouncy Castle还是在Android中实现的?我已经从 https://www.bouncycastle.org/latest_releases.html 下载并添加了jar到我的Android Studio项目.如何检查我是否正在使用它(我下载的那个)?

How I know if I using Bouncy Castle from jar or the one implemented in Android? I've downloaded from https://www.bouncycastle.org/latest_releases.html and add jar to my Android Studio project. How can I check if I am using it (The one I downloaded)?

推荐答案

对于至少最后几个版本,Android通过将它们使用的bouncycastle类重命名为com.android.**来解决了名称空间冲突.我不确定何时发生,但查看源代码存储库,网址为 https://android.googlesource.com/platform/external/bouncycastle/+refs 建议从Ice Cream Sandwich(API级别14)开始进行更改.

For at least the last several versions Android has fixed the namespace conflict by renaming the bouncycastle classes they use to com.android.**. I'm not exactly sure when this occurred, but looking at the source code repository at https://android.googlesource.com/platform/external/bouncycastle/+refs suggests the change happened starting with Ice Cream Sandwich -- API level 14.

我不确定他们如何处理基于字符串的提供程序查找,例如 Cipher.getInstance("AES/GCM/PKCS5PADDING","BC").但是,JCE中的每个 getInstance()方法也都有一个版本,您可以在其中明确指定Provider类,例如 Cipher.getInstance("AES/GCM/PKCS5PADDING",新的org.bouncycastle.jce.provider.BouncyCastleProvider())消除了任何歧义.

I'm not sure what they did about the string-based provider lookups, e.g. Cipher.getInstance("AES/GCM/PKCS5PADDING", "BC"). However, every getInstance() method in the JCE also has a version where you can explicitly specify the Provider class, e.g. Cipher.getInstance("AES/GCM/PKCS5PADDING", new org.bouncycastle.jce.provider.BouncyCastleProvider()) which eliminates any ambiguity.

这篇关于我怎么知道我是从jar中使用Bouncy Castle还是在Android中实现的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆