Show / Hide Table of Contents

CardCapabilityContainer Class

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

Use this class to process the CCC (Card Capability Container) data.

C#
public sealed class CardCapabilityContainer : PivDataObject
Inheritance object PivDataObject CardCapabilityContainer

Remarks

The PIV standard declares,

"The Card Capability Container (CCC) is a mandatory data object whose purpose is to facilitate compatibility of Government Smart Card Interoperability Specification (GSC-IS) applications with PIV Cards."

In other words, it's a holdover from the older smart card specification. In order to remain compatible with that older spec and with older applications, it might be necessary to read and write this data object.

There are many elements that make up the CCC, but most of them are ignored by PIV and the YubiKey. Other elements are fixed. Note that the PIV standard says,

"The data model of the PIV Card Application shall be identified by data model number 0x10. ... The content of the CCC data elements, other than the data model number, are out of scope for this specification."

There is only one element that can be set in this class, namely, the Card Identifier portion of the Unique Card Identifier. This is a 14-byte value. With the YubiKey, the caller sets it, or allows the SDK to set it to random bytes.

Upon manufacture, the CCC is "empty", so the IsEmpty property is true. This object will be considered empty until the Card Identifier is set. See SetCardId(ReadOnlySpan<byte>) and SetRandomCardId().

The following list indicates the elements of the CCC that can be found on a YubiKey.

  • Unique Card Identifier
  • Application Identifier (part of the Unique Card ID
  • GSC-RID (Registered Application Provider Identifier, part of the AID)
  • Card Identifier (part of the Unique Card ID)
  • Manufacturer ID
  • Card Type
  • Container Version Number
  • Grammar Version Number
  • PKCS #15 Version Number (for the YubiKey, this is 0x00 indicating PKCS #15 is not supported
  • Data Model Number

Constructors

Name Description
CardCapabilityContainer()

Build a new object. This will not get the CCC from from any YubiKey, it will only build an "empty" object.

Properties

Name Description
ApplicationIdentifier

The "AID" (Capabilities Application Identifier), which consists of the GSC-RID || ManufacturerID || CardType.

CardIdentifier

The actual Card Identifier portion of the Unique Card Identifier.

CardType

The card type is fixed at JavaCard.

ContainerVersionNumber

The version number of the CCC itself, it is fixed at version 2.1.

DataModelNumber

The number representing the Data Model used by the smart card. For the YubiKey it is fixed at 0x10 (a PIV requirement).

GrammarVersionNumber

The version number of the CCC grammar, it is fixed at version 2.1.

GscRid

The "Government Smart Card - Registered Application Provider Identifier".

ManufacturerId

The manufacturer ID is fixed at 0xFF

Pkcs15Version

The version of PKCS #15 the card supports. If the card does not support PKCS #15, this number is 0x00. For the YubiKey it is fixed at 0x00.

UniqueCardIdentifier

The full Unique Card Identifier which consists of the AID || CardID.

Methods

Name Description
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.

SetCardId(ReadOnlySpan<byte>)

Set the CardIdentifier with the given value. If the array is not exactly 14 bytes, this method will throw an exception.

SetRandomCardId()

Set the CardId with a random, 14-byte value.

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