【发布时间】:2017-04-30 21:31:50
【问题描述】:
.NET Core 似乎支持在 ECC 中创建自定义曲线。
我试过定义Curve25519,如下图:
public class Curves
{
// TODO: check the key gen rand.
public static ECCurve Curve25519
{
get
{
return new ECCurve()
{
CurveType = ECCurve.ECCurveType.PrimeMontgomery,
B = new byte[] { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
A = new byte[] {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,109,6},
G = new ECPoint()
{
X = new byte[] { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9},
Y = new byte[] {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }},
Prime = new byte[] { 127, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 237 },
Order = new byte[] {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8},
Cofactor = new byte[] { 1 } // fix later
};
}
}
但是,当我尝试定义它时
var ecc2 = ECDsa.Create(Curves.Curve25519);
我得到一个空指针异常。
有没有人看到任何明显的错误,或者.NET Core 中对显式曲线的支持仍然不多?
【问题讨论】:
-
有机会从错误中看到整个堆栈跟踪吗?
-
对此也很感兴趣
-
这个问题你解决了吗?
-
我得到一个不同的例外。对这个问题很感兴趣。 Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException:不支持请求的操作。
标签: .net cryptography .net-core elliptic-curve