ToolUp.Encryption.GoogleCloudKms
0.22.0
Prefix Reserved
dotnet add package ToolUp.Encryption.GoogleCloudKms --version 0.22.0
NuGet\Install-Package ToolUp.Encryption.GoogleCloudKms -Version 0.22.0
<PackageReference Include="ToolUp.Encryption.GoogleCloudKms" Version="0.22.0" />
<PackageVersion Include="ToolUp.Encryption.GoogleCloudKms" Version="0.22.0" />
<PackageReference Include="ToolUp.Encryption.GoogleCloudKms" />
paket add ToolUp.Encryption.GoogleCloudKms --version 0.22.0
#r "nuget: ToolUp.Encryption.GoogleCloudKms, 0.22.0"
#:package ToolUp.Encryption.GoogleCloudKms@0.22.0
#addin nuget:?package=ToolUp.Encryption.GoogleCloudKms&version=0.22.0
#tool nuget:?package=ToolUp.Encryption.GoogleCloudKms&version=0.22.0
ToolUp.Encryption.GoogleCloudKms
GCP Cloud KMS-backed IBlobEncryptionKeyResolver for ToolUp.Platform
(Phase 22a). Envelope encryption: the deployment's KMS symmetric
CryptoKey (KEK) never leaves GCP. Each blob is encrypted with its own
AES-256 data key (DEK) minted locally; the DEK is Encrypt'd under the
KEK and the ciphertext (plus the KEK resource name) is stamped into the
blob envelope's KeyId. A later read Decrypts it. The resolver holds
no key state between calls (GP 12 rule 4).
Mirrors src/Encryption/AwsKms/ packaging. Server-only companion.
Quick start
open Google.Cloud.Kms.V1
open ToolUp.Encryption.GoogleCloudKms
let client = KeyManagementServiceClient.Create() // ADC from the env
let keyName = "projects/my-proj/locations/europe-west2/keyRings/blob/cryptoKeys/kek"
let resolver = GoogleCloudKmsKeyResolver.create client keyName
// wire via ServerApp.withEncryptedBlobStorage resolver
Per-scope KEKs (multi-tenant key custody):
let resolver =
GoogleCloudKmsKeyResolver.createPerScope client (fun scope -> keyNameFor scope.ScopeId)
Behaviour
ResolveKey scope→ mint a random AES-256 DEK locally → KMSEncryptunder the KEK; returns the plaintext DEK + aKeyIdofgcp-kms:v1:{base64url(keyName)}.{base64(ciphertext)}.ResolveKeyById keyId→ recover the KEK resource name + ciphertext → KMSDecrypt.NOT_FOUNDsurfaces asKeyResolutionError.KeyNotFound;FAILED_PRECONDITION/PERMISSION_DENIED(disabled / destroyed key version) asKeyDestroyed(HTTP 410 Gone at the API boundary — crypto-shred); other gRPC failures asStorageFailure.
The DEK plaintext is generated in-process and only ever leaves as the Encrypt plaintext / Decrypt result — the KEK key material stays in KMS.
Verification
The resolver requires a live KMS CryptoKey (no offline fake — KMS has no
local emulator and KeyManagementServiceClient is not practically
mockable). Mirrors the env-gated live-arm convention of the AWS KMS
resolver / AIProviders.Tests. Verify against a real key:
- Create a symmetric
ENCRYPT_DECRYPTCryptoKey; grant the deployment service accountcloudkms.cryptoKeyEncrypterDecrypter. ResolveKey→ encrypt a blob →ResolveKeyByIdround-trips the DEK.- Disable the key version →
ResolveKeyByIdreturnsKeyDestroyed.
License
Apache-2.0.
| 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
- FSharp.Core (>= 10.1.300)
- Google.Cloud.Kms.V1 (>= 3.24.0)
- ToolUp.Platform.Core (>= 0.22.0)
- ToolUp.Platform.Server (>= 0.22.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.