Show / Hide Table of Contents

PutKey Method

PutKey(KeyReference, StaticKeys, int)

Puts an SCP03 key set onto the YubiKey using the Security Domain.

C#
public void PutKey(KeyReference keyReference, StaticKeys staticKeys, int replaceKvn = 0)

Parameters

Type Name Description
KeyReference keyReference

The key reference identifying where to store the key.

StaticKeys staticKeys

The new SCP03 key set to store.

int replaceKvn

The key version number to replace, or 0 for a new key (Default value is 0).

Exceptions

Type Condition
ArgumentException

Thrown when the KID is not 0x01 for SCP03 key sets.

SecureChannelException

Thrown when the new key set's checksum failed to verify, or some other SCP related error described in the exception message.

PutKey(KeyReference, ECPrivateKey, int)

Puts an EC private key onto the YubiKey using the Security Domain.

C#
public void PutKey(KeyReference keyReference, ECPrivateKey privateKeyParameters, int replaceKvn = 0)

Parameters

Type Name Description
KeyReference keyReference

The key reference identifying where to store the key.

ECPrivateKey privateKeyParameters

The EC private key parameters to store.

int replaceKvn

The key version number to replace, or 0 for a new key (Default value is 0).

Exceptions

Type Condition
ArgumentException

Thrown when the private key is not of type NIST P-256.

InvalidOperationException

Thrown when no secure session is established.

SecureChannelException

Thrown when the new key set's checksum failed to verify, or some other SCP related error described in the exception message.

PutKey(KeyReference, ECPrivateKeyParameters, int)

C#
[Obsolete("Obsolete, use PutKey(KeyReference, ECPrivateKey)", false)]
public void PutKey(KeyReference keyReference, ECPrivateKeyParameters privateKeyParameters, int replaceKvn = 0)

Parameters

Type Name Description
KeyReference keyReference
ECPrivateKeyParameters privateKeyParameters
int replaceKvn

PutKey(KeyReference, ECPublicKey, int)

Puts an EC public key onto the YubiKey using the Security Domain.

C#
public void PutKey(KeyReference keyReference, ECPublicKey publicKey, int replaceKvn = 0)

Parameters

Type Name Description
KeyReference keyReference

The key reference identifying where to store the key.

ECPublicKey publicKey

The EC public key parameters to store.

int replaceKvn

The key version number to replace, or 0 for a new key (Default value is 0).

Exceptions

Type Condition
ArgumentException

Thrown when the public key is not of type SECP256R1.

InvalidOperationException

Thrown when no secure session is established.

SecureChannelException

Thrown when the new key set's checksum failed to verify, or some other SCP related error described in the exception message.

PutKey(KeyReference, ECPublicKeyParameters, int)

C#
[Obsolete("Obsolete, use PutKey(KeyReference, ECPublicKey)", false)]
public void PutKey(KeyReference keyReference, ECPublicKeyParameters publicKey, int replaceKvn = 0)

Parameters

Type Name Description
KeyReference keyReference
ECPublicKeyParameters publicKey
int replaceKvn
In this article
Back to top Generated by DocFX