我需要一些幫助。我正在編寫應用程序,需要使用「PBKDF2WithHmacSHA1」算法(不能更改服務器端)。但這不工作在Android(不支持),但後來我在eclipse中創建android-maven項目,它在薑餅和最新的工作正常。但在Froyo不。我嘗試添加具有該算法但沒有任何內容的安全提供程序我可以在avaylable列表中看到它,但無法獲取它的實例。我的事件嘗試spoungycastle(重新編譯的bouncecastle),SunJCE。也許你有同樣的建議如何解決它? o一些workaroud?如何添加PBKDF2WithHmacSHA1 for android api 8(Froyo)
在這一行我得到錯誤
SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
錯誤:
W/System.err(1225): java.security.NoSuchAlgorithmException: SecretKeyFactory PBKDF2WithHmacSHA1 implementation not found:
W/System.err(1225): at java.security.Provider$Service.newInstance(Provider.java:1100)
W/System.err(1225): at org.apache.harmony.security.fortress.Engine.getInstance(Engine.java:112)
W/System.err(1225): at javax.crypto.SecretKeyFactory.getInstance(SecretKeyFactory.java:111)
W/System.err(1225): at com.ii.app.AppActivity.onCreate(AppActivity.java:46)
W/System.err(1225): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
W/System.err(1225): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
W/System.err(1225): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
W/System.err(1225): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
W/System.err(1225): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
W/System.err(1225): at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err(1225): at android.os.Looper.loop(Looper.java:123)
W/System.err(1225): at android.app.ActivityThread.main(ActivityThread.java:4627)
W/System.err(1225): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err(1225): at java.lang.reflect.Method.invoke(Method.java:521)
W/System.err(1225): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
W/System.err(1225): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
W/System.err(1225): at dalvik.system.NativeStart.main(Native Method)
W/System.err(1225): Caused by: java.lang.NullPointerException
W/System.err(1225): at com.sun.crypto.provider.SunJCE$2.run(DashoA13*..)
W/System.err(1225): at java.security.AccessController.doPrivilegedImpl(AccessController.java:264)
W/System.err(1225): at java.security.AccessController.doPrivileged(AccessController.java:84)
W/System.err(1225): at com.sun.crypto.provider.SunJCE.c(DashoA13*..)
W/System.err(1225): at com.sun.crypto.provider.SunJCE.b(DashoA13*..)
W/System.err(1225): at com.sun.crypto.provider.PBKDF2HmacSHA1Factory.<init>(DashoA13*..)
W/System.err(1225): at java.lang.Class.newInstanceImpl(Native Method)
W/System.err(1225): at java.lang.Class.newInstance(Class.java:1429)
W/System.err(1225): at java.security.Provider$Service.newInstance(Provider.java:1098)
W/System.err(1225): ... 16 more
任何運氣在這,我也有同樣的錯誤? –