Skip to content

dotnet-demos/Org.Security.Cryptography.X509Extensions

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

99 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Area Badges
Build .Net workflow
Code GitHub code size in bytes GitHub repo size
Code Quality Maintainability
Test codecov

Org.Security.Cryptography.X509Extensions

X509Certificate2 Extensions and classes for Encrypting and Signing using X509 certs.

Getting started

  • Clone or download the repo
  • Compile Org.Security.Cryptography.X509Extensions.csproj to get the assembly.
  • Refer the assembly in your project.

Usage (Encryption)

    var x509Certificate = GetCertificateUsingYourWay(); // This certificate doesn't need to have private key.
    Stream yourStreamToEncrypt = GetYourStreamToEncrypt();
    var encryptedStream = new MemoryStream();
    x509Certificate.EncryptStream(yourStreamToEncrypt,encryptedStream);  

Usage (Decryption)

    var x509Certificate = GetCertificateWithPrivateKeyUsingYourWay();
    Stream yourStreamToDecrypt = GetYourStreamToDecrypt();
    var decryptedStream = new MemoryStream();
    x509Certificate.DecryptStream(yourStreamToDecrypt, decryptedStream);  

For other APIs, please refer the unit tests or the API documentation

Documentation

Documentation site has articles as well as API documentation.

Running tests

Use dotnet test command or use the "Test Explorer" windows of Visual Studio.

In order to view coverage, use any of the below methods.

Commandline

Below command has codecoverage threshold 100. It will fail as of now.

dotnet test "src/UnitTests/UnitTests.csproj" --framework Net5.0 /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Threshold=100 /p:ThresholdType=line /p:Exclude="[*]X509.EnduranceTest.Shared*"

It is excluding the shared test library.

Visual Studio

Use the "Run Coverlet Report" extension as mentioned here.

About

Extensions for Encrypting and Signing using X509 certs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 97.2%
  • PowerShell 2.8%