Procházet zdrojové kódy

Add GenerateAndExportDataKey, ExportDataKey, ReEncrypt api.

sdk-team před 6 roky
rodič
revize
84d7d5b467

+ 3 - 0
CHANGELOG

@@ -1,3 +1,6 @@
+2020-07-23 Version: 1.36.530
+- Add GenerateAndExportDataKey, ExportDataKey, ReEncrypt api.
+
 2020-07-22 Version: 1.36.529
 - Generated 2015-01-01 for `R-kvstore`.
 - Add SyncDtsStatus API.

+ 1 - 1
VERSION

@@ -1 +1 @@
-1.36.529
+1.36.530

+ 12 - 0
kms/CMakeLists.txt

@@ -63,6 +63,10 @@ set(kms_public_header_model
 	include/alibabacloud/kms/model/EnableKeyResult.h
 	include/alibabacloud/kms/model/EncryptRequest.h
 	include/alibabacloud/kms/model/EncryptResult.h
+	include/alibabacloud/kms/model/ExportDataKeyRequest.h
+	include/alibabacloud/kms/model/ExportDataKeyResult.h
+	include/alibabacloud/kms/model/GenerateAndExportDataKeyRequest.h
+	include/alibabacloud/kms/model/GenerateAndExportDataKeyResult.h
 	include/alibabacloud/kms/model/GenerateDataKeyRequest.h
 	include/alibabacloud/kms/model/GenerateDataKeyResult.h
 	include/alibabacloud/kms/model/GenerateDataKeyWithoutPlaintextRequest.h
@@ -93,6 +97,8 @@ set(kms_public_header_model
 	include/alibabacloud/kms/model/ListSecretsResult.h
 	include/alibabacloud/kms/model/PutSecretValueRequest.h
 	include/alibabacloud/kms/model/PutSecretValueResult.h
+	include/alibabacloud/kms/model/ReEncryptRequest.h
+	include/alibabacloud/kms/model/ReEncryptResult.h
 	include/alibabacloud/kms/model/RestoreSecretRequest.h
 	include/alibabacloud/kms/model/RestoreSecretResult.h
 	include/alibabacloud/kms/model/ScheduleKeyDeletionRequest.h
@@ -156,6 +162,10 @@ set(kms_src
 	src/model/EnableKeyResult.cc
 	src/model/EncryptRequest.cc
 	src/model/EncryptResult.cc
+	src/model/ExportDataKeyRequest.cc
+	src/model/ExportDataKeyResult.cc
+	src/model/GenerateAndExportDataKeyRequest.cc
+	src/model/GenerateAndExportDataKeyResult.cc
 	src/model/GenerateDataKeyRequest.cc
 	src/model/GenerateDataKeyResult.cc
 	src/model/GenerateDataKeyWithoutPlaintextRequest.cc
@@ -186,6 +196,8 @@ set(kms_src
 	src/model/ListSecretsResult.cc
 	src/model/PutSecretValueRequest.cc
 	src/model/PutSecretValueResult.cc
+	src/model/ReEncryptRequest.cc
+	src/model/ReEncryptResult.cc
 	src/model/RestoreSecretRequest.cc
 	src/model/RestoreSecretResult.cc
 	src/model/ScheduleKeyDeletionRequest.cc

+ 24 - 0
kms/include/alibabacloud/kms/KmsClient.h

@@ -64,6 +64,10 @@
 #include "model/EnableKeyResult.h"
 #include "model/EncryptRequest.h"
 #include "model/EncryptResult.h"
+#include "model/ExportDataKeyRequest.h"
+#include "model/ExportDataKeyResult.h"
+#include "model/GenerateAndExportDataKeyRequest.h"
+#include "model/GenerateAndExportDataKeyResult.h"
 #include "model/GenerateDataKeyRequest.h"
 #include "model/GenerateDataKeyResult.h"
 #include "model/GenerateDataKeyWithoutPlaintextRequest.h"
@@ -94,6 +98,8 @@
 #include "model/ListSecretsResult.h"
 #include "model/PutSecretValueRequest.h"
 #include "model/PutSecretValueResult.h"
+#include "model/ReEncryptRequest.h"
+#include "model/ReEncryptResult.h"
 #include "model/RestoreSecretRequest.h"
 #include "model/RestoreSecretResult.h"
 #include "model/ScheduleKeyDeletionRequest.h"
@@ -184,6 +190,12 @@ namespace AlibabaCloud
 			typedef Outcome<Error, Model::EncryptResult> EncryptOutcome;
 			typedef std::future<EncryptOutcome> EncryptOutcomeCallable;
 			typedef std::function<void(const KmsClient*, const Model::EncryptRequest&, const EncryptOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> EncryptAsyncHandler;
+			typedef Outcome<Error, Model::ExportDataKeyResult> ExportDataKeyOutcome;
+			typedef std::future<ExportDataKeyOutcome> ExportDataKeyOutcomeCallable;
+			typedef std::function<void(const KmsClient*, const Model::ExportDataKeyRequest&, const ExportDataKeyOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ExportDataKeyAsyncHandler;
+			typedef Outcome<Error, Model::GenerateAndExportDataKeyResult> GenerateAndExportDataKeyOutcome;
+			typedef std::future<GenerateAndExportDataKeyOutcome> GenerateAndExportDataKeyOutcomeCallable;
+			typedef std::function<void(const KmsClient*, const Model::GenerateAndExportDataKeyRequest&, const GenerateAndExportDataKeyOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GenerateAndExportDataKeyAsyncHandler;
 			typedef Outcome<Error, Model::GenerateDataKeyResult> GenerateDataKeyOutcome;
 			typedef std::future<GenerateDataKeyOutcome> GenerateDataKeyOutcomeCallable;
 			typedef std::function<void(const KmsClient*, const Model::GenerateDataKeyRequest&, const GenerateDataKeyOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GenerateDataKeyAsyncHandler;
@@ -229,6 +241,9 @@ namespace AlibabaCloud
 			typedef Outcome<Error, Model::PutSecretValueResult> PutSecretValueOutcome;
 			typedef std::future<PutSecretValueOutcome> PutSecretValueOutcomeCallable;
 			typedef std::function<void(const KmsClient*, const Model::PutSecretValueRequest&, const PutSecretValueOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> PutSecretValueAsyncHandler;
+			typedef Outcome<Error, Model::ReEncryptResult> ReEncryptOutcome;
+			typedef std::future<ReEncryptOutcome> ReEncryptOutcomeCallable;
+			typedef std::function<void(const KmsClient*, const Model::ReEncryptRequest&, const ReEncryptOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ReEncryptAsyncHandler;
 			typedef Outcome<Error, Model::RestoreSecretResult> RestoreSecretOutcome;
 			typedef std::future<RestoreSecretOutcome> RestoreSecretOutcomeCallable;
 			typedef std::function<void(const KmsClient*, const Model::RestoreSecretRequest&, const RestoreSecretOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RestoreSecretAsyncHandler;
@@ -324,6 +339,12 @@ namespace AlibabaCloud
 			EncryptOutcome encrypt(const Model::EncryptRequest &request)const;
 			void encryptAsync(const Model::EncryptRequest& request, const EncryptAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
 			EncryptOutcomeCallable encryptCallable(const Model::EncryptRequest& request) const;
+			ExportDataKeyOutcome exportDataKey(const Model::ExportDataKeyRequest &request)const;
+			void exportDataKeyAsync(const Model::ExportDataKeyRequest& request, const ExportDataKeyAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
+			ExportDataKeyOutcomeCallable exportDataKeyCallable(const Model::ExportDataKeyRequest& request) const;
+			GenerateAndExportDataKeyOutcome generateAndExportDataKey(const Model::GenerateAndExportDataKeyRequest &request)const;
+			void generateAndExportDataKeyAsync(const Model::GenerateAndExportDataKeyRequest& request, const GenerateAndExportDataKeyAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
+			GenerateAndExportDataKeyOutcomeCallable generateAndExportDataKeyCallable(const Model::GenerateAndExportDataKeyRequest& request) const;
 			GenerateDataKeyOutcome generateDataKey(const Model::GenerateDataKeyRequest &request)const;
 			void generateDataKeyAsync(const Model::GenerateDataKeyRequest& request, const GenerateDataKeyAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
 			GenerateDataKeyOutcomeCallable generateDataKeyCallable(const Model::GenerateDataKeyRequest& request) const;
@@ -369,6 +390,9 @@ namespace AlibabaCloud
 			PutSecretValueOutcome putSecretValue(const Model::PutSecretValueRequest &request)const;
 			void putSecretValueAsync(const Model::PutSecretValueRequest& request, const PutSecretValueAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
 			PutSecretValueOutcomeCallable putSecretValueCallable(const Model::PutSecretValueRequest& request) const;
+			ReEncryptOutcome reEncrypt(const Model::ReEncryptRequest &request)const;
+			void reEncryptAsync(const Model::ReEncryptRequest& request, const ReEncryptAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
+			ReEncryptOutcomeCallable reEncryptCallable(const Model::ReEncryptRequest& request) const;
 			RestoreSecretOutcome restoreSecret(const Model::RestoreSecretRequest &request)const;
 			void restoreSecretAsync(const Model::RestoreSecretRequest& request, const RestoreSecretAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
 			RestoreSecretOutcomeCallable restoreSecretCallable(const Model::RestoreSecretRequest& request) const;

+ 60 - 0
kms/include/alibabacloud/kms/model/ExportDataKeyRequest.h

@@ -0,0 +1,60 @@
+/*
+ * Copyright 2009-2017 Alibaba Cloud 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.
+ */
+
+#ifndef ALIBABACLOUD_KMS_MODEL_EXPORTDATAKEYREQUEST_H_
+#define ALIBABACLOUD_KMS_MODEL_EXPORTDATAKEYREQUEST_H_
+
+#include <string>
+#include <vector>
+#include <alibabacloud/core/RpcServiceRequest.h>
+#include <alibabacloud/kms/KmsExport.h>
+
+namespace AlibabaCloud
+{
+	namespace Kms
+	{
+		namespace Model
+		{
+			class ALIBABACLOUD_KMS_EXPORT ExportDataKeyRequest : public RpcServiceRequest
+			{
+
+			public:
+				ExportDataKeyRequest();
+				~ExportDataKeyRequest();
+
+				std::string getEncryptionContext()const;
+				void setEncryptionContext(const std::string& encryptionContext);
+				std::string getWrappingAlgorithm()const;
+				void setWrappingAlgorithm(const std::string& wrappingAlgorithm);
+				std::string getCiphertextBlob()const;
+				void setCiphertextBlob(const std::string& ciphertextBlob);
+				std::string getPublicKeyBlob()const;
+				void setPublicKeyBlob(const std::string& publicKeyBlob);
+				std::string getWrappingKeySpec()const;
+				void setWrappingKeySpec(const std::string& wrappingKeySpec);
+
+            private:
+				std::string encryptionContext_;
+				std::string wrappingAlgorithm_;
+				std::string ciphertextBlob_;
+				std::string publicKeyBlob_;
+				std::string wrappingKeySpec_;
+
+			};
+		}
+	}
+}
+#endif // !ALIBABACLOUD_KMS_MODEL_EXPORTDATAKEYREQUEST_H_

+ 55 - 0
kms/include/alibabacloud/kms/model/ExportDataKeyResult.h

@@ -0,0 +1,55 @@
+/*
+ * Copyright 2009-2017 Alibaba Cloud 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.
+ */
+
+#ifndef ALIBABACLOUD_KMS_MODEL_EXPORTDATAKEYRESULT_H_
+#define ALIBABACLOUD_KMS_MODEL_EXPORTDATAKEYRESULT_H_
+
+#include <string>
+#include <vector>
+#include <utility>
+#include <alibabacloud/core/ServiceResult.h>
+#include <alibabacloud/kms/KmsExport.h>
+
+namespace AlibabaCloud
+{
+	namespace Kms
+	{
+		namespace Model
+		{
+			class ALIBABACLOUD_KMS_EXPORT ExportDataKeyResult : public ServiceResult
+			{
+			public:
+
+
+				ExportDataKeyResult();
+				explicit ExportDataKeyResult(const std::string &payload);
+				~ExportDataKeyResult();
+				std::string getExportedDataKey()const;
+				std::string getKeyId()const;
+				std::string getKeyVersionId()const;
+
+			protected:
+				void parse(const std::string &payload);
+			private:
+				std::string exportedDataKey_;
+				std::string keyId_;
+				std::string keyVersionId_;
+
+			};
+		}
+	}
+}
+#endif // !ALIBABACLOUD_KMS_MODEL_EXPORTDATAKEYRESULT_H_

+ 66 - 0
kms/include/alibabacloud/kms/model/GenerateAndExportDataKeyRequest.h

@@ -0,0 +1,66 @@
+/*
+ * Copyright 2009-2017 Alibaba Cloud 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.
+ */
+
+#ifndef ALIBABACLOUD_KMS_MODEL_GENERATEANDEXPORTDATAKEYREQUEST_H_
+#define ALIBABACLOUD_KMS_MODEL_GENERATEANDEXPORTDATAKEYREQUEST_H_
+
+#include <string>
+#include <vector>
+#include <alibabacloud/core/RpcServiceRequest.h>
+#include <alibabacloud/kms/KmsExport.h>
+
+namespace AlibabaCloud
+{
+	namespace Kms
+	{
+		namespace Model
+		{
+			class ALIBABACLOUD_KMS_EXPORT GenerateAndExportDataKeyRequest : public RpcServiceRequest
+			{
+
+			public:
+				GenerateAndExportDataKeyRequest();
+				~GenerateAndExportDataKeyRequest();
+
+				std::string getEncryptionContext()const;
+				void setEncryptionContext(const std::string& encryptionContext);
+				std::string getKeyId()const;
+				void setKeyId(const std::string& keyId);
+				std::string getKeySpec()const;
+				void setKeySpec(const std::string& keySpec);
+				int getNumberOfBytes()const;
+				void setNumberOfBytes(int numberOfBytes);
+				std::string getWrappingAlgorithm()const;
+				void setWrappingAlgorithm(const std::string& wrappingAlgorithm);
+				std::string getPublicKeyBlob()const;
+				void setPublicKeyBlob(const std::string& publicKeyBlob);
+				std::string getWrappingKeySpec()const;
+				void setWrappingKeySpec(const std::string& wrappingKeySpec);
+
+            private:
+				std::string encryptionContext_;
+				std::string keyId_;
+				std::string keySpec_;
+				int numberOfBytes_;
+				std::string wrappingAlgorithm_;
+				std::string publicKeyBlob_;
+				std::string wrappingKeySpec_;
+
+			};
+		}
+	}
+}
+#endif // !ALIBABACLOUD_KMS_MODEL_GENERATEANDEXPORTDATAKEYREQUEST_H_

+ 57 - 0
kms/include/alibabacloud/kms/model/GenerateAndExportDataKeyResult.h

@@ -0,0 +1,57 @@
+/*
+ * Copyright 2009-2017 Alibaba Cloud 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.
+ */
+
+#ifndef ALIBABACLOUD_KMS_MODEL_GENERATEANDEXPORTDATAKEYRESULT_H_
+#define ALIBABACLOUD_KMS_MODEL_GENERATEANDEXPORTDATAKEYRESULT_H_
+
+#include <string>
+#include <vector>
+#include <utility>
+#include <alibabacloud/core/ServiceResult.h>
+#include <alibabacloud/kms/KmsExport.h>
+
+namespace AlibabaCloud
+{
+	namespace Kms
+	{
+		namespace Model
+		{
+			class ALIBABACLOUD_KMS_EXPORT GenerateAndExportDataKeyResult : public ServiceResult
+			{
+			public:
+
+
+				GenerateAndExportDataKeyResult();
+				explicit GenerateAndExportDataKeyResult(const std::string &payload);
+				~GenerateAndExportDataKeyResult();
+				std::string getCiphertextBlob()const;
+				std::string getExportedDataKey()const;
+				std::string getKeyId()const;
+				std::string getKeyVersionId()const;
+
+			protected:
+				void parse(const std::string &payload);
+			private:
+				std::string ciphertextBlob_;
+				std::string exportedDataKey_;
+				std::string keyId_;
+				std::string keyVersionId_;
+
+			};
+		}
+	}
+}
+#endif // !ALIBABACLOUD_KMS_MODEL_GENERATEANDEXPORTDATAKEYRESULT_H_

+ 66 - 0
kms/include/alibabacloud/kms/model/ReEncryptRequest.h

@@ -0,0 +1,66 @@
+/*
+ * Copyright 2009-2017 Alibaba Cloud 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.
+ */
+
+#ifndef ALIBABACLOUD_KMS_MODEL_REENCRYPTREQUEST_H_
+#define ALIBABACLOUD_KMS_MODEL_REENCRYPTREQUEST_H_
+
+#include <string>
+#include <vector>
+#include <alibabacloud/core/RpcServiceRequest.h>
+#include <alibabacloud/kms/KmsExport.h>
+
+namespace AlibabaCloud
+{
+	namespace Kms
+	{
+		namespace Model
+		{
+			class ALIBABACLOUD_KMS_EXPORT ReEncryptRequest : public RpcServiceRequest
+			{
+
+			public:
+				ReEncryptRequest();
+				~ReEncryptRequest();
+
+				std::string getDestinationEncryptionContext()const;
+				void setDestinationEncryptionContext(const std::string& destinationEncryptionContext);
+				std::string getSourceEncryptionAlgorithm()const;
+				void setSourceEncryptionAlgorithm(const std::string& sourceEncryptionAlgorithm);
+				std::string getSourceKeyVersionId()const;
+				void setSourceKeyVersionId(const std::string& sourceKeyVersionId);
+				std::string getDestinationKeyId()const;
+				void setDestinationKeyId(const std::string& destinationKeyId);
+				std::string getSourceKeyId()const;
+				void setSourceKeyId(const std::string& sourceKeyId);
+				std::string getSourceEncryptionContext()const;
+				void setSourceEncryptionContext(const std::string& sourceEncryptionContext);
+				std::string getCiphertextBlob()const;
+				void setCiphertextBlob(const std::string& ciphertextBlob);
+
+            private:
+				std::string destinationEncryptionContext_;
+				std::string sourceEncryptionAlgorithm_;
+				std::string sourceKeyVersionId_;
+				std::string destinationKeyId_;
+				std::string sourceKeyId_;
+				std::string sourceEncryptionContext_;
+				std::string ciphertextBlob_;
+
+			};
+		}
+	}
+}
+#endif // !ALIBABACLOUD_KMS_MODEL_REENCRYPTREQUEST_H_

+ 55 - 0
kms/include/alibabacloud/kms/model/ReEncryptResult.h

@@ -0,0 +1,55 @@
+/*
+ * Copyright 2009-2017 Alibaba Cloud 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.
+ */
+
+#ifndef ALIBABACLOUD_KMS_MODEL_REENCRYPTRESULT_H_
+#define ALIBABACLOUD_KMS_MODEL_REENCRYPTRESULT_H_
+
+#include <string>
+#include <vector>
+#include <utility>
+#include <alibabacloud/core/ServiceResult.h>
+#include <alibabacloud/kms/KmsExport.h>
+
+namespace AlibabaCloud
+{
+	namespace Kms
+	{
+		namespace Model
+		{
+			class ALIBABACLOUD_KMS_EXPORT ReEncryptResult : public ServiceResult
+			{
+			public:
+
+
+				ReEncryptResult();
+				explicit ReEncryptResult(const std::string &payload);
+				~ReEncryptResult();
+				std::string getCiphertextBlob()const;
+				std::string getKeyId()const;
+				std::string getKeyVersionId()const;
+
+			protected:
+				void parse(const std::string &payload);
+			private:
+				std::string ciphertextBlob_;
+				std::string keyId_;
+				std::string keyVersionId_;
+
+			};
+		}
+	}
+}
+#endif // !ALIBABACLOUD_KMS_MODEL_REENCRYPTRESULT_H_

+ 111 - 3
kms/src/KmsClient.cc

@@ -31,21 +31,21 @@ KmsClient::KmsClient(const Credentials &credentials, const ClientConfiguration &
 	RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(credentials), configuration)
 {
 	auto locationClient = std::make_shared<LocationClient>(credentials, configuration);
-	endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "kms");
+	endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "kms-service");
 }
 
 KmsClient::KmsClient(const std::shared_ptr<CredentialsProvider>& credentialsProvider, const ClientConfiguration & configuration) :
 	RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration)
 {
 	auto locationClient = std::make_shared<LocationClient>(credentialsProvider, configuration);
-	endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "kms");
+	endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "kms-service");
 }
 
 KmsClient::KmsClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) :
 	RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(accessKeyId, accessKeySecret), configuration)
 {
 	auto locationClient = std::make_shared<LocationClient>(accessKeyId, accessKeySecret, configuration);
-	endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "kms");
+	endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "kms-service");
 }
 
 KmsClient::~KmsClient()
@@ -807,6 +807,78 @@ KmsClient::EncryptOutcomeCallable KmsClient::encryptCallable(const EncryptReques
 	return task->get_future();
 }
 
+KmsClient::ExportDataKeyOutcome KmsClient::exportDataKey(const ExportDataKeyRequest &request) const
+{
+	auto endpointOutcome = endpointProvider_->getEndpoint();
+	if (!endpointOutcome.isSuccess())
+		return ExportDataKeyOutcome(endpointOutcome.error());
+
+	auto outcome = makeRequest(endpointOutcome.result(), request);
+
+	if (outcome.isSuccess())
+		return ExportDataKeyOutcome(ExportDataKeyResult(outcome.result()));
+	else
+		return ExportDataKeyOutcome(outcome.error());
+}
+
+void KmsClient::exportDataKeyAsync(const ExportDataKeyRequest& request, const ExportDataKeyAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
+{
+	auto fn = [this, request, handler, context]()
+	{
+		handler(this, request, exportDataKey(request), context);
+	};
+
+	asyncExecute(new Runnable(fn));
+}
+
+KmsClient::ExportDataKeyOutcomeCallable KmsClient::exportDataKeyCallable(const ExportDataKeyRequest &request) const
+{
+	auto task = std::make_shared<std::packaged_task<ExportDataKeyOutcome()>>(
+			[this, request]()
+			{
+			return this->exportDataKey(request);
+			});
+
+	asyncExecute(new Runnable([task]() { (*task)(); }));
+	return task->get_future();
+}
+
+KmsClient::GenerateAndExportDataKeyOutcome KmsClient::generateAndExportDataKey(const GenerateAndExportDataKeyRequest &request) const
+{
+	auto endpointOutcome = endpointProvider_->getEndpoint();
+	if (!endpointOutcome.isSuccess())
+		return GenerateAndExportDataKeyOutcome(endpointOutcome.error());
+
+	auto outcome = makeRequest(endpointOutcome.result(), request);
+
+	if (outcome.isSuccess())
+		return GenerateAndExportDataKeyOutcome(GenerateAndExportDataKeyResult(outcome.result()));
+	else
+		return GenerateAndExportDataKeyOutcome(outcome.error());
+}
+
+void KmsClient::generateAndExportDataKeyAsync(const GenerateAndExportDataKeyRequest& request, const GenerateAndExportDataKeyAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
+{
+	auto fn = [this, request, handler, context]()
+	{
+		handler(this, request, generateAndExportDataKey(request), context);
+	};
+
+	asyncExecute(new Runnable(fn));
+}
+
+KmsClient::GenerateAndExportDataKeyOutcomeCallable KmsClient::generateAndExportDataKeyCallable(const GenerateAndExportDataKeyRequest &request) const
+{
+	auto task = std::make_shared<std::packaged_task<GenerateAndExportDataKeyOutcome()>>(
+			[this, request]()
+			{
+			return this->generateAndExportDataKey(request);
+			});
+
+	asyncExecute(new Runnable([task]() { (*task)(); }));
+	return task->get_future();
+}
+
 KmsClient::GenerateDataKeyOutcome KmsClient::generateDataKey(const GenerateDataKeyRequest &request) const
 {
 	auto endpointOutcome = endpointProvider_->getEndpoint();
@@ -1347,6 +1419,42 @@ KmsClient::PutSecretValueOutcomeCallable KmsClient::putSecretValueCallable(const
 	return task->get_future();
 }
 
+KmsClient::ReEncryptOutcome KmsClient::reEncrypt(const ReEncryptRequest &request) const
+{
+	auto endpointOutcome = endpointProvider_->getEndpoint();
+	if (!endpointOutcome.isSuccess())
+		return ReEncryptOutcome(endpointOutcome.error());
+
+	auto outcome = makeRequest(endpointOutcome.result(), request);
+
+	if (outcome.isSuccess())
+		return ReEncryptOutcome(ReEncryptResult(outcome.result()));
+	else
+		return ReEncryptOutcome(outcome.error());
+}
+
+void KmsClient::reEncryptAsync(const ReEncryptRequest& request, const ReEncryptAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
+{
+	auto fn = [this, request, handler, context]()
+	{
+		handler(this, request, reEncrypt(request), context);
+	};
+
+	asyncExecute(new Runnable(fn));
+}
+
+KmsClient::ReEncryptOutcomeCallable KmsClient::reEncryptCallable(const ReEncryptRequest &request) const
+{
+	auto task = std::make_shared<std::packaged_task<ReEncryptOutcome()>>(
+			[this, request]()
+			{
+			return this->reEncrypt(request);
+			});
+
+	asyncExecute(new Runnable([task]() { (*task)(); }));
+	return task->get_future();
+}
+
 KmsClient::RestoreSecretOutcome KmsClient::restoreSecret(const RestoreSecretRequest &request) const
 {
 	auto endpointOutcome = endpointProvider_->getEndpoint();

+ 84 - 0
kms/src/model/ExportDataKeyRequest.cc

@@ -0,0 +1,84 @@
+/*
+ * Copyright 2009-2017 Alibaba Cloud 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.
+ */
+
+#include <alibabacloud/kms/model/ExportDataKeyRequest.h>
+
+using AlibabaCloud::Kms::Model::ExportDataKeyRequest;
+
+ExportDataKeyRequest::ExportDataKeyRequest() :
+	RpcServiceRequest("kms", "2016-01-20", "ExportDataKey")
+{
+	setMethod(HttpRequest::Method::Post);
+}
+
+ExportDataKeyRequest::~ExportDataKeyRequest()
+{}
+
+std::string ExportDataKeyRequest::getEncryptionContext()const
+{
+	return encryptionContext_;
+}
+
+void ExportDataKeyRequest::setEncryptionContext(const std::string& encryptionContext)
+{
+	encryptionContext_ = encryptionContext;
+	setParameter("EncryptionContext", encryptionContext);
+}
+
+std::string ExportDataKeyRequest::getWrappingAlgorithm()const
+{
+	return wrappingAlgorithm_;
+}
+
+void ExportDataKeyRequest::setWrappingAlgorithm(const std::string& wrappingAlgorithm)
+{
+	wrappingAlgorithm_ = wrappingAlgorithm;
+	setParameter("WrappingAlgorithm", wrappingAlgorithm);
+}
+
+std::string ExportDataKeyRequest::getCiphertextBlob()const
+{
+	return ciphertextBlob_;
+}
+
+void ExportDataKeyRequest::setCiphertextBlob(const std::string& ciphertextBlob)
+{
+	ciphertextBlob_ = ciphertextBlob;
+	setParameter("CiphertextBlob", ciphertextBlob);
+}
+
+std::string ExportDataKeyRequest::getPublicKeyBlob()const
+{
+	return publicKeyBlob_;
+}
+
+void ExportDataKeyRequest::setPublicKeyBlob(const std::string& publicKeyBlob)
+{
+	publicKeyBlob_ = publicKeyBlob;
+	setParameter("PublicKeyBlob", publicKeyBlob);
+}
+
+std::string ExportDataKeyRequest::getWrappingKeySpec()const
+{
+	return wrappingKeySpec_;
+}
+
+void ExportDataKeyRequest::setWrappingKeySpec(const std::string& wrappingKeySpec)
+{
+	wrappingKeySpec_ = wrappingKeySpec;
+	setParameter("WrappingKeySpec", wrappingKeySpec);
+}
+

+ 65 - 0
kms/src/model/ExportDataKeyResult.cc

@@ -0,0 +1,65 @@
+/*
+ * Copyright 2009-2017 Alibaba Cloud 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.
+ */
+
+#include <alibabacloud/kms/model/ExportDataKeyResult.h>
+#include <json/json.h>
+
+using namespace AlibabaCloud::Kms;
+using namespace AlibabaCloud::Kms::Model;
+
+ExportDataKeyResult::ExportDataKeyResult() :
+	ServiceResult()
+{}
+
+ExportDataKeyResult::ExportDataKeyResult(const std::string &payload) :
+	ServiceResult()
+{
+	parse(payload);
+}
+
+ExportDataKeyResult::~ExportDataKeyResult()
+{}
+
+void ExportDataKeyResult::parse(const std::string &payload)
+{
+	Json::Reader reader;
+	Json::Value value;
+	reader.parse(payload, value);
+	setRequestId(value["RequestId"].asString());
+	if(!value["ExportedDataKey"].isNull())
+		exportedDataKey_ = value["ExportedDataKey"].asString();
+	if(!value["KeyId"].isNull())
+		keyId_ = value["KeyId"].asString();
+	if(!value["KeyVersionId"].isNull())
+		keyVersionId_ = value["KeyVersionId"].asString();
+
+}
+
+std::string ExportDataKeyResult::getExportedDataKey()const
+{
+	return exportedDataKey_;
+}
+
+std::string ExportDataKeyResult::getKeyId()const
+{
+	return keyId_;
+}
+
+std::string ExportDataKeyResult::getKeyVersionId()const
+{
+	return keyVersionId_;
+}
+

+ 106 - 0
kms/src/model/GenerateAndExportDataKeyRequest.cc

@@ -0,0 +1,106 @@
+/*
+ * Copyright 2009-2017 Alibaba Cloud 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.
+ */
+
+#include <alibabacloud/kms/model/GenerateAndExportDataKeyRequest.h>
+
+using AlibabaCloud::Kms::Model::GenerateAndExportDataKeyRequest;
+
+GenerateAndExportDataKeyRequest::GenerateAndExportDataKeyRequest() :
+	RpcServiceRequest("kms", "2016-01-20", "GenerateAndExportDataKey")
+{
+	setMethod(HttpRequest::Method::Post);
+}
+
+GenerateAndExportDataKeyRequest::~GenerateAndExportDataKeyRequest()
+{}
+
+std::string GenerateAndExportDataKeyRequest::getEncryptionContext()const
+{
+	return encryptionContext_;
+}
+
+void GenerateAndExportDataKeyRequest::setEncryptionContext(const std::string& encryptionContext)
+{
+	encryptionContext_ = encryptionContext;
+	setParameter("EncryptionContext", encryptionContext);
+}
+
+std::string GenerateAndExportDataKeyRequest::getKeyId()const
+{
+	return keyId_;
+}
+
+void GenerateAndExportDataKeyRequest::setKeyId(const std::string& keyId)
+{
+	keyId_ = keyId;
+	setParameter("KeyId", keyId);
+}
+
+std::string GenerateAndExportDataKeyRequest::getKeySpec()const
+{
+	return keySpec_;
+}
+
+void GenerateAndExportDataKeyRequest::setKeySpec(const std::string& keySpec)
+{
+	keySpec_ = keySpec;
+	setParameter("KeySpec", keySpec);
+}
+
+int GenerateAndExportDataKeyRequest::getNumberOfBytes()const
+{
+	return numberOfBytes_;
+}
+
+void GenerateAndExportDataKeyRequest::setNumberOfBytes(int numberOfBytes)
+{
+	numberOfBytes_ = numberOfBytes;
+	setParameter("NumberOfBytes", std::to_string(numberOfBytes));
+}
+
+std::string GenerateAndExportDataKeyRequest::getWrappingAlgorithm()const
+{
+	return wrappingAlgorithm_;
+}
+
+void GenerateAndExportDataKeyRequest::setWrappingAlgorithm(const std::string& wrappingAlgorithm)
+{
+	wrappingAlgorithm_ = wrappingAlgorithm;
+	setParameter("WrappingAlgorithm", wrappingAlgorithm);
+}
+
+std::string GenerateAndExportDataKeyRequest::getPublicKeyBlob()const
+{
+	return publicKeyBlob_;
+}
+
+void GenerateAndExportDataKeyRequest::setPublicKeyBlob(const std::string& publicKeyBlob)
+{
+	publicKeyBlob_ = publicKeyBlob;
+	setParameter("PublicKeyBlob", publicKeyBlob);
+}
+
+std::string GenerateAndExportDataKeyRequest::getWrappingKeySpec()const
+{
+	return wrappingKeySpec_;
+}
+
+void GenerateAndExportDataKeyRequest::setWrappingKeySpec(const std::string& wrappingKeySpec)
+{
+	wrappingKeySpec_ = wrappingKeySpec;
+	setParameter("WrappingKeySpec", wrappingKeySpec);
+}
+

+ 72 - 0
kms/src/model/GenerateAndExportDataKeyResult.cc

@@ -0,0 +1,72 @@
+/*
+ * Copyright 2009-2017 Alibaba Cloud 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.
+ */
+
+#include <alibabacloud/kms/model/GenerateAndExportDataKeyResult.h>
+#include <json/json.h>
+
+using namespace AlibabaCloud::Kms;
+using namespace AlibabaCloud::Kms::Model;
+
+GenerateAndExportDataKeyResult::GenerateAndExportDataKeyResult() :
+	ServiceResult()
+{}
+
+GenerateAndExportDataKeyResult::GenerateAndExportDataKeyResult(const std::string &payload) :
+	ServiceResult()
+{
+	parse(payload);
+}
+
+GenerateAndExportDataKeyResult::~GenerateAndExportDataKeyResult()
+{}
+
+void GenerateAndExportDataKeyResult::parse(const std::string &payload)
+{
+	Json::Reader reader;
+	Json::Value value;
+	reader.parse(payload, value);
+	setRequestId(value["RequestId"].asString());
+	if(!value["CiphertextBlob"].isNull())
+		ciphertextBlob_ = value["CiphertextBlob"].asString();
+	if(!value["KeyId"].isNull())
+		keyId_ = value["KeyId"].asString();
+	if(!value["ExportedDataKey"].isNull())
+		exportedDataKey_ = value["ExportedDataKey"].asString();
+	if(!value["KeyVersionId"].isNull())
+		keyVersionId_ = value["KeyVersionId"].asString();
+
+}
+
+std::string GenerateAndExportDataKeyResult::getCiphertextBlob()const
+{
+	return ciphertextBlob_;
+}
+
+std::string GenerateAndExportDataKeyResult::getExportedDataKey()const
+{
+	return exportedDataKey_;
+}
+
+std::string GenerateAndExportDataKeyResult::getKeyId()const
+{
+	return keyId_;
+}
+
+std::string GenerateAndExportDataKeyResult::getKeyVersionId()const
+{
+	return keyVersionId_;
+}
+

+ 106 - 0
kms/src/model/ReEncryptRequest.cc

@@ -0,0 +1,106 @@
+/*
+ * Copyright 2009-2017 Alibaba Cloud 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.
+ */
+
+#include <alibabacloud/kms/model/ReEncryptRequest.h>
+
+using AlibabaCloud::Kms::Model::ReEncryptRequest;
+
+ReEncryptRequest::ReEncryptRequest() :
+	RpcServiceRequest("kms", "2016-01-20", "ReEncrypt")
+{
+	setMethod(HttpRequest::Method::Post);
+}
+
+ReEncryptRequest::~ReEncryptRequest()
+{}
+
+std::string ReEncryptRequest::getDestinationEncryptionContext()const
+{
+	return destinationEncryptionContext_;
+}
+
+void ReEncryptRequest::setDestinationEncryptionContext(const std::string& destinationEncryptionContext)
+{
+	destinationEncryptionContext_ = destinationEncryptionContext;
+	setParameter("DestinationEncryptionContext", destinationEncryptionContext);
+}
+
+std::string ReEncryptRequest::getSourceEncryptionAlgorithm()const
+{
+	return sourceEncryptionAlgorithm_;
+}
+
+void ReEncryptRequest::setSourceEncryptionAlgorithm(const std::string& sourceEncryptionAlgorithm)
+{
+	sourceEncryptionAlgorithm_ = sourceEncryptionAlgorithm;
+	setParameter("SourceEncryptionAlgorithm", sourceEncryptionAlgorithm);
+}
+
+std::string ReEncryptRequest::getSourceKeyVersionId()const
+{
+	return sourceKeyVersionId_;
+}
+
+void ReEncryptRequest::setSourceKeyVersionId(const std::string& sourceKeyVersionId)
+{
+	sourceKeyVersionId_ = sourceKeyVersionId;
+	setParameter("SourceKeyVersionId", sourceKeyVersionId);
+}
+
+std::string ReEncryptRequest::getDestinationKeyId()const
+{
+	return destinationKeyId_;
+}
+
+void ReEncryptRequest::setDestinationKeyId(const std::string& destinationKeyId)
+{
+	destinationKeyId_ = destinationKeyId;
+	setParameter("DestinationKeyId", destinationKeyId);
+}
+
+std::string ReEncryptRequest::getSourceKeyId()const
+{
+	return sourceKeyId_;
+}
+
+void ReEncryptRequest::setSourceKeyId(const std::string& sourceKeyId)
+{
+	sourceKeyId_ = sourceKeyId;
+	setParameter("SourceKeyId", sourceKeyId);
+}
+
+std::string ReEncryptRequest::getSourceEncryptionContext()const
+{
+	return sourceEncryptionContext_;
+}
+
+void ReEncryptRequest::setSourceEncryptionContext(const std::string& sourceEncryptionContext)
+{
+	sourceEncryptionContext_ = sourceEncryptionContext;
+	setParameter("SourceEncryptionContext", sourceEncryptionContext);
+}
+
+std::string ReEncryptRequest::getCiphertextBlob()const
+{
+	return ciphertextBlob_;
+}
+
+void ReEncryptRequest::setCiphertextBlob(const std::string& ciphertextBlob)
+{
+	ciphertextBlob_ = ciphertextBlob;
+	setParameter("CiphertextBlob", ciphertextBlob);
+}
+

+ 65 - 0
kms/src/model/ReEncryptResult.cc

@@ -0,0 +1,65 @@
+/*
+ * Copyright 2009-2017 Alibaba Cloud 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.
+ */
+
+#include <alibabacloud/kms/model/ReEncryptResult.h>
+#include <json/json.h>
+
+using namespace AlibabaCloud::Kms;
+using namespace AlibabaCloud::Kms::Model;
+
+ReEncryptResult::ReEncryptResult() :
+	ServiceResult()
+{}
+
+ReEncryptResult::ReEncryptResult(const std::string &payload) :
+	ServiceResult()
+{
+	parse(payload);
+}
+
+ReEncryptResult::~ReEncryptResult()
+{}
+
+void ReEncryptResult::parse(const std::string &payload)
+{
+	Json::Reader reader;
+	Json::Value value;
+	reader.parse(payload, value);
+	setRequestId(value["RequestId"].asString());
+	if(!value["KeyId"].isNull())
+		keyId_ = value["KeyId"].asString();
+	if(!value["KeyVersionId"].isNull())
+		keyVersionId_ = value["KeyVersionId"].asString();
+	if(!value["CiphertextBlob"].isNull())
+		ciphertextBlob_ = value["CiphertextBlob"].asString();
+
+}
+
+std::string ReEncryptResult::getCiphertextBlob()const
+{
+	return ciphertextBlob_;
+}
+
+std::string ReEncryptResult::getKeyId()const
+{
+	return keyId_;
+}
+
+std::string ReEncryptResult::getKeyVersionId()const
+{
+	return keyVersionId_;
+}
+