CryptoSys PKI Pro Manual

Hpke.LabeledExpand Method

Compute the output of the LabeledExpand function as defined in RFC9180.

Syntax

[C#]
public static byte[] LabeledExpand(
   int numBytes,
   byte[] prk,
   string label,
   byte[] info,
   Hpke.CurveName curveName,
   Hpke.AeadAlg aeadAlg = Hpke.AeadAlg.None 
)
[VB]
Public Shared Function LabeledExpand (
   numBytes As Integer,
   prk As Byte(),
   label As String,
   info As Byte(),
   curveName As Hpke.CurveName,
   Optional aeadAlg As Hpke.AeadAlg = Hpke.AeadAlg.None 
) As Byte()

Parameters

numBytes  Int32
Required number of bytes (L) of output keying material.
prk  Byte
Pseudorandom key (prk)
label  String
Label string
info  Byte
Byte string info
curveName  Hpke.CurveName
ECDH curve used in scheme
aeadAlg  Hpke.AeadAlg  (Optional)
AEAD encryption algorithm used in the scheme or 0 (default) to indicate KDF is being used inside a KEM algorithm.

Return Value

Byte
L bytes of output keying material.

Remarks

The LabeledExpand function is defined in section 4 of [RFC9180]. It uses the "expand" stage of the HKDF function [RFC5869]. The ECDH curve group used in the scheme must be specified, which automatically fixes the KDF and associated HMAC algorithm to be used.

Example

int Nk = 16;
// key = LabeledExpand(secret, 'key', key_schedule_context, Nk)
byte[] key = Hpke.LabeledExpand(Nk, Cnv.FromHex("12fff91991e93b48de37e7daddb52981084bd8aa64289c3788471d9a9712f397"), "key",
   Cnv.FromHex("00725611c9d98c07c03f60095cd32d400d8347d45ed67097bbad50fc56da742d07cb6cffde367bb0565ba28bb02c90744a20f5ef37f30523526106f637abb05449"),
   Hpke.CurveName.X25519, Hpke.AeadAlg.Aes_128_Gcm);
// 4531685d41d65f03dc48f6b8302c05b0

See Also

VB6/C equivalent: HPKE_LabeledExpand

[Contents] [Index]

[PREV: Hpke.DerivePrivateKey Method...]   [Contents]   [Index]   
   [NEXT: Hpke.LabeledExtract Method...]

Copyright © 2004-26 D.I. Management Services Pty Ltd t/a CryptoSys. All rights reserved. Generated 2026-09-21T05:59:39Z.