method

TLSSocket.exportKeyingMaterial

length: number,
label: string,
context: Buffer
): Buffer;

Keying material is used for validations to prevent different kinds of attacks in network protocols, for example in the specifications of IEEE 802.1X.

@param length

number of bytes to retrieve from keying material

@param label
@param context

Optionally provide a context.

@returns

requested bytes of the keying material

const keyingMaterial = socket.exportKeyingMaterial(
  128,
  'client finished');

// Example return value of keyingMaterial:
// <Buffer 76 26 af 99 c5 56 8e 42 09 91 ef 9f 93 cb ad 6c 7b 65 f8 53 f1 d8 d9
//    12 5a 33 b8 b5 25 df 7b 37 9f e0 e2 4f b8 67 83 a3 2f cd 5d 41 42 4c 91
//    74 ef 2c ... 78 more bytes>
length: number,
label: string,
context?: string | BufferSource
): void;

Exports the keying material of the socket.

@param length

The length of the keying material to export.

@param label

The label of the keying material to export.

@param context

The context of the keying material to export.

Referenced types

type BufferSource =
| NodeJS.TypedArray<ArrayBufferLike>
| DataView<ArrayBufferLike>
| ArrayBufferLike