A simple .NET library to manage cryptographic keys.
Show/hide folder structure
.
├── .github
│ └── workflows
├── Devantler.SecretManager.Core
├── Devantler.SecretManager.SOPS.LocalAge
│ ├── Models
│ └── Utils
└── Devantler.SecretManager.SOPS.LocalAge.Tests
├── SOPSLocalAgeSecretManagerTests
└── Utils
└── SOPSConfigHelperTests
11 directories
To get started, you can install the packages from NuGet.
# For the Age key model
dotnet add package Devantler.SecretManager.SOPS.LocalAge
If you need to create a new implementation for a secret manager, you can install the core package.
dotnet add package Devantler.Keys.Core
The Local Age Secret Manager is a simple secret manager to manage Age keys on your local machine. The secret manager saves and loads keys from your SOPS keyring by default.
To create a new key, you can use the CreateKeyAsync
method.
using Devantler.SecretManager.SOPS.LocalAge;
var SecretManager = new SOPSLocalAgeSecretManager();
var key = await SecretManager.CreateKeyAsync();
To delete a key, you can use the DeleteKeyAsync
method.
using Devantler.Keys.Age;
using Devantler.SecretManager.SOPS.LocalAge;
var SecretManager = new SOPSLocalAgeSecretManager();
var ageKey = AgeKeygen.InMemory();
await SecretManager.DeleteKeyAsync(ageKey);
To get an existing key, you can use the GetKeyAsync
method.
using Devantler.SecretManager.SOPS.LocalAge;
var SecretManager = new SOPSLocalAgeSecretManager();
var key = await SecretManager.GetKeyAsync("<public key>");
To import a key, you can use the ImportKeyAsync
method.
using Devantler.Keys.Age;
using Devantler.SecretManager.SOPS.LocalAge;
var SecretManager = new SOPSLocalAgeSecretManager();
var ageKey = AgeKeygen.InMemory();
var key = await SecretManager.ImportKeyAsync(ageKey);
To check if a key exists, you can use the KeyExistsAsync
method.
using Devantler.SecretManager.SOPS.LocalAge;
var SecretManager = new SOPSLocalAgeSecretManager();
var exists = await SecretManager.KeyExistsAsync("<public key>");
To list all keys, you can use the ListKeysAsync
method.
using Devantler.SecretManager.SOPS.LocalAge;
var SecretManager = new SOPSLocalAgeSecretManager();
var keys = await SecretManager.ListKeysAsync();