-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathBrainpoolP160.cs
More file actions
54 lines (48 loc) · 1.94 KB
/
BrainpoolP160.cs
File metadata and controls
54 lines (48 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System.Globalization;
using System.Numerics;
namespace Waher.Security.EllipticCurves
{
/// <summary>
/// Brainpool P-160 Elliptic Curve, as defined in RFC5639:
/// https://datatracker.ietf.org/doc/html/rfc5639
/// </summary>
public class BrainpoolP160 : BrainpoolPrimeCurve
{
private static readonly BigInteger p0 = BigInteger.Parse("0E95E4A5F737059DC60DFC7AD95B3D8139515620F", NumberStyles.HexNumber);
private static readonly BigInteger a = BigInteger.Parse("0340E7BE2A280EB74E2BE61BADA745D97E8F7C300", NumberStyles.HexNumber);
private static readonly BigInteger b = BigInteger.Parse("01E589A8595423412134FAA2DBDEC95C8D8675E58", NumberStyles.HexNumber);
private static readonly BigInteger x = BigInteger.Parse("0BED5AF16EA3F6A4F62938C4631EB5AF7BDBCDBC3", NumberStyles.HexNumber);
private static readonly BigInteger y = BigInteger.Parse("01667CB477A1A8EC338F94741669C976316DA6321", NumberStyles.HexNumber);
private static readonly BigInteger q = BigInteger.Parse("0E95E4A5F737059DC60DF5991D45029409E60FC09", NumberStyles.HexNumber);
/// <summary>
/// Brainpool P-160 Elliptic Curve, as defined in RFC5639:
/// https://datatracker.ietf.org/doc/html/rfc5639
/// </summary>
public BrainpoolP160()
: base(p0, new PointOnCurve(x, y), a, b, q)
{
}
/// <summary>
/// Brainpool P-160 Elliptic Curve, as defined in RFC5639:
/// https://datatracker.ietf.org/doc/html/rfc5639
/// </summary>
/// <param name="Secret">Secret.</param>
public BrainpoolP160(byte[] Secret)
: base(p0, new PointOnCurve(x, y), a, b, q, Secret)
{
}
/// <summary>
/// Brainpool P-160 Elliptic Curve, as defined in RFC5639:
/// https://datatracker.ietf.org/doc/html/rfc5639
/// </summary>
/// <param name="Secret">Secret.</param>
public BrainpoolP160(uint[] Secret)
: base(p0, new PointOnCurve(x, y), a, b, q, Secret)
{
}
/// <summary>
/// Name of curve.
/// </summary>
public override string CurveName => "Brainpool P-160";
}
}