Open krisidmisso opened 6 years ago
The demo is still WIP, sorry for that. The keys in the demo does not correspond. It was a test that I made. Next week will update the docs and demo.
@tomvardasca Tried with a different Private Key and Public Key getting the following error while decrypting RSA
ERROR Error: java.security.spec.InvalidKeySpecException: java.lang.RuntimeException: error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag JS: com.android.org.conscrypt.OpenSSLKey.getPrivateKey(OpenSSLKey.java:180) JS: com.android.org.conscrypt.OpenSSLRSAKeyFactory.engineGeneratePrivate(OpenSSLRSAKeyFactory.java:64) JS: java.security.KeyFactory.generatePrivate(KeyFactory.java:187) JS: com.tns.Runtime.callJSMethodNative(Native Method) JS: com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1116) JS: com.tns.Runtime.callJSMethodImpl(Runtime.java:996) JS: com.tns.Runtime.callJSMethod(Runtime.java:983) JS: com.tns.Runtime.callJSMethod(Runtime.java:967) JS: com.tns.Runtime.callJSMethod(Runtime.java:959)
I get this error when trying to decode an encrypted message (used the same code in your demo(even the pub and priv keys)):
JS: ERROR Error: javax.crypto.BadPaddingException: data hash wrong JS: com.android.org.bouncycastle.jcajce.provider.asymmetric.rsa.CipherSpi.en gineDoFinal(CipherSpi.java:476) JS: javax.crypto.Cipher.doFinal(Cipher.java:1340) JS: com.tns.Runtime.callJSMethodNative(Native Method) JS: com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1084) JS: com.tns.Runtime.callJSMethodImpl(Runtime.java:966) JS: com.tns.Runtime.callJSMethod(Runtime.java:953) JS: com.tns.Runtime.callJSMethod(Runtime.java:937) JS: com.tns.Runtime.callJSMethod(Runtime.java:929) JS: com.tns.gen.android.app.Application_ActivityLifecycleCallbacks.onActivit yResumed(Application_ActivityLifecycleCallbacks.java:24) JS: android.app.Application.dispatchActivityResumed(Application.java:208) JS: android.app.Activity.onResume(Activity.java:1220) JS: android.app.Instrumentation.callActivityOnResume(Instrumentation.java:12 57) JS: android.app.Activity.performResume(Activity.java:6076) JS: android.app.ActivityThread.performResumeActivity(ActivityThread.java:297 5) JS: android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3017 ) JS: android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392 ) JS: android.app.ActivityThread.access$800(ActivityThread.java:151) JS: android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) JS: android.os.Handler.dispatchMessage(Handler.java:102) JS: android.os.Looper.loop(Looper.java:135) JS: android.app.ActivityThread.main(ActivityThread.java:5254) JS: java.lang.reflect.Method.invoke(Native Method) JS: java.lang.reflect.Method.invoke(Method.java:372) JS: com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.ja va:903) JS: com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) JS: ERROR CONTEXT [object Object]