如何添加BouncyCastle的算法到Android [英] how to add bouncycastle algorithm to android

查看:5205
本文介绍了如何添加BouncyCastle的算法到Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图写一个小的应用程序中使用BouncyCastle的算法,从<一个href="http://www.google.com/$c$csearch/p?hl=en#atE6BTe41-M/libcore/security/src/main/java/org/bouncycastle/jce/provider/BouncyCastleProvider.java&q=package%3aandroid%20blowfish%20lang%3ajava&d=9&t=0&l=205"相对=nofollow> BouncyCastleProvider.java 的,它说我们有进口和运行过程中通过以下code添加提供程序

I am trying to write a small application using bouncycastle algorithm, from the BouncyCastleProvider.java it says we have to import and add the provider during runtime by the following code

进口org.bouncycastle.jce.provider.BouncyCastleProvider; Security.addProvider(新BouncyCastleProvider());

错误 - 进口org.bouncycastle不能得到解决;在导入过程中 错误 - BouncyCastleProvider不能被解析为一个类型;调用addProvider当

error - The import org.bouncycastle cannot be resolved; during import error - BouncyCastleProvider cannot be resolved to a type; when calling addProvider

我虽然BouncyCastle的不提供的Andr​​oid 1.6 SDK,所以想单独安装的。我应该怎么办呢? 如果BouncyCastle的与SDK运以来,我应该怎么做才能避免这些错误? 我使用在WinXP的Andr​​oid 1.6,日食V3.4.0。 在此先感谢

I though bouncycastle is not provided with the Android 1.6 SDK, so thought of installing separately. how should i do this? If Bouncycastle is shipped along with SDK, what should i do to avoid these errors? I am using Android 1.6, eclipse-V3.4.0 on winXP . Thanks in advance

推荐答案

我不熟悉这个特定库。但是,这里有关于如何将传递一个'罐子'文件到Android项目库的一般说明。

I'm not familiar with this particular library. However, here are general instructions on how to include a library delivered as a 'jar' file into an Android project.

下载jar文件,并把它放在你的工作站上。您可能要放在项目的根目录下,您将可以在根目录的'lib'目录中安装它,或者。

Download the jar file and put it somewhere on your workstation. You may want to put in the root directory of the project your are installing it in, or maybe in a 'lib' directory in the root.

在Eclipse中,选择项目 - >属性,然后选择Java Build Path。然后单击添加外部JAR,浏览到你把.jar文件,选中它并点击打开。

In Eclipse, select Project->Properties, then select Java Build Path. Then click Add External Jars, navigate to where you put the .jar file, select it and click Open.

现在输入或粘贴一些code,试图使用的类在罐子。如果你是幸运的一个灯泡图标将出现在左边缘。单击该按钮将提示您正确的import语句添加到您的.java文件的顶端。

Now type or paste some code that attempts to use the classes in the jar. If you are lucky a light bulb icon will appear in the left margin. Clicking on this will prompt you to add the correct Import statement to the top of your .java file.

还有事情可以去错在这一点上。图书馆可利用的Java。*或使用javax。*的内容不是由机器人提供的(它有这些库的子集)。此外,它可以具有其自己的附加的库的依赖关系。还有其他原因导致的.jar可能与Android平台兼容。

There are still things that can go wrong at this point. The library may make use of java.* or javax.* content not supplied by Android (it has just a subset of these libraries). Also it may have additional library dependencies of its own. There are other reasons why the .jar may not be compatible with the Android platform.

另请注意,它会增加你的apk的大小,以适应新的内容。

Note also that it will increase the size of your .apk to accommodate the new content.

这篇关于如何添加BouncyCastle的算法到Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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