Skip to content

Commit be9bc2e

Browse files
author
Yalin Li
authored
[KeyVault Keys] Fix cspell errors (Azure#23250)
1 parent 6ab40ed commit be9bc2e

File tree

11 files changed

+45
-27
lines changed

11 files changed

+45
-27
lines changed

.vscode/cspell.json

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"sdk/identity/azure-identity/tests/pod-identity/**",
7575
"sdk/identity/azure-identity/tests/managed-identity-live/service-fabric/**",
7676
"sdk/keyvault/azure-keyvault-certificates/**",
77-
"sdk/keyvault/azure-keyvault-keys/**",
77+
"sdk/keyvault/azure-keyvault-keys/tests/keys.py",
7878
"sdk/mixedreality/azure-mixedreality-authentication/**",
7979
"sdk/modelsrepository/azure-iot-modelsrepository/**",
8080
"sdk/monitor/azure-monitor-opentelemetry-exporter/**",
@@ -119,14 +119,14 @@
119119
"aiohttp",
120120
"amqp",
121121
"apim",
122-
"Apim",
123122
"asyncio",
124123
"azcmagent",
125124
"azsdk",
126125
"azurecr",
127126
"azuremgmtcore",
128127
"azuremgmtcommunication",
129128
"bdist",
129+
"bstr",
130130
"byref",
131131
"cdll",
132132
"clientid",
@@ -141,13 +141,16 @@
141141
"ctypes",
142142
"dateutil",
143143
"ddos",
144+
"decryptor",
144145
"delenv",
145146
"dependened",
146147
"deserialization",
147148
"docfx",
148149
"dotenv",
149150
"DWORD",
150151
"eastus",
152+
"eckey",
153+
"encryptor",
151154
"engsys",
152155
"envname",
153156
"fileno",
@@ -169,9 +172,12 @@
169172
"inprogress",
170173
"ipconfiguration",
171174
"ipconfigurations",
175+
"iqmp",
172176
"iscoroutine",
173177
"iscsi",
174178
"ivar",
179+
"jwks",
180+
"keybak",
175181
"kube",
176182
"kubeconfig",
177183
"kubeconfigs",
@@ -181,6 +187,11 @@
181187
"livekvtestgetsecretperfsecret",
182188
"livekvtestlistperfsecret",
183189
"lmazuel",
190+
"livekvtest",
191+
"livekvtestdecryptperfkey",
192+
"livekvtestgetkeyperfkey",
193+
"livekvtestsignperfkey",
194+
"livekvtestunwrapperfkey",
184195
"logz",
185196
"LPCWSTR",
186197
"Lucene",
@@ -198,6 +209,7 @@
198209
"noarch",
199210
"northcentralus",
200211
"nspkg",
212+
"OAEP",
201213
"oauthlib",
202214
"objs",
203215
"odata",
@@ -226,11 +238,14 @@
226238
"revascularization",
227239
"riscv",
228240
"rollup",
241+
"RSNULL",
229242
"rtsp",
230243
"rtype",
231244
"scbedd",
232245
"sdist",
233246
"secbak",
247+
"SECG",
248+
"SECP",
234249
"setfacl",
235250
"signalr",
236251
"signup",
@@ -243,9 +258,11 @@
243258
"Teradata",
244259
"timegm",
245260
"toxenv",
261+
"tzname",
246262
"uamqp",
247263
"uksouth",
248264
"ukwest",
265+
"unpadder",
249266
"unredacted",
250267
"upserted",
251268
"urandom",
@@ -260,6 +277,7 @@
260277
"usgovtexas",
261278
"usgovvirginia",
262279
"utid",
280+
"Uvsc",
263281
"vcrpy",
264282
"verifysdist",
265283
"verifywhl",

sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def _get_exception_for_key_vault_error(cls, response):
2323
body = ContentDecodePolicy.deserialize_from_http_generics(response)
2424
message = "({}) {}".format(body["error"]["code"], body["error"]["message"]) # type: Optional[str]
2525
except (DecodeError, KeyError):
26-
# Key Vault error response bodies should have the expected shape and be deserializable.
26+
# Key Vault error response bodies should have the expected shape and be de-serializable.
2727
# If we somehow land here, we'll take HttpResponse's default message.
2828
message = None
2929

sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/http_challenge.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def __init__(self, request_uri, challenge, response_headers=None):
4141
raise ValueError("Invalid challenge parameters")
4242

4343
authorization_uri = self.get_authorization_server()
44-
# the authoritzation server URI should look something like https://login.windows.net/tenant-id
44+
# the authorization server URI should look something like https://login.windows.net/tenant-id
4545
uri_path = parse.urlparse(authorization_uri).path.lstrip("/")
4646
self.tenant_id = uri_path.split("/")[0] or None
4747

sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def _validate_arguments(operation, algorithm, **kwargs):
3232
"""Validates the arguments passed to perform an operation with a provided algorithm.
3333
3434
:param KeyOperation operation: the type of operation being requested
35-
:param EncyptionAlgorithm algorithm: the encryption algorithm to use for the operation
35+
:param EncryptionAlgorithm algorithm: the encryption algorithm to use for the operation
3636
:keyword bytes iv: initialization vector
3737
:keyword bytes authentication_tag: authentication tag returned from an encryption
3838
:keyword bytes additional_authenticated_data: data that is authenticated but not encrypted

sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/_internal/algorithms/aes_cbc_hmac.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ def __init__(self, key, iv, auth_data, auth_tag):
1919

2020
self._aes_key = key[: len(key) // 2]
2121
self._hmac_key = key[len(key) // 2 :]
22-
hash_algo = {256: hashes.SHA256(), 384: hashes.SHA384(), 512: hashes.SHA512()}[len(key) * 8]
22+
hash_algorithm = {256: hashes.SHA256(), 384: hashes.SHA384(), 512: hashes.SHA512()}[len(key) * 8]
2323

2424
self._cipher = Cipher(algorithms.AES(self._aes_key), modes.CBC(iv), backend=default_backend())
2525
self._tag = auth_tag or bytearray()
26-
self._hmac = hmac.HMAC(self._hmac_key, hash_algo, backend=default_backend())
26+
self._hmac = hmac.HMAC(self._hmac_key, hash_algorithm, backend=default_backend())
2727
self._auth_data_length = _int_to_fixed_length_bigendian_bytes(len(auth_data) * 8, 8)
2828

2929
# prime the hash

sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/_internal/ec_key.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
KeyCurveName.p_521: SECP521R1,
3535
"SECP256K1": SECP256K1, # "SECP256K1" is from Key Vault 2016-10-01
3636
}
37-
_curve_to_default_algo = {
37+
_curve_to_default_algorithm = {
3838
KeyCurveName.p_256: Es256.name(),
3939
KeyCurveName.p_256_k: Ecdsa256.name(),
4040
KeyCurveName.p_384: Es384.name(),
@@ -44,13 +44,13 @@
4444

4545

4646
class EllipticCurveKey(Key):
47-
_supported_signature_algorithms = frozenset(_curve_to_default_algo.values())
47+
_supported_signature_algorithms = frozenset(_curve_to_default_algorithm.values())
4848

4949
def __init__(self, x, y, d=None, kid=None, curve=None):
5050
super(EllipticCurveKey, self).__init__()
5151

5252
self._kid = kid or str(uuid.uuid4())
53-
self._default_algo = _curve_to_default_algo[curve]
53+
self._default_algorithm = _curve_to_default_algorithm[curve]
5454
curve_cls = _kv_crv_to_crypto_cls[curve]
5555

5656
public_numbers = EllipticCurvePublicNumbers(x, y, curve_cls())

sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/_key_validity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ def raise_if_time_invalid(not_before, expires_on):
3636
if not_before and not_before > now:
3737
raise ValueError("This client's key is not useable until {} (UTC)".format(not_before))
3838
if expires_on and expires_on <= now:
39-
raise ValueError("This client's key expires_onired at {} (UTC)".format(expires_on))
39+
raise ValueError("This client's key expired at {} (UTC)".format(expires_on))

sdk/keyvault/azure-keyvault-keys/tests/test_crypto_client.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def test_symmetric_encrypt_and_decrypt(self, key_client, **kwargs):
237237
assert imported_key is not None
238238
crypto_client = self.create_crypto_client(imported_key, api_version=key_client.api_version)
239239
# Use 256-bit AES algorithms for the 256-bit key
240-
symmetric_algorithms = [algo for algo in EncryptionAlgorithm if algo.startswith("A256")]
240+
symmetric_algorithms = [algorithm for algorithm in EncryptionAlgorithm if algorithm.startswith("A256")]
241241

242242
supports_nothing = mock.Mock(supports=mock.Mock(return_value=False))
243243
with mock.patch(crypto_client.__module__ + ".get_local_cryptography_provider", lambda *_: supports_nothing):
@@ -296,7 +296,7 @@ def test_encrypt_local(self, key_client, is_hsm, **kwargs):
296296
key = self._create_rsa_key(key_client, key_name, size=4096, hardware_protected=is_hsm)
297297
crypto_client = self.create_crypto_client(key, api_version=key_client.api_version)
298298

299-
rsa_encrypt_algorithms = [algo for algo in EncryptionAlgorithm if algo.startswith("RSA")]
299+
rsa_encrypt_algorithms = [algorithm for algorithm in EncryptionAlgorithm if algorithm.startswith("RSA")]
300300
for encrypt_algorithm in rsa_encrypt_algorithms:
301301
result = crypto_client.encrypt(encrypt_algorithm, self.plaintext)
302302
self.assertEqual(result.key_id, key.id)
@@ -313,7 +313,7 @@ def test_encrypt_local_from_jwk(self, key_client, is_hsm, **kwargs):
313313
crypto_client = self.create_crypto_client(key, api_version=key_client.api_version)
314314
local_client = CryptographyClient.from_jwk(key.key)
315315

316-
rsa_encrypt_algorithms = [algo for algo in EncryptionAlgorithm if algo.startswith("RSA")]
316+
rsa_encrypt_algorithms = [algorithm for algorithm in EncryptionAlgorithm if algorithm.startswith("RSA")]
317317
for encrypt_algorithm in rsa_encrypt_algorithms:
318318
result = local_client.encrypt(encrypt_algorithm, self.plaintext)
319319
self.assertEqual(result.key_id, key.id)
@@ -388,7 +388,7 @@ def test_wrap_local(self, key_client, is_hsm, **kwargs):
388388
key = self._create_rsa_key(key_client, key_name, size=4096, hardware_protected=is_hsm)
389389
crypto_client = self.create_crypto_client(key, api_version=key_client.api_version)
390390

391-
for wrap_algorithm in (algo for algo in KeyWrapAlgorithm if algo.startswith("RSA")):
391+
for wrap_algorithm in (algorithm for algorithm in KeyWrapAlgorithm if algorithm.startswith("RSA")):
392392
result = crypto_client.wrap_key(wrap_algorithm, self.plaintext)
393393
self.assertEqual(result.key_id, key.id)
394394

@@ -404,7 +404,7 @@ def test_wrap_local_from_jwk(self, key_client, is_hsm, **kwargs):
404404
crypto_client = self.create_crypto_client(key, api_version=key_client.api_version)
405405
local_client = CryptographyClient.from_jwk(key.key)
406406

407-
for wrap_algorithm in (algo for algo in KeyWrapAlgorithm if algo.startswith("RSA")):
407+
for wrap_algorithm in (algorithm for algorithm in KeyWrapAlgorithm if algorithm.startswith("RSA")):
408408
result = local_client.wrap_key(wrap_algorithm, self.plaintext)
409409
self.assertEqual(result.key_id, key.id)
410410

@@ -529,8 +529,8 @@ def test_operations(key, expected_error_substrings, encrypt_algorithms, wrap_alg
529529
# operations should not succeed with a key whose nbf is in the future
530530
the_year_3000 = datetime(3000, 1, 1, tzinfo=_UTC)
531531

532-
rsa_wrap_algorithms = [algo for algo in KeyWrapAlgorithm if algo.startswith("RSA")]
533-
rsa_encryption_algorithms = [algo for algo in EncryptionAlgorithm if algo.startswith("RSA")]
532+
rsa_wrap_algorithms = [algorithm for algorithm in KeyWrapAlgorithm if algorithm.startswith("RSA")]
533+
rsa_encryption_algorithms = [algorithm for algorithm in EncryptionAlgorithm if algorithm.startswith("RSA")]
534534
key_name = self.get_resource_name("rsa-not-yet-valid")
535535
not_yet_valid_key = self._create_rsa_key(
536536
key_client, key_name, not_before=the_year_3000, hardware_protected=is_hsm

sdk/keyvault/azure-keyvault-keys/tests/test_crypto_client_async.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ async def test_symmetric_encrypt_and_decrypt(self, key_client, **kwargs):
232232
assert imported_key is not None
233233
crypto_client = self.create_crypto_client(imported_key, is_async=True, api_version=key_client.api_version)
234234
# Use 256-bit AES algorithms for the 256-bit key
235-
symmetric_algorithms = [algo for algo in EncryptionAlgorithm if algo.startswith("A256")]
235+
symmetric_algorithms = [algorithm for algorithm in EncryptionAlgorithm if algorithm.startswith("A256")]
236236

237237
supports_nothing = mock.Mock(supports=mock.Mock(return_value=False))
238238
with mock.patch(crypto_client.__module__ + ".get_local_cryptography_provider", lambda *_: supports_nothing):
@@ -288,7 +288,7 @@ async def test_encrypt_local(self, key_client, is_hsm, **kwargs):
288288
key = await self._create_rsa_key(key_client, key_name, size=4096, hardware_protected=is_hsm)
289289
crypto_client = self.create_crypto_client(key, is_async=True, api_version=key_client.api_version)
290290

291-
rsa_encrypt_algorithms = [algo for algo in EncryptionAlgorithm if algo.startswith("RSA")]
291+
rsa_encrypt_algorithms = [algorithm for algorithm in EncryptionAlgorithm if algorithm.startswith("RSA")]
292292
for encrypt_algorithm in rsa_encrypt_algorithms:
293293
result = await crypto_client.encrypt(encrypt_algorithm, self.plaintext)
294294
self.assertEqual(result.key_id, key.id)
@@ -305,7 +305,7 @@ async def test_encrypt_local_from_jwk(self, key_client, is_hsm, **kwargs):
305305
crypto_client = self.create_crypto_client(key, is_async=True, api_version=key_client.api_version)
306306
local_client = CryptographyClient.from_jwk(key.key)
307307

308-
rsa_encrypt_algorithms = [algo for algo in EncryptionAlgorithm if algo.startswith("RSA")]
308+
rsa_encrypt_algorithms = [algorithm for algorithm in EncryptionAlgorithm if algorithm.startswith("RSA")]
309309
for encrypt_algorithm in rsa_encrypt_algorithms:
310310
result = await local_client.encrypt(encrypt_algorithm, self.plaintext)
311311
self.assertEqual(result.key_id, key.id)
@@ -380,7 +380,7 @@ async def test_wrap_local(self, key_client, is_hsm, **kwargs):
380380
key = await self._create_rsa_key(key_client, key_name, size=4096, hardware_protected=is_hsm)
381381
crypto_client = self.create_crypto_client(key, is_async=True, api_version=key_client.api_version)
382382

383-
for wrap_algorithm in (algo for algo in KeyWrapAlgorithm if algo.startswith("RSA")):
383+
for wrap_algorithm in (algorithm for algorithm in KeyWrapAlgorithm if algorithm.startswith("RSA")):
384384
result = await crypto_client.wrap_key(wrap_algorithm, self.plaintext)
385385
self.assertEqual(result.key_id, key.id)
386386

@@ -396,7 +396,7 @@ async def test_wrap_local_from_jwk(self, key_client, is_hsm, **kwargs):
396396
crypto_client = self.create_crypto_client(key, is_async=True, api_version=key_client.api_version)
397397
local_client = CryptographyClient.from_jwk(key.key)
398398

399-
for wrap_algorithm in (algo for algo in KeyWrapAlgorithm if algo.startswith("RSA")):
399+
for wrap_algorithm in (algorithm for algorithm in KeyWrapAlgorithm if algorithm.startswith("RSA")):
400400
result = await local_client.wrap_key(wrap_algorithm, self.plaintext)
401401
self.assertEqual(result.key_id, key.id)
402402

@@ -521,8 +521,8 @@ async def test_operations(key, expected_error_substrings, encrypt_algorithms, wr
521521
# operations should not succeed with a key whose nbf is in the future
522522
the_year_3000 = datetime(3000, 1, 1, tzinfo=_UTC)
523523

524-
rsa_wrap_algorithms = [algo for algo in KeyWrapAlgorithm if algo.startswith("RSA")]
525-
rsa_encryption_algorithms = [algo for algo in EncryptionAlgorithm if algo.startswith("RSA")]
524+
rsa_wrap_algorithms = [algorithm for algorithm in KeyWrapAlgorithm if algorithm.startswith("RSA")]
525+
rsa_encryption_algorithms = [algorithm for algorithm in EncryptionAlgorithm if algorithm.startswith("RSA")]
526526
key_name = self.get_resource_name("rsa-not-yet-valid")
527527
not_yet_valid_key = await self._create_rsa_key(
528528
key_client, key_name, not_before=the_year_3000, hardware_protected=is_hsm

sdk/keyvault/azure-keyvault-keys/tests/test_key_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ def test_get_cryptography_client(self, client, is_hsm, **kwargs):
674674
assert "RSA-OAEP" == result.algorithm
675675
assert plaintext == result.plaintext
676676

677-
# try ommitting the key version
677+
# try omitting the key version
678678
crypto_client = client.get_cryptography_client(key_name)
679679
# both clients should use the same generated client
680680
assert client._client == crypto_client._client

0 commit comments

Comments
 (0)