Show / Hide Table of Contents

PivDataObject Class

Namespace: Yubico.YubiKey.Piv.Objects Assembly: Yubico.YubiKey.dll

This abstract class defines the basic properties of a PIV Application Data Object.

C#
public abstract class PivDataObject
Inheritance object PivDataObject
AdminData
CardCapabilityContainer
CardholderUniqueId
KeyHistory
PinProtectedData

Remarks

Generally you will use one of the ReadObject<T>() methods to get the specified data out of a YubiKey. The formatted data will be parsed and the resulting object will present the data in a more readable form. You can then update the data and call WriteObject(PivDataObject).

Note that if there is no data on the YubiKey stored under the given object, then after calling ReadObject, the resulting PivDataObject will be "empty" (IsEmpty)

You can also create a new instance of a PivDataObject (call the constructor directly, rather than getting the YubiKey's contents), set it, and store it. However, when you store data (by calling WriteObject), you overwrite any data already there. Hence, you will likely want to get any data out first, to decide whether you want to change anything, rather than overwriting any possible contents sight unseen.

This class (and each subclass) implements IDisposable because the data might be sensitive. Upon disposal, any stored data is overwritten.

See also the user's manual entry on PIV data objects.

Properties

Name Description
DataTag

The value used to specify the storage location.

IsEmpty

Indicates whether there is any data or not. If this is true, then the contents of any property are meaningless.

Methods

Name Description
Decode(ReadOnlyMemory<byte>)

Decode the data given according to the format specified for the data object.

Dispose()

Releases any unmanaged resources and overwrites any sensitive data.

Dispose(bool)

Releases any unmanaged resources and overwrites any sensitive data.

Encode()

Build the encoding of the data.

GetDefinedDataTag()

Get the defined data tag. This is the data tag that the PIV standard or Yubico defines to specify the given data object.

IsValidAlternateTag(int)

Is the given tag valid as an alternate?

TryDecode(ReadOnlyMemory<byte>)

Try to decode the data given according to the format specified for the data object. If successful, return true, otherwise, return false.

In this article
Back to top Generated by DocFX