NSec is available as a NuGet package from It can be added to a project in a number of ways, depending on the project type and tools used:

dotnet CLI

$ dotnet add package NSec.Cryptography --version 18.6.0

Visual Studio

PM> Install-Package NSec.Cryptography -Version 18.6.0


<PackageReference Include="NSec.Cryptography" Version="18.6.0"/>

Supported Languages

NSec requires C# 7.2 or later.

A C# 7.2 compiler is included in the .NET Core SDK beginning with version 2.1 and Visual Studio beginning with version 15.5. Projects need to opt into C# 7.2 by setting the Language Version to latest or 7.2 (or later).

Supported Platforms

NSec runs on the following platforms and .NET Core versions:

OSVersionArchitectures.NET Core Runtimes
Windows 101803x64 / x862.1 / 2.0 / 1.1
macOS10.12x642.1 / 2.0 / 1.1
CentOS7.4x642.1 / 2.0 / 1.1
Debian8.10x642.1 / 2.0 / 1.1
9.4x642.1 / 2.0
Fedora26x642.1 / 2.0
27x642.1 / 2.0
28x642.1 / 2.0
OpenSUSE42.3x642.1 / 2.0
Ubuntu14.04x642.1 / 2.0 / 1.1
16.04x642.1 / 2.0 / 1.1
17.10x642.1 / 2.0
18.04x642.1 / 2.0

Other operating systems and versions supported by .NET Core should work as well but are untested.

Using NSec on Windows requires the Visual C++ 2015 Redistributable. This dependency is automatically installed by the .NET Core installer but may not be present, for example, when deploying a self-contained application.

The implementation of AES-GCM in NSec is hardware-accelerated and requires an x64 processor with the AES-NI extension. The availability of this extension can be checked at runtime with the static IsSupported property of the NSec.Cryptography.Aes256Gcm class.

.NET Framework

Running NSec on recent versions of .NET Framework might work as well but is untested. It seems at least the following conditions are required to be met: First, the project needs to use <PackageReference> package references; projects using Packages.config don’t work. Second, the project needs to have the Platform Target set to x64 or x86; other platform targets – including Any CPU – don’t work.