SecurityDataParsers.FederalAgencySmartCredentialNumber 1.0.2

dotnet add package SecurityDataParsers.FederalAgencySmartCredentialNumber --version 1.0.2                
NuGet\Install-Package SecurityDataParsers.FederalAgencySmartCredentialNumber -Version 1.0.2                
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="SecurityDataParsers.FederalAgencySmartCredentialNumber" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SecurityDataParsers.FederalAgencySmartCredentialNumber --version 1.0.2                
#r "nuget: SecurityDataParsers.FederalAgencySmartCredentialNumber, 1.0.2"                
#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.
// Install SecurityDataParsers.FederalAgencySmartCredentialNumber as a Cake Addin
#addin nuget:?package=SecurityDataParsers.FederalAgencySmartCredentialNumber&version=1.0.2

// Install SecurityDataParsers.FederalAgencySmartCredentialNumber as a Cake Tool
#tool nuget:?package=SecurityDataParsers.FederalAgencySmartCredentialNumber&version=1.0.2                

FederalAgencySmartCredentialNumber

NuGet NuGet Release

A class for extracting all the good data from FASCN codes

  • Agency Code: Identifies the government agency issuing the credential
  • System Code: Identifies the system the card is enrolled in and is unique for each site
  • Credential Number: Encoded by the issuing agency. For a given system no duplicate numbers are active.
  • Credential Series: Field is available to reflect major system changes
  • Individual Credential Issue: Usually a 1 will be incremented if a card is replaced due to loss or damaged
  • Person Identifier: Numeric Code used by the identity source to uniquely identify the token carrier
  • Organizational Category: Type of Organization the individual is affiliated with; whether it is Federal, State, Commercial, or Foreign
  • Organization Identifier: The Identifier that identifies the organization the individual is affiliated with.
  • Person Or Organization Association Category: Indicates the affiliation type the individual has with the Organization, including their employment type.

For more info see the CAC Implementation Guide or the CAC Endpoint Implementation Guide

Or the NIST specification

Installation

Install the package with NuGet

    Install-Package SecurityDataParsers.FederalAgencySmartCredentialNumber

Or via the .NET Core command line interface:

    dotnet add package SecurityDataParsers.FederalAgencySmartCredentialNumber

Either commands, from Package Manager Console or .NET Core CLI, will download and install the package.

Usage


  using SecurityDataParsers.FederalAgencySmartCredentialNumber;
  // Load the smart card certificate, or any cert you want to check for a FASCN
  X509Certificate2 cert = new X509Certificate2("path/to/certificate.pfx", "password");
  // Smart card certificates are usually cached in windows personal cert store,
  // so you can pull it as only the public portion and still pull the FASCN off it.

  // Create a new FASCN object
  FASCN fascnObj = FASCN.fromCertificate(cert);

  // Extract the identifying properties from the FASCN object
  
  // Identifies the government agency issuing the credential
  string agencyCode = fascnObj.AgencyCode.GetFriendlyName();
  
  // Identifies the system the card is enrolled in and is unique for each site
  // 4 digits stored as bytes
  (byte, byte, byte, byte) systemCode = fascnObj.SystemCode.AsTuple();
  
  // Encoded by the issuing agency. For a given system no duplicate numbers are active.
  // 6 digits stored as bytes, too many possibilities to enumerate all possible friendly names, so it's up to the user to find agency codes.
  (byte, byte, byte, byte, byte, byte) credentialNumber = fascnObj.CredentialNumber.AsTuple();
  
  // Single reserved digit. Field is available to reflect major system changes
  ValueTuple<byte> credentialSeries = fascnObj.CredentialSeries.AsTuple();
  
  // Usually a 1, but will be incremented if a card is replaced due to loss or damaged
  ValueTuple<byte> individualCredentialIssue = fascnObj.IndividualCredentialIssue.AsTuple();
  
  // Numeric Code used by the identity source to uniquely identify the token carrier
  // 10 digits stored as bytes, this is what is usually the User ID
  byte[] personIdentifier = fascnObj.PersonIdentifier.Digits;
  
  // Type of Organization the individual is affiliated with; whether it is Federal, State, Commercial, or Foreign
  string organizationalCategory = fascnObj.OrganizationalCategory.GetFriendlyName();
  
  // The Identifier that identifies the organization the individual is affiliated with.
  // 4 digits stored as bytes
  (byte, byte, byte, byte) organizationIdentifier = fascnObj.OrganizationIdentifier.AsTuple();
  
  // Indicates the affiliation type the individual has with the Organization, including their employment type.
  string personOrOrganizationAssociationCategory = fascnObj.PersonOrOrganizationAssociationCategory.GetFriendlyName();

API

See the API docs: docs/README.md

Changelog

Take a look at the CHANGELOG.md.

Contribution

You're free to contribute to this project by submitting issues and/or pull requests.

Please keep in mind that every change and feature should be covered by tests.

License

This project is licensed under MIT.

Contributors

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on SecurityDataParsers.FederalAgencySmartCredentialNumber:

Package Downloads
SecurityDataParsers.SubjectAlternativeName

A parser to extract all the data that the spec allows for from certificate SAN data

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 315 10/27/2023
1.0.1 171 10/24/2023
1.0.0 169 10/24/2023

CHANGELOG.md