Skip to content

Rust SDK: read AES-GCM name of top-level folder (KSM-1687) - #1332

Open
stas-schaller wants to merge 1 commit into
release/sdk/rust/v18.0.0from
feature/KSM-1687-rust-root-gcm
Open

stas-schaller wants to merge 1 commit into
release/sdk/rust/v18.0.0from
feature/KSM-1687-rust-root-gcm

Conversation

@stas-schaller

Copy link
Copy Markdown
Collaborator

Summary

Rust SDK: get_folders now reads the name of a top-level folder that is encrypted with AES-GCM and sets use_gcm to true on it. Before, the SDK read every top-level folder name as AES-CBC, so a GCM name came back empty.

Changes

Fixed

  • A top-level folder name now reads as AES-GCM first. The server zero-pads that value, so the new CryptoUtils::decrypt_aes_gcm_padded strips the trailing zeros and adds them back one at a time until the GCM tag authenticates (KSM-1687).
  • If the value does not authenticate, it reads as AES-CBC with the full value, as before. If it is neither, the folder is skipped and the call does not return an error. The SDK does not choose the cipher from the data length.
  • A value that authenticates as AES-GCM but is not valid JSON returns the folder with an empty name and use_gcm true.

Testing

cd sdk/rust && cargo test --test root_folder_gcm_tests

Breaking Changes

None.

Related Issues

get_folders read a top-level folder name as AES-CBC only, so a folder with an AES-GCM name came back with an empty name. Try zero-padded AES-GCM first, fall back to AES-CBC with the full value, and skip the folder when neither reads.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant