/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include #include #include #include #include #include using namespace Aws::KMS::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; using namespace Aws; DecryptResult::DecryptResult() : m_encryptionAlgorithm(EncryptionAlgorithmSpec::NOT_SET) { } DecryptResult::DecryptResult(const Aws::AmazonWebServiceResult& result) : m_encryptionAlgorithm(EncryptionAlgorithmSpec::NOT_SET) { *this = result; } DecryptResult& DecryptResult::operator =(const Aws::AmazonWebServiceResult& result) { JsonView jsonValue = result.GetPayload().View(); if(jsonValue.ValueExists("KeyId")) { m_keyId = jsonValue.GetString("KeyId"); } if(jsonValue.ValueExists("Plaintext")) { m_plaintext = HashingUtils::Base64Decode(jsonValue.GetString("Plaintext")); } if(jsonValue.ValueExists("EncryptionAlgorithm")) { m_encryptionAlgorithm = EncryptionAlgorithmSpecMapper::GetEncryptionAlgorithmSpecForName(jsonValue.GetString("EncryptionAlgorithm")); } if(jsonValue.ValueExists("CiphertextForRecipient")) { m_ciphertextForRecipient = HashingUtils::Base64Decode(jsonValue.GetString("CiphertextForRecipient")); } const auto& headers = result.GetHeaderValueCollection(); const auto& requestIdIter = headers.find("x-amzn-requestid"); if(requestIdIter != headers.end()) { m_requestId = requestIdIter->second; } return *this; }