How to include the Spongy Castle JAR in Android?(如何在 Android 中包含 Spongy Castle JAR?)
问题描述
显然 Spongy Castle 是使用完整版 Bouncy Castle 的 Android 替代方案.
Apparently Spongy Castle is the Android alternative to using a full version of Bouncy Castle.
但是,在导入 jar 时,我遇到了各种无法解决"的错误,因为它依赖于 Android 未包含的包,主要是 javax.mail、javax.activation 和 javax.awt.datatransfer.
However, on importing the jar I'm getting all kinds of "cannot be resolved" errors because it relies on packages not included with Android, primarily javax.mail, javax.activation, and javax.awt.datatransfer.
那么解决这个问题的最佳方法是什么?这个问题的回复和 这个 表示根本不应该使用这些包,并且 这个热门问题 甚至没有考虑找到让 AWT 恢复的方法.那么海绵城堡是如何依赖他们的呢?人们在使用海绵城堡,对吧?
So what's the best way around this? Responses to this question and this indicate those packages shouldn't be used at all, and this popular question doesn't even consider finding a way to get AWT back. So how is Spongy Castle relying on them? People are using Spongy Castle, right?
推荐答案
下面是两个非常简单的示例,说明如何在项目中包含 Spongy Castle:
These are two very simple examples of how to include Spongy Castle in a project:
- github.com/rtyley/spongycastle-eclipse - Eclipse
- github.com/rtyley/toy-android-ssh-agent -专家
- github.com/rtyley/spongycastle-eclipse - Eclipse
- github.com/rtyley/toy-android-ssh-agent - Maven
自 v1.47 起,Spongy Castle 已被拆分为单独的子 jar,这些子 jar 完全反映了匹配的 Bouncy Castle 工件(例如 sc-light-jdk15on.jar
、scpg-jdk15on.jar
等),重要的是要确保您包含所有您正在做的事情所需的 Spongy Castle 罐子.
Since v1.47, Spongy Castle has been split into separate sub-jars that exactly mirror the matching Bouncy Castle artifacts (eg sc-light-jdk15on.jar
, scpg-jdk15on.jar
, etc), and it is important to ensure you include all the Spongy Castle jars required for what you're doing.
有关依赖项的完整信息可以在以下位置找到:
Full information on dependencies can be found at:
http://rtyley.github.com/spongycastle/#downloads
您至少需要 sc-light-jdk15on.jar
(基础轻量级 API 实现),可能还需要 scprov-jdk15on.jar
(JCE 轻量级 API 的包装).如果您使用的是 Maven,那么所有这些依赖管理的东西都会为您处理好.
At minimum you'll need the sc-light-jdk15on.jar
(the base lightweight-API implementation) and probably scprov-jdk15on.jar
(the JCE wrapper around the lightweight-API). If you're using Maven then all this dependency-management stuff is taken care of for you.
您在 javax.mail
、javax.activation
等上描述的有问题的依赖项表明您可能选择了不正确的 jar(例如every-single-library-组件一,而不是核心提供者"一) - 因为 scprov-jdk15on
jar 绝对 没有 有任何这些奇怪的依赖项,并且在 Android 上运行愉快.
The problematic dependencies you describe on javax.mail
, javax.activation
, etc, indicate that you might have chosen an incorrect jar (e.g. the every-single-library-component one, rather than the 'core provider' one) - as the scprov-jdk15on
jar definitely doesn't have any of those weird dependencies, and runs happily on Android.
(免责声明,我是 Spongy Castle 的维护者,但我也收到了很多其他用户的成功报告!)
(disclaimer, I'm the maintainer of Spongy Castle, but I've had plenty of success reports from other users too!)
这篇关于如何在 Android 中包含 Spongy Castle JAR?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 Android 中包含 Spongy Castle JAR?


- Java包名称中单词分隔符的约定是什么? 2022-01-01
- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01
- Jersey REST 客户端:发布多部分数据 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01
- 将log4j 1.2配置转换为log4j 2配置 2022-01-01