-
Notifications
You must be signed in to change notification settings - Fork 136
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
pkcs8: An easier way to pass in scrypt parameters? #1205
Comments
It's bad if OpenSSL can't support our defaults. I don't suppose you have a full repro code around? What version of OpenSSL are you using? If 3 doesn't support it we should probably consider degrading the parameters until it can. |
Thanks for the reply! Yep, I have a simple reproducer here: https://github.com/chenxiaolong/RustCrypto-formats-1205 I'm using the latest available openssl version on my Linux distro: EDIT: Just to rule out my distro's openssl version being the issue, I compiled |
Your repro works, and I've additionally confirmed I get the It seems like we should probably add a method to |
FYI, I'm working on a PR for this, should have it opened shortly |
Oof, just realized that #1195 is really needed to add an easy API. I can open a PR but it will be rebased on top of that and can't be merged until that's merged first (and it has breaking changes) |
Got it. Thanks for looking into this so quickly! |
just an FYI, I encountered the same incompatibility issue using PBKDF2. For example let pbes2_params =
pbes2::Parameters::pbkdf2_sha256_aes128cbc(Default::default(), &salt, &iv)?; |
Ugh, OpenSSL is why we can't have nice things |
Currently, when calling
RsaPrivateKey.to_pkcs8_encrypted_pem()
, it seems to use the scrypt crate's default parameters, which are: n=32768, r=8, p=1, len=32. Unfortunately, openssl can't load these files and fails with:Looking at openssl's manpage, it seems that they default to a lower
n
value:Currently, I'm able to match that and create openssl-compatible key files with:
pkcs8's defaults are more secure, so I don't think they should be changed, but could a more convenient API for specifying the parameters be added? (or does such a thing already exist?)
Thanks!
The text was updated successfully, but these errors were encountered: