Skip to content

Commit

Permalink
[Keyvault] az keyvault security-domain upload: Fix `password must b…
Browse files Browse the repository at this point in the history
…e bytes-like` for `--passwords` (#23187)

* `az keyvault security-domain upload`: Fix `password must be bytes-like` for `--passwords`

* linter
  • Loading branch information
evelyn-ys authored Jul 20, 2022
1 parent 75129a1 commit a931eff
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/azure-cli/azure/cli/command_modules/keyvault/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -2421,6 +2421,8 @@ def _security_domain_gen_share_arrays(sd_wrapping_keys, passwords, shared_keys,
with open(private_key_path, 'rb') as f:
pem_data = f.read()
password = passwords[private_key_index] if private_key_index < len(passwords) else None
if password and not isinstance(password, bytes):
password = password.encode(encoding="utf-8")
private_key = load_pem_private_key(pem_data, password=password, backend=default_backend())

with open(cert_path, 'rb') as f:
Expand Down

0 comments on commit a931eff

Please sign in to comment.