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

Keeping_Your_Secrets.pdf

Avatar for Tomek2k4 Tomek2k4
October 11, 2018

 Keeping_Your_Secrets.pdf

Avatar for Tomek2k4

Tomek2k4

October 11, 2018

Other Decks in Technology

Transcript

  1. AGENDA • Why would you need it? • Evolution •

    TEE • DIY • Demo App • Key takeaways
  2. Definitions • AndroidKeystore API implemented as extension of JCA •

    Keystore deamon Provides access to all Keystore functionality Place for “key blobs” • Keymaster Low level implementation that talks with hardware backed security
  3. Evolution Before 4.3 version • There were no Public API

    that allows you to use KeyChain directly - only system aps used it • Reason why above was hide is because it would mean to get key material outside the keystore • To use key chain it was required to use reflection and use binder - no manager class was provided • It was possible to check if store is hardware backed by calling mBinder.test(), where mBinder is Keystore service obtained as described above
  4. Evolution JellyBean 4.3 • Added public API to allow making

    crypto operation (sign or verify) • Possible to use asymmetric keys that are protected by system store • RSA key pair generator • It is possible to encrypt another user symmetric key with RSA key pair wit use of OAEP • Checking if device is hardware backed is determined by calling KeyChain.isBoundKeyAlgorithm(KeyProperties.KEY_ALGOR ITHM_RSA)
  5. Evolution Marshmallow 6.0 • Possible to use symmetric keys that

    are protected by system store • new symmetric Key Generator • There is no need to have device lock to generate keys • Key material cannot be exported from key store, API allows to use Crypto libraries to perform operations with keys • Changing device protection policy (None,Pattern,PIN,Password) in most cases won't wipe your keys • Introduced per-key authorization setUserAuthenticationRequired()
  6. What is TEE? • runs alongside the mobile device’s OS

    • resides in the main device processor • running its own operating system • It’s not „Secure Element” as a standard • Ready to use for developers!
  7. Hardware-backed Keystore • Encrypted keys are stored in /data/misc/keystore_user_x" •

    Keys are encrypted with dedicated KEK(key encryption key) - from Android 6.0 each user has its own KEK • KEK is derived by hashing a binary tag representing the key's root of trust - might be hardware or software • The current software implementation uses a 128-bit AES key • It is expected that the final implementation use a hardware-backed master-key and thus not directly accessible from Android.
  8. Where’s the catch? • Unfortunately changing device lock policy might

    wipe out your application stored keys " • Behavior differs from version to version • Trend to reduce customizing crypto libraries
  9. Do it yourself approach • Use PBKDF (Password Based Key

    Derivation Function) • Keep keys in your resource .ks file • Store key characteristics in DB
  10. Key takeaways • Check the secure communities guidelines OWASP, BouncyCastle

    • Use best available security that platform offers • Combine platform solutions with own customization • Don't use self implemented crypto methods