【问题标题】:how to generate libssl.so and libcrypto.so from openSSL using encryption and decryption using JNI如何使用 JNI 加密和解密从 openSSL 生成 libssl.so 和 libcrypto.so
【发布时间】:2015-02-04 09:05:21
【问题描述】:

我想使用 libssl.so 和 libcrypto.so 在 Android 中使用 JNI 对文件进行加密和解密。但是,我无法从开放 SSL 中获取这两个库。那么,如何获得这两个库请帮助我。

我从https://github.com/guardianproject/openssl-android 下载了openSSL Guardian 项目。将此打开的 SSL 项目添加到我的小型 Android 应用程序中后。我构建了那个项目,但我没有找到任何 libssl.so 和 libcrypto.so 库。所以,请帮助我如何构建 libssl.so 和 libcrytpo.so,以便我可以继续在 Android 中使用 JNI 进行加密和解密。

【问题讨论】:

标签: android android-ndk openssl java-native-interface ndk-build


【解决方案1】:

我认为您想确保获得所需的 openssl 版本,这就是您尝试自己编译它的原因。

一般来说,编译一个通常构建在比 Android 更“正常”的 linux 变体上的 Android 项目可能需要摆弄。看来openssl的人在这里有一套说明:

http://wiki.openssl.org/index.php/Android

首先,您需要获得一个合适的 Android NDK 并为您要部署的设备类型创建一个独立的工具链。上面的 wiki 页面似乎有使用这样的工具链编译 openssl 的说明,例如,设置 CC=[gcc-version-from-your-toolchain] 等。

从您的帖子中很难说出您究竟为什么需要这样做,我同意 EJP 的评论,即根据您的需要,可能有比自己编译新版本的 openssl 更简单的方法。

【讨论】:

    猜你喜欢
    • 2019-04-29
    • 1970-01-01
    • 1970-01-01
    • 2022-11-25
    • 2014-02-17
    • 1970-01-01
    • 1970-01-01
    • 2010-11-03
    • 1970-01-01
    相关资源
    最近更新 更多