nseal 1.3.0
See the version list below for details.
dotnet add package nseal --version 1.3.0
NuGet\Install-Package nseal -Version 1.3.0
<PackageReference Include="nseal" Version="1.3.0" />
paket add nseal --version 1.3.0
#r "nuget: nseal, 1.3.0"
// Install nseal as a Cake Addin #addin nuget:?package=nseal&version=1.3.0 // Install nseal as a Cake Tool #tool nuget:?package=nseal&version=1.3.0
NSeal
The library focuses on the problem of storing content in insecure storage locations, or transporting content across insecure transport.
Storage Encryption
Storing content in insecure locations makes it vulnerable to abuse from malicious actors.Nseal provides the KeyEnvelope
to generate a master data encryption key (DEK) and generate a key encryption key (KEK) to encrypt the DEK. The KEK is derived from the user's password and a salt, so is not accessible to an attacker.
This is intended for systems protecting user data with their own keys. It is not a solution for end to end encryption. Never provide private data or password information to a system you do not trust.
The following example shows how to create a key envelope and get the DEK to perform symmetric key encryption:
var envelope = await KeyEnvelope.Create("your password");
var dek = await envelope.GetDek("your password");
// perform your own encryption operations
The following example shows how to create a key envelope and use it to create encrypted streams to write private data to:
var envelope = await KeyEnvelope.Create("your password");
await using var contentStream = new MemoryStream();
var encryption = await envelope.CreateEncryptionStream("your password", contentStream);
await encryption.WriteAsync(content);
await encryption.FlushAsync();
The provided stream will flush the final block when the stream is closed or disposed.
Transport Encryption
Transporting content over insecure transports exposes the content to eavesdropping or manipulation. To prevent this, the data should at least be encrypted (content security), but should also signed to show it has not been altered (integrity check).
Nseal provides the CryptoSealer
class to generate a zip file for encrypted content. When building the encrypted content, the CryptoSealer
uses the public key of the intended recipient to generate (DEK) and protect (KEK) symmetric keys used for content encryption. There is a corresponding CryptoUnsealer
for performing the unpacking of the encrypted content. To decrypt the content, the recipient's private key is required.
The CryptoSealer
and CryptoUnsealer
use asymmetric keys to protect the generated encryption keys to make it easier to perform key exchanges across systems.
The following example shows how to create an encrypted package:
var sealer = new CryptoSealer([Recipient RSA]);
await using (var output = File.Create("output.zip"))
{
var content = new EncryptionContent(
"item.txt",
new MemoryStream(Encoding.UTF8.GetBytes("Hello, World")));
await sealer.Encrypt(new[] { content }, output);
}
// File is now ready for reading or transport.
var readableStream = File.OpenRead("output.zip");
See tests for further running examples.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. 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 | 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. |
-
.NETStandard 2.1
- Newtonsoft.Json (>= 12.0.3)
- sharpcompress (>= 0.26.0)
-
net5.0
- Newtonsoft.Json (>= 12.0.3)
- sharpcompress (>= 0.26.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.