-
Notifications
You must be signed in to change notification settings - Fork 5
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
Make sqlite database upgradabale and crypto-agile #124
Conversation
0e38432
to
d4bd38e
Compare
077482a
to
f848663
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.
Looks good.
By any chance, did you test this change with pkcs11-provider locally to make sure this works correctly and we wont break the CI?
Yes I always make a run with pkcs11-provider locally to ensure changes actually work in a backwards compatible way. |
Adds a new metadat table named meta. Sets a database version in this table to allow for future upgrades/backwards compatibility functions. Moves token info from a fake object to metadata storage. Signed-off-by: Simo Sorce <[email protected]>
The database Encryption Key is now stored as the ASN.1 Encoding of the KProtectedData structure, which contains all the data to reversibly derive t Key Encryption Key from the pin using PBKDF2 and then encrypt the Encryption Key with this KEK using AES GCM. This structure allows us to be crypto agile, as the derivation function and the encryption function are identified by the OIDs stored in this ASN.1 Structure, and therefore the data is fully self described so that a future change can be done while maintaining the ability to interoperate with pre-existing databases. Signed-off-by: Simo Sorce <[email protected]>
Implement the data encryption layer explained in the document added in the previoud commit. Specifically make the EK be a generic key and then derive individual AES keys from it via an HKDF Expand step before encrypting the actual data. Signed-off-by: Simo Sorce <[email protected]>
No need for object gimmicks, just keep a copy of the struct and remove a bunch of now useless attributes. Signed-off-by: Simo Sorce <[email protected]>
Insted of using a complex pkcs#11 object, save user PIN and counters in the metadata table. Enhance the ACI Authentication Info structure to carry all of the user data and streamline all related operations. Signed-off-by: Simo Sorce <[email protected]>
Change these two databases to properly handle the move of token and user info out of the database objects space. Signed-off-by: Simo Sorce <[email protected]>
Rebased on main, and fixed the typo in the comment. |
Add metadata to the sqlite database that allows for easier crypto agility as well as allow future upgrades. Move all non-object information to a metadata table.
Fixes #109