protect sensitive data with ada keystore
play

Protect Sensitive Data with Ada Keystore Stphane Carrez FOSDEM - PowerPoint PPT Presentation

Protect Sensitive Data with Ada Keystore Stphane Carrez FOSDEM 2020 Why Ada Keystore? Store sensitive parameters of an Ada server : Database connection passwords API secret keys Tool to store sensitive information :


  1. Protect Sensitive Data with Ada Keystore Stéphane Carrez FOSDEM 2020

  2. Why Ada Keystore? ● Store sensitive parameters of an Ada server : – Database connection passwords – API secret keys ● Tool to store sensitive information : – Passwords and accounts – Encrypted documents without exposing their keys https://github.com/stcarrez/ada-keystore 2

  3. Getting a secret (1) ● Open keystore with simple password (simple but less secure : password in code!) w i t h K e y s t o r e . F i l e s ; f u n c t i o n G e t _ S e c r e t r e t u r n S t r i n g i s W S : K e y s t o r e . F i l e s . W a l l e t _ F i l e ; P a s s : K e y s t o r e . S e c r e t _ K e y : = K e y s t o r e . C r e a t e ( " . . . " ) ; b e g i n W S . O p e n ( P a s s , “ s e c u r e . a k t ” ) ; r e t u r n W S . G e t ( " a p i - k e y " ) ; e n d G e t _ S e c r e t ; https://github.com/stcarrez/ada-keystore 3

  4. Getting a secret (2) ● Open keystore protected with GPG w i t h K e y s t o r e . G P G ; w i t h K e y s t o r e . P a s s w o r d s . G P G ; w i t h K e y s t o r e . F i l e s ; f u n c t i o n G e t _ S e c r e t r e t u r n S t r i n g i s W S : K e y s t o r e . F i l e s . W a l l e t _ F i l e ; C t x : K e y s t o r e . P a s s w o r d s . G P G . C o n t e x t _ T y p e ; b e g i n K e y s t o r e . G P G . O p e n ( W S , C t x , “ s e c u r e . a k t ” ) ; r e t u r n W S . G e t ( " a p i - k e y " ) ; e n d G e t _ S e c r e t ; https://github.com/stcarrez/ada-keystore 4

  5. Ada Keystore: a secure storage Encrypted Data Keystore AKT Ada Keystore User password GPG protected key https://github.com/stcarrez/ada-keystore 5

  6. Ada Keystore: with multiple keys Master key block Directory keys Encrypted Data Data keys Data fragment User password Directory key Data fragment Data info key Data fragment Data key key Data keys GPG protected key Data fragment Signature key Data fragment https://github.com/stcarrez/ada-keystore 6

  7. Ada Keystore: with blocks (unchained) Header block 4K Ada UUID Storage HDR Data Storage Info + HMAC HMAC-256 (1815-12-10) ID (1852-11-27) Master key block ... Key slot 1 Key slot 7 HDR UUID HMAC-256 Wallet info Directory block ... Directory Name Entry Data block indexes & keys HDR HMAC-256 Data block Data Fragment Data fragment info HMAC-256 HDR HMAC-256 https://github.com/stcarrez/ada-keystore 7

  8. Ada Keystore: key protection Wallet master key block ... Key slot 1 Key slot 7 HDR Wallet info UUID HMAC-256 Wallet Sign Wallet Header Key, wallet header IV, Block ID NO, invalid AES-256 HMAC = ? block CBC 256 YES, valid block Wallet master key slot N (512 bytes) salt key N salt IV N ctr slot N key slot N Sign N HMAC (32 bytes) (32 bytes) (4 bytes) (4 bytes) (240 bytes) (32 bytes) (32 bytes) IV AES-256 HMAC PBKDF2 User password NO, invalid = ? HMAC CBC 256 password 256 Key PBKDF2 YES, valid password HMAC 256 Wallet Master Keys key sign key IV key key dat sign dat IV dat key dir IV dir key dir sign (256 bits) (128 bits) (256 bits) (256 bits) (128 bits) (256 bits) (128 bits) (256 bits) (256 bits) https://github.com/stcarrez/ada-keystore 8

  9. Ada Keystore: GPG protection Header block Ada UUID Storage (1815-12-10) HDR Data Storage Info + HMAC HMAC-256 ID (1852-11-27) GPG Private key GPG2 Wallet master key block ... Key slot 1 Key slot 7 HDR Wallet info UUID HMAC-256 Sign IV Key IV Key (16 bytes) (32 bytes) (16 bytes) (32 bytes) (32 bytes) AES-256 HMAC NO, invalid = ? CBC 256 block Wallet master key slot N (512 bytes) YES, valid block header tag key slot N Sign N HMAC (4 bytes) (240 bytes) (32 bytes) (32 bytes) Key, IV AES-256 HMAC CBC NO, invalid = ? 256 password YES, valid password Wallet Master Keys key sign key IV key key dat sign dat IV dat key dir IV dir key dir sign (256 bits) (128 bits) (256 bits) (256 bits) (128 bits) (256 bits) (128 bits) (256 bits) (256 bits) https://github.com/stcarrez/ada-keystore 9

  10. Ada Keystore: directory encryption Directory block ... ... Directory Name Entry Data block indexes & keys HDR HMAC-256 Directory Key, directory IV, Block ID AES-256 CBC HMAC 256 Directory Sign Per data fragment encryption keys Name Entry ID Entry ID Store ID Block Num IV key (4 bytes) (4 bytes) (4 bytes) (4 bytes) (256 bits) (N bytes) (128 bits) Data Fragment Data Fragment HDR Data fragment info HMAC-256 HMAC-256 Data fragment info HMAC-256 HDR HMAC-256 https://github.com/stcarrez/ada-keystore 10

  11. Ada Keystore: data encryption Data block HDR Data Fragment ... Data fragment info HMAC-256 HMAC-256 Data Key, IV, Block ID AES-256 HMAC CBC 256 Data Sign Data entry descriptor Entry ID Slot Size Data Ofgset HMAC (4 bytes) (2 bytes) (8 bytes) (256 bits) Data fragment Key, IV, Block ID AES-256 CBC HMAC 256 Data Fragment https://github.com/stcarrez/ada-keystore 11

  12. Ada Keystore: directory decryption Directory block ... ... Directory Name Entry Data block indexes & keys HDR HMAC-256 Directory Sign Directory Key, directory IV, Block ID NO, invalid AES-256 HMAC = ? block CBC 256 YES, valid block Per data fragment encryption keys Name Entry ID Entry ID Store ID Block Num IV key (4 bytes) (4 bytes) (4 bytes) (4 bytes) (256 bits) (N bytes) (128 bits) Data Fragment Data Fragment Data fragment info HMAC-256 Data fragment info HMAC-256 HDR HMAC-256 HDR HMAC-256 https://github.com/stcarrez/ada-keystore 12

  13. Ada Keystore: data decryption Data block HDR ... Data Fragment Data fragment info HMAC-256 HMAC-256 Data Sign Data Key, IV, Block ID NO, invalid HMAC AES-256 = ? block CBC 256 YES, valid block Data entry descriptor Slot Size Entry ID Data Ofgset HMAC (4 bytes) (2 bytes) (8 bytes) (256 bits) Data fragment Key, IV, Block ID NO, invalid AES-256 HMAC = ? fragment CBC 256 YES, valid fragment Data Fragment https://github.com/stcarrez/ada-keystore 13

  14. Ada Keystore: more complexity Wallet master key block ... HDR UUID Key slot 1 Key slot 7 HMAC-256 Wallet info Thread safe API Wallet Sign Insert data Wallet Header Key, wallet header IV, Block ID NO, invalid AES-256 HMAC = ? block CBC 256 YES, valid block Wallet master key slot N (512 bytes) salt key N salt IV N ctr slot N key slot N Sign N HMAC (32 bytes) (32 bytes) (4 bytes) (4 bytes) (240 bytes) (32 bytes) (32 bytes) Update data IV AES-256 HMAC PBKDF2 User password NO, invalid = ? HMAC CBC 256 password 256 Key Secure data erase PBKDF2 YES, valid password HMAC 256 Wallet Master Keys key sign key IV key key dat sign dat IV dat key dir IV dir key dir sign (256 bits) (128 bits) (256 bits) (256 bits) (128 bits) (256 bits) (128 bits) (256 bits) (256 bits) Prevent security holes Data block Directory block HDR ... Data Fragment ... ... Data fragment info HMAC-256 HMAC-256 HDR Directory Name Entry Data block indexes & keys HMAC-256 Data Sign Directory Sign Data Key, IV, Block ID NO, invalid HMAC Directory Key, directory IV, Block ID AES-256 NO, invalid AES-256 HMAC Protect keys = ? block = ? CBC 256 block CBC 256 YES, valid block YES, valid block Data entry descriptor Entry ID Slot Size Data Ofgset HMAC (4 bytes) (2 bytes) (8 bytes) (256 bits) Per data fragment encryption keys Name Entry ID Entry ID Store ID Block Num IV key (4 bytes) (4 bytes) (4 bytes) (4 bytes) (256 bits) (N bytes) (128 bits) Data fragment Key, IV, Block ID NO, invalid AES-256 HMAC = ? fragment CBC 256 Multi-task encryption/decryption YES, valid fragment HDR Data fragment info HMAC-256 Data Fragment HMAC-256 HDR Data fragment info HMAC-256 Data Fragment HMAC-256 Data Fragment https://github.com/stcarrez/ada-keystore 14

  15. Ada benefit : limited types ● Use limited record : – Encryption keys cannot be copied – Secret key content visible only to AES operations ● Use Ada.Finalization.Limited_Controlled : – Erase encryption keys when object is released t y p e i s l i m i t e d p r i v a t e S e c r e t _ K e y ( L e n g t h : K e y _ L e n g t h ) ; https://github.com/stcarrez/ada-keystore 15

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend