没有此类算法:提供商BC的ECDSA [英] no such algorithm: ECDSA for provider BC

查看:234
本文介绍了没有此类算法:提供商BC的ECDSA的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序是minSDK 15-所以我认为我可以直接使用BouncyCastle。不幸的是我得到了NoSuchAlgorithmException。那我需要使用SpongyCastle吗?该库在JVM应用程序中运行良好-但在android系统中失败。

My app is minSDK 15 - so I thought I can use BouncyCastle directly. Unfortunately I get a NoSuchAlgorithmException. Do I have to use SpongyCastle then? The lib works great in a JVM app - but fails on android.

 Caused by: java.security.NoSuchAlgorithmException: no such algorithm: ECDSA for provider BC
    at sun.security.jca.GetInstance.getService(GetInstance.java:87)
    at sun.security.jca.GetInstance.getInstance(GetInstance.java:206)
    at java.security.KeyPairGenerator.getInstance(KeyPairGenerator.java:307)
    at org.kethereum.crypto.Keys.createSecp256k1KeyPair$crypto(Keys.kt:43)
    at org.kethereum.crypto.Keys.createEcKeyPair(Keys.kt:51)
    at org.walleth.data.keystore.KethereumWallethKeyStore.newAddress(KethereumWallethKeyStore.kt:43)
    at org.walleth.activities.CreateAccountActivity$onCreate$4.onClick(CreateAccountActivity.kt:95)
    at android.view.View.performClick(View.java:6256)
    at android.view.View$PerformClick.run(View.java:24701)
    at android.os.Handler.handleCallback(Handler.java:789)
    at android.os.Handler.dispatchMessage(Handler.java:98)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6541)


推荐答案

Android对ECDSA的支持自4.0版开始就使用Bouncycastle(v1.46)作为默认的密码提供程序。请参阅博客 https:// nelenkov .blogspot.com.es / 2011/12 / using-ecdh-on-android.html?m = 1

Android support for ECDSA was introduced since version 4.0 using Bouncycastle (v1.46) as the default cryptographic provider. See the blog https://nelenkov.blogspot.com.es/2011/12/using-ecdh-on-android.html?m=1

但是Android包含了的简化版本Bouncycastle,并且没有对ECDSA的完全支持。您可以在链接中看到不支持算法 KeyPairGenerator / ECDSA ,这是生成以太坊密钥所必需的。

But Android included a shortened version of Bouncycastle, and there is no full support for ECDSA. You can see in the link that algorithm KeyPairGenerator/ECDSA is not supported, which is the required one to generate ethereum keys.

您不能直接包含bouncycastle库,因为包名称 org.bouncycastle 与之冲突。我建议在您的项目中包含spongycastle,它是Android org.spongycastle 的bouncycastle的重新打包版本。

You can not include directly the bouncycastle library because there is a conflict with the package name org.bouncycastle. I suggest to include spongycastle in your project, which it is a repackaged version of bouncycastle for Android org.spongycastle.

软件包名称冲突已在新的android版本中解决,但是如果您的目标是旧版本,则需要确保使用哪个加密提供程序。

The package name conflict has been resolved in new android versions, but if your target are old versions then you need to ensure which cryptographic provider is being used.

这篇关于没有此类算法:提供商BC的ECDSA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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