Show / Hide Table of Contents

RenameCredential Method

RenameCredential(Credential, string?, string)

Renames an existing credential on the YubiKey by setting new issuer and account names.

C#
public void RenameCredential(Credential credential, string? newIssuer, string newAccount)

Parameters

Type Name Description
Credential credential

The Credential to rename.

string newIssuer

The new issuer to set on the credential. The issuer is optional and can be null.

string newAccount

The new account name to set on the credential.

Exceptions

Type Condition
ArgumentNullException

The credential to rename is null. Or the new account name to set is null, empty, or consists only of white-space characters.

InvalidOperationException

There is no KeyCollector loaded if the authentication is required, the RenameCommand is not supported on this YubiKey, or the RenameCommand failed.

SecurityException

Unable to verify password either because KeyCollector was canceled by the user or an incorrect password was provided if authentication is required.

Remarks

This command is only available on the YubiKeys with firmware version 5.3.0 and later.

RenameCredential(string?, string, string?, string, CredentialType, CredentialPeriod)

Renames an existing credential on the YubiKey by setting new issuer and account names.

C#
public Credential RenameCredential(string? currentIssuer, string currentAccount, string? newIssuer, string newAccount, CredentialType currentType = CredentialType.Totp, CredentialPeriod currentPeriod = CredentialPeriod.Period30)

Parameters

Type Name Description
string currentIssuer

The current credential's issuer.

string currentAccount

The current credential's account name.

string newIssuer

The new issuer to set on the credential. The issuer is optional and can be null.

string newAccount

The new account name to set on the credential.

CredentialType currentType

Indicates the CredentialType of the current credential as either HOTP or TOTP. The default value is TOTP.

CredentialPeriod currentPeriod

Indicates the CredentialPeriod of the current credential in seconds for TOTP code. It can only be 15, 30, or 60 seconds. For HOTP should be set to zero (Undefined). The default value is 30.

Returns

Credential

Exceptions

Type Condition
InvalidOperationException

There is no KeyCollector loaded if the authentication is required, the RenameCommand is not supported on this YubiKey, the RenameCommand failed, or the provided current or new account, type, or period is invalid.

SecurityException

Unable to verify password either because KeyCollector was canceled by the user or an incorrect password was provided if authentication is required.

Remarks

This command is only available on the YubiKeys with firmware version 5.3.0 and later.

In this article
Back to top Generated by DocFX