You can integrate the Key Management Service (KMS) instance SDK to perform cryptographic operations and obtain secret values using keys. This topic describes how to install the KMS instance SDK (C#).
Network environment description
Ensure the application's runtime environment has network access to the KMS instance VPC address <KMS_INSTANCE_ID>.cryptoservice.kms.aliyuncs.com.
If the application's runtime environment and the KMS instance are in both the same region and VPC, they are connected by default with no additional configuration required.
If the application runtime environment and the KMS instance are in the same region but different VPCs, you must associate the VPC of the application with the KMS instance. For instructions, see how to access the KMS instance from multiple VPCs in the same region.
If the application's runtime environment is within a local IDC, refer to this guide for configuring network connectivity to ensure access to the KMS instance without using domain names.
Prerequisites
A KMS instance is purchased and enabled. For more information, see Purchase and enable a KMS instance.
A key and a secret are created. For more information, see Software-protected keys, Hardware-protected keys, and Create a secret.
NoteIf your business does not require a secret, you do not need to create one.
Environment preparation
Version requirements: .NET Framework 5.0 or later, or .NET Standard 2.0 or later.
Install the SDK
Install the SDK using the .NET command-line interface (CLI).
dotnet add package AlibabaCloud.Dkms.Gcs.SdkWe recommend using the latest version of the SDK. For version details, see the open source code repository.