Class AwsKmsMasterKey
Master key provider for AWS KMS keys used by SOPS. Wraps AWSSDK.KMS Decrypt to unwrap the encrypted data key share.
public class AwsKmsMasterKey : IMasterKeyProvider
- Inheritance
-
AwsKmsMasterKey
- Implements
- Inherited Members
Constructors
AwsKmsMasterKey(string, string, IReadOnlyList<KeyValuePair<string, string>>?, IAmazonKeyManagementService?)
Creates a new AWS KMS master key provider.
public AwsKmsMasterKey(string arn, string encryptedShare = "", IReadOnlyList<KeyValuePair<string, string>>? context = null, IAmazonKeyManagementService? client = null)
Parameters
arnstringencryptedSharestringcontextIReadOnlyList<KeyValuePair<string, string>>clientIAmazonKeyManagementService
Properties
Arn
The ARN of the KMS key (e.g., arn:aws:kms:us-east-1:123456789012:key/abcd-1234-5678-efgh)
public string Arn { get; }
Property Value
Client
The KMS client used for decryption. If null, uses the default credential chain.
public IAmazonKeyManagementService? Client { get; }
Property Value
- IAmazonKeyManagementService
Context
Optional encryption context key-value pairs. Must match what was used during encryption.
public IReadOnlyList<KeyValuePair<string, string>> Context { get; }
Property Value
EncryptedShare
Informational only: decryption uses the encrypted share read from the SOPS file metadata, so this can be left empty.
public string EncryptedShare { get; }
Property Value
KeyType
The key type identifier ("aws_kms").
public string KeyType { get; }
Property Value
Methods
DecryptShareAsync(string, CancellationToken)
Decrypt the encrypted data key share using AWS KMS. Returns null if this key cannot decrypt (ARN/context mismatch handled by caller).
public Task<byte[]?> DecryptShareAsync(string enc, CancellationToken ct = default)
Parameters
encstringctCancellationToken