TopSecret.ProtectedString 0.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package TopSecret.ProtectedString --version 0.1.1
                    
NuGet\Install-Package TopSecret.ProtectedString -Version 0.1.1
                    
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="TopSecret.ProtectedString" Version="0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TopSecret.ProtectedString" Version="0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="TopSecret.ProtectedString" />
                    
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 TopSecret.ProtectedString --version 0.1.1
                    
#r "nuget: TopSecret.ProtectedString, 0.1.1"
                    
#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 TopSecret.ProtectedString@0.1.1
                    
#: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=TopSecret.ProtectedString&version=0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=TopSecret.ProtectedString&version=0.1.1
                    
Install as a Cake Tool

TopSecret

A small suite of .NET packages for keeping secrets safe in memory. It exists because SecureString never got a cross-platform story — its encryption is Windows-only and Microsoft advises against it for new code — yet real applications still hold passwords, API tokens, and cryptographic key material in plain strings and arrays that any heap dump, swap file, crash report, or memory scan can read. With TopSecret, secrets live AES-GCM-256-encrypted under a per-process (optionally hardware-backed) key, plaintext surfaces only briefly inside escape-resistant span callbacks, and every scratch buffer is pinned, locked, and wiped on exit.

Packages

  • TopSecret.ProtectedString — the core: a cross-platform SecureString replacement for text secrets, with constant-time equality, Argon2id credential hashing (OWASP defaults), opt-in hardware-backed key wrapping (Apple Secure Enclave / Android Keystore built in), and a bundled Roslyn analyzer that flags plaintext escaping the access callbacks.
  • TopSecret.ProtectedBlob — multi-megabyte binary secrets (key stores, sealed assets, model shards): write-once, chunked AES-GCM-256, streamed chunk-at-a-time reads that fail closed on tampering.
  • TopSecret.ProtectedString.WindowsTpm — opt-in Windows TPM 2.0 wrapping of the process master key.
  • TopSecret.ProtectedString.LinuxTpm — the same for Linux TPM 2.0 (/dev/tpmrm0).
  • TopSecret.ProtectedString.Configuration — binds appsettings.json / IConfiguration values straight into ProtectedString, with no plaintext string detour.

Documentation & threat model · Live browser demo · Changelog · MIT

The threat model defends secrets at rest in memory (dumps, swap, scraping) — not an attacker already executing code inside your process. Read it before relying on any in-memory protection.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-android36.0 is compatible.  net10.0-browser was computed.  net10.0-browser1.0 is compatible.  net10.0-ios was computed.  net10.0-ios26.0 is compatible.  net10.0-maccatalyst was computed.  net10.0-maccatalyst26.0 is compatible.  net10.0-macos was computed.  net10.0-macos26.0 is compatible.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on TopSecret.ProtectedString:

Package Downloads
TopSecret.ProtectedString.LinuxTpm

Linux TPM 2.0 hardware-backed master-key protector for TopSecret.ProtectedString. References the main package and auto-registers via ModuleInitializer when loaded on Linux. Uses Microsoft.TSS to talk TPM 2.0 commands directly to /dev/tpmrm0 (RSA-2048 OAEP-SHA256). On non-Linux hosts the package is a no-op.

TopSecret.ProtectedString.WindowsTpm

Windows TPM 2.0 hardware-backed master-key protector for TopSecret.ProtectedString. References the main package and auto-registers via ModuleInitializer when loaded on Windows. Uses NCrypt + Microsoft Platform Crypto Provider (RSA-2048 OAEP-SHA256). On non-Windows hosts the package is a no-op.

TopSecret.ProtectedBlob

Multi-megabyte secret blobs for TopSecret.ProtectedString: byte-oriented, write-once, stored as chunked AES-GCM-256 ciphertext in ordinary memory with a per-blob key wrapped under the shared process master (including the optional hardware-backed tiers). Reads decrypt one chunk at a time through span callbacks or streaming sinks.

TopSecret.ProtectedString.Configuration

Optional companion to TopSecret.ProtectedString that binds ProtectedStringOptions from a Microsoft.Extensions.Configuration source (e.g. appsettings.json). Adds a single dependency the main package deliberately does not take.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.1.1 36 7/5/2026
2.1.0 43 7/5/2026
2.0.0 47 7/4/2026
1.1.0 48 7/4/2026
1.0.1 47 7/4/2026
1.0.0 49 7/4/2026
0.1.2 45 7/4/2026
0.1.1 50 7/4/2026
0.1.0 48 7/4/2026

## [0.1.1](https://github.com/Alpaq92/TopSecret.ProtectedString/compare/v0.1.0...v0.1.1) (2026-07-04)


### Bug Fixes

* **ci:** never cancel an in-flight Pages deployment ([ab9c243](https://github.com/Alpaq92/TopSecret.ProtectedString/commit/ab9c243bfdd03ce8aedb2e9d2262488ef56d89c6))


### Documentation

* **nuget:** lengthen the suite intro (API tokens, cryptographic, swap file) ([969e0c9](https://github.com/Alpaq92/TopSecret.ProtectedString/commit/969e0c9f1eb5d4bb99d89e6015f8538c305ae926))
* Release workflow badge, matching Fluid.Avalonia ([2c54084](https://github.com/Alpaq92/TopSecret.ProtectedString/commit/2c54084e2f57b0969279faa65b3696f92a898e8c))