Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
5c789c6
Initial implementation
laiapat Sep 8, 2023
18b742a
cspell
laiapat Sep 8, 2023
56cf5de
pylint
laiapat Sep 8, 2023
ccc3686
Update import source
laiapat Sep 8, 2023
96c04a8
Remove kwargs
laiapat Sep 11, 2023
af15d76
Integrate public alg/mgf properties
laiapat Sep 12, 2023
f2eaee6
Update class name, imports
laiapat Sep 12, 2023
1b32b3d
Add decryption test
laiapat Sep 12, 2023
cff56f6
Clean up local crypto tests
laiapat Sep 12, 2023
feb27f7
Rename key type
laiapat Sep 12, 2023
492eb3a
Create key with CryptographyClient method
laiapat Sep 14, 2023
fc9e24e
Change key_size impl
laiapat Sep 14, 2023
e60de24
Implement private_numbers
laiapat Sep 14, 2023
05d4315
pylint; mypy; remove key_id param
laiapat Sep 14, 2023
d3a95ba
Update test
laiapat Sep 14, 2023
ca5e6c5
Add unimplemented signer method from mindep
laiapat Sep 14, 2023
6b6881d
Pylint
laiapat Sep 14, 2023
d8a526d
Add empty impl of RSAPublicKey
laiapat Sep 14, 2023
b205306
Initial impl of public key
laiapat Sep 15, 2023
131e1d2
Add signing test
laiapat Sep 16, 2023
3761dbc
Docstrings; more tests
laiapat Sep 25, 2023
3b50b96
Update changelog
laiapat Sep 26, 2023
98fa2f4
Test impls against cryptography's
laiapat Oct 3, 2023
74aaed1
Use crypto impls for non-KV operations
laiapat Oct 5, 2023
a008d79
Add synchronous limitation disclaimer
laiapat Oct 5, 2023
27ac6e1
Merge branch 'main' into kv-rsaprivatekey
laiapat Oct 5, 2023
841ba43
cspell; pylint; synchronize recordings
laiapat Oct 5, 2023
7179bfb
Raise 'private_bytes'-specific error
laiapat Oct 5, 2023
7cac601
Reliably get private key size
laiapat Oct 10, 2023
dc81307
Update changelog for release
laiapat Oct 11, 2023
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
3 changes: 2 additions & 1 deletion .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,8 @@
{
"filename": "sdk/keyvault/**",
"words": [
"eddsa"
"eddsa",
"Thawte"
]
},
{
Expand Down
12 changes: 5 additions & 7 deletions sdk/keyvault/azure-keyvault-keys/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# Release History

## 4.9.0b2 (Unreleased)
## 4.9.0b2 (2023-10-12)

### Features Added

### Breaking Changes

### Bugs Fixed

### Other Changes
- The `cryptography` library's `RSAPrivateKey` and `RSAPublicKey` interfaces are now implemented by
`KeyVaultRSAPrivateKey` and `KeyVaultRSAPublicKey` classes that can use keys managed by Key Vault
- `CryptographyClient` has `create_rsa_private_key` and `create_rsa_public_key` methods that return a
`KeyVaultRSAPrivateKey` and `KeyVaultRSAPublicKey`, respectively

## 4.9.0b1 (2023-05-16)

Expand Down
2 changes: 1 addition & 1 deletion sdk/keyvault/azure-keyvault-keys/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "python",
"TagPrefix": "python/keyvault/azure-keyvault-keys",
"Tag": "python/keyvault/azure-keyvault-keys_28b4323b48"
"Tag": "python/keyvault/azure-keyvault-keys_8ef3422a55"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from ._models import DecryptResult, EncryptResult, SignResult, WrapResult, VerifyResult, UnwrapResult
from ._models import (
DecryptResult,
EncryptResult,
KeyVaultRSAPrivateKey,
KeyVaultRSAPublicKey,
SignResult,
WrapResult,
VerifyResult,
UnwrapResult,
)
from ._enums import EncryptionAlgorithm, KeyWrapAlgorithm, SignatureAlgorithm
from ._client import CryptographyClient

Expand All @@ -12,6 +21,8 @@
"DecryptResult",
"EncryptionAlgorithm",
"EncryptResult",
"KeyVaultRSAPrivateKey",
"KeyVaultRSAPublicKey",
"KeyWrapAlgorithm",
"SignatureAlgorithm",
"SignResult",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from . import DecryptResult, EncryptionAlgorithm, EncryptResult, SignResult, VerifyResult, UnwrapResult, WrapResult
from ._key_validity import raise_if_time_invalid
from ._models import KeyVaultRSAPrivateKey, KeyVaultRSAPublicKey
from ._providers import get_local_cryptography_provider, NoLocalCryptography
from .. import KeyOperation
from .._models import JsonWebKey, KeyVaultKey
Expand Down Expand Up @@ -211,6 +212,30 @@ def _initialize(self, **kwargs) -> None:
# try to get the key again next time unless we know we're forbidden to do so
self._initialized = self._keys_get_forbidden

@distributed_trace
def create_rsa_private_key(self) -> KeyVaultRSAPrivateKey: # pylint:disable=client-method-missing-kwargs
"""Create an `RSAPrivateKey` implementation backed by this `CryptographyClient`, as a `KeyVaultRSAPrivateKey`.

The `CryptographyClient` will attempt to download the key, if it hasn't been already, as part of this operation.

:returns: A `KeyVaultRSAPrivateKey`, which implements `cryptography`'s `RSAPrivateKey` interface.
:rtype: :class:`~azure.keyvault.keys.crypto.KeyVaultRSAPrivateKey`
"""
self._initialize()
return KeyVaultRSAPrivateKey(client=self, key_material=cast(JsonWebKey, self._key))

@distributed_trace
def create_rsa_public_key(self) -> KeyVaultRSAPublicKey: # pylint:disable=client-method-missing-kwargs
"""Create an `RSAPublicKey` implementation backed by this `CryptographyClient`, as a `KeyVaultRSAPublicKey`.

The `CryptographyClient` will attempt to download the key, if it hasn't been already, as part of this operation.

:returns: A `KeyVaultRSAPublicKey`, which implements `cryptography`'s `RSAPublicKey` interface.
:rtype: :class:`~azure.keyvault.keys.crypto.KeyVaultRSAPublicKey`
"""
self._initialize()
return KeyVaultRSAPublicKey(client=self, key_material=cast(JsonWebKey, self._key))

@distributed_trace
def encrypt(self, algorithm: "EncryptionAlgorithm", plaintext: bytes, **kwargs) -> EncryptResult:
"""Encrypt bytes using the client's key.
Expand Down
Loading