KeyType

Kinds of asymmetric keys, with their raw encodings. Every public key crossing the CryptoBackend boundary uses the encoding documented here; protocol code converts to and from wire formats.

The post-quantum types have two private-key encodings, told apart by length, so that every backend and every key format (COSE_Key, a key store) read the same bytes the same way: the seedLength-byte seed that key generation starts from, and the expandedPrivateKeyLength-byte expanded key the FIPS standards define. A software backend generates the seed, which is small and determines the whole key, and imports either.

Entries

Link copied to clipboard

RFC 7748; 32-byte u-coordinate.

Link copied to clipboard

RFC 7748; 56-byte u-coordinate.

Link copied to clipboard

secp256r1 for ECDH and ECDSA; public keys are uncompressed SEC1 points 04 || x || y.

Link copied to clipboard

secp384r1; uncompressed SEC1 points.

Link copied to clipboard

RFC 8032; 32-byte public key.

Link copied to clipboard

FIPS 203 encapsulation keys ek (k = 2, 3, 4).

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

FIPS 204 public keys pk.

Link copied to clipboard
Link copied to clipboard

Properties

Link copied to clipboard

Returns a representation of an immutable list of all enum entries, in the order they're declared.

Link copied to clipboard

For ML-KEM and ML-DSA, the length of the expanded private key: the decapsulation key dk = dk_PKE || ek || H(ek) || z of 768k + 96 bytes (FIPS 203 Algorithm 16, §8 Table 3) or sk = ρ || K || tr || s1 || s2 || t0 (FIPS 204 Algorithm 24, §4 Table 2). Null for the other types.

Link copied to clipboard
expect val name: String
Link copied to clipboard
expect val ordinal: Int
Link copied to clipboard

Raw public key length in bytes.

Link copied to clipboard

For ML-KEM and ML-DSA, the length of the seed that determines the private key: d || z of ML-KEM.KeyGen (64 bytes, FIPS 203 Algorithm 19) or ξ of ML-DSA.KeyGen (32 bytes, FIPS 204 Algorithm 1). Null for the other types, whose private keys have a single raw encoding.

Functions

Link copied to clipboard
fun valueOf(value: String): KeyType

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Link copied to clipboard

Returns an array containing the constants of this enum type, in the order they're declared.