本文整理汇总了C#中ECCurve类的典型用法代码示例。如果您正苦于以下问题:C# ECCurve类的具体用法?C# ECCurve怎么用?C# ECCurve使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ECCurve类属于命名空间,在下文中一共展示了ECCurve类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GlvMultiplier
public GlvMultiplier(ECCurve curve, GlvEndomorphism glvEndomorphism)
{
if (curve == null || curve.Order == null)
throw new ArgumentException("Need curve with known group order", "curve");
this.curve = curve;
this.glvEndomorphism = glvEndomorphism;
}
示例2: ConfigureCurve
protected virtual ECCurve ConfigureCurve(ECCurve c, int coord)
{
if (c.CoordinateSystem == coord)
return c;
if (!c.SupportsCoordinateSystem(coord))
throw new ArgumentException("Coordinate system " + coord + " not supported by this curve", "coord");
return c.Configure().SetCoordinateSystem(coord).Create();
}
示例3: IsCurveTypeEqual
public bool IsCurveTypeEqual(ECCurve.ECCurveType actual)
{
if (CurveType == actual)
return true;
// Montgomery and Weierstrass are interchangable depending on the platform
if (CurveType == ECCurve.ECCurveType.PrimeMontgomery && actual == ECCurve.ECCurveType.PrimeShortWeierstrass ||
CurveType == ECCurve.ECCurveType.PrimeShortWeierstrass && actual == ECCurve.ECCurveType.PrimeMontgomery)
{
return true;
}
return false;
}
示例4: GlvTypeBEndomorphism
public GlvTypeBEndomorphism(ECCurve curve, GlvTypeBParameters parameters)
{
this.m_curve = curve;
this.m_parameters = parameters;
this.m_pointMap = new ScaleXPointMap(curve.FromBigInteger(parameters.Beta));
}
示例5: Curve25519Point
/**
* Create a point which encodes with point compression.
*
* @param curve the curve to use
* @param x affine x co-ordinate
* @param y affine y co-ordinate
*
* @deprecated Use ECCurve.CreatePoint to construct points
*/
public Curve25519Point(ECCurve curve, ECFieldElement x, ECFieldElement y)
: this(curve, x, y, false)
{
}
示例6: Create
public ECDsa Create(ECCurve curve)
{
return new ECDsaOpenSsl(curve);
}
示例7: GetCombSize
public static int GetCombSize(ECCurve c)
{
BigInteger order = c.Order;
return order == null ? c.FieldSize + 1 : order.BitLength;
}
示例8: SecP256K1Point
public SecP256K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs,
bool withCompression)
: base(curve, x, y, zs, withCompression)
{
}
示例9: Create
public static ECDsa Create(ECCurve curve)
{
return s_provider.Create(curve);
}
示例10: SecT163R2Point
/**
* @deprecated Use ECCurve.createPoint to construct points
*/
public SecT163R2Point(ECCurve curve, ECFieldElement x, ECFieldElement y)
: this(curve, x, y, false)
{
}
示例11: SecP192K1Point
/**
* Create a point that encodes with or without point compresion.
*
* @param curve
* the curve to use
* @param x
* affine x co-ordinate
* @param y
* affine y co-ordinate
* @param withCompression
* if true encode with point compression
*
* @deprecated per-point compression property will be removed, refer
* {@link #getEncoded(bool)}
*/
public SecP192K1Point(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression)
: base(curve, x, y, withCompression)
{
if ((x == null) != (y == null))
throw new ArgumentException("Exactly one of the field elements is null");
}
示例12: CompareCurve
internal static void CompareCurve(ECCurve c1, ECCurve c2)
{
if (c1.IsNamed)
{
Assert.True(c2.IsNamed);
Assert.Equal(c1.Oid.FriendlyName, c2.Oid.FriendlyName);
}
else if (c1.IsExplicit)
{
Assert.True(c2.IsExplicit);
Assert.Equal(c1.A, c2.A);
Assert.Equal(c1.B, c2.B);
Assert.Equal(c1.CurveType, c2.CurveType);
Assert.Equal(c1.G.X, c2.G.X);
Assert.Equal(c1.G.Y, c2.G.Y);
Assert.Equal(c1.Cofactor, c2.Cofactor);
Assert.Equal(c1.Order, c2.Order);
Assert.Equal(c1.Seed, c2.Seed);
Assert.Equal(c1.Hash, c2.Hash);
if (c1.IsPrime)
{
Assert.True(c2.IsPrime);
Assert.Equal(c1.Prime, c2.Prime);
}
else if (c1.IsCharacteristic2)
{
Assert.True(c2.IsCharacteristic2);
Assert.Equal(c1.Polynomial, c2.Polynomial);
}
}
}
示例13: Create
/// <summary>
/// Creates an instance of the platform specific implementation of the cref="ECDsa" algorithm.
/// </summary>
/// <param name="curve">
/// The <see cref="ECCurve"/> representing the elliptic curve.
/// </param>
public static ECDsa Create(ECCurve curve)
{
return new ECDsaImplementation.ECDsaOpenSsl(curve);
}
示例14: Validate
private static void Validate(
ECParameters parameters,
ECCurve explicitCurve,
byte[] msg,
byte[] signature,
HashAlgorithmName hashAlgorithm)
{
byte[] tamperedSignature = (byte[])signature.Clone();
tamperedSignature[0] ^= 0xFF;
using (ECDsa ecdsa = ECDsaFactory.Create())
{
ecdsa.ImportParameters(parameters);
Assert.True(
ecdsa.VerifyData(msg, signature, hashAlgorithm),
"named verifies signature");
Assert.False(
ecdsa.VerifyData(msg, tamperedSignature, hashAlgorithm),
"named verifies tampered");
}
if (ECDsaFactory.ExplicitCurvesSupported)
{
using (ECDsa ecdsa = ECDsaFactory.Create())
{
parameters.Curve = explicitCurve;
ecdsa.ImportParameters(parameters);
Assert.True(
ecdsa.VerifyData(msg, signature, hashAlgorithm),
"explicit verifies signature");
Assert.False(
ecdsa.VerifyData(msg, tamperedSignature, hashAlgorithm),
"explicit verifies tampered");
}
}
}
示例15: Create
public ECDsa Create(ECCurve curve)
{
return new ECDsaCng(curve);
}