开发者

How to reference jsse classes in Android?

I am using Eclipse Helios with Android SDK plugin and writing for Android 2.2

I am attempting to write an app the encrypts communication that is sent to a web service, but errors

It fail开发者_运维百科s at

    // wrap with RSA public key
    ObjectInputStream keyIn = new ObjectInputStream(getResource(getFileLocation(PUBLIC_KEY, localTest)));
    Key publicKey = (Key) keyIn.readObject();
    keyIn.close();

with error in console...

java.lang.ClassNotFoundException: com.sun.net.ssl.internal.ssl.JSA_RSAPublicKey

which is a class in the jsse.jar file. If I attempt to include the jsse.jar file in the build path, I get a warning error and complaining by the compiler.

" trouble processing "javax/net/ServerSocketFactory.class":"

How does one reference this library or reference the core android's library correctly?

FYI, this works ok as a Java app but not in the Android module.


A lot of Android's libraries are custom versions of already existing ones, also javax is meant more for servers.

Try looking at encryption API's such as BouncyCastles.

If you're using an older version of Android, there is already a bit of bouncycastle in there but for newer versions like the one you're using, I'd recommend importing one of theirs.


Ok as soon as I posted my last comment, I realized the issue might be in the JRE that developed the keys. Thus, I had to recreate the keys using JRE 1.5 because the Android system is using at least JRE 1.5. That seems to have worked!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜