Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error handling in crypto box #213

Closed
angellllk opened this issue Jan 9, 2024 · 0 comments · Fixed by #217
Closed

Error handling in crypto box #213

angellllk opened this issue Jan 9, 2024 · 0 comments · Fixed by #217
Assignees

Comments

@angellllk
Copy link

Hi. I'm submitting this issue in regard to crypto_box_seal_open. Passing a [u8], with length less than 32 as ciphertext, results in a panic (range end index 32 out of range for slice).

let ephem_pk = X25519KeyPair::from_public_bytes(&ciphertext[..CBOX_KEY_LENGTH])?;

It should be checked if the array has the correct length, as it is checked in crypto_box_open:

if buf_len < CBOX_TAG_LENGTH {
        return Err(err_msg!(Encryption, "Invalid size for encrypted data"));
}
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 a pull request may close this issue.

2 participants