Class GcpKmsMasterKey
Master key provider for Google Cloud KMS keys used by SOPS. Uses Google.Cloud.Kms.V1 to decrypt the encrypted data key share.
public class GcpKmsMasterKey : IMasterKeyProvider
- Inheritance
-
GcpKmsMasterKey
- Implements
- Inherited Members
Constructors
GcpKmsMasterKey(string, string, KeyManagementServiceClient?)
Creates a new GCP KMS master key provider.
public GcpKmsMasterKey(string resourceName, string encryptedShare = "", KeyManagementServiceClient? client = null)
Parameters
resourceNamestringencryptedSharestringclientKeyManagementServiceClient
Properties
Client
The CloudKMS client used for decryption. If null, uses Application Default Credentials.
public KeyManagementServiceClient? Client { 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 ("gcp_kms").
public string KeyType { get; }
Property Value
ResourceName
The full resource name of the KMS key (e.g., projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key).
public string ResourceName { get; }
Property Value
Methods
DecryptShareAsync(string, CancellationToken)
Decrypt the encrypted data key share using Google Cloud KMS. Returns null if this key cannot decrypt (resource name mismatch handled by caller).
public Task<byte[]?> DecryptShareAsync(string enc, CancellationToken ct = default)
Parameters
encstringctCancellationToken