Moved the Base64Encode() and Base64Decode() functions to be static members of a Convert class within the Azure::Core namespace. (#1870)
* Moved the `Base64Encode()` and `Base64Decode()` functions to be static members of a `Convert` class within the `Azure::Core` namespace. * Add the class name in the source file for posix.
This commit is contained in:
parent
7c862e1a51
commit
6a1afb9cbe
@ -39,6 +39,7 @@
|
||||
- Removed `Azure::Core::DateTime::GetRfc3339String()`: `Azure::Core::DateTime::ToString()` was extended to provide the same functionality.
|
||||
- Changed the constructor of `Azure::IO::FileBodyStream` to accept a file name directly and take ownership of opening/closing the file, instead of accepting a file descriptor, offset, and length.
|
||||
- Renamed the `Range` type to `HttpRange` within the `Azure::Core::Http` namespace.
|
||||
- Moved the `Base64Encode()` and `Base64Decode()` functions to be static members of a `Convert` class within the `Azure::Core` namespace.
|
||||
- Moved `Azure::Core::Response<T>` to `Azure::Response<T>`.
|
||||
- Moved `Azure::Core::ETag` to `Azure::ETag`.
|
||||
- Moved `Azure::Core::DateTime` to `Azure::DateTime`.
|
||||
|
||||
@ -15,19 +15,30 @@
|
||||
namespace Azure { namespace Core {
|
||||
|
||||
/**
|
||||
* @brief Encodes the vector of binary data into UTF-8 encoded text represented as base 64.
|
||||
*
|
||||
* @param data The input vector that contains binary data that needs to be encoded.
|
||||
* @return The UTF-8 encoded text in base 64.
|
||||
*@brief Used to convert one form of data into another, for example encoding binary data into
|
||||
*base 64 text.
|
||||
*/
|
||||
std::string Base64Encode(const std::vector<uint8_t>& data);
|
||||
class Convert {
|
||||
private:
|
||||
// This type currently only contains static methods and hence disallowing instance creation.
|
||||
Convert() = default;
|
||||
|
||||
/**
|
||||
* @brief Decodes the UTF-8 encoded text represented as base 64 into binary data.
|
||||
*
|
||||
* @param text The input UTF-8 encoded text in base 64 that needs to be decoded.
|
||||
* @return The decoded binary data.
|
||||
*/
|
||||
std::vector<uint8_t> Base64Decode(const std::string& text);
|
||||
public:
|
||||
/**
|
||||
* @brief Encodes the vector of binary data into UTF-8 encoded text represented as base 64.
|
||||
*
|
||||
* @param data The input vector that contains binary data that needs to be encoded.
|
||||
* @return The UTF-8 encoded text in base 64.
|
||||
*/
|
||||
static std::string Base64Encode(const std::vector<uint8_t>& data);
|
||||
|
||||
/**
|
||||
* @brief Decodes the UTF-8 encoded text represented as base 64 into binary data.
|
||||
*
|
||||
* @param text The input UTF-8 encoded text in base 64 that needs to be decoded.
|
||||
* @return The decoded binary data.
|
||||
*/
|
||||
static std::vector<uint8_t> Base64Decode(const std::string& text);
|
||||
};
|
||||
|
||||
}} // namespace Azure::Core
|
||||
|
||||
@ -19,7 +19,7 @@ namespace Azure { namespace Core {
|
||||
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
|
||||
std::string Base64Encode(const std::vector<uint8_t>& data)
|
||||
std::string Convert::Base64Encode(const std::vector<uint8_t>& data)
|
||||
{
|
||||
std::string encoded;
|
||||
// According to RFC 4648, the encoded length should be ceiling(n / 3) * 4
|
||||
@ -36,7 +36,7 @@ namespace Azure { namespace Core {
|
||||
return encoded;
|
||||
}
|
||||
|
||||
std::vector<uint8_t> Base64Decode(const std::string& text)
|
||||
std::vector<uint8_t> Convert::Base64Decode(const std::string& text)
|
||||
{
|
||||
std::vector<uint8_t> decoded;
|
||||
// According to RFC 4648, the encoded length should be ceiling(n / 3) * 4, so we can infer an
|
||||
@ -58,7 +58,7 @@ namespace Azure { namespace Core {
|
||||
|
||||
#elif defined(AZ_PLATFORM_POSIX)
|
||||
|
||||
std::string Base64Encode(const std::vector<uint8_t>& data)
|
||||
std::string Convert::Base64Encode(const std::vector<uint8_t>& data)
|
||||
{
|
||||
BIO* bio = BIO_new(BIO_s_mem());
|
||||
bio = BIO_push(BIO_new(BIO_f_base64()), bio);
|
||||
@ -73,7 +73,7 @@ namespace Azure { namespace Core {
|
||||
return std::string(bufferPtr->data, bufferPtr->length);
|
||||
}
|
||||
|
||||
std::vector<uint8_t> Base64Decode(const std::string& text)
|
||||
std::vector<uint8_t> Convert::Base64Decode(const std::string& text)
|
||||
{
|
||||
std::vector<uint8_t> decoded;
|
||||
// According to RFC 4648, the encoded length should be ceiling(n / 3) * 4, so we can infer an
|
||||
|
||||
@ -19,48 +19,54 @@ TEST(Base64, Basic)
|
||||
data.push_back(i + 1);
|
||||
}
|
||||
|
||||
std::string result = Base64Encode(data);
|
||||
std::string result = Convert::Base64Encode(data);
|
||||
EXPECT_PRED2(
|
||||
[](std::string expect, std::string actual) { return expect == actual; },
|
||||
result,
|
||||
"AQIDBAUGBw==");
|
||||
EXPECT_TRUE(std::equal(data.begin(), data.end(), Base64Decode(result).begin()));
|
||||
EXPECT_TRUE(std::equal(data.begin(), data.end(), Convert::Base64Decode(result).begin()));
|
||||
|
||||
std::vector<uint8_t> subsection = std::vector<uint8_t>(data.begin(), data.begin() + 1);
|
||||
result = Base64Encode(subsection);
|
||||
result = Convert::Base64Encode(subsection);
|
||||
EXPECT_PRED2(
|
||||
[](std::string expect, std::string actual) { return expect == actual; }, result, "AQ==");
|
||||
EXPECT_TRUE(std::equal(subsection.begin(), subsection.end(), Base64Decode(result).begin()));
|
||||
EXPECT_TRUE(
|
||||
std::equal(subsection.begin(), subsection.end(), Convert::Base64Decode(result).begin()));
|
||||
|
||||
subsection = std::vector<uint8_t>(data.begin(), data.begin() + 2);
|
||||
result = Base64Encode(subsection);
|
||||
result = Convert::Base64Encode(subsection);
|
||||
EXPECT_PRED2(
|
||||
[](std::string expect, std::string actual) { return expect == actual; }, result, "AQI=");
|
||||
EXPECT_TRUE(std::equal(subsection.begin(), subsection.end(), Base64Decode(result).begin()));
|
||||
EXPECT_TRUE(
|
||||
std::equal(subsection.begin(), subsection.end(), Convert::Base64Decode(result).begin()));
|
||||
|
||||
subsection = std::vector<uint8_t>(data.begin(), data.begin() + 3);
|
||||
result = Base64Encode(subsection);
|
||||
result = Convert::Base64Encode(subsection);
|
||||
EXPECT_PRED2(
|
||||
[](std::string expect, std::string actual) { return expect == actual; }, result, "AQID");
|
||||
EXPECT_TRUE(std::equal(subsection.begin(), subsection.end(), Base64Decode(result).begin()));
|
||||
EXPECT_TRUE(
|
||||
std::equal(subsection.begin(), subsection.end(), Convert::Base64Decode(result).begin()));
|
||||
|
||||
subsection = std::vector<uint8_t>(data.begin(), data.begin() + 4);
|
||||
result = Base64Encode(subsection);
|
||||
result = Convert::Base64Encode(subsection);
|
||||
EXPECT_PRED2(
|
||||
[](std::string expect, std::string actual) { return expect == actual; }, result, "AQIDBA==");
|
||||
EXPECT_TRUE(std::equal(subsection.begin(), subsection.end(), Base64Decode(result).begin()));
|
||||
EXPECT_TRUE(
|
||||
std::equal(subsection.begin(), subsection.end(), Convert::Base64Decode(result).begin()));
|
||||
|
||||
subsection = std::vector<uint8_t>(data.begin(), data.begin() + 5);
|
||||
result = Base64Encode(subsection);
|
||||
result = Convert::Base64Encode(subsection);
|
||||
EXPECT_PRED2(
|
||||
[](std::string expect, std::string actual) { return expect == actual; }, result, "AQIDBAU=");
|
||||
EXPECT_TRUE(std::equal(subsection.begin(), subsection.end(), Base64Decode(result).begin()));
|
||||
EXPECT_TRUE(
|
||||
std::equal(subsection.begin(), subsection.end(), Convert::Base64Decode(result).begin()));
|
||||
|
||||
subsection = std::vector<uint8_t>(data.begin(), data.begin() + 6);
|
||||
result = Base64Encode(subsection);
|
||||
result = Convert::Base64Encode(subsection);
|
||||
EXPECT_PRED2(
|
||||
[](std::string expect, std::string actual) { return expect == actual; }, result, "AQIDBAUG");
|
||||
EXPECT_TRUE(std::equal(subsection.begin(), subsection.end(), Base64Decode(result).begin()));
|
||||
EXPECT_TRUE(
|
||||
std::equal(subsection.begin(), subsection.end(), Convert::Base64Decode(result).begin()));
|
||||
}
|
||||
|
||||
static thread_local std::mt19937_64 random_generator(std::random_device{}());
|
||||
@ -108,6 +114,6 @@ TEST(Base64, Roundtrip)
|
||||
std::vector<uint8_t> data;
|
||||
data.resize(len);
|
||||
RandomBuffer(data.data(), data.size());
|
||||
EXPECT_EQ(Base64Decode(Base64Encode(data)), data);
|
||||
EXPECT_EQ(Convert::Base64Decode(Convert::Base64Encode(data)), data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,9 +65,10 @@ uint64_t RandomInt(uint64_t minNumber, uint64_t maxNumber)
|
||||
TEST(Md5Hash, Basic)
|
||||
{
|
||||
Md5Hash md5empty;
|
||||
EXPECT_EQ(Azure::Core::Base64Encode(md5empty.Final()), "1B2M2Y8AsgTpgAmY7PhCfg==");
|
||||
EXPECT_EQ(Azure::Core::Base64Encode(ComputeHash("")), "1B2M2Y8AsgTpgAmY7PhCfg==");
|
||||
EXPECT_EQ(Azure::Core::Base64Encode(ComputeHash("Hello Azure!")), "Pz8543xut4RVSbb2g52Mww==");
|
||||
EXPECT_EQ(Azure::Core::Convert::Base64Encode(md5empty.Final()), "1B2M2Y8AsgTpgAmY7PhCfg==");
|
||||
EXPECT_EQ(Azure::Core::Convert::Base64Encode(ComputeHash("")), "1B2M2Y8AsgTpgAmY7PhCfg==");
|
||||
EXPECT_EQ(
|
||||
Azure::Core::Convert::Base64Encode(ComputeHash("Hello Azure!")), "Pz8543xut4RVSbb2g52Mww==");
|
||||
|
||||
auto data = RandomBuffer(static_cast<std::size_t>(16777216));
|
||||
|
||||
@ -104,7 +105,8 @@ TEST(Md5Hash, ExpectThrow)
|
||||
EXPECT_THROW(instance.Append(nullptr, 1), std::invalid_argument);
|
||||
|
||||
EXPECT_EQ(
|
||||
Azure::Core::Base64Encode(instance.Final(ptr, data.length())), "1B2M2Y8AsgTpgAmY7PhCfg==");
|
||||
Azure::Core::Convert::Base64Encode(instance.Final(ptr, data.length())),
|
||||
"1B2M2Y8AsgTpgAmY7PhCfg==");
|
||||
EXPECT_THROW(instance.Final(), std::runtime_error);
|
||||
EXPECT_THROW(instance.Final(ptr, data.length()), std::runtime_error);
|
||||
EXPECT_THROW(instance.Append(ptr, data.length()), std::runtime_error);
|
||||
|
||||
@ -33,7 +33,7 @@ TEST(SimplifiedHeader, core)
|
||||
EXPECT_NO_THROW(Azure::Core::Context c);
|
||||
EXPECT_NO_THROW(Azure::DateTime(2020, 11, 03, 15, 30, 44));
|
||||
EXPECT_NO_THROW(Azure::ETag e);
|
||||
EXPECT_NO_THROW(Azure::Core::Base64Decode("foo"));
|
||||
EXPECT_NO_THROW(Azure::Core::Convert::Base64Decode("foo"));
|
||||
EXPECT_NO_THROW(Azure::Core::Cryptography::Md5Hash m);
|
||||
EXPECT_NO_THROW(Azure::Core::Http::RawResponse r(
|
||||
1, 1, Azure::Core::Http::HttpStatusCode::Accepted, "phrase"));
|
||||
|
||||
@ -4466,7 +4466,8 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
path.size() == 2 && path[0] == XmlTagName::k_Properties
|
||||
&& path[1] == XmlTagName::k_ContentMD5)
|
||||
{
|
||||
ret.Details.HttpHeaders.ContentHash.Value = Azure::Core::Base64Decode(node.Value);
|
||||
ret.Details.HttpHeaders.ContentHash.Value
|
||||
= Azure::Core::Convert::Base64Decode(node.Value);
|
||||
}
|
||||
else if (
|
||||
path.size() == 2 && path[0] == XmlTagName::k_Properties
|
||||
@ -4566,7 +4567,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
path.size() == 2 && path[0] == XmlTagName::k_Properties
|
||||
&& path[1] == XmlTagName::k_EncryptionKeySHA256)
|
||||
{
|
||||
ret.Details.EncryptionKeySha256 = Azure::Core::Base64Decode(node.Value);
|
||||
ret.Details.EncryptionKeySha256 = Azure::Core::Convert::Base64Decode(node.Value);
|
||||
}
|
||||
else if (
|
||||
path.size() == 2 && path[0] == XmlTagName::k_Properties
|
||||
@ -4868,7 +4869,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-encryption-key-sha256",
|
||||
Azure::Core::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
}
|
||||
if (options.EncryptionAlgorithm.HasValue())
|
||||
{
|
||||
@ -4934,7 +4935,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
ContentHash hash;
|
||||
hash.Algorithm = HashAlgorithm::Md5;
|
||||
hash.Value = Azure::Core::Base64Decode(content_md5_iterator->second);
|
||||
hash.Value = Azure::Core::Convert::Base64Decode(content_md5_iterator->second);
|
||||
response.TransactionalContentHash = std::move(hash);
|
||||
}
|
||||
auto x_ms_content_crc64_iterator = headers.find("x-ms-content-crc64");
|
||||
@ -4942,7 +4943,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
ContentHash hash;
|
||||
hash.Algorithm = HashAlgorithm::Crc64;
|
||||
hash.Value = Azure::Core::Base64Decode(x_ms_content_crc64_iterator->second);
|
||||
hash.Value = Azure::Core::Convert::Base64Decode(x_ms_content_crc64_iterator->second);
|
||||
response.TransactionalContentHash = std::move(hash);
|
||||
}
|
||||
}
|
||||
@ -5003,14 +5004,14 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
if (content_md5__iterator != httpResponse.GetHeaders().end())
|
||||
{
|
||||
response.Details.HttpHeaders.ContentHash.Value
|
||||
= Azure::Core::Base64Decode(content_md5__iterator->second);
|
||||
= Azure::Core::Convert::Base64Decode(content_md5__iterator->second);
|
||||
}
|
||||
auto x_ms_blob_content_md5__iterator
|
||||
= httpResponse.GetHeaders().find("x-ms-blob-content-md5");
|
||||
if (x_ms_blob_content_md5__iterator != httpResponse.GetHeaders().end())
|
||||
{
|
||||
response.Details.HttpHeaders.ContentHash.Value
|
||||
= Azure::Core::Base64Decode(x_ms_blob_content_md5__iterator->second);
|
||||
= Azure::Core::Convert::Base64Decode(x_ms_blob_content_md5__iterator->second);
|
||||
}
|
||||
auto content_disposition__iterator
|
||||
= httpResponse.GetHeaders().find("content-disposition");
|
||||
@ -5031,7 +5032,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
if (x_ms_encryption_key_sha256__iterator != httpResponse.GetHeaders().end())
|
||||
{
|
||||
response.Details.EncryptionKeySha256
|
||||
= Azure::Core::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
|
||||
= Azure::Core::Convert::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
|
||||
}
|
||||
auto x_ms_encryption_scope__iterator
|
||||
= httpResponse.GetHeaders().find("x-ms-encryption-scope");
|
||||
@ -5382,7 +5383,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-encryption-key-sha256",
|
||||
Azure::Core::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
}
|
||||
if (options.EncryptionAlgorithm.HasValue())
|
||||
{
|
||||
@ -5496,14 +5497,14 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
if (content_md5__iterator != httpResponse.GetHeaders().end())
|
||||
{
|
||||
response.HttpHeaders.ContentHash.Value
|
||||
= Azure::Core::Base64Decode(content_md5__iterator->second);
|
||||
= Azure::Core::Convert::Base64Decode(content_md5__iterator->second);
|
||||
}
|
||||
auto x_ms_blob_content_md5__iterator
|
||||
= httpResponse.GetHeaders().find("x-ms-blob-content-md5");
|
||||
if (x_ms_blob_content_md5__iterator != httpResponse.GetHeaders().end())
|
||||
{
|
||||
response.HttpHeaders.ContentHash.Value
|
||||
= Azure::Core::Base64Decode(x_ms_blob_content_md5__iterator->second);
|
||||
= Azure::Core::Convert::Base64Decode(x_ms_blob_content_md5__iterator->second);
|
||||
}
|
||||
auto content_disposition__iterator
|
||||
= httpResponse.GetHeaders().find("content-disposition");
|
||||
@ -5536,7 +5537,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
if (x_ms_encryption_key_sha256__iterator != httpResponse.GetHeaders().end())
|
||||
{
|
||||
response.EncryptionKeySha256
|
||||
= Azure::Core::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
|
||||
= Azure::Core::Convert::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
|
||||
}
|
||||
auto x_ms_encryption_scope__iterator
|
||||
= httpResponse.GetHeaders().find("x-ms-encryption-scope");
|
||||
@ -5720,11 +5721,11 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
request.SetHeader("x-ms-blob-cache-control", options.HttpHeaders.CacheControl);
|
||||
}
|
||||
if (!Azure::Core::Base64Encode(options.HttpHeaders.ContentHash.Value).empty())
|
||||
if (!Azure::Core::Convert::Base64Encode(options.HttpHeaders.ContentHash.Value).empty())
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-blob-content-md5",
|
||||
Azure::Core::Base64Encode(options.HttpHeaders.ContentHash.Value));
|
||||
Azure::Core::Convert::Base64Encode(options.HttpHeaders.ContentHash.Value));
|
||||
}
|
||||
if (!options.HttpHeaders.ContentDisposition.empty())
|
||||
{
|
||||
@ -5828,7 +5829,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-encryption-key-sha256",
|
||||
Azure::Core::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
}
|
||||
if (options.EncryptionAlgorithm.HasValue())
|
||||
{
|
||||
@ -6176,7 +6177,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-encryption-key-sha256",
|
||||
Azure::Core::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
}
|
||||
if (options.EncryptionAlgorithm.HasValue())
|
||||
{
|
||||
@ -6241,7 +6242,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
if (x_ms_encryption_key_sha256__iterator != httpResponse.GetHeaders().end())
|
||||
{
|
||||
response.EncryptionKeySha256
|
||||
= Azure::Core::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
|
||||
= Azure::Core::Convert::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
|
||||
}
|
||||
auto x_ms_encryption_scope__iterator
|
||||
= httpResponse.GetHeaders().find("x-ms-encryption-scope");
|
||||
@ -6917,7 +6918,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-encryption-key-sha256",
|
||||
Azure::Core::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
}
|
||||
if (options.EncryptionAlgorithm.HasValue())
|
||||
{
|
||||
@ -6934,13 +6935,15 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
request.SetHeader(
|
||||
"Content-MD5",
|
||||
Azure::Core::Base64Encode(options.TransactionalContentHash.GetValue().Value));
|
||||
Azure::Core::Convert::Base64Encode(
|
||||
options.TransactionalContentHash.GetValue().Value));
|
||||
}
|
||||
else if (options.TransactionalContentHash.GetValue().Algorithm == HashAlgorithm::Crc64)
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-content-crc64",
|
||||
Azure::Core::Base64Encode(options.TransactionalContentHash.GetValue().Value));
|
||||
Azure::Core::Convert::Base64Encode(
|
||||
options.TransactionalContentHash.GetValue().Value));
|
||||
}
|
||||
}
|
||||
if (!options.HttpHeaders.ContentType.empty())
|
||||
@ -6959,11 +6962,11 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
request.SetHeader("x-ms-blob-cache-control", options.HttpHeaders.CacheControl);
|
||||
}
|
||||
if (!Azure::Core::Base64Encode(options.HttpHeaders.ContentHash.Value).empty())
|
||||
if (!Azure::Core::Convert::Base64Encode(options.HttpHeaders.ContentHash.Value).empty())
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-blob-content-md5",
|
||||
Azure::Core::Base64Encode(options.HttpHeaders.ContentHash.Value));
|
||||
Azure::Core::Convert::Base64Encode(options.HttpHeaders.ContentHash.Value));
|
||||
}
|
||||
if (!options.HttpHeaders.ContentDisposition.empty())
|
||||
{
|
||||
@ -7029,7 +7032,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
ContentHash hash;
|
||||
hash.Algorithm = HashAlgorithm::Md5;
|
||||
hash.Value = Azure::Core::Base64Decode(content_md5_iterator->second);
|
||||
hash.Value = Azure::Core::Convert::Base64Decode(content_md5_iterator->second);
|
||||
response.TransactionalContentHash = std::move(hash);
|
||||
}
|
||||
auto x_ms_content_crc64_iterator = headers.find("x-ms-content-crc64");
|
||||
@ -7037,7 +7040,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
ContentHash hash;
|
||||
hash.Algorithm = HashAlgorithm::Crc64;
|
||||
hash.Value = Azure::Core::Base64Decode(x_ms_content_crc64_iterator->second);
|
||||
hash.Value = Azure::Core::Convert::Base64Decode(x_ms_content_crc64_iterator->second);
|
||||
response.TransactionalContentHash = std::move(hash);
|
||||
}
|
||||
}
|
||||
@ -7053,7 +7056,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
if (x_ms_encryption_key_sha256__iterator != httpResponse.GetHeaders().end())
|
||||
{
|
||||
response.EncryptionKeySha256
|
||||
= Azure::Core::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
|
||||
= Azure::Core::Convert::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
|
||||
}
|
||||
auto x_ms_encryption_scope__iterator
|
||||
= httpResponse.GetHeaders().find("x-ms-encryption-scope");
|
||||
@ -7103,13 +7106,15 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
request.SetHeader(
|
||||
"Content-MD5",
|
||||
Azure::Core::Base64Encode(options.TransactionalContentHash.GetValue().Value));
|
||||
Azure::Core::Convert::Base64Encode(
|
||||
options.TransactionalContentHash.GetValue().Value));
|
||||
}
|
||||
else if (options.TransactionalContentHash.GetValue().Algorithm == HashAlgorithm::Crc64)
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-content-crc64",
|
||||
Azure::Core::Base64Encode(options.TransactionalContentHash.GetValue().Value));
|
||||
Azure::Core::Convert::Base64Encode(
|
||||
options.TransactionalContentHash.GetValue().Value));
|
||||
}
|
||||
}
|
||||
if (options.LeaseId.HasValue())
|
||||
@ -7124,7 +7129,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-encryption-key-sha256",
|
||||
Azure::Core::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
}
|
||||
if (options.EncryptionAlgorithm.HasValue())
|
||||
{
|
||||
@ -7153,7 +7158,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
ContentHash hash;
|
||||
hash.Algorithm = HashAlgorithm::Md5;
|
||||
hash.Value = Azure::Core::Base64Decode(content_md5_iterator->second);
|
||||
hash.Value = Azure::Core::Convert::Base64Decode(content_md5_iterator->second);
|
||||
response.TransactionalContentHash = std::move(hash);
|
||||
}
|
||||
auto x_ms_content_crc64_iterator = headers.find("x-ms-content-crc64");
|
||||
@ -7161,7 +7166,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
ContentHash hash;
|
||||
hash.Algorithm = HashAlgorithm::Crc64;
|
||||
hash.Value = Azure::Core::Base64Decode(x_ms_content_crc64_iterator->second);
|
||||
hash.Value = Azure::Core::Convert::Base64Decode(x_ms_content_crc64_iterator->second);
|
||||
response.TransactionalContentHash = std::move(hash);
|
||||
}
|
||||
}
|
||||
@ -7172,7 +7177,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
if (x_ms_encryption_key_sha256__iterator != httpResponse.GetHeaders().end())
|
||||
{
|
||||
response.EncryptionKeySha256
|
||||
= Azure::Core::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
|
||||
= Azure::Core::Convert::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
|
||||
}
|
||||
auto x_ms_encryption_scope__iterator
|
||||
= httpResponse.GetHeaders().find("x-ms-encryption-scope");
|
||||
@ -7238,13 +7243,15 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-source-content-md5",
|
||||
Azure::Core::Base64Encode(options.TransactionalContentHash.GetValue().Value));
|
||||
Azure::Core::Convert::Base64Encode(
|
||||
options.TransactionalContentHash.GetValue().Value));
|
||||
}
|
||||
else if (options.TransactionalContentHash.GetValue().Algorithm == HashAlgorithm::Crc64)
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-source-content-crc64",
|
||||
Azure::Core::Base64Encode(options.TransactionalContentHash.GetValue().Value));
|
||||
Azure::Core::Convert::Base64Encode(
|
||||
options.TransactionalContentHash.GetValue().Value));
|
||||
}
|
||||
}
|
||||
if (options.LeaseId.HasValue())
|
||||
@ -7259,7 +7266,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-encryption-key-sha256",
|
||||
Azure::Core::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
}
|
||||
if (options.EncryptionAlgorithm.HasValue())
|
||||
{
|
||||
@ -7310,7 +7317,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
ContentHash hash;
|
||||
hash.Algorithm = HashAlgorithm::Md5;
|
||||
hash.Value = Azure::Core::Base64Decode(content_md5_iterator->second);
|
||||
hash.Value = Azure::Core::Convert::Base64Decode(content_md5_iterator->second);
|
||||
response.TransactionalContentHash = std::move(hash);
|
||||
}
|
||||
auto x_ms_content_crc64_iterator = headers.find("x-ms-content-crc64");
|
||||
@ -7318,7 +7325,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
ContentHash hash;
|
||||
hash.Algorithm = HashAlgorithm::Crc64;
|
||||
hash.Value = Azure::Core::Base64Decode(x_ms_content_crc64_iterator->second);
|
||||
hash.Value = Azure::Core::Convert::Base64Decode(x_ms_content_crc64_iterator->second);
|
||||
response.TransactionalContentHash = std::move(hash);
|
||||
}
|
||||
}
|
||||
@ -7329,7 +7336,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
if (x_ms_encryption_key_sha256__iterator != httpResponse.GetHeaders().end())
|
||||
{
|
||||
response.EncryptionKeySha256
|
||||
= Azure::Core::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
|
||||
= Azure::Core::Convert::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
|
||||
}
|
||||
auto x_ms_encryption_scope__iterator
|
||||
= httpResponse.GetHeaders().find("x-ms-encryption-scope");
|
||||
@ -7402,11 +7409,11 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
request.SetHeader("x-ms-blob-cache-control", options.HttpHeaders.CacheControl);
|
||||
}
|
||||
if (!Azure::Core::Base64Encode(options.HttpHeaders.ContentHash.Value).empty())
|
||||
if (!Azure::Core::Convert::Base64Encode(options.HttpHeaders.ContentHash.Value).empty())
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-blob-content-md5",
|
||||
Azure::Core::Base64Encode(options.HttpHeaders.ContentHash.Value));
|
||||
Azure::Core::Convert::Base64Encode(options.HttpHeaders.ContentHash.Value));
|
||||
}
|
||||
if (!options.HttpHeaders.ContentDisposition.empty())
|
||||
{
|
||||
@ -7429,7 +7436,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-encryption-key-sha256",
|
||||
Azure::Core::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
}
|
||||
if (options.EncryptionAlgorithm.HasValue())
|
||||
{
|
||||
@ -7495,7 +7502,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
if (x_ms_encryption_key_sha256__iterator != httpResponse.GetHeaders().end())
|
||||
{
|
||||
response.EncryptionKeySha256
|
||||
= Azure::Core::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
|
||||
= Azure::Core::Convert::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
|
||||
}
|
||||
auto x_ms_encryption_scope__iterator
|
||||
= httpResponse.GetHeaders().find("x-ms-encryption-scope");
|
||||
@ -7769,11 +7776,11 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
request.SetHeader("x-ms-blob-cache-control", options.HttpHeaders.CacheControl);
|
||||
}
|
||||
if (!Azure::Core::Base64Encode(options.HttpHeaders.ContentHash.Value).empty())
|
||||
if (!Azure::Core::Convert::Base64Encode(options.HttpHeaders.ContentHash.Value).empty())
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-blob-content-md5",
|
||||
Azure::Core::Base64Encode(options.HttpHeaders.ContentHash.Value));
|
||||
Azure::Core::Convert::Base64Encode(options.HttpHeaders.ContentHash.Value));
|
||||
}
|
||||
if (!options.HttpHeaders.ContentDisposition.empty())
|
||||
{
|
||||
@ -7807,7 +7814,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-encryption-key-sha256",
|
||||
Azure::Core::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
}
|
||||
if (options.EncryptionAlgorithm.HasValue())
|
||||
{
|
||||
@ -7869,7 +7876,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
if (x_ms_encryption_key_sha256__iterator != httpResponse.GetHeaders().end())
|
||||
{
|
||||
response.EncryptionKeySha256
|
||||
= Azure::Core::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
|
||||
= Azure::Core::Convert::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
|
||||
}
|
||||
auto x_ms_encryption_scope__iterator
|
||||
= httpResponse.GetHeaders().find("x-ms-encryption-scope");
|
||||
@ -7934,13 +7941,15 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
request.SetHeader(
|
||||
"Content-MD5",
|
||||
Azure::Core::Base64Encode(options.TransactionalContentHash.GetValue().Value));
|
||||
Azure::Core::Convert::Base64Encode(
|
||||
options.TransactionalContentHash.GetValue().Value));
|
||||
}
|
||||
else if (options.TransactionalContentHash.GetValue().Algorithm == HashAlgorithm::Crc64)
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-content-crc64",
|
||||
Azure::Core::Base64Encode(options.TransactionalContentHash.GetValue().Value));
|
||||
Azure::Core::Convert::Base64Encode(
|
||||
options.TransactionalContentHash.GetValue().Value));
|
||||
}
|
||||
}
|
||||
request.SetHeader("x-ms-page-write", "update");
|
||||
@ -7974,7 +7983,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-encryption-key-sha256",
|
||||
Azure::Core::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
}
|
||||
if (options.EncryptionAlgorithm.HasValue())
|
||||
{
|
||||
@ -8031,7 +8040,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
ContentHash hash;
|
||||
hash.Algorithm = HashAlgorithm::Md5;
|
||||
hash.Value = Azure::Core::Base64Decode(content_md5_iterator->second);
|
||||
hash.Value = Azure::Core::Convert::Base64Decode(content_md5_iterator->second);
|
||||
response.TransactionalContentHash = std::move(hash);
|
||||
}
|
||||
auto x_ms_content_crc64_iterator = headers.find("x-ms-content-crc64");
|
||||
@ -8039,7 +8048,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
ContentHash hash;
|
||||
hash.Algorithm = HashAlgorithm::Crc64;
|
||||
hash.Value = Azure::Core::Base64Decode(x_ms_content_crc64_iterator->second);
|
||||
hash.Value = Azure::Core::Convert::Base64Decode(x_ms_content_crc64_iterator->second);
|
||||
response.TransactionalContentHash = std::move(hash);
|
||||
}
|
||||
}
|
||||
@ -8052,7 +8061,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
if (x_ms_encryption_key_sha256__iterator != httpResponse.GetHeaders().end())
|
||||
{
|
||||
response.EncryptionKeySha256
|
||||
= Azure::Core::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
|
||||
= Azure::Core::Convert::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
|
||||
}
|
||||
auto x_ms_encryption_scope__iterator
|
||||
= httpResponse.GetHeaders().find("x-ms-encryption-scope");
|
||||
@ -8127,13 +8136,15 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-source-content-md5",
|
||||
Azure::Core::Base64Encode(options.TransactionalContentHash.GetValue().Value));
|
||||
Azure::Core::Convert::Base64Encode(
|
||||
options.TransactionalContentHash.GetValue().Value));
|
||||
}
|
||||
else if (options.TransactionalContentHash.GetValue().Algorithm == HashAlgorithm::Crc64)
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-source-content-crc64",
|
||||
Azure::Core::Base64Encode(options.TransactionalContentHash.GetValue().Value));
|
||||
Azure::Core::Convert::Base64Encode(
|
||||
options.TransactionalContentHash.GetValue().Value));
|
||||
}
|
||||
}
|
||||
request.SetHeader("x-ms-page-write", "update");
|
||||
@ -8167,7 +8178,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-encryption-key-sha256",
|
||||
Azure::Core::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
}
|
||||
if (options.EncryptionAlgorithm.HasValue())
|
||||
{
|
||||
@ -8224,7 +8235,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
ContentHash hash;
|
||||
hash.Algorithm = HashAlgorithm::Md5;
|
||||
hash.Value = Azure::Core::Base64Decode(content_md5_iterator->second);
|
||||
hash.Value = Azure::Core::Convert::Base64Decode(content_md5_iterator->second);
|
||||
response.TransactionalContentHash = std::move(hash);
|
||||
}
|
||||
auto x_ms_content_crc64_iterator = headers.find("x-ms-content-crc64");
|
||||
@ -8232,7 +8243,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
ContentHash hash;
|
||||
hash.Algorithm = HashAlgorithm::Crc64;
|
||||
hash.Value = Azure::Core::Base64Decode(x_ms_content_crc64_iterator->second);
|
||||
hash.Value = Azure::Core::Convert::Base64Decode(x_ms_content_crc64_iterator->second);
|
||||
response.TransactionalContentHash = std::move(hash);
|
||||
}
|
||||
}
|
||||
@ -8245,7 +8256,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
if (x_ms_encryption_key_sha256__iterator != httpResponse.GetHeaders().end())
|
||||
{
|
||||
response.EncryptionKeySha256
|
||||
= Azure::Core::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
|
||||
= Azure::Core::Convert::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
|
||||
}
|
||||
auto x_ms_encryption_scope__iterator
|
||||
= httpResponse.GetHeaders().find("x-ms-encryption-scope");
|
||||
@ -8332,7 +8343,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-encryption-key-sha256",
|
||||
Azure::Core::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
}
|
||||
if (options.EncryptionAlgorithm.HasValue())
|
||||
{
|
||||
@ -8454,7 +8465,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-encryption-key-sha256",
|
||||
Azure::Core::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
}
|
||||
if (options.EncryptionAlgorithm.HasValue())
|
||||
{
|
||||
@ -8925,11 +8936,11 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
request.SetHeader("x-ms-blob-cache-control", options.HttpHeaders.CacheControl);
|
||||
}
|
||||
if (!Azure::Core::Base64Encode(options.HttpHeaders.ContentHash.Value).empty())
|
||||
if (!Azure::Core::Convert::Base64Encode(options.HttpHeaders.ContentHash.Value).empty())
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-blob-content-md5",
|
||||
Azure::Core::Base64Encode(options.HttpHeaders.ContentHash.Value));
|
||||
Azure::Core::Convert::Base64Encode(options.HttpHeaders.ContentHash.Value));
|
||||
}
|
||||
if (!options.HttpHeaders.ContentDisposition.empty())
|
||||
{
|
||||
@ -8953,7 +8964,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-encryption-key-sha256",
|
||||
Azure::Core::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
}
|
||||
if (options.EncryptionAlgorithm.HasValue())
|
||||
{
|
||||
@ -9015,7 +9026,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
if (x_ms_encryption_key_sha256__iterator != httpResponse.GetHeaders().end())
|
||||
{
|
||||
response.EncryptionKeySha256
|
||||
= Azure::Core::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
|
||||
= Azure::Core::Convert::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
|
||||
}
|
||||
auto x_ms_encryption_scope__iterator
|
||||
= httpResponse.GetHeaders().find("x-ms-encryption-scope");
|
||||
@ -9069,13 +9080,15 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
request.SetHeader(
|
||||
"Content-MD5",
|
||||
Azure::Core::Base64Encode(options.TransactionalContentHash.GetValue().Value));
|
||||
Azure::Core::Convert::Base64Encode(
|
||||
options.TransactionalContentHash.GetValue().Value));
|
||||
}
|
||||
else if (options.TransactionalContentHash.GetValue().Algorithm == HashAlgorithm::Crc64)
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-content-crc64",
|
||||
Azure::Core::Base64Encode(options.TransactionalContentHash.GetValue().Value));
|
||||
Azure::Core::Convert::Base64Encode(
|
||||
options.TransactionalContentHash.GetValue().Value));
|
||||
}
|
||||
}
|
||||
if (options.LeaseId.HasValue())
|
||||
@ -9100,7 +9113,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-encryption-key-sha256",
|
||||
Azure::Core::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
}
|
||||
if (options.EncryptionAlgorithm.HasValue())
|
||||
{
|
||||
@ -9157,7 +9170,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
ContentHash hash;
|
||||
hash.Algorithm = HashAlgorithm::Md5;
|
||||
hash.Value = Azure::Core::Base64Decode(content_md5_iterator->second);
|
||||
hash.Value = Azure::Core::Convert::Base64Decode(content_md5_iterator->second);
|
||||
response.TransactionalContentHash = std::move(hash);
|
||||
}
|
||||
auto x_ms_content_crc64_iterator = headers.find("x-ms-content-crc64");
|
||||
@ -9165,7 +9178,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
ContentHash hash;
|
||||
hash.Algorithm = HashAlgorithm::Crc64;
|
||||
hash.Value = Azure::Core::Base64Decode(x_ms_content_crc64_iterator->second);
|
||||
hash.Value = Azure::Core::Convert::Base64Decode(x_ms_content_crc64_iterator->second);
|
||||
response.TransactionalContentHash = std::move(hash);
|
||||
}
|
||||
}
|
||||
@ -9180,7 +9193,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
if (x_ms_encryption_key_sha256__iterator != httpResponse.GetHeaders().end())
|
||||
{
|
||||
response.EncryptionKeySha256
|
||||
= Azure::Core::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
|
||||
= Azure::Core::Convert::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
|
||||
}
|
||||
auto x_ms_encryption_scope__iterator
|
||||
= httpResponse.GetHeaders().find("x-ms-encryption-scope");
|
||||
@ -9246,13 +9259,15 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-source-content-md5",
|
||||
Azure::Core::Base64Encode(options.TransactionalContentHash.GetValue().Value));
|
||||
Azure::Core::Convert::Base64Encode(
|
||||
options.TransactionalContentHash.GetValue().Value));
|
||||
}
|
||||
else if (options.TransactionalContentHash.GetValue().Algorithm == HashAlgorithm::Crc64)
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-source-content-crc64",
|
||||
Azure::Core::Base64Encode(options.TransactionalContentHash.GetValue().Value));
|
||||
Azure::Core::Convert::Base64Encode(
|
||||
options.TransactionalContentHash.GetValue().Value));
|
||||
}
|
||||
}
|
||||
if (options.LeaseId.HasValue())
|
||||
@ -9277,7 +9292,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
request.SetHeader(
|
||||
"x-ms-encryption-key-sha256",
|
||||
Azure::Core::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.GetValue()));
|
||||
}
|
||||
if (options.EncryptionAlgorithm.HasValue())
|
||||
{
|
||||
@ -9334,7 +9349,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
ContentHash hash;
|
||||
hash.Algorithm = HashAlgorithm::Md5;
|
||||
hash.Value = Azure::Core::Base64Decode(content_md5_iterator->second);
|
||||
hash.Value = Azure::Core::Convert::Base64Decode(content_md5_iterator->second);
|
||||
response.TransactionalContentHash = std::move(hash);
|
||||
}
|
||||
auto x_ms_content_crc64_iterator = headers.find("x-ms-content-crc64");
|
||||
@ -9342,7 +9357,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
ContentHash hash;
|
||||
hash.Algorithm = HashAlgorithm::Crc64;
|
||||
hash.Value = Azure::Core::Base64Decode(x_ms_content_crc64_iterator->second);
|
||||
hash.Value = Azure::Core::Convert::Base64Decode(x_ms_content_crc64_iterator->second);
|
||||
response.TransactionalContentHash = std::move(hash);
|
||||
}
|
||||
}
|
||||
@ -9357,7 +9372,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
if (x_ms_encryption_key_sha256__iterator != httpResponse.GetHeaders().end())
|
||||
{
|
||||
response.EncryptionKeySha256
|
||||
= Azure::Core::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
|
||||
= Azure::Core::Convert::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
|
||||
}
|
||||
auto x_ms_encryption_scope__iterator
|
||||
= httpResponse.GetHeaders().find("x-ms-encryption-scope");
|
||||
|
||||
@ -143,9 +143,9 @@ namespace Azure { namespace Storage { namespace Sas {
|
||||
+ snapshotVersion + "\n" + CacheControl + "\n" + ContentDisposition + "\n" + ContentEncoding
|
||||
+ "\n" + ContentLanguage + "\n" + ContentType;
|
||||
|
||||
std::string signature = Azure::Core::Base64Encode(Storage::_detail::HmacSha256(
|
||||
std::string signature = Azure::Core::Convert::Base64Encode(Storage::_detail::HmacSha256(
|
||||
std::vector<uint8_t>(stringToSign.begin(), stringToSign.end()),
|
||||
Azure::Core::Base64Decode(credential.GetAccountKey())));
|
||||
Azure::Core::Convert::Base64Decode(credential.GetAccountKey())));
|
||||
|
||||
Azure::Core::Url builder;
|
||||
builder.AppendQueryParameter(
|
||||
@ -244,9 +244,9 @@ namespace Azure { namespace Storage { namespace Sas {
|
||||
+ CacheControl + "\n" + ContentDisposition + "\n" + ContentEncoding + "\n" + ContentLanguage
|
||||
+ "\n" + ContentType;
|
||||
|
||||
std::string signature = Azure::Core::Base64Encode(Storage::_detail::HmacSha256(
|
||||
std::string signature = Azure::Core::Convert::Base64Encode(Storage::_detail::HmacSha256(
|
||||
std::vector<uint8_t>(stringToSign.begin(), stringToSign.end()),
|
||||
Azure::Core::Base64Decode(userDelegationKey.Value)));
|
||||
Azure::Core::Convert::Base64Decode(userDelegationKey.Value)));
|
||||
|
||||
Azure::Core::Url builder;
|
||||
builder.AppendQueryParameter(
|
||||
|
||||
@ -130,7 +130,8 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
constexpr std::size_t BlockIdLength = 64;
|
||||
std::string blockId = std::to_string(id);
|
||||
blockId = std::string(BlockIdLength - blockId.length(), '0') + blockId;
|
||||
return Azure::Core::Base64Encode(std::vector<uint8_t>(blockId.begin(), blockId.end()));
|
||||
return Azure::Core::Convert::Base64Encode(
|
||||
std::vector<uint8_t>(blockId.begin(), blockId.end()));
|
||||
};
|
||||
|
||||
auto uploadBlockFunc = [&](int64_t offset, int64_t length, int64_t chunkId, int64_t numChunks) {
|
||||
@ -192,7 +193,8 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
constexpr std::size_t BlockIdLength = 64;
|
||||
std::string blockId = std::to_string(id);
|
||||
blockId = std::string(BlockIdLength - blockId.length(), '0') + blockId;
|
||||
return Azure::Core::Base64Encode(std::vector<uint8_t>(blockId.begin(), blockId.end()));
|
||||
return Azure::Core::Convert::Base64Encode(
|
||||
std::vector<uint8_t>(blockId.begin(), blockId.end()));
|
||||
};
|
||||
|
||||
Storage::_detail::FileReader fileReader(fileName);
|
||||
|
||||
@ -553,7 +553,7 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
std::vector<uint8_t> aes256Key;
|
||||
aes256Key.resize(32);
|
||||
RandomBuffer(&aes256Key[0], aes256Key.size());
|
||||
key.Key = Azure::Core::Base64Encode(aes256Key);
|
||||
key.Key = Azure::Core::Convert::Base64Encode(aes256Key);
|
||||
key.KeyHash = _detail::Sha256(aes256Key);
|
||||
key.Algorithm = Blobs::Models::EncryptionAlgorithmType::Aes256;
|
||||
return key;
|
||||
|
||||
@ -263,7 +263,7 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
EXPECT_NO_THROW(pageBlobClient.UploadPages(0, &pageContent, options));
|
||||
|
||||
pageContent.Rewind();
|
||||
hash.Value = Azure::Core::Base64Decode(DummyMd5);
|
||||
hash.Value = Azure::Core::Convert::Base64Decode(DummyMd5);
|
||||
options.TransactionalContentHash = hash;
|
||||
EXPECT_THROW(pageBlobClient.UploadPages(0, &pageContent, options), StorageException);
|
||||
}
|
||||
@ -291,7 +291,7 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
EXPECT_NO_THROW(pageBlobClient.UploadPages(0, &pageContent, options));
|
||||
|
||||
pageContent.Rewind();
|
||||
hash.Value = Azure::Core::Base64Decode(DummyCrc64);
|
||||
hash.Value = Azure::Core::Convert::Base64Decode(DummyCrc64);
|
||||
options.TransactionalContentHash = hash;
|
||||
EXPECT_THROW(pageBlobClient.UploadPages(0, &pageContent, options), StorageException);
|
||||
}
|
||||
|
||||
@ -103,9 +103,9 @@ namespace Azure { namespace Storage { namespace Sas {
|
||||
+ (IPRange.HasValue() ? IPRange.GetValue() : "") + "\n" + protocol + "\n"
|
||||
+ Storage::_detail::DefaultSasVersion + "\n";
|
||||
|
||||
std::string signature = Azure::Core::Base64Encode(Storage::_detail::HmacSha256(
|
||||
std::string signature = Azure::Core::Convert::Base64Encode(Storage::_detail::HmacSha256(
|
||||
std::vector<uint8_t>(stringToSign.begin(), stringToSign.end()),
|
||||
Azure::Core::Base64Decode(credential.GetAccountKey())));
|
||||
Azure::Core::Convert::Base64Decode(credential.GetAccountKey())));
|
||||
|
||||
Azure::Core::Url builder;
|
||||
builder.AppendQueryParameter(
|
||||
|
||||
@ -81,8 +81,8 @@ namespace Azure { namespace Storage { namespace _detail {
|
||||
// remove last linebreak
|
||||
string_to_sign.pop_back();
|
||||
|
||||
return Azure::Core::Base64Encode(_detail::HmacSha256(
|
||||
return Azure::Core::Convert::Base64Encode(_detail::HmacSha256(
|
||||
std::vector<uint8_t>(string_to_sign.begin(), string_to_sign.end()),
|
||||
Azure::Core::Base64Decode(m_credential->GetAccountKey())));
|
||||
Azure::Core::Convert::Base64Decode(m_credential->GetAccountKey())));
|
||||
}
|
||||
}}} // namespace Azure::Storage::_detail
|
||||
|
||||
@ -9,13 +9,13 @@ namespace Azure { namespace Storage { namespace _detail {
|
||||
ContentHash FromBase64String(const std::string& base64String, HashAlgorithm algorithm)
|
||||
{
|
||||
ContentHash hash;
|
||||
hash.Value = Azure::Core::Base64Decode(base64String);
|
||||
hash.Value = Azure::Core::Convert::Base64Decode(base64String);
|
||||
hash.Algorithm = algorithm;
|
||||
return hash;
|
||||
}
|
||||
|
||||
std::string ToBase64String(const ContentHash& hash)
|
||||
{
|
||||
return Azure::Core::Base64Encode(hash.Value);
|
||||
return Azure::Core::Convert::Base64Encode(hash.Value);
|
||||
}
|
||||
}}} // namespace Azure::Storage::_detail
|
||||
|
||||
@ -18,10 +18,10 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
TEST(CryptFunctionsTest, Sha256)
|
||||
{
|
||||
EXPECT_EQ(
|
||||
Azure::Core::Base64Encode(_detail::Sha256(ToBinaryVector(""))),
|
||||
Azure::Core::Convert::Base64Encode(_detail::Sha256(ToBinaryVector(""))),
|
||||
"47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=");
|
||||
EXPECT_EQ(
|
||||
Azure::Core::Base64Encode(_detail::Sha256(ToBinaryVector("Hello Azure!"))),
|
||||
Azure::Core::Convert::Base64Encode(_detail::Sha256(ToBinaryVector("Hello Azure!"))),
|
||||
"Mjzwx2mqGHb9FSgjm33ShNmXYndkgvwA6tQmEiskOHg=");
|
||||
}
|
||||
|
||||
@ -30,10 +30,11 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
std::string key = "8CwtGFF1mGR4bPEP9eZ0x1fxKiQ3Ca5N";
|
||||
std::vector<uint8_t> binaryKey(key.begin(), key.end());
|
||||
EXPECT_EQ(
|
||||
Azure::Core::Base64Encode(_detail::HmacSha256(ToBinaryVector(""), binaryKey)),
|
||||
Azure::Core::Convert::Base64Encode(_detail::HmacSha256(ToBinaryVector(""), binaryKey)),
|
||||
"fFy2T+EuCvAgouw/vB/RAJ75z7jwTj+uiURebkFKF5M=");
|
||||
EXPECT_EQ(
|
||||
Azure::Core::Base64Encode(_detail::HmacSha256(ToBinaryVector("Hello Azure!"), binaryKey)),
|
||||
Azure::Core::Convert::Base64Encode(
|
||||
_detail::HmacSha256(ToBinaryVector("Hello Azure!"), binaryKey)),
|
||||
"+SBESxQVhI53mSEdZJcCBpdBkaqwzfPaVYZMAf5LP3c=");
|
||||
}
|
||||
|
||||
@ -47,10 +48,10 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
TEST(CryptFunctionsTest, Crc64Hash_Basic)
|
||||
{
|
||||
Crc64Hash crc64empty;
|
||||
EXPECT_EQ(Azure::Core::Base64Encode(crc64empty.Final()), "AAAAAAAAAAA=");
|
||||
EXPECT_EQ(Azure::Core::Convert::Base64Encode(crc64empty.Final()), "AAAAAAAAAAA=");
|
||||
|
||||
EXPECT_EQ(Azure::Core::Base64Encode(ComputeHash("")), "AAAAAAAAAAA=");
|
||||
EXPECT_EQ(Azure::Core::Base64Encode(ComputeHash("Hello Azure!")), "DtjZpL9/o8c=");
|
||||
EXPECT_EQ(Azure::Core::Convert::Base64Encode(ComputeHash("")), "AAAAAAAAAAA=");
|
||||
EXPECT_EQ(Azure::Core::Convert::Base64Encode(ComputeHash("Hello Azure!")), "DtjZpL9/o8c=");
|
||||
|
||||
auto data = RandomBuffer(static_cast<std::size_t>(16_MB));
|
||||
{
|
||||
@ -129,7 +130,8 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
EXPECT_THROW(instance.Final(nullptr, 1), std::invalid_argument);
|
||||
EXPECT_THROW(instance.Append(nullptr, 1), std::invalid_argument);
|
||||
|
||||
EXPECT_EQ(Azure::Core::Base64Encode(instance.Final(ptr, data.length())), "AAAAAAAAAAA=");
|
||||
EXPECT_EQ(
|
||||
Azure::Core::Convert::Base64Encode(instance.Final(ptr, data.length())), "AAAAAAAAAAA=");
|
||||
EXPECT_THROW(instance.Final(), std::runtime_error);
|
||||
EXPECT_THROW(instance.Final(ptr, data.length()), std::runtime_error);
|
||||
EXPECT_THROW(instance.Append(ptr, data.length()), std::runtime_error);
|
||||
|
||||
@ -86,7 +86,7 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
|
||||
inline std::string Base64EncodeText(const std::string& text)
|
||||
{
|
||||
return Azure::Core::Base64Encode(std::vector<uint8_t>(text.begin(), text.end()));
|
||||
return Azure::Core::Convert::Base64Encode(std::vector<uint8_t>(text.begin(), text.end()));
|
||||
}
|
||||
|
||||
}}} // namespace Azure::Storage::Test
|
||||
|
||||
@ -138,9 +138,9 @@ namespace Azure { namespace Storage { namespace Sas {
|
||||
+ "\n" + CacheControl + "\n" + ContentDisposition + "\n" + ContentEncoding + "\n"
|
||||
+ ContentLanguage + "\n" + ContentType;
|
||||
|
||||
std::string signature = Azure::Core::Base64Encode(Storage::_detail::HmacSha256(
|
||||
std::string signature = Azure::Core::Convert::Base64Encode(Storage::_detail::HmacSha256(
|
||||
std::vector<uint8_t>(stringToSign.begin(), stringToSign.end()),
|
||||
Azure::Core::Base64Decode(credential.GetAccountKey())));
|
||||
Azure::Core::Convert::Base64Decode(credential.GetAccountKey())));
|
||||
|
||||
Azure::Core::Url builder;
|
||||
builder.AppendQueryParameter(
|
||||
@ -228,9 +228,9 @@ namespace Azure { namespace Storage { namespace Sas {
|
||||
+ Storage::_detail::DefaultSasVersion + "\n" + resource + "\n" + "\n" + CacheControl + "\n"
|
||||
+ ContentDisposition + "\n" + ContentEncoding + "\n" + ContentLanguage + "\n" + ContentType;
|
||||
|
||||
std::string signature = Azure::Core::Base64Encode(Storage::_detail::HmacSha256(
|
||||
std::string signature = Azure::Core::Convert::Base64Encode(Storage::_detail::HmacSha256(
|
||||
std::vector<uint8_t>(stringToSign.begin(), stringToSign.end()),
|
||||
Azure::Core::Base64Decode(userDelegationKey.Value)));
|
||||
Azure::Core::Convert::Base64Decode(userDelegationKey.Value)));
|
||||
|
||||
Azure::Core::Url builder;
|
||||
builder.AppendQueryParameter(
|
||||
|
||||
@ -42,7 +42,8 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { nam
|
||||
{
|
||||
result.append(
|
||||
pair.first + "="
|
||||
+ Azure::Core::Base64Encode(std::vector<uint8_t>(pair.second.begin(), pair.second.end()))
|
||||
+ Azure::Core::Convert::Base64Encode(
|
||||
std::vector<uint8_t>(pair.second.begin(), pair.second.end()))
|
||||
+ ",");
|
||||
}
|
||||
if (!result.empty())
|
||||
|
||||
@ -98,9 +98,9 @@ namespace Azure { namespace Storage { namespace Sas {
|
||||
+ "\n" + protocol + "\n" + Storage::_detail::DefaultSasVersion + "\n" + CacheControl + "\n"
|
||||
+ ContentDisposition + "\n" + ContentEncoding + "\n" + ContentLanguage + "\n" + ContentType;
|
||||
|
||||
std::string signature = Azure::Core::Base64Encode(Storage::_detail::HmacSha256(
|
||||
std::string signature = Azure::Core::Convert::Base64Encode(Storage::_detail::HmacSha256(
|
||||
std::vector<uint8_t>(stringToSign.begin(), stringToSign.end()),
|
||||
Azure::Core::Base64Decode(credential.GetAccountKey())));
|
||||
Azure::Core::Convert::Base64Decode(credential.GetAccountKey())));
|
||||
|
||||
Azure::Core::Url builder;
|
||||
builder.AppendQueryParameter(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user