Show / Hide Table of Contents

Credential Constructor

Credential(CryptographicKeyType, string, bool)

Constructs an instance of the Credential class with the provided arguments.

C#
public Credential(CryptographicKeyType keyType, string label, bool touchRequired)

Parameters

Type Name Description
CryptographicKeyType keyType

The cryptographic algorithm associated with the Credential.

The value is not allowed to be None.

string label

A short name or description of the Credential.

The string only contains characters that can be encoded with UTF-8, and its UTF-8 byte count is between MinLabelByteCount and MaxLabelByteCount. Non-printing characters are allowed, as long as they can be encoded with UTF-8. For example, null (UTF-8: 0x00) and Right-To-Left Mark U+200F (UTF-8: 0xE2 0x80 0x8F) would be acceptable.

The System.Text.UTF8Encoding class contains methods such as System.Text.UTF8Encoding.GetByteCount(string) which can be used to validate the string prior to attempting to set it here. It is recommended to use the constructor System.Text.UTF8Encoding.UTF8Encoding(bool, bool) so error detection is enabled for invalid characters.

bool touchRequired Describes if the user is required to touch the YubiKey when accessing the Credential.

Exceptions

Type Condition
ArgumentException

Thrown when label has an invalid length.

ArgumentOutOfRangeException

Thrown when keyType is an invalid value.

Credential()

Constructs an instance of the Credential class.

C#
public Credential()

Remarks

This constructor is provided to allow for object-initializer syntax. The default values are not guaranteed to be valid, so all properties should be set manually.

In this article
Back to top Generated by DocFX