ETAMP 1.4.0
See the version list below for details.
dotnet add package ETAMP --version 1.4.0
NuGet\Install-Package ETAMP -Version 1.4.0
<PackageReference Include="ETAMP" Version="1.4.0" />
paket add ETAMP --version 1.4.0
#r "nuget: ETAMP, 1.4.0"
// Install ETAMP as a Cake Addin #addin nuget:?package=ETAMP&version=1.4.0 // Install ETAMP as a Cake Tool #tool nuget:?package=ETAMP&version=1.4.0
ETAMP (Encrypted Token And Message Protocol)
NuGet Package
ETAMP (Encrypted Token And Message Protocol) is a lightweight .NET library designed for enhancing message and transaction security within applications. It incorporates advanced cryptographic techniques, including JWT (JSON Web Tokens), ECDSA (Elliptic Curve Digital Signature Algorithm), and optional ECDH (Elliptic Curve Diffie-Hellman) encryption, to provide robust protection against unauthorized access and data tampering. Ideal for systems requiring secure data transmission, ETAMP is easy to integrate and ensures the highest levels of data integrity and confidentiality.
Features
- Create and verify JWT tokens using ECDSA
- Optional encryption of JWT tokens using ECDH
- Message integrity verification using ECDSA digital signatures
- Easy integration with existing projects
- High scalability and performance
Installation
Install ETAMP via NuGet Package Manager:
Install-Package ETAMP
Usage
Creating a Basic ETAMP
using ETAMPManagment;
using ETAMPManagment.Factories;
using ETAMPManagment.Models;
ISigningCredentialsProvider signingCredentialsProvider = new ECDsaSigningCredentialsProvider()
// Create an ETAMP factory
var etampFactory = new ETAMPFactory();
etampFactory.RegisterGenerator(ETAMPType.Base, () => new ETAMPBase(signingCredentialsProvider));
// Create an ETAMP builder
var etampBuilder = new ETAMPBuilder(etampFactory);
// Create a basic ETAMP
var payload = new BasePayload();
var etamp = etampBuilder.CreateETAMP("update_type", payload).Build();
Creating a Signed ETAMP
using System.Security.Cryptography;
using ETAMPManagment.Wrapper;
// Create a signature wrapper
var ecdsa = ECDsa.Create();
var signWrapper = new SignWrapper(ecdsa, HashAlgorithmName.SHA512);
// Create an ETAMP factory
var etampFactory = new ETAMPFactory();
etampFactory.RegisterGenerator(ETAMPType.Sign, () => new ETAMPSign(signWrapper));
// Create an ETAMP builder
var etampBuilder = new ETAMPBuilder(etampFactory);
// Create a signed ETAMP
var payload = new BasePayload();
var etamp = etampBuilder.CreateSignETAMP("update_type", payload).Build();
Creating an Encrypted ETAMP
using ETAMPManagment.Encryption;
using ETAMPManagment.Factories;
// Create an encryption service factory
var encryptionServiceFactory = new EncryptionServiceFactory();
encryptionServiceFactory.RegisterEncryptionService("AES", () => new AesEncryptionService());
// Create an ETAMP factory
var etampFactory = new ETAMPFactory();
etampFactory.RegisterGenerator(ETAMPType.Encrypted, () => new ETAMPEncrypted(new EciesEncryptionService(new KeyExchanger(new KeyPairProvider()), encryptionServiceFactory, "AES")));
// Create an ETAMP builder
var etampBuilder = new ETAMPBuilder(etampFactory);
// Create an encrypted ETAMP
var payload = new BasePayload();
var etamp = etampBuilder.CreateEncryptedETAMP("update_type", payload).Build();
Creating an Encrypted and Signed ETAMP
using System.Security.Cryptography;
using ETAMPManagment.Encryption;
using ETAMPManagment.Factories;
using ETAMPManagment.Wrapper;
// Create a signature wrapper
var ecdsa = ECDsa.Create();
var signWrapper = new SignWrapper(ecdsa, HashAlgorithmName.SHA512);
// Create an encryption service factory
var encryptionServiceFactory = new EncryptionServiceFactory();
encryptionServiceFactory.RegisterEncryptionService("AES", () => new AesEncryptionService());
// Create an ETAMP factory
var etampFactory = new ETAMPFactory();
etampFactory.RegisterGenerator(ETAMPType.EncryptedSign, () => new ETAMPEncryptedSigned(signWrapper, new EciesEncryptionService(new KeyExchanger(new KeyPairProvider()), encryptionServiceFactory, "AES")));
// Create an ETAMP builder
var etampBuilder = new ETAMPBuilder(etampFactory);
// Create an encrypted and signed ETAMP
var payload = new BasePayload();
var etamp = etampBuilder.CreateEncryptedSignETAMP("update_type", payload).Build();
Validating an ETAMP
using ETAMPManagment.Validators;
using Microsoft.IdentityModel.Tokens;
using System.Security.Cryptography;
// Create an ETAMP validator
var ecdsa = ECDsa.Create();
var tokenSecurityKey = new ECDsaSecurityKey(ecdsa);
var jwtValidator = new JwtValidator();
var structureValidator = new StructureValidator(jwtValidator);
var signatureValidator = new SignatureValidator(new VerifyWrapper(ecdsa, HashAlgorithmName.SHA512));
var etampValidator = new ETAMPValidator(jwtValidator, structureValidator, signatureValidator);
// Validate the ETAMP
var isValid = await etampValidator.ValidateETAMP(etamp.ToString(), "audience", "issuer", tokenSecurityKey);
License
This project is licensed under the MIT License.
Contributing
Contributions are welcome! If you're interested in contributing, please feel free to submit pull requests or open issues for bugs and feature requests.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. |
-
net8.0
- Newtonsoft.Json (>= 13.0.3)
- System.IdentityModel.Tokens.Jwt (>= 7.4.1)
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 |
---|---|---|
3.1.2 | 52 | 10/29/2024 |
3.0.2 | 101 | 5/31/2024 |
3.0.1 | 96 | 5/31/2024 |
3.0.0 | 99 | 5/31/2024 |
2.0.0 | 121 | 5/5/2024 |
1.4.0 | 132 | 3/23/2024 |
1.3.1 | 133 | 3/4/2024 |
1.3.0 | 116 | 3/2/2024 |
1.2.0 | 140 | 3/1/2024 |
1.1.5 | 138 | 2/8/2024 |
1.1.4 | 216 | 12/16/2023 |
1.1.3 | 166 | 12/6/2023 |
1.1.2 | 147 | 12/5/2023 |
1.1.1 | 145 | 12/3/2023 |
1.1.0 | 159 | 12/3/2023 |
1.0.2 | 161 | 11/28/2023 |
1.0.1 | 144 | 11/27/2023 |
1.0.0 | 127 | 11/26/2023 |