Add GenerateAndExportDataKey, ExportDataKey, ReEncrypt api.
This commit is contained in:
@@ -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
kms/src/model/ExportDataKeyRequest.cc
Normal file
84
kms/src/model/ExportDataKeyRequest.cc
Normal file
@@ -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
kms/src/model/ExportDataKeyResult.cc
Normal file
65
kms/src/model/ExportDataKeyResult.cc
Normal file
@@ -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
kms/src/model/GenerateAndExportDataKeyRequest.cc
Normal file
106
kms/src/model/GenerateAndExportDataKeyRequest.cc
Normal file
@@ -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
kms/src/model/GenerateAndExportDataKeyResult.cc
Normal file
72
kms/src/model/GenerateAndExportDataKeyResult.cc
Normal file
@@ -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
kms/src/model/ReEncryptRequest.cc
Normal file
106
kms/src/model/ReEncryptRequest.cc
Normal file
@@ -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
kms/src/model/ReEncryptResult.cc
Normal file
65
kms/src/model/ReEncryptResult.cc
Normal file
@@ -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_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user