CryptAndHashLib.NetStandard 1.1.0

dotnet add package CryptAndHashLib.NetStandard --version 1.1.0
NuGet\Install-Package CryptAndHashLib.NetStandard -Version 1.1.0
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="CryptAndHashLib.NetStandard" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CryptAndHashLib.NetStandard --version 1.1.0
#r "nuget: CryptAndHashLib.NetStandard, 1.1.0"
#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.
// Install CryptAndHashLib.NetStandard as a Cake Addin
#addin nuget:?package=CryptAndHashLib.NetStandard&version=1.1.0

// Install CryptAndHashLib.NetStandard as a Cake Tool
#tool nuget:?package=CryptAndHashLib.NetStandard&version=1.1.0

CryptAndHashLib.NetStandard

This is a simple package for cryption/encryption and hashing for use in .Net Standard.

Encryption and decryption

The library supports one algorithm for encrypting and decrypting, the AES algorithm, taken from the .netstandard framework. Standard setup is used, with CBC as the mode with PKCS7 padding, 256 bits key and 16-bits initialization vector. The key is retrieved from active configuration file and app setting "EncryptionKey". This library demands that you have this app setting. The library does not support key vaults such as Azure Key vault.

It is possible to specify initialization vector to the encryption, if not the auto-generated IV is selected.

Hashing and verifying

Hashing and verifying is done using the Pbkdf2 key derivation. It is possible to specify pseudo random function as one of the KeyDerivationPrf functions and number of iterations. Default if number of iterations and prf is not specified is 10,000 iterations and the HMACSHA1 prf is selected for compability with .NET Framework. The verifying runs a SequenceEqual of hashed bytes input and generated hashed bytes of course.

The hashing generates a 16 byte salt and 32 byte hash separated with a space character. To verify the hash, provide this hash with the salt to the verify method, do not split the string before as this is done internally in the verify method.

Generating new nuget package

Just run this dotnet command:

dotnet pack

Use in production environment

This library could be used for small scale use in production environments. But using a key vault such as Azure Key Vault is strongly suggested.

License

The license of this library is MIT License. No warranties are given. You may freely redistribute and alter this library.

<hr />

Last update: 27.02.201

Tore Aurstad IT

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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  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.0 319 2/27/2021
1.0.0 273 2/26/2021