-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add support for Windows Hello (Quick Unlock) #7384
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #7384 +/- ##
===========================================
- Coverage 64.33% 64.30% -0.03%
===========================================
Files 339 339
Lines 43215 43364 +149
===========================================
+ Hits 27800 27881 +81
- Misses 15415 15483 +68 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
64592e1
to
39b44f3
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.
Few notes:
-
I suggest unifying procedures which generate the signature of challenge and derivative the encryption key from the signature into single function.
-
Implementation assumes the signature is not randomized (RSA PCKS#1 v1.5/2.0) i.e. deterministic which is the case at the moment. This can change in the future implementations of WindowsHello.
This WindowsHello implementation doesn't permanently store the encrypted master key as #6029, is there any future plan to support this? |
39b44f3
to
6859fd4
Compare
@HexF I incorporated your WIndows Hello implementation, and it works 100% (I had to make one tweak, don't use QByteArray::fromRawData since that requires the source data to persist). Thank you so much for your work and contributing RIGHT ON TIME. You have been appropriately attributed for your contribution. Another benefit to your implementation is that it does not require a Windows Hello authentication on initial unlock. I think this is because NCryptEncrypt is using DPAPI in the backend. Canceling the Windows Hello prompt disallows authentication and resets the stored key. |
The reason for not getting WH dialog is probably because the existing WH key is used. |
2490b23
to
e4f5969
Compare
e4f5969
to
f75bceb
Compare
What was the reasoning for switching back to WinRT APIs? |
They are far easier to work with and actually provide a hardware backed (TPM) key. When the proxy is made to obfuscate the quick unlock backend we may re introduce an NCrypt version to support msys builds. But it's really unnecessary. To be more technical, the chosen implementation with NCrypt worked in that it showed the windows hello authentication prompt. With WinRT API you are given a "guarantee" that the private key is stored in the computers TPM chip, if available. Further, that key is only accessible by the application that put it there. The user prompt prevents all access to the mechanism with which to sign the challenge and there is no way to backdoor that. Additionally, for @HexF implementation, you used the first key available in the store and if one wasn't available just failed silently. This creates two problems: (1) If there are no keys then the feature never works, instead of creating a key for the feature; (2) if a new key is added while an active quick unlock is stored, you will falsely use that key instead of the original one and fail. |
b54ac19
to
5354634
Compare
3630b85
to
605530f
Compare
This should hold true also for |
I'm sorry you are absolutely correct. I need to do some more thinking. I personally don't like that you need to auth with winhello on unlock, this is directly caused by using the key to sign data. The WinRT API misses a crucial ability to use the KeyCredential as a CryptographicKey which would be perfect. As far as I have tried, there is no way to pull a Certificate that would allow you to load from the PersistedKeyProvider. |
605530f
to
5ec9efb
Compare
9595883
to
7c52cfb
Compare
* Special thanks to @HexF and @smlu for their contributions towards this feature. * Add MVP support for Windows Hello as a Quick Unlock solution using the WinRT API. This works by signing a random challenge vector with the Windows Hello protected key store (typically from TPM). The signed challenge is hashed using SHA-256 and then used as the encryption key to encrypt the database credentials. Credentials are encrypted using AES-256/GCM. This ensures the database password can only be decrypted following a successful authentication with Windows Hello in the future. * Unify Touch ID and Windows Hello behavior under the Quick Unlock branding. Remove all timeout features of Touch ID as they are unnecessary and complicate the feature for no security gain. * Quick Unlock is automatically reset only when the database key is changed vice whenever database settings are modified. * Don't set database unlock dialog as always on top. This allows Touch ID and Windows Hello prompts to appear above the dialog properly. * Prevent quick unlock when using AutoOpen or opening from the command line.
7c52cfb
to
579d9c7
Compare
@phoerious made final changes as discussed |
return false; | ||
} | ||
|
||
// Encrypt the data using AES-256-CBC |
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.
Maybe update the comment.
Special thanks to @HexF and @smlu for their contributions towards this feature.
Add MVP support for Windows Hello as a Quick Unlock solution using the WinRT API. This works by signing a random challenge vector with the Windows Hello protected key store (typically from TPM). The signed challenge is hashed using SHA-256 and then used as the encryption key to encrypt the database credentials. This ensures the database password can only be decrypted following a successful authentication with Windows Hello in the future.
Unify Touch ID and Windows Hello behavior under the Quick Unlock branding. Remove all timeout features of Touch ID as they are unnecessary and complicate the feature for no security gain.
Quick Unlock is now reset only when the database key is changed vice whenever database settings are modified.
Don't set database unlock dialog as always on top. This allows Touch ID and Windows Hello prompts to appear above the dialog properly.
Screenshots
Example in unlock dialog:
Example when cancel / fail operation:
Testing strategy
Tested on Windows and macOS (for regression).
Type of change