c# - 在 Xamarin.Forms CngKey.Create 中显示“操作未实现”错误
问题描述
我开发 Xamarin.Forms 应用程序,现在我正在我的 Android 设备上调试它(如果重要的话,它是 Android 的 4.4 版)。我需要将密码学与 ECDsa 一起使用,所以我发现 System.Security.Cryptography 需要 System.Security.Cryptography.Cng 来支持它。我已经下载了 System.Security.Cryptography.Cng 版本。我所有项目的 Nuget 包中的 4.5.0。所以我需要创建一对新的密钥来签署一些数据,当我尝试这样做时
var p = new CngKeyCreationParameters
{
ExportPolicy = CngExportPolicies.AllowPlaintextExport,
KeyCreationOptions = CngKeyCreationOptions.OverwriteExistingKey,
UIPolicy = new CngUIPolicy(CngUIProtectionLevels.ProtectKey, KeyName, null, null, null)
};
CngKey key = CngKey.Create(CngAlgorithm.ECDsa, keyAlias, p);
我收到错误“System.NotImplementedException:方法或操作未实现。” 我已经为 CngAlgorithm、参数尝试了许多算法,但仍然有同样的例外。那么我做错了什么?我知道这可能很愚蠢,真的需要帮助才能找到它。我试图找到同样的问题,但没有幸运。唯一接近的问题是:“ CngKey.Create 不支持请求的操作”,但它没有帮助。
解决方案
推荐阅读
- javascript - 如何在不执行更改检测例程的情况下使用“间隔”Rxjs 函数?
- c# - 如何通过登录 ActivityDirectory 来获取名称?
- bash - 如何在 AIX 服务器中行前 grep
- python - 使用 Connexion 和 Flask 测试上传 API 的应用程序单元测试
- angular - 选择选项角度2
- python - kivy SQL 和标签
- javascript - 如何在 JavaScript 中使用 Intl.DateTimeFormat 获取基于语言环境的日期格式
- database - 如何将数据从 elasticsearch 获取到 Oracle 等关系数据库?
- javascript - 通过检查值将对象值分配给常量
- python - python tornado框架中传递URL的问题