SecureRequest.GcpSecretManager
1.0.0
dotnet add package SecureRequest.GcpSecretManager --version 1.0.0
NuGet\Install-Package SecureRequest.GcpSecretManager -Version 1.0.0
<PackageReference Include="SecureRequest.GcpSecretManager" Version="1.0.0" />
<PackageVersion Include="SecureRequest.GcpSecretManager" Version="1.0.0" />
<PackageReference Include="SecureRequest.GcpSecretManager" />
paket add SecureRequest.GcpSecretManager --version 1.0.0
#r "nuget: SecureRequest.GcpSecretManager, 1.0.0"
#:package SecureRequest.GcpSecretManager@1.0.0
#addin nuget:?package=SecureRequest.GcpSecretManager&version=1.0.0
#tool nuget:?package=SecureRequest.GcpSecretManager&version=1.0.0
SecureRequest.GcpSecretManager
Google Cloud Secret Manager provider for the SecureRequest NuGet package.
Stores the RSA private key inside GCP Secret Manager instead of Redis/IDistributedCache,
protected by IAM access control, Cloud Audit Logs, and optional CMEK encryption.
Installation
dotnet add package SecureRequest
dotnet add package SecureRequest.GcpSecretManager
Usage
Chain .WithGcpSecretManager() onto AddSecureRequest():
builder.Services
.AddSecureRequest(builder.Configuration)
.WithGcpSecretManager(projectId: "my-gcp-project");
Application Default Credentials (ADC) are used automatically — picks up Workload Identity in GKE, GOOGLE_APPLICATION_CREDENTIALS environment variable, and gcloud auth application-default login in development.
Custom secret ID
builder.Services
.AddSecureRequest(builder.Configuration)
.WithGcpSecretManager(
projectId : "my-gcp-project",
secretId : "myapp-rsa-private-key");
Bring your own client (already in DI)
builder.Services.AddSingleton(SecretManagerServiceClient.Create());
builder.Services
.AddSecureRequest(builder.Configuration)
.WithGcpSecretManager(
projectId : "my-gcp-project",
clientFactory : sp => sp.GetRequiredService<SecretManagerServiceClient>());
Required IAM permissions
Grant the service account running the application the following roles on the secret resource:
| Role | Purpose |
|---|---|
roles/secretmanager.secretAccessor |
Read secret versions (AccessSecretVersion) |
roles/secretmanager.secretVersionAdder |
Add new versions (AddSecretVersion) |
roles/secretmanager.admin |
Create secret on first startup (CreateSecret) — can be reduced to secretVersionAdder after first run |
Minimum policy (after secret is created):
roles/secretmanager.secretAccessor
roles/secretmanager.secretVersionAdder
How it works
- First startup — if the secret doesn't exist,
GcpSecretManagerKeyStorageProvidercreates it (Automatic replication policy) and adds the first version. - Subsequent startups — reads the
latestversion to load the private key. - Key rotation — adds a new version. Previous versions remain accessible (useful for auditing) but
latestpoints to the new key.
appsettings.json
No changes needed — SecureRequest options are bound from the same section:
"SecureRequest": {
"Enabled": true,
"EnableBodyEncryption": true,
"EnableHmacSigning": true,
"TimestampToleranceSeconds": 300,
"NonceCacheTtlSeconds": 700,
"SecuredMethods": ["POST", "PUT", "PATCH"],
"ExcludedPaths": []
}
Note:
IDistributedCacheis still required for nonce anti-replay storage. Only the RSA private key moves to Secret Manager — nonces remain in Redis/in-memory cache.
Comparison
| Default (Redis) | GcpSecretManagerKeyStorageProvider |
|
|---|---|---|
| Key stored in | Redis (plain Base64) | GCP Secret Manager (AES-256 encrypted) |
| Access control | Redis connection string | IAM roles |
| Audit trail | None | Cloud Audit Logs |
| Encryption at rest | Depends on Redis config | AES-256 (optional CMEK) |
| Compliance | Not sufficient for PCI-DSS / HIPAA | Satisfies requirements |
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
-
net8.0
- Google.Cloud.SecretManager.V1 (>= 2.7.0)
- SecureRequest (>= 1.2.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.0.0 | 34,264 | 6/12/2026 |