-
Notifications
You must be signed in to change notification settings - Fork 230
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
NSS keydb #6548
NSS keydb #6548
Conversation
e838172
to
abcd64b
Compare
b4f3904
to
2c0fea2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems good to me. I'm mildly concerned about some of the unwrapping/panicing, but this is really your call. I do think you should wait a few days to let Ben have a look if possible and he has time, but I'm +1 on this.
@mhammond , thanks for the review! I think you have raised important points here, I will think again in detail about the error handling. I have mostly imitated the behavior of @bendk , please wait a bit until I have incorporated Mark's feedback. |
6d6ff7c
to
8ba136e
Compare
I have now revised the implementation. The new method |
btw I added the once_cell dependency because we already use it heavily throughout AS. Do I have to take any additional steps here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great from my POV as well, I just had one documentation request.
aac3e37
to
62ee9c4
Compare
This adds a feature `keydb` to rc_crypto's nss create, which enables the `ensure_initialized_with_profile_dir` initialize function. This configures NSS to use a profile and persist keys into key4.db. Also adding methods for managing AES256 keys with NSS: * `authentication_with_primary_password_is_needed`: check wheather primary password is enabled * `authenticate_with_primary_password`: authenticate with primary password against NSS key database * `get_or_create_aes256_key`: retrieve a key from key4.db or, if not present, create one
Add NSS functionality for key management, enabled via feature flag.
New feature flag
keydb
inrc_crypto/nss
, which enables NSS key persistence:ensure_initialized_with_profile_dir(path: impl AsRef<Path>)
initializes NSS with a profile directory and appropriate flags to persist keys (and certificates) in its internal PKCS11 software implementation.New methods for dealing with primary password and key persistence, available within the
keydb
feature:authorization_with_primary_password_is_needed()
: checks weather a primary password is set and needs to be authorizedauthorize_with_primary_password(primary_password: &str)
: method for authorizing NSS key store against a user-provided primary passwordget_or_create_aes256_key(name: &str)
: retrieve a key byname
from the internal NSS key store. If none exists, create one, persist, and return.Pull Request checklist
[ci full]
to the PR title.Branch builds: add
[firefox-android: branch-name]
to the PR title.