/*
* Copyright (c) 2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
namespace TencentCloud.Kms.V20190118
{
using Newtonsoft.Json;
using System.Threading.Tasks;
using TencentCloud.Common;
using TencentCloud.Common.Profile;
using TencentCloud.Kms.V20190118.Models;
public class KmsClient : AbstractClient{
private const string endpoint = "kms.tencentcloudapi.com";
private const string version = "2019-01-18";
///
/// Client constructor.
///
/// Credentials.
/// Region name, such as "ap-guangzhou".
public KmsClient(Credential credential, string region)
: this(credential, region, new ClientProfile())
{
}
///
/// Client Constructor.
///
/// Credentials.
/// Region name, such as "ap-guangzhou".
/// Client profiles.
public KmsClient(Credential credential, string region, ClientProfile profile)
: base(endpoint, version, credential, region, profile)
{
}
///
/// 使用指定的RSA非对称密钥的私钥进行数据解密,密文必须是使用对应公钥加密的。处于Enabled 状态的非对称密钥才能进行解密操作。
///
///
///
public async Task AsymmetricRsaDecrypt(AsymmetricRsaDecryptRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "AsymmetricRsaDecrypt");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 使用指定的RSA非对称密钥的私钥进行数据解密,密文必须是使用对应公钥加密的。处于Enabled 状态的非对称密钥才能进行解密操作。
///
///
///
public AsymmetricRsaDecryptResponse AsymmetricRsaDecryptSync(AsymmetricRsaDecryptRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "AsymmetricRsaDecrypt");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 使用指定的SM2非对称密钥的私钥进行数据解密,密文必须是使用对应公钥加密的。处于Enabled 状态的非对称密钥才能进行解密操作。传入的密文的长度不能超过256字节。
///
///
///
public async Task AsymmetricSm2Decrypt(AsymmetricSm2DecryptRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "AsymmetricSm2Decrypt");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 使用指定的SM2非对称密钥的私钥进行数据解密,密文必须是使用对应公钥加密的。处于Enabled 状态的非对称密钥才能进行解密操作。传入的密文的长度不能超过256字节。
///
///
///
public AsymmetricSm2DecryptResponse AsymmetricSm2DecryptSync(AsymmetricSm2DecryptRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "AsymmetricSm2Decrypt");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 取消CMK的计划删除操作
///
///
///
public async Task CancelKeyDeletion(CancelKeyDeletionRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "CancelKeyDeletion");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 取消CMK的计划删除操作
///
///
///
public CancelKeyDeletionResponse CancelKeyDeletionSync(CancelKeyDeletionRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "CancelKeyDeletion");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 创建用户管理数据密钥的主密钥CMK(Custom Master Key)。
///
///
///
public async Task CreateKey(CreateKeyRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "CreateKey");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 创建用户管理数据密钥的主密钥CMK(Custom Master Key)。
///
///
///
public CreateKeyResponse CreateKeySync(CreateKeyRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "CreateKey");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 创建白盒密钥。 密钥个数的上限为 50。
///
///
///
public async Task CreateWhiteBoxKey(CreateWhiteBoxKeyRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "CreateWhiteBoxKey");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 创建白盒密钥。 密钥个数的上限为 50。
///
///
///
public CreateWhiteBoxKeyResponse CreateWhiteBoxKeySync(CreateWhiteBoxKeyRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "CreateWhiteBoxKey");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 本接口用于解密密文,得到明文数据。
///
///
///
public async Task Decrypt(DecryptRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "Decrypt");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 本接口用于解密密文,得到明文数据。
///
///
///
public DecryptResponse DecryptSync(DecryptRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "Decrypt");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 用于删除导入的密钥材料,仅对EXTERNAL类型的CMK有效,该接口将CMK设置为PendingImport 状态,并不会删除CMK,在重新进行密钥导入后可继续使用。彻底删除CMK请使用 ScheduleKeyDeletion 接口。
///
///
///
public async Task DeleteImportedKeyMaterial(DeleteImportedKeyMaterialRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "DeleteImportedKeyMaterial");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 用于删除导入的密钥材料,仅对EXTERNAL类型的CMK有效,该接口将CMK设置为PendingImport 状态,并不会删除CMK,在重新进行密钥导入后可继续使用。彻底删除CMK请使用 ScheduleKeyDeletion 接口。
///
///
///
public DeleteImportedKeyMaterialResponse DeleteImportedKeyMaterialSync(DeleteImportedKeyMaterialRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "DeleteImportedKeyMaterial");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 删除白盒密钥, 注意:必须先禁用后,才可以删除。
///
///
///
public async Task DeleteWhiteBoxKey(DeleteWhiteBoxKeyRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "DeleteWhiteBoxKey");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 删除白盒密钥, 注意:必须先禁用后,才可以删除。
///
///
///
public DeleteWhiteBoxKeyResponse DeleteWhiteBoxKeySync(DeleteWhiteBoxKeyRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "DeleteWhiteBoxKey");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 用于获取指定KeyId的主密钥属性详情信息。
///
///
///
public async Task DescribeKey(DescribeKeyRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "DescribeKey");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 用于获取指定KeyId的主密钥属性详情信息。
///
///
///
public DescribeKeyResponse DescribeKeySync(DescribeKeyRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "DescribeKey");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 该接口用于批量获取主密钥属性信息。
///
///
///
public async Task DescribeKeys(DescribeKeysRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "DescribeKeys");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 该接口用于批量获取主密钥属性信息。
///
///
///
public DescribeKeysResponse DescribeKeysSync(DescribeKeysRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "DescribeKeys");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 获取白盒解密密钥
///
///
///
public async Task DescribeWhiteBoxDecryptKey(DescribeWhiteBoxDecryptKeyRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "DescribeWhiteBoxDecryptKey");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 获取白盒解密密钥
///
///
///
public DescribeWhiteBoxDecryptKeyResponse DescribeWhiteBoxDecryptKeySync(DescribeWhiteBoxDecryptKeyRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "DescribeWhiteBoxDecryptKey");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 展示白盒密钥的信息
///
///
///
public async Task DescribeWhiteBoxKey(DescribeWhiteBoxKeyRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "DescribeWhiteBoxKey");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 展示白盒密钥的信息
///
///
///
public DescribeWhiteBoxKeyResponse DescribeWhiteBoxKeySync(DescribeWhiteBoxKeyRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "DescribeWhiteBoxKey");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 获取白盒密钥列表
///
///
///
public async Task DescribeWhiteBoxKeyDetails(DescribeWhiteBoxKeyDetailsRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "DescribeWhiteBoxKeyDetails");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 获取白盒密钥列表
///
///
///
public DescribeWhiteBoxKeyDetailsResponse DescribeWhiteBoxKeyDetailsSync(DescribeWhiteBoxKeyDetailsRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "DescribeWhiteBoxKeyDetails");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 获取白盒密钥服务状态
///
///
///
public async Task DescribeWhiteBoxServiceStatus(DescribeWhiteBoxServiceStatusRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "DescribeWhiteBoxServiceStatus");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 获取白盒密钥服务状态
///
///
///
public DescribeWhiteBoxServiceStatusResponse DescribeWhiteBoxServiceStatusSync(DescribeWhiteBoxServiceStatusRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "DescribeWhiteBoxServiceStatus");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 本接口用于禁用一个主密钥,处于禁用状态的Key无法用于加密、解密操作。
///
///
///
public async Task DisableKey(DisableKeyRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "DisableKey");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 本接口用于禁用一个主密钥,处于禁用状态的Key无法用于加密、解密操作。
///
///
///
public DisableKeyResponse DisableKeySync(DisableKeyRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "DisableKey");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 对指定的CMK禁止密钥轮换功能。
///
///
///
public async Task DisableKeyRotation(DisableKeyRotationRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "DisableKeyRotation");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 对指定的CMK禁止密钥轮换功能。
///
///
///
public DisableKeyRotationResponse DisableKeyRotationSync(DisableKeyRotationRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "DisableKeyRotation");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 该接口用于批量禁止CMK的使用。
///
///
///
public async Task DisableKeys(DisableKeysRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "DisableKeys");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 该接口用于批量禁止CMK的使用。
///
///
///
public DisableKeysResponse DisableKeysSync(DisableKeysRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "DisableKeys");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 禁用白盒密钥
///
///
///
public async Task DisableWhiteBoxKey(DisableWhiteBoxKeyRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "DisableWhiteBoxKey");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 禁用白盒密钥
///
///
///
public DisableWhiteBoxKeyResponse DisableWhiteBoxKeySync(DisableWhiteBoxKeyRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "DisableWhiteBoxKey");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 批量禁用白盒密钥
///
///
///
public async Task DisableWhiteBoxKeys(DisableWhiteBoxKeysRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "DisableWhiteBoxKeys");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 批量禁用白盒密钥
///
///
///
public DisableWhiteBoxKeysResponse DisableWhiteBoxKeysSync(DisableWhiteBoxKeysRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "DisableWhiteBoxKeys");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 用于启用一个指定的CMK。
///
///
///
public async Task EnableKey(EnableKeyRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "EnableKey");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 用于启用一个指定的CMK。
///
///
///
public EnableKeyResponse EnableKeySync(EnableKeyRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "EnableKey");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 对指定的CMK开启密钥轮换功能。
///
///
///
public async Task EnableKeyRotation(EnableKeyRotationRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "EnableKeyRotation");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 对指定的CMK开启密钥轮换功能。
///
///
///
public EnableKeyRotationResponse EnableKeyRotationSync(EnableKeyRotationRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "EnableKeyRotation");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 该接口用于批量启用CMK。
///
///
///
public async Task EnableKeys(EnableKeysRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "EnableKeys");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 该接口用于批量启用CMK。
///
///
///
public EnableKeysResponse EnableKeysSync(EnableKeysRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "EnableKeys");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 批量启用白盒密钥
///
///
///
public async Task EnableWhiteBoxKey(EnableWhiteBoxKeyRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "EnableWhiteBoxKey");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 批量启用白盒密钥
///
///
///
public EnableWhiteBoxKeyResponse EnableWhiteBoxKeySync(EnableWhiteBoxKeyRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "EnableWhiteBoxKey");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 批量启用白盒密钥
///
///
///
public async Task EnableWhiteBoxKeys(EnableWhiteBoxKeysRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "EnableWhiteBoxKeys");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 批量启用白盒密钥
///
///
///
public EnableWhiteBoxKeysResponse EnableWhiteBoxKeysSync(EnableWhiteBoxKeysRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "EnableWhiteBoxKeys");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 本接口用于加密最多为4KB任意数据,可用于加密数据库密码,RSA Key,或其它较小的敏感信息。对于应用的数据加密,使用GenerateDataKey生成的DataKey进行本地数据的加解密操作
///
///
///
public async Task Encrypt(EncryptRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "Encrypt");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 本接口用于加密最多为4KB任意数据,可用于加密数据库密码,RSA Key,或其它较小的敏感信息。对于应用的数据加密,使用GenerateDataKey生成的DataKey进行本地数据的加解密操作
///
///
///
public EncryptResponse EncryptSync(EncryptRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "Encrypt");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 使用白盒密钥进行加密
///
///
///
public async Task EncryptByWhiteBox(EncryptByWhiteBoxRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "EncryptByWhiteBox");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 使用白盒密钥进行加密
///
///
///
public EncryptByWhiteBoxResponse EncryptByWhiteBoxSync(EncryptByWhiteBoxRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "EncryptByWhiteBox");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 本接口生成一个数据密钥,您可以用这个密钥进行本地数据的加密。
///
///
///
public async Task GenerateDataKey(GenerateDataKeyRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "GenerateDataKey");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 本接口生成一个数据密钥,您可以用这个密钥进行本地数据的加密。
///
///
///
public GenerateDataKeyResponse GenerateDataKeySync(GenerateDataKeyRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "GenerateDataKey");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 随机数生成接口。
///
///
///
public async Task GenerateRandom(GenerateRandomRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "GenerateRandom");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 随机数生成接口。
///
///
///
public GenerateRandomResponse GenerateRandomSync(GenerateRandomRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "GenerateRandom");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 查询指定的CMK是否开启了密钥轮换功能。
///
///
///
public async Task GetKeyRotationStatus(GetKeyRotationStatusRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "GetKeyRotationStatus");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 查询指定的CMK是否开启了密钥轮换功能。
///
///
///
public GetKeyRotationStatusResponse GetKeyRotationStatusSync(GetKeyRotationStatusRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "GetKeyRotationStatus");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 获取导入主密钥(CMK)材料的参数,返回的Token作为执行ImportKeyMaterial的参数之一,返回的PublicKey用于对自主导入密钥材料进行加密。返回的Token和PublicKey 24小时后失效,失效后如需重新导入,需要再次调用该接口获取新的Token和PublicKey。
///
///
///
public async Task GetParametersForImport(GetParametersForImportRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "GetParametersForImport");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 获取导入主密钥(CMK)材料的参数,返回的Token作为执行ImportKeyMaterial的参数之一,返回的PublicKey用于对自主导入密钥材料进行加密。返回的Token和PublicKey 24小时后失效,失效后如需重新导入,需要再次调用该接口获取新的Token和PublicKey。
///
///
///
public GetParametersForImportResponse GetParametersForImportSync(GetParametersForImportRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "GetParametersForImport");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 该接口用户获取 KeyUsage为ASYMMETRIC_DECRYPT_RSA_2048 和 ASYMMETRIC_DECRYPT_SM2 的非对称密钥的公钥信息,使用该公钥用户可在本地进行数据加密,使用该公钥加密的数据只能通过KMS使用对应的私钥进行解密。只有处于Enabled状态的非对称密钥才可能获取公钥。
///
///
///
public async Task GetPublicKey(GetPublicKeyRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "GetPublicKey");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 该接口用户获取 KeyUsage为ASYMMETRIC_DECRYPT_RSA_2048 和 ASYMMETRIC_DECRYPT_SM2 的非对称密钥的公钥信息,使用该公钥用户可在本地进行数据加密,使用该公钥加密的数据只能通过KMS使用对应的私钥进行解密。只有处于Enabled状态的非对称密钥才可能获取公钥。
///
///
///
public GetPublicKeyResponse GetPublicKeySync(GetPublicKeyRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "GetPublicKey");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 用于查询该用户是否已开通KMS服务
///
///
///
public async Task GetServiceStatus(GetServiceStatusRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "GetServiceStatus");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 用于查询该用户是否已开通KMS服务
///
///
///
public GetServiceStatusResponse GetServiceStatusSync(GetServiceStatusRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "GetServiceStatus");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 用于导入密钥材料。只有类型为EXTERNAL 的CMK 才可以导入,导入的密钥材料使用 GetParametersForImport 获取的密钥进行加密。可以为指定的 CMK 重新导入密钥材料,并重新指定过期时间,但必须导入相同的密钥材料。CMK 密钥材料导入后不可以更换密钥材料。导入的密钥材料过期或者被删除后,指定的CMK将无法使用,需要再次导入相同的密钥材料才能正常使用。CMK是独立的,同样的密钥材料可导入不同的 CMK 中,但使用其中一个 CMK 加密的数据无法使用另一个 CMK解密。
/// 只有Enabled 和 PendingImport状态的CMK可以导入密钥材料。
///
///
///
public async Task ImportKeyMaterial(ImportKeyMaterialRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "ImportKeyMaterial");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 用于导入密钥材料。只有类型为EXTERNAL 的CMK 才可以导入,导入的密钥材料使用 GetParametersForImport 获取的密钥进行加密。可以为指定的 CMK 重新导入密钥材料,并重新指定过期时间,但必须导入相同的密钥材料。CMK 密钥材料导入后不可以更换密钥材料。导入的密钥材料过期或者被删除后,指定的CMK将无法使用,需要再次导入相同的密钥材料才能正常使用。CMK是独立的,同样的密钥材料可导入不同的 CMK 中,但使用其中一个 CMK 加密的数据无法使用另一个 CMK解密。
/// 只有Enabled 和 PendingImport状态的CMK可以导入密钥材料。
///
///
///
public ImportKeyMaterialResponse ImportKeyMaterialSync(ImportKeyMaterialRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "ImportKeyMaterial");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 列出当前Region支持的加密方式
///
///
///
public async Task ListAlgorithms(ListAlgorithmsRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "ListAlgorithms");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 列出当前Region支持的加密方式
///
///
///
public ListAlgorithmsResponse ListAlgorithmsSync(ListAlgorithmsRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "ListAlgorithms");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 根据指定Offset和Limit获取主密钥列表详情。
///
///
///
public async Task ListKeyDetail(ListKeyDetailRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "ListKeyDetail");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 根据指定Offset和Limit获取主密钥列表详情。
///
///
///
public ListKeyDetailResponse ListKeyDetailSync(ListKeyDetailRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "ListKeyDetail");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 列出账号下面状态为Enabled, Disabled 和 PendingImport 的CMK KeyId 列表
///
///
///
public async Task ListKeys(ListKeysRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "ListKeys");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 列出账号下面状态为Enabled, Disabled 和 PendingImport 的CMK KeyId 列表
///
///
///
public ListKeysResponse ListKeysSync(ListKeysRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "ListKeys");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 使用指定CMK对密文重新加密。
///
///
///
public async Task ReEncrypt(ReEncryptRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "ReEncrypt");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 使用指定CMK对密文重新加密。
///
///
///
public ReEncryptResponse ReEncryptSync(ReEncryptRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "ReEncrypt");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// CMK计划删除接口,用于指定CMK删除的时间,可选时间区间为[7,30]天
///
///
///
public async Task ScheduleKeyDeletion(ScheduleKeyDeletionRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "ScheduleKeyDeletion");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// CMK计划删除接口,用于指定CMK删除的时间,可选时间区间为[7,30]天
///
///
///
public ScheduleKeyDeletionResponse ScheduleKeyDeletionSync(ScheduleKeyDeletionRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "ScheduleKeyDeletion");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 用于修改CMK的别名。对于处于PendingDelete状态的CMK禁止修改。
///
///
///
public async Task UpdateAlias(UpdateAliasRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "UpdateAlias");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 用于修改CMK的别名。对于处于PendingDelete状态的CMK禁止修改。
///
///
///
public UpdateAliasResponse UpdateAliasSync(UpdateAliasRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "UpdateAlias");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 该接口用于对指定的cmk修改描述信息。对于处于PendingDelete状态的CMK禁止修改。
///
///
///
public async Task UpdateKeyDescription(UpdateKeyDescriptionRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = await this.InternalRequest(req, "UpdateKeyDescription");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
///
/// 该接口用于对指定的cmk修改描述信息。对于处于PendingDelete状态的CMK禁止修改。
///
///
///
public UpdateKeyDescriptionResponse UpdateKeyDescriptionSync(UpdateKeyDescriptionRequest req)
{
JsonResponseModel rsp = null;
try
{
var strResp = this.InternalRequestSync(req, "UpdateKeyDescription");
rsp = JsonConvert.DeserializeObject>(strResp);
}
catch (JsonSerializationException e)
{
throw new TencentCloudSDKException(e.Message);
}
return rsp.Response;
}
}
}