-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHashToCurveProfile.java
More file actions
51 lines (44 loc) · 2.08 KB
/
HashToCurveProfile.java
File metadata and controls
51 lines (44 loc) · 2.08 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
// SPDX-FileCopyrightText: 2025 Digg - Agency for Digital Government
//
// SPDX-License-Identifier: EUPL-1.2
package se.digg.crypto.hashtocurve.data;
import java.math.BigInteger;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* Supported profiles for hash to curve.
*
* <p>_NU_ is identical to _RO_, * except that the encoding type is encode_to_curve.
* encode_to_curve is not yet implemented in this lib, thus these options are not yet included.
*/
@SuppressWarnings({"checkstyle:MemberName", "checkstyle:AbbreviationAsWordInName"})
@Getter
@AllArgsConstructor
public enum HashToCurveProfile {
P256_XMD_SHA_256_SSWU_RO_("P256_XMD:SHA-256_SSWU_RO_", BigInteger.valueOf(-10), 48, 128),
// P256_XMD_SHA_256_SSWU_NU_("P256_XMD:SHA-256_SSWU_NU_", BigInteger.valueOf(-10), 128),
P384_XMD_SHA_384_SSWU_RO_("P384_XMD:SHA-384_SSWU_RO_", BigInteger.valueOf(-12), 72, 192),
// P384_XMD_SHA_384_SSWU_NU_("P384_XMD:SHA-384_SSWU_NU_", BigInteger.valueOf(-12), 192),
P521_XMD_SHA_512_SSWU_RO_("P521_XMD:SHA-512_SSWU_RO_", BigInteger.valueOf(-4), 98, 256),
// P521_XMD_SHA_512_SSWU_NU_("P521_XMD:SHA-512_SSWU_NU_", BigInteger.valueOf(-4), 256),
curve25519_XMD_SHA_512_ELL2_RO_("curve25519_XMD:SHA-512_ELL2_RO_", BigInteger.valueOf(2), 48,
128),
// curve25519_XMD_SHA_512_ELL2_NU_("curve25519_XMD:SHA-512_ELL2_NU_", BigInteger.valueOf(2), 128),
;
/** The cipher suite ID. */
private final String cipherSuiteID;
/**
* The z value is a value of the curve field that satisfies the following criteria.
* <ol>
* <li>Z is non-square in F. This is a field object e.g., F = GF(2^521 - 1).</li>
* <li>Z is not equal to negative one -1 in the field F.</li>
* <li>The polynomial g(x) - Z is irreducible over the field F. In this context, an irreducible
* polynomial cannot be factored into polynomials of lower degree, also in the field F</li>
* <li>The polynomial g(B / (Z * A)) should be a square number in the field F</li>
* </ol>
*/
private final BigInteger Z;
/** The target security level in bits for the curve. */
private final int L;
private final int k;
}