Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Protect sensitive data in pipeline with Tink an...

Protect sensitive data in pipeline with Tink and Cloud KMS as Envelope Encryption

This session was presented in the International Women Day’s event partnered with GDG Cloud Bangkok to celebrate IWD in DareToBe theme.

This topic shows how to use data encryption and apply it to the data pipeline with Tink and Cloud Key management system as envelope encryption (as well as client-side encryption)

Presented By Burasakorn Sabyeying (Mils),
Women Techmakers Ambassador

#GDGCloudBangkok
#WomenTechmakers
#WTMDareToBe
#WTMDareToBeBangkok
#LifeAtAgoda
#TechAtAgoda

Burasakorn Sabyeying

April 25, 2023
Tweet

More Decks by Burasakorn Sabyeying

Other Decks in Technology

Transcript

  1. Data Engineer, CJ Express. Women Techmakers Ambassador Protect sensitive data

    in pipeline with Tink Burasakorn Sabyeying (Mils)
  2. Why

  3. Team Requirement 1. Encrypt sensitive data before sending to storage

    2. Able to decrypt data in BigQuery for specific role/people
  4. Cloud Storage always encrypts your data on the server side,

    before it is written to disk, at no additional charge (default way)
  5. 2 additional encryption options here: 1. Server-side encryption: encryption that

    occurs after Cloud Storage receives your data, but before the data is written to disk and stored. E.g. CMEK, CSEK 2. Client-side encryption: encryption that occurs before Cloud Storage receives your data
  6. You can use Google's open source cryptographic SDK, Tink, to

    perform client-side encryption, then protect your keys with Cloud Key Management Service.
  7. Open-source cryptography library written by cryptographers and security engineers at

    Google 1. Making it unnecessary for every team at Google to independently develop their own cryptography. 2. Tink also supports encrypting or storing keys in Amazon KMS, Google Cloud KMS, Android Keystore, and iOS Keychain 3. You can build Tink from source or use language-specific packages. e.g. C++, Go, Java, ObjC, Python What is Tink ?
  8. Cloud KMS = create and manage encryption keys for use

    in compatible Google Cloud services and in your own applications. key URI points: gcp-kms://projects/<PROJECT>/locations/<LOCATION>/keyRings/<KEYRING>/cryptoKeys/<KEYNAME>/cryptoKeyV ersions/<VERSION> "gcp-kms://projects/mils-project-2023/locations/asia-southeast1/keyRings/key-ring-1/cryptoKeys/key-name"
  9. Envelope encryption = process of encrypting a key with another

    key 1. Data encryption keys (DEK) The key used to encrypt data itself 2. Key encryption keys (KEK) The DEK is encrypted/wrapped by a key encryption key (KEK)
  10. Some Best Practices 1. Store the DEK near the data

    that it encrypts. 2. You don't need to rotate the DEK but rotate KEK regularly 3. Do not use the same DEK to encrypt data from two different users. 4. Use a strong algorithm such as 256-bit Advanced Encryption Standard (AES) in Galois Counter Mode (GCM). 5. Store KEKs centrally
  11. Benefits 1. You need both keys to decrypt data 2.

    Symmetric key algorithms work faster 3. Cloud KMS was designed to manage KEKs 4. A single KEK can be wrapped all DEKs; so individual data objects have their own DEK without massively increasing volume of keys stored in a central KMS Role: Cloud KMS CryptoKey Encrypter/Decrypter Via Delegation**
  12. Key Takeaway 1. Envelope Encryption with Tink and Cloud KMS/

    Client-side encryption with Tink and Cloud KMS 2. Tink = python, open source, easy to use 3. Able to work with BigQuery AEAD Encryption Function
  13. Further Reading 1. Client-side encryption with Tink and Cloud KMS

    https://cloud.google.com/kms/docs/client-side-encryption 2. การทํา Data Encryptionด้วย Cloud KMS + Tink (และการใช้งานร่วมกับ BigQuery Encryption Functions) by Jamie https://medium.com/cj-express-tech-tildi/81590305b314 3. เข้ารหัสข้อมูลให้ปลอดภัยด้วย Envelope Encryption by Manatsawin https://life.wongnai.com/envelope-encryption-f93837e5309f
  14. Join the Women Techmakers Members community today! + Access exclusive

    members-only content + Sneak peaks at upcoming events + Connect with other women like yourself bit.ly/wtmmembership