SecurityDataParsers.SubjectAlternativeName 1.0.3

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

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

SubjectAlternativeName

NuGet NuGet Release

A class for digging into all the possible extension data that can be on a certificate.

Some of the more obscure ones are:

  • Federal Agency Smart Credential Number (FASC-N)
  • X400 Address
  • Edi Party Name

See the IETF Specification for more information

Installation

Install the package with NuGet

    Install-Package SecurityDataParsers.SubjectAlternativeName

Or via the .NET Core command line interface:

    dotnet add package SecurityDataParsers.SubjectAlternativeName

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

Usage

using SecurityDataParsers.SubjectAlternativeName;

// Load the certificate you want get data from
var cert = new X509Certificate2("path/to/certificate.pfx", "password");

// Get the SAN extension
var sanExtension = cert.Extensions["2.5.29.17"];
// Parse the SAN extension
var san = new SAN(sanExtension);

// Or let the SAN class extract it itself
var san = new SAN(cert);


// Destructure the SAN extension to get its properties
var (
  fASCN,
  principalName,
  rfc822Name,
  dnsName,
  x400Address,
  directoryName,
  ediPartyName,
  uniformResourceIdentifier,
  iPAddress,
  registeredID
) = san.First;

// Use the properties as needed
Console.WriteLine($"FASCN: {fASCN.personIdentifier}");
Console.WriteLine($"Principal Name: {principalName}");

// If it contains multiples, the base class contains lists you can check.
san.dnsNames.Select(v => Console.WrtitLine(v.Host))

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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.3 258 11/17/2023
1.0.2 160 10/27/2023
1.0.1 155 10/24/2023
1.0.0 143 10/24/2023

CHANGELOG.md