ML-KEM-1024-PrivateKey ::= CHOICE {
seed [0] OCTET STRING (SIZE (64)),
expandedKey OCTET STRING (SIZE (3168)),
both SEQUENCE {
seed OCTET STRING (SIZE (64)),
expandedKey OCTET STRING (SIZE (3168))
}
}
This class supports reading, writing, and converting between them.
Current code follows RFC 9935 and RFC 9881.
| Modifier and Type | Class and Description |
|---|---|
| private static record | |
| public static enum |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static byte[] | Returns: the preferred encodingpreferred output choice type type,parameter set name pname, int seed length seedLen, byte[] the input encoding input, BiFunction<String, byte[], byte[]> function to calculate expanded from seed, could be null
if there is already expanded in input expander)Reads from any encoding and write to the specified type. |
| public static byte[] | Returns: the expanded keyparameter set name pname, int seed length seedLen, byte[] input encoding input, BiFunction<String, byte[], byte[]> function to calculate expanded from seed, could be null
if there is already expanded in input expander)Reads from any choice of encoding and return the expanded format. |
| public static KeyChoices. | Returns: the type"mlkem" or "mldsa". name)Gets the preferred choice type for an algorithm, defined as an overridable security property "jdk. |
| private static KeyChoices. | Returns: aChoice object. Byte arrays inside are newly allocatedcorrect seed length seedLen, byte[] input bytes input)Splits one of the ML-KEM or ML-DSA private key formats into seed and expandedKey, if exists. |
| private static int | |
| public static KeyChoices. | |
| private static void | |
| public static byte[] | Returns: one of the choicespreferred output choice type type,the seed, could be null seed, byte[] the expanded key, could be null expanded)Writes one of the ML-KEM or ML-DSA private key formats. |
| KeyChoices | back to summary |
|---|---|
| public KeyChoices() | |
| choiceToChoice | back to summary |
|---|---|
| public static byte[] choiceToChoice(KeyChoices. Reads from any encoding and write to the specified type.
| |
| choiceToExpanded | back to summary |
|---|---|
| public static byte[] choiceToExpanded(String pname, int seedLen, byte[] input, BiFunction<String, byte[], byte[]> expander) throws InvalidKeyException Reads from any choice of encoding and return the expanded format.
| |
| getPreferred | back to summary |
|---|---|
| public static KeyChoices. Gets the preferred choice type for an algorithm, defined as an
overridable security property "jdk. "mlkem" or "mldsa".
the type
| |
| readFromChoice | back to summary |
|---|---|
| private static KeyChoices. Splits one of the ML-KEM or ML-DSA private key formats into seed and expandedKey, if exists.
| |
| readShortLength | back to summary |
|---|---|
| private static int readShortLength(byte[] input, int from) throws InvalidKeyException | |
| typeOfChoice | back to summary |
|---|---|
| public static KeyChoices. Gets the type of input.
| |
| writeShortLength | back to summary |
|---|---|
| private static void writeShortLength(byte[] input, int from, int value) | |
| writeToChoice | back to summary |
|---|---|
| public static byte[] writeToChoice(KeyChoices. Writes one of the ML-KEM or ML-DSA private key formats. This method does not check the length of the inputs or whether they match each other. The caller must make sure `seed` and/or `expanded` are provided if `type` requires any of them.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final byte[] | expanded
Record Component accessed by expanded(). |
| private final byte[] | |
| private final KeyChoices. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public final boolean | equals(Object o)
Implements abstract java. Indicates whether some other object is "equal to" this one. |
| public byte[] | |
| public final int | |
| public byte[] | |
| public final String | toString()
Implements abstract java. Returns a string representation of the record. |
| public KeyChoices. |
| expanded | back to summary |
|---|---|
| private final byte[] expanded Record Component accessed by expanded(). | |
| seed | back to summary |
|---|---|
| private final byte[] seed Record Component accessed by seed(). | |
| type | back to summary |
|---|---|
| private final KeyChoices. Record Component accessed by type(). | |
| Choice | back to summary |
|---|---|
| private Choice(KeyChoices. | |
| equals | back to summary |
|---|---|
| public final boolean equals(Object o) Implements abstract java. Doc from java. Indicates whether some other object is "equal to" this one. In addition
to the general contract of
R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
| |
| expanded | back to summary |
|---|---|
| public byte[] expanded() Record Component getter of expanded. | |
| hashCode | back to summary |
|---|---|
| public final int hashCode() Implements abstract java. Doc from java. Returns a hash code value for the record.
Obeys the general contract of | |
| seed | back to summary |
|---|---|
| public byte[] seed() Record Component getter of seed. | |
| toString | back to summary |
|---|---|
| public final String toString() Implements abstract java. Doc from java. Returns a string representation of the record.
In accordance with the general contract of In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves. | |
| type | back to summary |
|---|---|
| public KeyChoices. Record Component getter of type. | |
| Modifier and Type | Field and Description |
|---|---|
| public static final KeyChoices. | |
| public static final KeyChoices. | |
| public static final KeyChoices. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static KeyChoices. | |
| public static KeyChoices. |
| BOTH | back to summary |
|---|---|
| public static final KeyChoices. | |
| EXPANDED_KEY | back to summary |
|---|---|
| public static final KeyChoices. | |
| SEED | back to summary |
|---|---|
| public static final KeyChoices. | |
| Type | back to summary |
|---|---|
| private Type() | |
| valueOf | back to summary |
|---|---|
| public static KeyChoices. | |
| values | back to summary |
|---|---|
| public static KeyChoices. | |