eas-dotnet 1.1.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package eas-dotnet --version 1.1.3
                    
NuGet\Install-Package eas-dotnet -Version 1.1.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="eas-dotnet" Version="1.1.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="eas-dotnet" Version="1.1.3" />
                    
Directory.Packages.props
<PackageReference Include="eas-dotnet" />
                    
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 eas-dotnet --version 1.1.3
                    
#r "nuget: eas-dotnet, 1.1.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.
#:package eas-dotnet@1.1.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=eas-dotnet&version=1.1.3
                    
Install as a Cake Addin
#tool nuget:?package=eas-dotnet&version=1.1.3
                    
Install as a Cake Tool

eas-dotnet

GitHub issues GitHub

This C# SDK is intended to be used in conjunction with making a user account at Encryption API Service and uptaining a API key to generate a token. The SDK makes authenticated API calls to the main EAS API. We have done ton's of work for you on the API side of things organizing and researching some of the most popular and performant crytographic packages and implementing them in the systems level language Rust. We have also saved you the time of learning to work with Rust FFI in our performant_encryption crate which is what the API calls in this SDK are utilizing.

The Nuget package homepage can be located here.

Examples

Getting a Token

EASConfiguration.ApiKey = "";

TokenCache tokenCache = new TokenCache();
string token = await tokenCache.GetToken();
Console.WriteLine(token);

ED25519-Dalek (Signatures)

// Insert your API Key located in the EAS user dashboard into this string.
EASConfiguration.ApiKey = "";

// Get our authentication token based on the ApiKey.
string token = await new TokenCache().GetToken();

ED25519DalekService dalek = new ED25519DalekService();
var keyPair = await dalek.GenerateKeyPair(token);
string dataToSign = "DataToSignWithDalk2";
ED25519DalekSignResponse signatureResponse = await dalek.Sign(token, keyPair.KeyPair, dataToSign);
// This will be a value of false because our signature data is different than the data we are verifying.
ED25519DalekVerifyResponse verifyResponse = await dalek.Verify(token, signatureResponse.PublicKey, signatureResponse.Signature, "123");

Password Hasing (Argon2)

// Insert your API Key located in the EAS user dashboard into this string.
EASConfiguration.ApiKey = "";

// Get our authentication token based on the ApiKey.
string token = await new TokenCache().GetToken();

PasswordService passwordService = new PasswordService();

string password = "MyBadPasswordToHash";
// One-way hash the password
string encryptedPassword = await passwordService.Argon2HashPassword(token, password);
// Check is the user supplied password is the same password as the one supplied
bool isValid = await passwordService.Argon2VerifyPassword(token, encryptedPassword, password);

RSA Key Pair Generation, Encrypt, and Decrypt

// Insert your API Key located in the EAS user dashboard into this string.
EASConfiguration.ApiKey = "";

string token = await new TokenCache().GetToken();
string dataToEncrypt = "DataToEncrypt#($*#$(*#$(";

RsaService rsaService = new RsaService();
// Get an RSA 4096 bit key pair
RsaGetKeyPairResponse rsaKeyPair = await rsaService.GetRsaKeys(token, 4096);
Console.WriteLine(rsaKeyPair.PrivateKey + "\n");
Console.WriteLine(rsaKeyPair.PublicKey + "\n");

// Encrypt our string with the Public Key we generated 
RsaEncryptWithPublicResponse encryptedResponse = await rsaService.EncryptWithPublicKey(token, rsaKeyPair.PublicKey, dataToEncrypt);
Console.WriteLine("Encrypted Data: {0}", encryptedResponse.EncryptedData);
// Decrypt our string with the Private Key we generated
RsaDecryptResponse decryptResponse = await rsaService.DecryptWithPrivateKey(token, rsaKeyPair.PrivateKey, encryptedResponse.EncryptedData);
Console.WriteLine("Decrypted Data : {0}", decryptResponse.DecryptedData);

AES/RSA Hybrid Encryption and Decryption

// Insert API Key here.
EASConfiguration.ApiKey = "";

HybridEncryptionService service = new HybridEncryptionService();
TokenCache tokenCache = new TokenCache();
string token = await tokenCache.GetToken();
NonceGenerator nonceGenerator = new NonceGenerator();
string nonceKey = nonceGenerator.GenerateAES256Nonce();
string dataToEncrypt = "12345678cvnksdfio";
AESRSAHybridEncryptResponse encryptResponse = await service.EncryptAESRsaHybrid(token, nonceKey, 4096, dataToEncrypt);
AESRSAHybridDecryptResponse decryptResponse = await service.DecryptAESRsaHybrid(token, encryptResponse.PrivateKey, encryptResponse.EncryptedAesKey, nonceKey, encryptResponse.EncryptedData);

Supporters / Dontations

Microsoft For Startups

Buy Me A Coffee

This project is maintained through Apache 2.0.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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.1.4 268 5/30/2023
1.1.3 267 5/18/2023
1.1.2 301 5/2/2023
1.1.1 315 4/11/2023
1.1.0 362 3/12/2023
1.0.9 352 3/12/2023
1.0.8 348 3/12/2023
1.0.7 378 2/26/2023
1.0.6 394 2/19/2023
1.0.5 381 2/18/2023
1.0.4 440 1/15/2023
1.0.3 431 1/15/2023
1.0.2 440 1/15/2023
1.0.1 450 12/18/2022