Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Key Vault] Add new encryption algorithms for 7.2-preview #16566

Merged
merged 28 commits into from
Feb 10, 2021
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8191ceb
Generate from latest swagger
mccoyp Feb 3, 2021
cff7cc7
Add new EncryptionAlgorithm values
mccoyp Feb 4, 2021
a4802fd
Add 7.2-preview enum value
mccoyp Feb 4, 2021
f85c322
Specify local-capable encrypt algs in crypto tests
mccoyp Feb 4, 2021
bd69135
Regenerate 7.2-preview without arm setting
mccoyp Feb 4, 2021
dc6b387
EncryptionAlgorithm and KeyWrapAlgorithm match .NET
mccoyp Feb 5, 2021
012961a
Add kwarg support for iv, tag, aad
mccoyp Feb 5, 2021
c275520
NotImplementedError -> ValueError in generated client
mccoyp Feb 5, 2021
d161861
Raise ValueError for incompatible parameters
mccoyp Feb 5, 2021
07e8191
optional arguments -> kwargs
mccoyp Feb 5, 2021
83e1f8b
wip; local crypto testing
mccoyp Feb 5, 2021
3e82b1a
Address feedback
mccoyp Feb 5, 2021
88c492a
Consolidate argument checks in helper
mccoyp Feb 5, 2021
6d63b71
Clean up argument validation
mccoyp Feb 5, 2021
cc29c95
Update async crypto client
mccoyp Feb 6, 2021
4860a26
Update tests, re-record
mccoyp Feb 6, 2021
b05acac
Share argument validation method between clients
mccoyp Feb 6, 2021
0fba28d
Record tests with URL missing trailing /
mccoyp Feb 6, 2021
79db935
Add async multiapi generated classes/update client base
mccoyp Feb 6, 2021
e7e94e7
Record tests with correct async API version
mccoyp Feb 6, 2021
cf6e9a2
Update administration recordings
mccoyp Feb 8, 2021
0f75c8d
Update async administration recordings
mccoyp Feb 9, 2021
8033832
Pop kwargs before initialization
mccoyp Feb 9, 2021
5ca469d
Add oct-HSM support
mccoyp Feb 9, 2021
2052aae
Test AES encryption and key wrapping algs
mccoyp Feb 9, 2021
553dfff
Module-level encrypt parameter validation tests
mccoyp Feb 9, 2021
741616d
Address feedback
mccoyp Feb 9, 2021
4fc96e7
bytes.fromhex -> codecs.decode
mccoyp Feb 9, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ class KeyType(str, Enum):
rsa = "RSA"
rsa_hsm = "RSA-HSM" #: RSA with a private key which is not exportable from the HSM
oct = "oct" #: Octet sequence (used to represent symmetric keys)
oct_hsm = "oct-HSM" #: Octet sequence with a private key which is not exportable from the HSM
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from typing import Any
from typing import TYPE_CHECKING

from azure.core.configuration import Configuration
from azure.core.pipeline import policies

from ._version import VERSION

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any

class KeyVaultClientConfiguration(Configuration):
"""Configuration for KeyVaultClient.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,20 @@
# regenerated.
# --------------------------------------------------------------------------

from azure.core import PipelineClient
from msrest import Serializer, Deserializer
from typing import TYPE_CHECKING

from azure.core import PipelineClient
from azure.profiles import KnownProfiles, ProfileDefinition
from azure.profiles.multiapiclient import MultiApiClientMixin
from msrest import Deserializer, Serializer

from ._configuration import KeyVaultClientConfiguration
from ._operations_mixin import KeyVaultClientOperationsMixin

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any, Optional

class _SDKClient(object):
def __init__(self, *args, **kwargs):
"""This is a fake class to support current implemetation of MultiApiClientMixin."
Expand All @@ -33,11 +40,10 @@ class KeyVaultClient(KeyVaultClientOperationsMixin, MultiApiClientMixin, _SDKCli
The profile sets a mapping between an operation group and its API version.
The api-version parameter sets the default API version if the operation
group is not described in the profile.
:param str api_version: API version to use if no profile is provided, or if
missing in profile.
:param api_version: API version to use if no profile is provided, or if missing in profile.
:type api_version: str
:param profile: A profile definition, from KnownProfiles to dict.
:type profile: azure.profiles.KnownProfiles
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
"""

DEFAULT_API_VERSION = '7.1'
Expand Down Expand Up @@ -110,14 +116,14 @@ class KeyVaultClient(KeyVaultClientOperationsMixin, MultiApiClientMixin, _SDKCli

def __init__(
self,
api_version=None,
profile=KnownProfiles.default,
api_version=None, # type: Optional[str]
profile=KnownProfiles.default, # type: KnownProfiles
**kwargs # type: Any
):
if api_version == '2016-10-01' or api_version == '7.0' or api_version == '7.1':
if api_version == '2016-10-01' or api_version == '7.0' or api_version == '7.1' or api_version == '7.2-preview':
base_url = '{vaultBaseUrl}'
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
raise ValueError("API version {} is not available".format(api_version))
self._config = KeyVaultClientConfiguration(**kwargs)
self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs)
super(KeyVaultClient, self).__init__(
Expand All @@ -136,6 +142,7 @@ def models(cls, api_version=DEFAULT_API_VERSION):
* 2016-10-01: :mod:`v2016_10_01.models<azure.keyvault.v2016_10_01.models>`
* 7.0: :mod:`v7_0.models<azure.keyvault.v7_0.models>`
* 7.1: :mod:`v7_1.models<azure.keyvault.v7_1.models>`
* 7.2-preview: :mod:`v7_2_preview.models<azure.keyvault.v7_2_preview.models>`
"""
if api_version == '2016-10-01':
from .v2016_10_01 import models
Expand All @@ -146,7 +153,10 @@ def models(cls, api_version=DEFAULT_API_VERSION):
elif api_version == '7.1':
from .v7_1 import models
return models
raise NotImplementedError("APIVersion {} is not available".format(api_version))
elif api_version == '7.2-preview':
from .v7_2_preview import models
return models
raise ValueError("API version {} is not available".format(api_version))

def close(self):
self._client.close()
Expand Down
Loading