public final class HpkeUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static byte[] |
AES_128_GCM_AEAD_ID |
static byte[] |
AES_256_GCM_AEAD_ID |
static byte[] |
AUTH_MODE |
static byte[] |
BASE_MODE |
static byte[] |
CHACHA20_POLY1305_AEAD_ID |
static byte[] |
EMPTY_SALT |
static byte[] |
HKDF_SHA256_KDF_ID |
static byte[] |
HKDF_SHA384_KDF_ID |
static byte[] |
HKDF_SHA512_KDF_ID |
static byte[] |
P256_HKDF_SHA256_KEM_ID |
static byte[] |
P384_HKDF_SHA384_KEM_ID |
static byte[] |
P521_HKDF_SHA512_KEM_ID |
static byte[] |
X25519_HKDF_SHA256_KEM_ID |
| Modifier and Type | Method and Description |
|---|---|
static int |
encodingSizeInBytes(HpkeParameters.KemId kemId)
Returns the encapsulated key length (in bytes) for the specified
kemId. |
static int |
getEncodedPrivateKeyLength(HpkeParameters.KemId kemId)
Lengths from 'Nsk' column in https://www.rfc-editor.org/rfc/rfc9180.html#table-2.
|
static int |
getEncodedPublicKeyLength(HpkeParameters.KemId kemId)
Lengths from 'Npk' column in https://www.rfc-editor.org/rfc/rfc9180.html#table-2.
|
static byte[] |
intToByteArray(int capacity,
int value)
Transforms a passed value to an MSB first byte array with the size of the specified capacity.
|
public static final byte[] BASE_MODE
public static final byte[] AUTH_MODE
public static final byte[] X25519_HKDF_SHA256_KEM_ID
public static final byte[] P256_HKDF_SHA256_KEM_ID
public static final byte[] P384_HKDF_SHA384_KEM_ID
public static final byte[] P521_HKDF_SHA512_KEM_ID
public static final byte[] HKDF_SHA256_KDF_ID
public static final byte[] HKDF_SHA384_KDF_ID
public static final byte[] HKDF_SHA512_KDF_ID
public static final byte[] AES_128_GCM_AEAD_ID
public static final byte[] AES_256_GCM_AEAD_ID
public static final byte[] CHACHA20_POLY1305_AEAD_ID
public static final byte[] EMPTY_SALT
public static byte[] intToByteArray(int capacity,
int value)
Bytes.intToByteArray(int, int) with MSB first
instead of LSB first).
The HPKE standard defines this function as I2OSP(n, w) where w = capacity and n = value.
https://www.rfc-editor.org/rfc/rfc9180.html#name-notation
capacity - size of the resulting byte arrayvalue - that should be represented as a byte arraypublic static int getEncodedPublicKeyLength(HpkeParameters.KemId kemId) throws GeneralSecurityException
GeneralSecurityExceptionpublic static int encodingSizeInBytes(HpkeParameters.KemId kemId)
kemId. This value
corresponds to the 'Nenc' column in the following table.
https://www.rfc-editor.org/rfc/rfc9180.html#name-key-encapsulation-mechanism.
public static int getEncodedPrivateKeyLength(HpkeParameters.KemId kemId) throws GeneralSecurityException
GeneralSecurityException