public class MLKEMPrivateKey
extends iaik.pkcs.pkcs8.PrivateKeyInfo
| Modifier and Type | Class and Description |
|---|---|
static class |
MLKEMPrivateKey.PrivateKeyEncoding
This enumeration is only applied for the needed encoding as an ASN.1 object.
|
| Constructor and Description |
|---|
MLKEMPrivateKey(byte[] encoded)
Create private key from an ASN.1 encoded byte sequence
|
MLKEMPrivateKey(byte[] byteDk,
byte[] byteEk,
byte[] byteHashedEk,
byte[] z,
MLKEMParameterSpec parameterSpec)
Create private key from private key byte array, public key byte array, public key hash and seed z.
|
MLKEMPrivateKey(byte[] arr,
MLKEMParameterSpec parameterSpec)
Create private key from a byte array, where
arr is either the seed,
which is 64 bytes long, or the expandedKey, which is long as for the specific parameter defined. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
decode(byte[] bytes) |
protected byte[] |
encode() |
boolean |
equals(Object o) |
String |
getAlgorithm() |
byte[] |
getExpandedKey()
Returns a copy of the private key as a byte array (raw data).
|
MLKEMPrivateKey.PrivateKeyEncoding |
getPrivateKeyEncodingDefault()
Get the
privateKeyEncodingDefault variable |
MLKEMPublicKey |
getPublicKey()
Returns the MLKEMPublicKey
|
byte[] |
getSeed()
Returns a copy of the seed as a byte array.
|
int |
hashCode() |
void |
setPrivateKeyEncodingDefault(MLKEMPrivateKey.PrivateKeyEncoding privateKeyEncoding)
Set the
privateKeyEncodingDefault variable |
String |
toString() |
clone, createPrivateKeyInfo, decode, getAlgorithmID, getAttributes, getEncoded, getFormat, getPrivateKey, getPrivateKey, getPrivateKey, getPrivateKey, getPrivateKey, getPrivateKey, getPubKey, setAttributes, setPubKey, toASN1Object, writeTofinalize, getClass, notify, notifyAll, wait, wait, waitdestroy, isDestroyedpublic MLKEMPrivateKey(byte[] byteDk,
byte[] byteEk,
byte[] byteHashedEk,
byte[] z,
MLKEMParameterSpec parameterSpec)
throws InvalidKeyException
expandedKey is build internally by concatenating byteDk, byteEk,
byteHashedEk and z. The seed cannot be recreated, therefore seed is null.byteDk - private key (KEM decaps key) as a byte sequencebyteEk - public key (KEM encaps key) as a byte sequencebyteHashedEk - public key hashz - seedparameterSpec - the given specification of the parametersInvalidKeyException - throws an error if failing to create the encoding of the private keypublic MLKEMPrivateKey(byte[] arr,
MLKEMParameterSpec parameterSpec)
throws InvalidKeyException
arr is either the seed,
which is 64 bytes long, or the expandedKey, which is long as for the specific parameter defined.
According to NIST FIPS203:
For ML-KEM-512 expandedKey is 1632 bytes
For ML-KEM-768 expandedKey is 2400 bytes
For ML-KEM-1024 expandedKey is 3168 bytesarr - raw byte arrayparameterSpec - the given specification of the parametersInvalidKeyException - throws an error if failing to create the encoding of the private keypublic MLKEMPrivateKey(byte[] encoded)
throws InvalidKeyException
encoded - private key encoded as ASN.1 byte sequenceInvalidKeyException - if the encoding is not validpublic void setPrivateKeyEncodingDefault(MLKEMPrivateKey.PrivateKeyEncoding privateKeyEncoding)
privateKeyEncodingDefault variableprivateKeyEncoding - public MLKEMPrivateKey.PrivateKeyEncoding getPrivateKeyEncodingDefault()
privateKeyEncodingDefault variableprotected void decode(byte[] bytes)
throws InvalidKeyException
decode in class iaik.pkcs.pkcs8.PrivateKeyInfoInvalidKeyExceptionprotected byte[] encode()
encode in class iaik.pkcs.pkcs8.PrivateKeyInfopublic String getAlgorithm()
getAlgorithm in interface KeygetAlgorithm in class iaik.pkcs.pkcs8.PrivateKeyInfopublic boolean equals(Object o)
equals in class iaik.pkcs.pkcs8.PrivateKeyInfopublic int hashCode()
hashCode in class iaik.pkcs.pkcs8.PrivateKeyInfopublic String toString()
toString in class iaik.pkcs.pkcs8.PrivateKeyInfopublic MLKEMPublicKey getPublicKey() throws InvalidKeyException
InvalidKeyExceptionpublic byte[] getExpandedKey()
expandedKey == (byteDk||byteEk||byteHashedEk||z)public byte[] getSeed()
Copyright © 2020–2025 Stiftung SIC. All rights reserved.