Area | Badges |
---|---|
Build | |
Code | |
Code Quality | |
Test |
X509Certificate2
Extensions and classes for Encrypting and Signing using X509 certs.
- Clone or download the repo
- Compile Org.Security.Cryptography.X509Extensions.csproj to get the assembly.
- Refer the assembly in your project.
var x509Certificate = GetCertificateUsingYourWay(); // This certificate doesn't need to have private key.
Stream yourStreamToEncrypt = GetYourStreamToEncrypt();
var encryptedStream = new MemoryStream();
x509Certificate.EncryptStream(yourStreamToEncrypt,encryptedStream);
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 site has articles as well as API documentation.
Use dotnet test
command or use the "Test Explorer" windows of Visual Studio.
In order to view coverage, use any of the below methods.
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.
Use the "Run Coverlet Report" extension as mentioned here.