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

chore: use crypto-bigint instead of ursa #207

Closed

Conversation

berendsliedrecht
Copy link
Contributor

@berendsliedrecht berendsliedrecht commented May 17, 2023

closes #202
partially resolves #203

Signed-off-by: blu3beri <blu3beri@proton.me>
})?))
impl From<&str> for LinkSecret {
fn from(value: &str) -> Self {
Self(U256::from_be_hex(value))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will panic on bad input, which doesn't seem ideal. I've been decoding the hex to bytes and using U256::from_be_slice but crypto-bigint could use fallible methods for this.

@berendsliedrecht
Copy link
Contributor Author

@andrewwhitehead I have been running into some small issues between converting a U256 bigint to an ursa master secret.

Right now, I am doing quite a hacky way of serializing a link_secret, U256, into json and deserializing it into a master_secret, openssl bignum. Openssls bignum in JSON is represented as a decimal, but the U256 defaults to lower_le_hex.

Do you know of a way to fix this? There are some libraries which can convert between hex strings and decimal strings, which might be fine for now as this is a very temporary solution, but I might be missing some better conversion.

@andrewwhitehead
Copy link
Member

Added a PR for decimal support, although it might still need some changes: RustCrypto/crypto-bigint#246

@berendsliedrecht
Copy link
Contributor Author

@andrewwhitehead #237 makes this redundant, correct?

@andrewwhitehead
Copy link
Member

Yep I don't think it's needed.

@berendsliedrecht berendsliedrecht deleted the use-big-num branch August 21, 2023 16:33
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.

Zeroing the Link Secret
2 participants