Nops.Configuration
1.1.0
Prefix Reserved
See the version list below for details.
dotnet add package Nops.Configuration --version 1.1.0
NuGet\Install-Package Nops.Configuration -Version 1.1.0
<PackageReference Include="Nops.Configuration" Version="1.1.0" />
<PackageVersion Include="Nops.Configuration" Version="1.1.0" />
<PackageReference Include="Nops.Configuration" />
paket add Nops.Configuration --version 1.1.0
#r "nuget: Nops.Configuration, 1.1.0"
#:package Nops.Configuration@1.1.0
#addin nuget:?package=Nops.Configuration&version=1.1.0
#tool nuget:?package=Nops.Configuration&version=1.1.0
<p align="center"> <img src="https://raw.githubusercontent.com/atulmish/Nops/main/docs/images/banner.png" alt="Nops: read SOPS-encrypted secrets straight into .NET configuration" width="100%"> </p>
<p align="center"> <a href="https://github.com/atulmish/Nops/actions/workflows/ci.yml"><img src="https://github.com/atulmish/Nops/actions/workflows/ci.yml/badge.svg" alt="CI"></a> <a href="https://github.com/atulmish/Nops/actions/workflows/codeql.yml"><img src="https://github.com/atulmish/Nops/actions/workflows/codeql.yml/badge.svg" alt="CodeQL"></a> <a href="https://securityscorecards.dev/viewer/?uri=github.com/atulmish/Nops"><img src="https://api.securityscorecards.dev/projects/github.com/atulmish/Nops/badge" alt="OpenSSF Scorecard"></a> <a href="https://atulmish.github.io/Nops/"><img src="https://github.com/atulmish/Nops/actions/workflows/pages.yml/badge.svg" alt="Docs"></a> </p>
<p align="center"> <a href="https://www.nuget.org/packages/Nops.Core"><img src="https://img.shields.io/nuget/v/Nops.Core.svg?label=Nops.Core&logo=nuget" alt="Nops.Core on NuGet"></a> <a href="https://www.nuget.org/packages/Nops.Configuration"><img src="https://img.shields.io/nuget/v/Nops.Configuration.svg?label=Nops.Configuration&logo=nuget" alt="Nops.Configuration on NuGet"></a> <a href="https://www.nuget.org/packages/Nops.Core"><img src="https://img.shields.io/nuget/dt/Nops.Core.svg?label=downloads&color=blue" alt="NuGet downloads"></a> <a href="https://dotnet.microsoft.com/download"><img src="https://img.shields.io/badge/.NET-8%20%7C%2010-512BD4?logo=dotnet" alt=".NET 8 and .NET 10"></a> <a href="https://github.com/atulmish/Nops/actions/workflows/ci.yml"><img src="https://img.shields.io/badge/coverage-%E2%89%A595%25%20enforced-brightgreen" alt="Line coverage of at least 95% is enforced in CI"></a> </p>
<p align="center"> <a href="https://github.com/atulmish/Nops/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License: MIT"></a> <a href="https://github.com/atulmish/Nops/releases"><img src="https://img.shields.io/github/v/release/atulmish/Nops?include_prereleases&logo=github" alt="Latest release"></a> <a href="https://github.com/atulmish/Nops/commits/main"><img src="https://img.shields.io/github/last-commit/atulmish/Nops?logo=git&logoColor=white" alt="Last commit"></a> <a href="https://github.com/atulmish/Nops/blob/main/CONTRIBUTING.md"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs welcome"></a> <a href="https://github.com/atulmish/Nops/security/dependabot"><img src="https://img.shields.io/badge/dependabot-enabled-025E8C?logo=dependabot" alt="Dependabot enabled"></a> <a href="https://github.com/atulmish/Nops/stargazers"><img src="https://img.shields.io/github/stars/atulmish/Nops?style=flat&logo=github" alt="GitHub stars"></a> </p>
<p align="center"> <a href="https://atulmish.github.io/Nops/"><b>Documentation</b></a> · <a href="https://github.com/atulmish/Nops/blob/main/docs/quickstart.md">Quickstart</a> · <a href="https://github.com/atulmish/Nops/blob/main/samples/README.md">Samples</a> · <a href="https://github.com/atulmish/Nops/blob/main/CHANGELOG.md">Changelog</a> </p>
SOPS for .NET, without the sops binary
Nops reads SOPS-encrypted secrets straight into .NET configuration. There is no sops binary, no subprocess and no plaintext on disk.
| If you are... | What Nops gives you |
|---|---|
| A platform or Kubernetes engineer | No sops binary, shell or init step in the image. It runs on distroless and chiseled images, on Windows, and outside Kubernetes. |
| A security engineer | The file's MAC is verified before any value is returned, decrypted values stay in memory, and the age implementation is checked against the 101 official test vectors and against real sops output. See the security model. |
| An application developer | One line, AddSops("secrets.sops.yaml"), then IConfiguration, IOptions<T>, layering and reload work as they always have. |
You keep encrypting and editing secrets with the sops CLI as usual and commit the encrypted files. Your app decrypts them in-process at startup:
builder.Configuration.AddSops("secrets.sops.yaml");
Nops finds your age keys the same way sops does, decrypts the data key (age, PGP, AWS KMS, GCP KMS, Azure Key Vault, HashiCorp Vault), checks the file's MAC, and exposes the values through IConfiguration, ready for IOptions<T>.
<p align="center"> <img src="https://raw.githubusercontent.com/atulmish/Nops/main/docs/images/flow.png" alt="An encrypted secrets.sops.yaml committed to git is decrypted in-process by Nops (find key, unwrap data key, verify MAC, decrypt in memory) into IConfiguration values" width="100%"> </p>
The problem Nops solves
SOPS is a good way to keep secrets in git: values are encrypted, keys stay readable, diffs are reviewable, and access is controlled with age, PGP or a cloud KMS. But SOPS is a Go command-line tool, and a .NET app cannot read a SOPS file by itself. In practice teams reach for one of these:
| What you do today | What it costs |
|---|---|
Run sops -d in CI or an entrypoint script and ship the result |
A plaintext copy of the secrets on disk, in the image layer or in a Kubernetes Secret. An extra pipeline step to keep working. |
Bake the sops binary into the image and shell out at startup (including the .NET wrappers around the sops and age CLIs) |
A native binary per OS and architecture to ship, pin and patch. A subprocess, a shell and temp files at startup. Awkward on distroless images, Windows and Azure Functions. |
| Cluster tooling such as helm-secrets, ksops or a SOPS operator | Kubernetes only. The secrets end up as plaintext Kubernetes Secrets, and nothing helps outside a cluster or on a laptop. |
| Move to a runtime secret store (Vault, Key Vault, Secrets Manager) | A network dependency and infrastructure to run, and secrets leave your repo, so you lose reviewable, versioned, encrypted-in-git config. |
Nops is the missing piece for .NET: a library that reads the same SOPS files in-process. There is no sops binary at runtime, no subprocess and no plaintext on disk. Your app opens the encrypted file with the key it already has, verifies the file's MAC, and exposes the values as ordinary IConfiguration, so IOptions<T>, layering, environment-variable overrides and reload on change all work as usual.
You keep everything good about SOPS: your team still edits secrets with the sops CLI, the files in git don't change, and access is still decided by age, PGP or KMS keys. Nops only replaces the "decrypt it somehow before the app starts" step.
Use Nops if you have a .NET app, you want secrets encrypted in git, and you would rather not ship the sops binary or run a decrypt step. Look elsewhere if you need to create or edit encrypted files from code (Nops only decrypts, use the sops CLI), you are not on .NET, or you already run a secret store and are happy with it.
Why Nops
<p align="center"> <img src="https://raw.githubusercontent.com/atulmish/Nops/main/docs/images/features.png" alt="In-process, tamper-evident, same files as sops, fits .NET configuration, pay for what you use, reloads on change" width="100%"> </p>
<details> <summary>The same, as text</summary>
- No extra tooling at runtime. Your container doesn't need the
sopsbinary, a shell or a temporary plaintext file. - Same files as the
sopsCLI. Every test fixture is generated by realsops(3.13) and checked againstsops decryptin CI. - Tamper-evident. The file's MAC is verified before any value is returned.
- Fits .NET configuration. Values are layered, overridable, reloadable and bindable like any other configuration source.
- Pay for what you use.
Nops.Corehas no cloud SDK dependencies; each KMS lives in its own package.
</details>
Install
dotnet add package Nops.Configuration # IConfiguration provider (includes Nops.Core)
dotnet add package Nops.Core # Decryption API only
| Package | Use it for |
|---|---|
Nops.Core |
Decrypting files directly; age and PGP keys |
Nops.Configuration |
IConfiguration provider with reload on change (ASP.NET Core, generic host, console) |
Nops.Core.AwsKms |
AWS KMS keys |
Nops.Core.GcpKms |
Google Cloud KMS keys |
Nops.Core.Azkv |
Azure Key Vault keys |
Nops.Core.Vault |
HashiCorp Vault Transit keys |
Nops.Templates |
dotnet new templates for a web API and a worker service that load SOPS secrets |
From version 1.1.0 the libraries target .NET 8 and .NET 10, the two long-term support releases. Applications on .NET 9 use the .NET 8 build.
Try it in five minutes
dotnet new install Nops.Templates
dotnet new nops-webapi -n MyApi
cd MyApi && dotnet run
The template ships a demo secrets file and a TEST-ONLY key so it runs immediately. Its README explains how to switch to your own key. See also the samples and the hosting guide (console, worker service, ASP.NET Core, Azure Functions).
Quickstart
Encrypt a file with sops as usual:
age-keygen -o ~/.config/sops/age/keys.txt # once per machine
sops -e --age "$(age-keygen -y ~/.config/sops/age/keys.txt)" secrets.yaml > secrets.sops.yaml
ASP.NET Core / generic host
using Nops.Configuration;
var builder = WebApplication.CreateBuilder(args); // or Host.CreateApplicationBuilder(args)
builder.Configuration.AddSops("secrets.sops.yaml", opts =>
{
opts.WatchForChanges = true; // IOptionsMonitor<T> sees rotated secrets
});
builder.Services.AddOptions<DatabaseOptions>()
.BindConfiguration("Database")
.ValidateOnStart();
Database.Password in the YAML becomes Database:Password in IConfiguration, the same as with appsettings.json.
Decrypt directly
using Nops.Core;
var bytes = await File.ReadAllBytesAsync("secrets.sops.yaml");
// Flattened "a:b:c" keys
IReadOnlyDictionary<string, string> values =
await SopsFile.DecryptToDictionaryAsync(bytes, "yaml", new SopsOptions());
// Or bind to a type
var settings = await SopsFile.DecryptAsync<MySettings>(bytes, "yaml", new SopsOptions());
Plain config plus one secrets file
Most apps keep appsettings.json in plaintext and put only the secrets in a SOPS file. Sources layer in the order you add them, so the SOPS values override the plaintext file and environment variables still win:
builder.Configuration
.AddSops("secrets.sops.yaml")
.AddEnvironmentVariables()
.AddCommandLine(args);
Config diffs stay readable in review and only the secrets are encrypted. See Deploying with Nops for Kubernetes and Docker setups, partial encryption with encrypted_regex, and key rotation.
Where keys come from
| Source | How |
|---|---|
| sops environment (default) | SOPS_AGE_KEY, SOPS_AGE_KEY_FILE, then $XDG_CONFIG_HOME/sops/age/keys.txt (~/.config/…, ~/Library/Application Support/… or %AppData%\…). Turn off with UseSopsEnvironment = false. |
| Explicit age keys | opts.AgeIdentities = ["AGE-SECRET-KEY-1…", "/run/secrets/age.txt"] (keys or key-file paths) |
| PGP | opts.PgpKeys = [(File.ReadAllBytes("key.asc"), passphrase)] (armored or binary secret key) |
| Cloud KMS / Vault | opts.MasterKeys = [new AwsKmsMasterKey("arn:aws:kms:…")]. See Cloud KMS setup. |
In containers, mount the age key as a secret and point SOPS_AGE_KEY_FILE at it. Files with several key groups (Shamir shamir_threshold) work as soon as enough of the keys are available.
Security model
- The file's MAC is verified before any value is returned, so a tampered or truncated file fails instead of loading partly.
- Decrypted values live in memory only. Nops never writes plaintext to disk and starts no subprocess.
- Key material is read from the same places as the
sopsCLI, or from a cloud KMS so no key is on disk at all. Optional = truetolerates a missing file only. A present file that fails to decrypt or fails its MAC check always throws, so a required secret never silently disappears.
To report a vulnerability, see SECURITY.md.
Supported
<p align="center"> <img src="https://raw.githubusercontent.com/atulmish/Nops/main/docs/images/keys.png" alt="Formats: YAML, JSON, dotenv, INI, binary. Keys: age, PGP, AWS KMS, GCP KMS, Azure Key Vault, HashiCorp Vault Transit" width="100%"> </p>
| Formats | YAML, JSON, dotenv, INI, binary |
| Master keys | age (X25519), PGP, AWS KMS, GCP KMS, Azure Key Vault, HashiCorp Vault Transit |
| sops features | MAC verification, key groups + Shamir threshold, unencrypted_suffix / encrypted_suffix, unencrypted_regex / encrypted_regex, comment regexes, mac_only_encrypted, YAML anchors and comments |
| Configuration | Reload on change, optional files, multiple files layered in order, max file size |
Not supported (yet)
- Encrypting or editing. Nops only decrypts; use the
sopsCLI to create and change files. SOPS_AGE_KEY_CMD, age SSH identities, age plugins, passphrase (scrypt) and post-quantum age recipients.- PGP keys from a gpg keyring or agent: pass the secret key bytes instead.
Relative file paths are resolved against the current working directory.
Documentation
- Quickstart: first decrypt, typed binding, samples
- Configuration reference: every option, key flattening, reload, errors
- Deploying with Nops: config layout, Kubernetes and Docker, key rotation, troubleshooting
- Hosting guide: console, worker service, ASP.NET Core and Azure Functions
- Docker and distroless images: run without a shell or the sops binary
- Kubernetes and GitOps: how Nops fits with Flux, Argo CD and in-cluster decryption
- Migrating to Nops: from
sops -din CI, user-secrets and plain environment variables - Comparison: Nops and the other ways to use SOPS from .NET
- Security model: guarantees, how the implementation was verified, and its limits
- Cloud KMS setup: AWS, GCP, Azure, Vault
- Test keys: how the fixtures are generated
- Samples: console, minimal API and layered-config apps you can run
Contributing
Issues and pull requests are welcome. See CONTRIBUTING.md. To report a vulnerability, follow SECURITY.md instead of opening an issue.
dotnet build Nops.slnx
dotnet test Nops.slnx
Cloud integration tests are skipped unless their environment is available (for example AWS_LIVE_TEST=1 with LocalStack).
License
MIT. See LICENSE. Nops reimplements the SOPS file format and cryptography in C# without copying Go code. SOPS itself is MPL-2.0.
| 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. 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 is compatible. 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. |
-
net10.0
- Microsoft.Extensions.Configuration (>= 10.0.13)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.0)
- Nops.Core (>= 1.1.0)
-
net8.0
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.1)
- Nops.Core (>= 1.1.0)
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.1 | 160 | 10/25/2026 |
| 1.1.0 | 114 | 10/25/2026 |
| 1.0.0 | 132 | 10/25/2026 |
| 1.0.0-preview.1 | 75 | 10/10/2026 |