Removed the /internal/ directory in Keyvault Keys and move headers to private that don't need to be public. (#2625)

* Removed the /internal/ directory in Keyvault Keys and move headers to
private that don't need to be public.

* Clang format.

* Move CryptographyProvider and RCC into private headers as well.

* Fix clang formatting.
This commit is contained in:
Ahson Khan 2021-07-14 15:26:23 -07:00 committed by GitHub
parent c4ff48e8a5
commit 427e892582
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 56 additions and 44 deletions

View File

@ -41,11 +41,6 @@ set(
inc/azure/keyvault/keys/cryptography/wrap_result.hpp
inc/azure/keyvault/keys/cryptography/unwrap_result.hpp
inc/azure/keyvault/keys/cryptography/verify_result.hpp
inc/azure/keyvault/keys/internal/cryptography/cryptography_provider.hpp
inc/azure/keyvault/keys/internal/cryptography/local_cryptography_provider_factory.hpp
inc/azure/keyvault/keys/internal/cryptography/local_cryptography_provider.hpp
inc/azure/keyvault/keys/internal/cryptography/remote_cryptography_client.hpp
inc/azure/keyvault/keys/internal/cryptography/rsa_cryptography_provider.hpp
inc/azure/keyvault/keys/backup_key_result.hpp
inc/azure/keyvault/keys/delete_key_operation.hpp
inc/azure/keyvault/keys/deleted_key.hpp
@ -83,6 +78,7 @@ set(
src/cryptography/wrap_result.cpp
src/cryptography/unwrap_result.cpp
src/cryptography/verify_result.cpp
src/private/cryptography_provider.hpp
src/private/cryptography_serializers.hpp
src/private/key_backup.hpp
src/private/key_constants.hpp
@ -93,7 +89,11 @@ set(
src/private/key_wrap_parameters.hpp
src/private/keyvault_constants.hpp
src/private/keyvault_protocol.hpp
src/private/local_cryptography_provider.hpp
src/private/local_cryptography_provider_factory.hpp
src/private/package_version.hpp
src/private/remote_cryptography_client.hpp
src/private/rsa_cryptography_provider.hpp
src/delete_key_operation.cpp
src/deleted_key.cpp
src/import_key_options.cpp

View File

@ -11,18 +11,24 @@
#include "../src/private/keyvault_protocol.hpp"
#include <azure/core/context.hpp>
#include <azure/core/io/body_stream.hpp>
#include "azure/keyvault/keys/cryptography/cryptography_client_options.hpp"
#include "azure/keyvault/keys/cryptography/decrypt_parameters.hpp"
#include "azure/keyvault/keys/cryptography/decrypt_result.hpp"
#include "azure/keyvault/keys/cryptography/encrypt_parameters.hpp"
#include "azure/keyvault/keys/cryptography/encrypt_result.hpp"
#include "azure/keyvault/keys/cryptography/key_wrap_algorithm.hpp"
#include "azure/keyvault/keys/cryptography/sign_result.hpp"
#include "azure/keyvault/keys/cryptography/signature_algorithm.hpp"
#include "azure/keyvault/keys/cryptography/unwrap_result.hpp"
#include "azure/keyvault/keys/cryptography/verify_result.hpp"
#include "azure/keyvault/keys/cryptography/wrap_result.hpp"
#include "azure/keyvault/keys/internal/cryptography/cryptography_provider.hpp"
#include "azure/keyvault/keys/internal/cryptography/remote_cryptography_client.hpp"
#include <memory>
#include <string>
#include <vector>
namespace Azure {
namespace Security {
@ -30,6 +36,11 @@ namespace Azure {
namespace Keys {
namespace Cryptography {
namespace _detail {
struct CryptographyProvider;
struct RemoteCryptographyClient;
} // namespace _detail
/**
* @brief A client used to perform cryptographic operations with Azure Key Vault keys.
*
@ -52,18 +63,6 @@ namespace Azure {
void Initialize(std::string const& operation, Azure::Core::Context const& context);
/**
* @brief Provides a #CryptographyProvider that performs operations in the Key Vault Keys
* Server.
*
* @return A cryptographic client to perform operations on the server.
*/
std::shared_ptr<Azure::Security::KeyVault::Keys::Cryptography::_detail::CryptographyProvider>
RemoteClient() const
{
return m_remoteProvider;
}
/**
* @brief Gets whether this #CryptographyClient runs only local operations.
*
@ -89,6 +88,12 @@ namespace Azure {
{
}
/**
* @brief Destructs `%CryptographyClient`.
*
*/
~CryptographyClient();
/**
* @brief Encrypts plaintext.
*
@ -122,8 +127,8 @@ namespace Azure {
* @param key The key to encrypt.
* @param context A #Azure::Core::Context to cancel the operation.
* @return The result of the wrap operation. The returned #WrapResult contains the wrapped key
* along with all other information needed to unwrap it. This information should be stored with
* the wrapped key.
* along with all other information needed to unwrap it. This information should be stored
* with the wrapped key.
*/
WrapResult WrapKey(
KeyWrapAlgorithm algorithm,
@ -136,8 +141,8 @@ namespace Azure {
* @param algorithm The #KeyWrapAlgorithm to use.
* @param encryptedKey The encrypted key.
* @param context A #Azure::Core::Context to cancel the operation.
* @return The result of the unwrap operation. The returned #UnwrapResult contains the key along
* with information regarding the algorithm and key used to unwrap it.
* @return The result of the unwrap operation. The returned #UnwrapResult contains the key
* along with information regarding the algorithm and key used to unwrap it.
*/
UnwrapResult UnwrapKey(
KeyWrapAlgorithm algorithm,
@ -152,8 +157,8 @@ namespace Azure {
* must be compatable with the specified algorithm.
* @param context A #Azure::Core::Context to cancel the operation.
* @return The result of the sign operation. The returned #SignResult contains the signature
* along with all other information needed to verify it. This information should be stored with
* the signature.
* along with all other information needed to verify it. This information should be stored
* with the signature.
*/
SignResult Sign(
SignatureAlgorithm algorithm,
@ -167,8 +172,8 @@ namespace Azure {
* @param data The data to sign.
* @param context A #Azure::Core::Context to cancel the operation.
* @return The result of the sign operation. The returned #SignResult contains the signature
* along with all other information needed to verify it. This information should be stored with
* the signature.
* along with all other information needed to verify it. This information should be stored
* with the signature.
*/
SignResult SignData(
SignatureAlgorithm algorithm,
@ -182,8 +187,8 @@ namespace Azure {
* @param data The data to sign.
* @param context A #Azure::Core::Context to cancel the operation.
* @return The result of the sign operation. The returned #SignResult contains the signature
* along with all other information needed to verify it. This information should be stored with
* the signature.
* along with all other information needed to verify it. This information should be stored
* with the signature.
*/
SignResult SignData(
SignatureAlgorithm algorithm,
@ -193,8 +198,8 @@ namespace Azure {
/**
* @brief Verifies the specified signature.
*
* @param algorithm The #SignatureAlgorithm to use. This must be the same algorithm used to sign
* the digest.
* @param algorithm The #SignatureAlgorithm to use. This must be the same algorithm used to
* sign the digest.
* @param digest The pre-hashed digest corresponding to the signature. The hash algorithm used
* to compute the digest must be compatable with the specified algorithm.
* @param signature The signature to verify.
@ -211,8 +216,8 @@ namespace Azure {
/**
* @brief Verifies the specified signature.
*
* @param algorithm The #SignatureAlgorithm to use. This must be the same algorithm used to sign
* the data.
* @param algorithm The #SignatureAlgorithm to use. This must be the same algorithm used to
* sign the data.
* @param data The data corresponding to the signature.
* @param signature The signature to verify.
* @param context A #Azure::Core::Context to cancel the operation.
@ -228,8 +233,8 @@ namespace Azure {
/**
* @brief Verifies the specified signature.
*
* @param algorithm The #SignatureAlgorithm to use. This must be the same algorithm used to sign
* the data.
* @param algorithm The #SignatureAlgorithm to use. This must be the same algorithm used to
* sign the data.
* @param data The data corresponding to the signature.
* @param signature The signature to verify.
* @param context A #Azure::Core::Context to cancel the operation.

View File

@ -9,9 +9,12 @@
#include <azure/core/http/policies/policy.hpp>
#include "azure/keyvault/keys/cryptography/cryptography_client.hpp"
#include "azure/keyvault/keys/internal/cryptography/local_cryptography_provider_factory.hpp"
#include "azure/keyvault/keys/key_operation.hpp"
#include "../private/cryptography_provider.hpp"
#include "../private/local_cryptography_provider_factory.hpp"
#include "../private/remote_cryptography_client.hpp"
#include <memory>
#include <string>
#include <vector>
@ -51,6 +54,8 @@ inline std::vector<uint8_t> CreateDigest(
}
} // namespace
CryptographyClient::~CryptographyClient() = default;
void CryptographyClient::Initialize(std::string const&, Azure::Core::Context const& context)
{
if (m_provider != nullptr)

View File

@ -11,7 +11,7 @@
#include "../private/key_sign_parameters.hpp"
#include "../private/key_verify_parameters.hpp"
#include "../private/key_wrap_parameters.hpp"
#include "azure/keyvault/keys/internal/cryptography/remote_cryptography_client.hpp"
#include "../private/remote_cryptography_client.hpp"
#include <memory>
#include <string>

View File

@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: MIT
#include "azure/keyvault/keys/internal/cryptography/rsa_cryptography_provider.hpp"
#include "../private/rsa_cryptography_provider.hpp"
#include <memory>
#include <string>

View File

@ -9,7 +9,8 @@
#pragma once
#include "azure/keyvault/keys/internal/cryptography/cryptography_provider.hpp"
#include "cryptography_provider.hpp"
#include "azure/keyvault/keys/key_vault_key.hpp"
#include <memory>

View File

@ -9,10 +9,11 @@
#pragma once
#include "azure/keyvault/keys/internal/cryptography/cryptography_provider.hpp"
#include "azure/keyvault/keys/internal/cryptography/rsa_cryptography_provider.hpp"
#include "azure/keyvault/keys/key_vault_key.hpp"
#include "cryptography_provider.hpp"
#include "rsa_cryptography_provider.hpp"
#include <memory>
#include <string>

View File

@ -12,12 +12,12 @@
#include <azure/core/response.hpp>
#include <azure/core/url.hpp>
#include "../src/private/keyvault_protocol.hpp"
#include "cryptography_provider.hpp"
#include "keyvault_protocol.hpp"
#include "azure/keyvault/keys/cryptography/cryptography_client_options.hpp"
#include "azure/keyvault/keys/cryptography/encrypt_parameters.hpp"
#include "azure/keyvault/keys/cryptography/encrypt_result.hpp"
#include "azure/keyvault/keys/internal/cryptography/cryptography_provider.hpp"
#include "azure/keyvault/keys/key_vault_key.hpp"
#include <memory>

View File

@ -9,7 +9,7 @@
#pragma once
#include "azure/keyvault/keys/internal/cryptography/local_cryptography_provider.hpp"
#include "local_cryptography_provider.hpp"
#include <memory>
#include <string>