FideliusCrypto 1.0.13

dotnet add package FideliusCrypto --version 1.0.13
                    
NuGet\Install-Package FideliusCrypto -Version 1.0.13
                    
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="FideliusCrypto" Version="1.0.13" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FideliusCrypto" Version="1.0.13" />
                    
Directory.Packages.props
<PackageReference Include="FideliusCrypto" />
                    
Project file
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 FideliusCrypto --version 1.0.13
                    
#r "nuget: FideliusCrypto, 1.0.13"
                    
#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.
#addin nuget:?package=FideliusCrypto&version=1.0.13
                    
Install FideliusCrypto as a Cake Addin
#tool nuget:?package=FideliusCrypto&version=1.0.13
                    
Install FideliusCrypto as a Cake Tool

FideliusCrypto 🔐

GitHub Workflow Status NuGet NuGet Downloads

A .NET library for ECDH cryptography, utilizing Curve25519 and a custom HMAC-based Key Derivation Function to generate AES-GCM keys for secure data encryption and decryption. Its primary purpose is to secure health data within the ABDM ecosystem.


📦 Installation

NuGet Package

Install the package via NuGet:

dotnet add package FideliusCrypto

🔑 KeyPair Generation

var keyPairGen = new FideliusKeyPairGeneration();
var result = keyPairGen.Generate();

🔒 Encryption

var keyPairGen = new FideliusKeyPairGeneration();
var sender = keyPairGen.Generate();
var requester = keyPairGen.Generate();

var encryptionRequest = new FideliusEncryptionRequest(
    sender.PrivateKey,
    sender.Nonce,
    requester.PublicKey,
    requester.Nonce,
    "testString");

var encryptionService = new FideliusEncryptionService();

var response = encryptionService.Encrypt(encryptionRequest);

🔓 Decryption

var keyPairGen = new FideliusKeyPairGeneration();
var sender = keyPairGen.Generate();
var requester = keyPairGen.Generate();

var decryptionRequest = new FideliusDecryptionRequest(
    "G3UUnMPvWxCt3kE7KZ6kSpfakoeo8sn/Fzo=",
    requester.Nonce,
    sender.Nonce,
    requester.PrivateKey,
    sender.PublicKey);

var decryptionService = new FideliusDecryptionService();

var response = decryptionService.Decrypt(decryptionRequest);

📝 Usage Example

Here's a complete example to demonstrate the usage of FideliusCrypto:

using FideliusCrypto;

class Program
{
    static void Main(string[] args)
    {
        var keyPairGen = new FideliusKeyPairGeneration();

        // Generate key pairs for sender and requester
        var sender = keyPairGen.Generate();
        var requester = keyPairGen.Generate();

        // Create encryption request
        var encryptionRequest = new FideliusEncryptionRequest(
            sender.PrivateKey,
            sender.Nonce,
            requester.PublicKey,
            requester.Nonce,
            "This is a secret message.");

        var encryptionService = new FideliusEncryptionService();
        var encryptedResponse = encryptionService.Encrypt(encryptionRequest);

        // Display encrypted message
        Console.WriteLine("Encrypted message: " + encryptedResponse.EncryptedText);

        // Create decryption request
        var decryptionRequest = new FideliusDecryptionRequest(
            encryptedResponse.EncryptedText,
            requester.Nonce,
            sender.Nonce,
            requester.PrivateKey,
            sender.PublicKey);

        var decryptionService = new FideliusDecryptionService();
        var decryptedResponse = decryptionService.Decrypt(decryptionRequest);

        // Display decrypted message
        Console.WriteLine("Decrypted message: " + decryptedResponse.DecryptedText);
    }
}

📦 Dependency Injection Support

FideliusCrypto can be easily registered in .NET Dependency Injection (DI):

using FideliusCrypto;
using Microsoft.Extensions.DependencyInjection;

var services = new ServiceCollection();
services.AddFideliusCrypto();
var serviceProvider = services.BuildServiceProvider();

// Resolve services
var keyPairGen = serviceProvider.GetRequiredService<FideliusKeyPairGeneration>();
var encryptionService = serviceProvider.GetRequiredService<FideliusEncryptionService>();
var decryptionService = serviceProvider.GetRequiredService<FideliusDecryptionService>();

🛠 Features

KeyPair Generation: Generate cryptographic key pairs for secure communication.

ECDH Key Exchange: Securely exchange keys using Elliptic Curve Diffie-Hellman (ECDH).

AES-GCM Encryption: Encrypt data with AES-GCM for authenticated encryption.

HKDF Key Derivation: Derive keys using HMAC-based Extract-and-Expand Key Derivation Function (HKDF).

GitHub Repository: FideliusCrypto

NuGet Package: FideliusCrypto

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  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.  net9.0 was computed.  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. 
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.13 544 a month ago
1.0.12 137 a month ago
1.0.11 138 a month ago
1.0.10 221 a month ago
1.0.9 216 2 months ago
1.0.8 211 2 months ago
1.0.7 198 2 months ago
1.0.6 211 2 months ago
1.0.5 202 2 months ago
1.0.2 206 2 months ago
1.0.1 197 2 months ago
1.0.0 204 2 months ago

Initial release of FideliusCrypto with ECDH key exchange, AES-GCM encryption, and HKDF support.