|
2 | 2 | # Copyright (c) Microsoft Corporation. |
3 | 3 | # Licensed under the MIT License. |
4 | 4 | # ------------------------------------ |
| 5 | +from __future__ import annotations |
5 | 6 | from typing import Any, cast, Optional, NoReturn, Union, TYPE_CHECKING |
6 | 7 |
|
7 | 8 | from cryptography.exceptions import InvalidSignature |
@@ -308,6 +309,14 @@ def __eq__(self, other: object) -> bool: |
308 | 309 | return all(getattr(self._key, field) == getattr(other, field) for field in self._key._FIELDS) |
309 | 310 | return False |
310 | 311 |
|
| 312 | + def __copy__(self) -> KeyVaultRSAPublicKey: |
| 313 | + """Returns this instance since it is treated as immutable. |
| 314 | +
|
| 315 | + :returns: This instance. |
| 316 | + :rtype: ~azure.keyvault.keys.crypto.KeyVaultRSAPublicKey |
| 317 | + """ |
| 318 | + return self |
| 319 | + |
311 | 320 | def verifier( # pylint:disable=docstring-missing-param,docstring-missing-return,docstring-missing-rtype |
312 | 321 | self, signature: bytes, padding: AsymmetricPadding, algorithm: HashAlgorithm |
313 | 322 | ) -> NoReturn: |
@@ -482,6 +491,14 @@ def signer( # pylint:disable=docstring-missing-param,docstring-missing-return,d |
482 | 491 | """Not implemented. This method was deprecated in `cryptography` 2.0 and removed in 37.0.0.""" |
483 | 492 | raise NotImplementedError() |
484 | 493 |
|
| 494 | + def __copy__(self) -> KeyVaultRSAPrivateKey: |
| 495 | + """Returns this instance since it is treated as immutable. |
| 496 | +
|
| 497 | + :returns: This instance. |
| 498 | + :rtype: ~azure.keyvault.keys.crypto.KeyVaultRSAPrivateKey |
| 499 | + """ |
| 500 | + return self |
| 501 | + |
485 | 502 |
|
486 | 503 | class DecryptResult: |
487 | 504 | """The result of a decrypt operation. |
|
0 commit comments