Show / Hide Table of Contents

WriteObject Method

WriteObject(PivDataObject)

Write the contents of the given object to the storage location specified by the DataTag property.

C#
public void WriteObject(PivDataObject pivDataObject)

Parameters

Type Name Description
PivDataObject pivDataObject

The object containing the data to store (and the definition of its formatting), along with the data tag under which it is to be stored.

Exceptions

Type Condition
ArgumentNullException

The pivDataObject argument is null.

InvalidOperationException

The method was not able to store the data onto the YubiKey.

Remarks

This method will call on the pivObject to encode the data following its definition, then store that data on the YubiKey under the PivObject.DataTag storage location.

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

Note that it is possible to change the DataTag, and this method will store the data under whatever DataTag is set to.

Note also that this method will overwrite any data already on the YubiKey, if there is any. Hence, make sure you know what data is stored there currently, and that it is safe to overwrite, before calling this method.

If the pivDataObject has no data (the IsEmpty property is true), then this method will "clear" a storage location. If there was data in the storage location before the call to WriteObject, it will be gone after.

In this article
Back to top Generated by DocFX