Skip to content

Commit 426d0db

Browse files
authored
[KeyVault] - Cryptography client refactoring (Azure#14077)
## What This PR does a pure refactor of local cryptography from the existing implementation to provide some flexibility for upcoming AES algorithms and allow for a cleaner separation of concerns between local / remote providers. ## Why The existing implementation worked well but I hit a few bumps when trying to add support for AES algorithms which require different parameters crypto providers to conform to the same API our top-level clients do and allows for ease of extensibility when AES algorithms are added in the future. ## High level changes - Replaced the crypto algorithms with a crypto provider interface that supplies a common set of operations - Top level crypto client maintains a list of "providers" which are responsible for the crypto operations. Each provider isn't aware of other providers and the crypto client is responsible for sending the request to the right one. - Centralized validation to top-level client. Resolves Azure#14129
1 parent d11cd55 commit 426d0db

File tree

54 files changed

+8197
-2792
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+8197
-2792
lines changed

sdk/keyvault/keyvault-keys/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- Added `curve` to `createKeyOptions` to be used when creating an `EC` key.
77
- Deprecated the current `encrypt` and `decrypt` methods in favor of the more flexible overloads that take an `{Encrypt|Decrypt}Parameters` and allow passing in algorithm specific parameters. This enables support for the various AES algorithms used in Managed HSM. The deprecated methods continue to function and there's no timeline for their removal.
88
- Added `additionalAuthenticatedData`, `iv`, and `authenticationTag` to `EncryptResult` in order to support AES encryption and decryption.
9+
- Refactored the various cryptography providers and updated the error messages to be clearer and more descriptive.
910

1011
## 4.2.0-beta.3 (2021-02-09)
1112

sdk/keyvault/keyvault-keys/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
"browser": {
3737
"os": false,
3838
"process": false,
39-
"./dist-esm/keyvault-keys/src/localCryptography/algorithms.js": "./dist-esm/keyvault-keys/src/localCryptography/algorithms.browser.js",
40-
"./dist-esm/keyvault-keys/src/localCryptography/hash.js": "./dist-esm/keyvault-keys/src/localCryptography/hash.browser.js"
39+
"./dist-esm/keyvault-keys/src/cryptography/hash.js": "./dist-esm/keyvault-keys/src/cryptography/hash.browser.js",
40+
"./dist-esm/keyvault-keys/src/cryptography/rsaCryptographyProvider.js": "./dist-esm/keyvault-keys/src/cryptography/rsaCryptographyProvider.browser.js"
4141
},
4242
"scripts": {
4343
"audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit",

sdk/keyvault/keyvault-keys/recordings/node/cryptographyclient_all_decrypts_happen_remotely/recording_encrypt__decrypt_with_an_rsahsm_key_and_the_rsa1_5_algorithm.js

Lines changed: 301 additions & 109 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/keyvault/keyvault-keys/recordings/node/cryptographyclient_all_decrypts_happen_remotely/recording_encrypt__decrypt_with_an_rsahsm_key_and_the_rsaoaep_algorithm.js

Lines changed: 687 additions & 111 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/keyvault/keyvault-keys/recordings/node/cryptographyclient_all_decrypts_happen_remotely/recording_encrypt__decrypt_with_rsa1_5.js

Lines changed: 420 additions & 68 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/keyvault/keyvault-keys/recordings/node/cryptographyclient_all_decrypts_happen_remotely/recording_encrypt__decrypt_with_rsaoaep.js

Lines changed: 223 additions & 63 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/keyvault/keyvault-keys/recordings/node/cryptographyclient_all_decrypts_happen_remotely/recording_manually_encrypt_locally_and_decrypt_remotely_both_with_rsa1_5.js

Lines changed: 100 additions & 68 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/keyvault/keyvault-keys/recordings/node/cryptographyclient_all_decrypts_happen_remotely/recording_manually_encrypt_locally_and_decrypt_remotely_both_with_rsaoaep.js

Lines changed: 228 additions & 68 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)