Move the crytpo headers out of public/internal and into private folders within src. (#6119)
This commit is contained in:
parent
e7df815541
commit
22c52996f3
@ -46,8 +46,6 @@ set(
|
||||
inc/azure/data/tables/credentials/named_key_credential.hpp
|
||||
inc/azure/data/tables/dll_import_export.hpp
|
||||
inc/azure/data/tables/enum_operators.hpp
|
||||
inc/azure/data/tables/internal/cryptography/hmacsha256.hpp
|
||||
inc/azure/data/tables/internal/cryptography/url_encode.hpp
|
||||
inc/azure/data/tables/internal/policies/service_version_policy.hpp
|
||||
inc/azure/data/tables/internal/policies/shared_key_lite_policy.hpp
|
||||
inc/azure/data/tables/internal/policies/tenant_bearer_token_policy.hpp
|
||||
@ -70,6 +68,8 @@ set(
|
||||
src/policies/shared_key_lite_policy.cpp
|
||||
src/policies/tenant_bearer_token_policy.cpp
|
||||
src/policies/timeout_policy.cpp
|
||||
src/private/hmacsha256.hpp
|
||||
src/private/url_encode.hpp
|
||||
src/private/package_version.hpp
|
||||
src/serializers.cpp
|
||||
src/tables_clients.cpp
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
|
||||
#include "azure/data/tables/account_sas_builder.hpp"
|
||||
|
||||
#include "azure/data/tables/internal/cryptography/hmacsha256.hpp"
|
||||
#include "azure/data/tables/internal/cryptography/url_encode.hpp"
|
||||
#include "private/hmacsha256.hpp"
|
||||
#include "private/url_encode.hpp"
|
||||
|
||||
#include <azure/core/base64.hpp>
|
||||
#include <azure/core/http/http.hpp>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "azure/data/tables/internal/cryptography/hmacsha256.hpp"
|
||||
#include "../private/hmacsha256.hpp"
|
||||
|
||||
#include <azure/core/azure_assert.hpp>
|
||||
#include <azure/core/cryptography/hash.hpp>
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
#include "azure/data/tables/internal/policies/shared_key_lite_policy.hpp"
|
||||
|
||||
#include "azure/data/tables/internal/cryptography/hmacsha256.hpp"
|
||||
#include "../private/hmacsha256.hpp"
|
||||
|
||||
#include <azure/core/base64.hpp>
|
||||
#include <azure/core/cryptography/hash.hpp>
|
||||
|
||||
@ -1,21 +1,21 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <azure/core/azure_assert.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Azure { namespace Data { namespace Tables { namespace _detail { namespace Cryptography {
|
||||
class HmacSha256 final {
|
||||
public:
|
||||
static std::vector<uint8_t> Compute(
|
||||
const std::vector<uint8_t>& data,
|
||||
const std::vector<uint8_t>& key);
|
||||
};
|
||||
}}}}} // namespace Azure::Data::Tables::_detail::Cryptography
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <azure/core/azure_assert.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Azure { namespace Data { namespace Tables { namespace _detail { namespace Cryptography {
|
||||
class HmacSha256 final {
|
||||
public:
|
||||
static std::vector<uint8_t> Compute(
|
||||
const std::vector<uint8_t>& data,
|
||||
const std::vector<uint8_t>& key);
|
||||
};
|
||||
}}}}} // namespace Azure::Data::Tables::_detail::Cryptography
|
||||
@ -1,59 +1,59 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Azure { namespace Data { namespace Tables { namespace _detail { namespace Cryptography {
|
||||
|
||||
class UrlUtils final {
|
||||
public:
|
||||
static std::string UrlEncodeQueryParameter(const std::string& value)
|
||||
{
|
||||
const static std::string DoNotEncodeCharacters = []() {
|
||||
// Core::Url::Encode won't encode unreserved characters.
|
||||
std::string doNotEncodeCharacters = "!$&'()*+,;=";
|
||||
doNotEncodeCharacters += "/:@?";
|
||||
doNotEncodeCharacters.erase(
|
||||
std::remove_if(
|
||||
doNotEncodeCharacters.begin(),
|
||||
doNotEncodeCharacters.end(),
|
||||
[](char x) {
|
||||
// we also encode + and &
|
||||
// Surprisingly, '=' also needs to be encoded because Azure Storage server side is
|
||||
// so strict. We are applying this function to query key and value respectively,
|
||||
// so this won't affect that = used to separate key and query.
|
||||
return x == '+' || x == '=' || x == '&';
|
||||
}),
|
||||
doNotEncodeCharacters.end());
|
||||
return doNotEncodeCharacters;
|
||||
}();
|
||||
return Core::Url::Encode(value, DoNotEncodeCharacters);
|
||||
}
|
||||
|
||||
static std::string UrlEncodePath(const std::string& value)
|
||||
{
|
||||
const static std::string DoNotEncodeCharacters = []() {
|
||||
// Core::Url::Encode won't encode unreserved characters.
|
||||
std::string doNotEncodeCharacters = "!$&'()*+,;=";
|
||||
doNotEncodeCharacters += "/:@";
|
||||
doNotEncodeCharacters.erase(
|
||||
std::remove_if(
|
||||
doNotEncodeCharacters.begin(),
|
||||
doNotEncodeCharacters.end(),
|
||||
[](char x) {
|
||||
// we also encode +
|
||||
return x == '+';
|
||||
}),
|
||||
doNotEncodeCharacters.end());
|
||||
return doNotEncodeCharacters;
|
||||
}();
|
||||
return Core::Url::Encode(value, DoNotEncodeCharacters);
|
||||
}
|
||||
};
|
||||
}}}}} // namespace Azure::Data::Tables::_detail::Cryptography
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Azure { namespace Data { namespace Tables { namespace _detail { namespace Cryptography {
|
||||
|
||||
class UrlUtils final {
|
||||
public:
|
||||
static std::string UrlEncodeQueryParameter(const std::string& value)
|
||||
{
|
||||
const static std::string DoNotEncodeCharacters = []() {
|
||||
// Core::Url::Encode won't encode unreserved characters.
|
||||
std::string doNotEncodeCharacters = "!$&'()*+,;=";
|
||||
doNotEncodeCharacters += "/:@?";
|
||||
doNotEncodeCharacters.erase(
|
||||
std::remove_if(
|
||||
doNotEncodeCharacters.begin(),
|
||||
doNotEncodeCharacters.end(),
|
||||
[](char x) {
|
||||
// we also encode + and &
|
||||
// Surprisingly, '=' also needs to be encoded because Azure Storage server side is
|
||||
// so strict. We are applying this function to query key and value respectively,
|
||||
// so this won't affect that = used to separate key and query.
|
||||
return x == '+' || x == '=' || x == '&';
|
||||
}),
|
||||
doNotEncodeCharacters.end());
|
||||
return doNotEncodeCharacters;
|
||||
}();
|
||||
return Core::Url::Encode(value, DoNotEncodeCharacters);
|
||||
}
|
||||
|
||||
static std::string UrlEncodePath(const std::string& value)
|
||||
{
|
||||
const static std::string DoNotEncodeCharacters = []() {
|
||||
// Core::Url::Encode won't encode unreserved characters.
|
||||
std::string doNotEncodeCharacters = "!$&'()*+,;=";
|
||||
doNotEncodeCharacters += "/:@";
|
||||
doNotEncodeCharacters.erase(
|
||||
std::remove_if(
|
||||
doNotEncodeCharacters.begin(),
|
||||
doNotEncodeCharacters.end(),
|
||||
[](char x) {
|
||||
// we also encode +
|
||||
return x == '+';
|
||||
}),
|
||||
doNotEncodeCharacters.end());
|
||||
return doNotEncodeCharacters;
|
||||
}();
|
||||
return Core::Url::Encode(value, DoNotEncodeCharacters);
|
||||
}
|
||||
};
|
||||
}}}}} // namespace Azure::Data::Tables::_detail::Cryptography
|
||||
@ -3,8 +3,8 @@
|
||||
|
||||
#include "azure/data/tables/tables_sas_builder.hpp"
|
||||
|
||||
#include "azure/data/tables/internal/cryptography/hmacsha256.hpp"
|
||||
#include "azure/data/tables/internal/cryptography/url_encode.hpp"
|
||||
#include "private/hmacsha256.hpp"
|
||||
#include "private/url_encode.hpp"
|
||||
|
||||
#include <azure/core/base64.hpp>
|
||||
#include <azure/core/http/http.hpp>
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "../src/private/hmacsha256.hpp"
|
||||
#include "azure/data/tables/credentials/named_key_credential.hpp"
|
||||
#include "azure/data/tables/internal/cryptography/hmacsha256.hpp"
|
||||
#include "azure/data/tables/internal/policies/shared_key_lite_policy.hpp"
|
||||
|
||||
#include <azure/core/base64.hpp>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user