Nops.Core.AwsKms
1.0.0
Prefix Reserved
See the version list below for details.
dotnet add package Nops.Core.AwsKms --version 1.0.0
NuGet\Install-Package Nops.Core.AwsKms -Version 1.0.0
<PackageReference Include="Nops.Core.AwsKms" Version="1.0.0" />
<PackageVersion Include="Nops.Core.AwsKms" Version="1.0.0" />
<PackageReference Include="Nops.Core.AwsKms" />
paket add Nops.Core.AwsKms --version 1.0.0
#r "nuget: Nops.Core.AwsKms, 1.0.0"
#:package Nops.Core.AwsKms@1.0.0
#addin nuget:?package=Nops.Core.AwsKms&version=1.0.0
#tool nuget:?package=Nops.Core.AwsKms&version=1.0.0
Nops.Core.AwsKms
AWS KMS master key provider for Nops - in-process SOPS decryption.
Installation
dotnet add package Nops.Core.AwsKms
Usage
using Nops.Core;
using Nops.Core.Keys;
// Option 1: Default credential chain (environment variables, IMDS, shared config)
var masterKey = new AwsKmsMasterKey(
arn: "arn:aws:kms:us-east-1:123456789012:key/abcd-1234-5678-efgh",
context: new List<KeyValuePair<string, string>>
{
new KeyValuePair<string, string>("Project", "myapp")
}
);
// Option 2: Explicit client (useful for LocalStack or custom endpoints)
var client = new AmazonKMSClient(
new BasicAWSCredentials("AKIAIOSFODNN7EXAMPLE", "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"),
RegionEndpoint.USEast1
);
var masterKey2 = new AwsKmsMasterKey(
arn: "arn:aws:kms:us-east-1:123456789012:key/abcd-1234-5678-efgh",
client: client
);
// Use with SopsFile
var result = await SopsFile.DecryptTreeAsync(
fileBytes: File.ReadAllBytes("secrets.sops.yaml"),
fileKind: "yaml",
options: new SopsOptions
{
MasterKeys = new[] { masterKey }
});
Authentication
AWS KMS uses the AWS SDK default credential chain:
- Environment variables:
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AWS_SESSION_TOKEN - Shared credentials file:
~/.aws/credentials - IAM role (EC2, ECS, EKS, Lambda)
- Amazon Cognito identity
LocalStack Development
docker run -p 4566:4566 localstack/localstack
var client = new AmazonKMSClient(
new BasicAWSCredentials("test", "test"),
RegionEndpoint.USEast1)
{
Config = new AmazonKMSConfig { ServiceURL = "http://localhost:4566" }
};
IAM Permissions
Minimum IAM policy for KMS decrypt:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "kms:Decrypt",
"Resource": "arn:aws:kms:<region>:<account>:key/<key-id>"
}
]
}
If using encryption context, the same policy applies - context matching is enforced at decrypt time.
Encryption Context Mapping
SOPS stores encryption context as key-value pairs in .sops.kms[].context. These must match exactly what was used during encryption:
sops:
kms:
- arn: arn:aws:kms:us-east-1:123456789012:key/abcd-1234
enc: BASE64_ENCODED_SHARE
context:
Project: myapp
Environment: production
When creating AwsKmsMasterKey, pass the same context:
var key = new AwsKmsMasterKey(
arn: "arn:aws:kms:us-east-1:123456789012:key/abcd-1234",
context: new[] {
new KeyValuePair<string, string>("Project", "myapp"),
new KeyValuePair<string, string>("Environment", "production")
}
);
Running Tests
Unit tests run without dependencies:
dotnet test tests/Nops.Core.AwsKms.Tests --filter FullyQualifiedName~AwsKmsEntryParserTests
Integration tests need a KMS endpoint (for example LocalStack, started as shown above):
AWS_LIVE_TEST=1 dotnet test tests/Nops.Core.AwsKms.Tests --filter FullyQualifiedName~AwsKmsIntegrationTests
License
MIT - see LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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
- AWSSDK.Core (>= 4.0.102.8)
- AWSSDK.KeyManagementService (>= 4.0.100.15)
- Nops.Core (>= 1.0.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 | 112 | 10/25/2026 |
| 1.1.0 | 106 | 10/25/2026 |
| 1.0.0 | 114 | 10/25/2026 |
| 1.0.0-preview.1 | 84 | 10/10/2026 |