StoreData Method
StoreData(ReadOnlyMemory<Byte>)
Stores data in the Security Domain or targeted Application on the YubiKey using the GlobalPlatform STORE DATA command.
public void StoreData(ReadOnlyMemory<byte> data)
Parameters
Type | Name | Description |
---|---|---|
System.ReadOnlyMemory<System.Byte> | data | The data to be stored, which must be formatted as BER-TLV structures according to ISO 8825. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when no secure connection is available or the security context is invalid. |
SecureChannelException | Thrown when there was an SCP error, described in the exception message. |
Remarks
The STORE DATA command is used to transfer data to either the Security Domain itself or to an Application being personalized. The data must be formatted as BER-TLV structures according to ISO 8825.
This implementation: - Uses a single block transfer (P1.b8=1 indicating last block) - Requires BER-TLV formatted data (P1.b5-b4=10) - Does not provide encryption information (P1.b7-b6=00)
See GlobalPlatform Technology Card Specification v2.3.1 §11 APDU Command Reference for more information.
The SecurityDomainSession makes use of this method to store data in the Security Domain. Such as the StoreCaIssuer(KeyReference, ReadOnlyMemory<Byte>), StoreCertificates(KeyReference, IReadOnlyList<X509Certificate2>), StoreAllowlist(KeyReference, IReadOnlyCollection<String>), and other data.