Skip to content

Commit

Permalink
Fix: Set key helper key length to 32 bytes (#253)
Browse files Browse the repository at this point in the history
* Update pip version in the virtualenv

* Increase key length to 32 (256bits)

unnecessary call to base64 encode was also removed
  • Loading branch information
daniel-cit authored Dec 23, 2021
1 parent b8c357e commit 06b21ab
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 2 additions & 0 deletions helpers/wrapped-key/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ source kms_helper/bin/activate
### Install dependencies

```sh
pip install --upgrade pip

pip install -r requirements.txt
```

Expand Down
5 changes: 1 addition & 4 deletions helpers/wrapped-key/wrapped_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ def encrypt_symmetric(project_id, location_id, key_ring_id, key_id):
"""

# Generate random bytes
key = generate_random_bytes(project_id, location_id, 16)

# Encode key to b64
plaintext_bytes = base64.b64encode(key)
plaintext_bytes = generate_random_bytes(project_id, location_id, 32)

# Optional, but recommended: compute plaintext's CRC32C.
# See crc32c() function defined below.
Expand Down

0 comments on commit 06b21ab

Please sign in to comment.