Show / Hide Table of Contents

IsValidSlotNumberForGenerate Method

IsValidSlotNumberForGenerate(byte)

Is the given number a valid slot number for generating asymmetric keys.

C#
public static bool IsValidSlotNumberForGenerate(byte slotNumber)

Parameters

Type Name Description
byte slotNumber

The number to check.

Returns

bool

True if slotNumber is a valid PIV asymmetric key slot that can generate a new key pair, or False otherwise.

Remarks

Note that if a slot is valid for generate, it is also valid for importing.

This verifies that a number given is not only a valid slot number, but a valid slot number for a slot that can generate an asymmetric key pair. For example, if the input is 0x9A, it will return true. If the input is 0x80 or 0x9B, it will return false. Even though 80 and 9B are valid slot numbers, they are for slots that cannot generate asymmetric keys.

Note that it is possible to generate a key pair in slot F9 (attestation key). However, that would make attestation no longer possible, unless you obtain, for that key, a proper attestation certificate that chains to a supported root.

See the User's Manual entry on PIV slots for more details on each of the possible slots.

In this article
Back to top Generated by DocFX