WSCT.GlobalPlatform
1.0.0
dotnet add package WSCT.GlobalPlatform --version 1.0.0
NuGet\Install-Package WSCT.GlobalPlatform -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WSCT.GlobalPlatform" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WSCT.GlobalPlatform" Version="1.0.0" />
<PackageReference Include="WSCT.GlobalPlatform" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WSCT.GlobalPlatform --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: WSCT.GlobalPlatform, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package WSCT.GlobalPlatform@1.0.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=WSCT.GlobalPlatform&version=1.0.0
#tool nuget:?package=WSCT.GlobalPlatform&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
WSCT GlobalPlatform
Public repository for WSCT GlobalPlatform project.
Features
The current status of this project is work in progress.
- GP 2.2 commands:
-
SELECT CARD MANAGER -
GET CARD DATA -
GET DATA -
GET STATUS -
INSTALL [for load] -
INSTALL [for install] -
INSTALL [for make selectable] -
INSTALL [for install and make selectable] -
LOAD -
DELETE
-
- SCP01 support:
- Mutual authentication (
INITIALIZE UPDATE,EXTERNAL AUTHENTICATE) - Automatic wrapping / unwrapping of APDU
- CMAC
- CDEC
- Mutual authentication (
- SCP02 support:
- 3-keys
- 1-key
- Mutual authentication (
INITIALIZE UPDATE,EXTERNAL AUTHENTICATE) - Automatic wrapping / unwrapping of APDU
- CMAC
- RMAC
- CDEC
Some example of usage
Secure Channel Establishment
// Define GlobalPlatform card keys
var SEnc = "40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F".FromHexa();
var SMac = "40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F".FromHexa();
var Dek = "40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F".FromHexa();
CardContext? cardContext;
CardChannel? cardChannel;
try
{
// Get a valid cardChannel instance
// ...
// Use GlobalPlatform API
var gpCard = new GlobalPlatformCard(cardChannel);
gpCard
.ProcessSelectCardManager();
gpCard
.ProcessGetCardData();
Console.WriteLine(gpCard.CardData);
// Do SCP02 Mutual Authentication
var scpUsed = gpCard.CardData.SupportedScps.First(scp => scp.Identifier == 0x02);
gpCard
.ProcessInitializeUpdate(scpUsed, keyVersion, KeyIdentifier, hostChallenge);
Console.WriteLine(gpCard.SecureChannelData);
gpCard
.CreateSessionKeys(new Keys(SEnc, SMac, Dek));
Console.WriteLine(gpCard.SecureChannelData);
gpCard
.AuthenticateCard();
gpCard
.ProcessExternalAuthenticate(SecurityLevel.CMac /*| SecurityLevel.CEnc */);
Console.WriteLine(gpCard.SecureChannelData);
// GET STATUS command
gpCard
.ProcessCommand(new CommandAPDU(0x80, 0xF2, 0x40, 0x00, 0x02, new byte[] { 0x4F, 0x00 }, 0x00));
// GET DATA Key Information Template
gpCard
.ProcessCommand(new GetDataCommand(0xE0));
// GET DATA Sequence Counter of the default Key Version Number
gpCard
.ProcessCommand(new GetDataCommand(0xC1));
}
finally
{
cardChannel?
.Disconnect(Disposition.UnpowerCard);
cardContext
.Release();
}
INSTALL [for load]
Once the secure channel is established, a new application on the card can be loaded on the card.
var loadFileAid = "F04341454E42".FromHexa();
byte[] securityDomainAid = [];
byte[] loadFileDataBlockHash = [];
byte[] loadParameters = [];
byte[] loadToken = [];
gpCard
.ProcessInstallForLoad(loadFileAid, securityDomainAid, loadFileDataBlockHash, loadParameters, loadToken);
var pathToCapFile = @"path/to/cap/file/applet.cap";
gpCard
.ProcessLoad(pathToCapFile);
INSTALL [for install and make selectable]
var moduleAid = "F04341454E42 01".FromHexa();
var applicationAid = "F04341454E42 01".FromHexa();
var privileges = "00".FromHexa();
var installParameters = "C9 00".FromHexa();
byte[] installToken = [];
gpCard
.ProcessInstallForInstallAndMakeSelectable(loadFileAid, moduleAid, applicationAid, privileges, installParameters, installToken);
DELETE
var aid = "F04341454E42".FromHexa();
gpCard
.ProcessDelete(aid);
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- WSCT.Core (>= 6.5.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.