【问题标题】:Spongycastle provider not working on AndroidSpongycastle 提供程序无法在 Android 上运行
【发布时间】:2014-09-13 22:09:46
【问题描述】:

我正在尝试在我的 Android 应用程序上使用 Spongy Castle。根据这些instructions,我已经添加了jar文件,然后调用了这个方法来包含provider。

static {
    Security.insertProviderAt(new org.spongycastle.jce.provider.BouncyCastleProvider(), 1);
}

但我仍然在这一行得到错误:

KeyStore keyStore = KeyStore.getInstance("SC");

我得到的例外是:

java.security.KeyStoreException: KeyStore SC implementation not found

我已经为此花费了几个小时,但我无法弄清楚我错过了什么。

【问题讨论】:

  • 您确定 KeyStore 被称为“SC”吗?
  • "SC" 不是 KeyStore,而是提供者。如果我使用默认的“BKS”提供程序但不使用 Spongy Castle 提供程序,它可以工作
  • 用“BC”就够了吗?
  • KeyStore keyStore = KeyStore.getInstance("PKCS12", BouncyCastleProvider.PROVIDER_NAME); //"SC"

标签: java android security bouncycastle spongycastle


【解决方案1】:

如果你使用 Eclipse,我建议你下载 this example 并编译它。根据示例,“SC”不是KeyStore

如果您需要另一个示例,有一个很好的教程 here(ECDH - Android 上的椭圆曲线 Diffie Hellman)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-30
    • 2019-08-03
    • 2020-03-16
    • 2018-04-24
    • 1970-01-01
    相关资源
    最近更新 更多