SlideShare a Scribd company logo
Crypto storage
Cryptographic storage
for people in a hurry
               Graham Lee
 Smartphone security boffin, Fuzzy Aliens Ltd.




                                 fuzzyaliens.com
Cryptographic storage
for people in a hurry
               Graham Lee
 Smartphone security boffin, Fuzzy Aliens Ltd.
From App to Crap
From App to Crap
Nut[the problem]shell
Nut[the problem]shell
• Want to store data
Nut[the problem]shell
• Want to store data
• But it must be secret
Nut[the problem]shell
• Want to store data
• But it must be secret
 • if the phone is stolen
Nut[the problem]shell
• Want to store data
• But it must be secret
 • if the phone is stolen
 • if the iTunes backup is stolen
Nut[the problem]shell
• Want to store data
• But it must be secret
 • if the phone is stolen
 • if the iTunes backup is stolen
• It must be tamper-proof
Nut[the problem]shell
• Want to store data
• But it must be secret
 • if the phone is stolen
 • if the iTunes backup is stolen
• It must be tamper-proof
• …to some extent
Solution: aescrypt
Solution: aescrypt
• Unencumbered (public domain) format and
  freeware implementation at http://
  aescrypt.org
Solution: aescrypt
• Unencumbered (public domain) format and
  freeware implementation at http://
  aescrypt.org
• Not just you using it
Solution: aescrypt
• Unencumbered (public domain) format and
  freeware implementation at http://
  aescrypt.org
• Not just you using it
• Mac, iOS, more
Solution: aescrypt
• Unencumbered (public domain) format and
  freeware implementation at http://
  aescrypt.org
• Not just you using it
• Mac, iOS, more
• Let’s start at byte 0 :-)
‘AES0020’


• Magic number
• Tells you the version of the crypto format
Meet a Data
Crypto storage
Crypto storage
Metadata
Metadata

• Arbitrary ‘extensions’ section
Metadata

• Arbitrary ‘extensions’ section
• Creator ID, creation date…
Metadata

• Arbitrary ‘extensions’ section
• Creator ID, creation date…
• …as long as that stuff isn’t a secret
What’s our vector,
               Victor?
   // We will use an initialization vector comprised of the
current time
   // process ID, and random data, all hashed together
with SHA-256.




                                           source: wikipedia
You can’t come in here unless
     you say “Swordfish”
   // Hash the IV and password 8192 times
   memset(digest, 0, 32);
   memcpy(digest, IV, 16);
   for(i=0; i<8192; i++)
   {
      sha256_starts( &sha_ctx);
      sha256_update( &sha_ctx, digest, 32);
      sha256_update( &sha_ctx,
                (unsigned char*)passwd,
                (unsigned long)passlen);
      sha256_finish( &sha_ctx,
                digest);
   }
Cutty say 'e can't HANG!
Cutty say 'e can't HANG!

 • The key we just derived is not used to
   encrypt the plaintext file
 • Instead, it’s used to encrypt a key, which is
   itself used to encrypt the file.
 • …why?
Irony: Eminem tribute act
singing “the real slim shady”
…
16 Octets - Initialization Vector (IV) used for encrypting the
        IV and symmetric key that is actually used to encrypt
        the bulk of the plaintext file.
48 Octets - Encrypted IV and 256-bit AES key used to encrypt the
        bulk of the file
        16 octets - initialization vector
        32 octets - encryption key
32 Octets - HMAC
nn Octets - Encrypted message (2^64 octets max)
 1 Octet - File size modulo 16 in least significant bit positions
32 Octets - HMAC
…
Filler material
…
16 Octets - Initialization Vector (IV) used for encrypting the
       IV and symmetric key that is actually used to encrypt
       the bulk of the plaintext file.
48 Octets - Encrypted IV and 256-bit AES key used to encrypt the
       bulk of the file
       16 octets - initialization vector
       32 octets - encryption key
32 Octets - HMAC
nn Octets - Encrypted message (2^64 octets max)
 1 Octet - File size modulo 16 in least significant bit positions
32 Octets - HMAC
…
To the Question Pit!
     @iamleeg
To the Question Pit!
     @iamleeg


              fuzzyaliens.com

More Related Content

PPT
Advanced Web Technologies 13
KEY
Dial M For Mitigation
ZIP
Designing a Secure Cocoa App
PDF
The Principled Programmer
PDF
Sign your code
PDF
Intel Briefing Notes
PDF
Beyond build and analyze
ZIP
Presentations and Podcasts - OxMug July 2009
Advanced Web Technologies 13
Dial M For Mitigation
Designing a Secure Cocoa App
The Principled Programmer
Sign your code
Intel Briefing Notes
Beyond build and analyze
Presentations and Podcasts - OxMug July 2009

Similar to Crypto storage (20)

PDF
Breaking Smart Speakers: We are Listening to You.
PDF
Protect Sensitive Data with Ada Keystore
PPTX
Password Storage Sucks!
PPTX
Cryptography 101 for_java_developers, Fall 2019
PPTX
Crypto Wallets: A Technical Perspective (Nakov at OpenFest 2018)
PPT
Unit II.ppt.............................
PDF
How does cryptography work? by Jeroen Ooms
PDF
Eusecwest
PDF
Hitcon badge 2018
PDF
How to Use Cryptography Properly: The Common Mistakes People Make When Using ...
PPTX
Blockchain Technology, Cryptography and cryptocurrencies Module2.pptx
PPTX
Tranning-2
PDF
Techniques to Store and Use Bitcoins.pdf
PDF
Exploiting null byte vm
PDF
Feasibility of Security in Micro-Controllers
PPTX
Using Cryptography Properly in Applications
PPTX
JavaOne 2016 - JVM assisted sensitive data
PPTX
Cryptography 101 for Java Developers - Devoxx 2019
PPTX
Cryptography and PKI
PPTX
Cryptography 101 for Java Developers - JavaZone2019
Breaking Smart Speakers: We are Listening to You.
Protect Sensitive Data with Ada Keystore
Password Storage Sucks!
Cryptography 101 for_java_developers, Fall 2019
Crypto Wallets: A Technical Perspective (Nakov at OpenFest 2018)
Unit II.ppt.............................
How does cryptography work? by Jeroen Ooms
Eusecwest
Hitcon badge 2018
How to Use Cryptography Properly: The Common Mistakes People Make When Using ...
Blockchain Technology, Cryptography and cryptocurrencies Module2.pptx
Tranning-2
Techniques to Store and Use Bitcoins.pdf
Exploiting null byte vm
Feasibility of Security in Micro-Controllers
Using Cryptography Properly in Applications
JavaOne 2016 - JVM assisted sensitive data
Cryptography 101 for Java Developers - Devoxx 2019
Cryptography and PKI
Cryptography 101 for Java Developers - JavaZone2019
Ad

More from Graham Lee (7)

PPTX
Object-Oriented Programming in Functional Programming in Swift
KEY
Cross platform Objective-C Strategy
KEY
Taking a Test Drive: iOS Dev UK guide to TDD
KEY
Taking a Test Drive
KEY
Smartphone security and privacy: you're doing it wrong
KEY
Unit testing for Cocoa developers
KEY
Security and Encryption on iOS
Object-Oriented Programming in Functional Programming in Swift
Cross platform Objective-C Strategy
Taking a Test Drive: iOS Dev UK guide to TDD
Taking a Test Drive
Smartphone security and privacy: you're doing it wrong
Unit testing for Cocoa developers
Security and Encryption on iOS
Ad

Recently uploaded (20)

PPTX
A Presentation on Artificial Intelligence
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
MYSQL Presentation for SQL database connectivity
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PPTX
Cloud computing and distributed systems.
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Machine learning based COVID-19 study performance prediction
PDF
cuic standard and advanced reporting.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Big Data Technologies - Introduction.pptx
PDF
KodekX | Application Modernization Development
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
A Presentation on Artificial Intelligence
Dropbox Q2 2025 Financial Results & Investor Presentation
Understanding_Digital_Forensics_Presentation.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Digital-Transformation-Roadmap-for-Companies.pptx
Network Security Unit 5.pdf for BCA BBA.
MYSQL Presentation for SQL database connectivity
“AI and Expert System Decision Support & Business Intelligence Systems”
Agricultural_Statistics_at_a_Glance_2022_0.pdf
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Cloud computing and distributed systems.
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Machine learning based COVID-19 study performance prediction
cuic standard and advanced reporting.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Big Data Technologies - Introduction.pptx
KodekX | Application Modernization Development
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy

Crypto storage

Editor's Notes

  • #2: \n
  • #3: \n
  • #4: \n
  • #5: \n
  • #6: \n
  • #7: \n
  • #8: Yes, so there is the NSFileProtection encryption. However, the ability to use that to actually protect data depends on the user having a passcode lock enabled, and you can&amp;#x2019;t test for that in your app. If you can&amp;#x2019;t enforce that all of your users comply with a particular passcode policy, you must implement your own protection mechanism.\n
  • #9: Yes, so there is the NSFileProtection encryption. However, the ability to use that to actually protect data depends on the user having a passcode lock enabled, and you can&amp;#x2019;t test for that in your app. If you can&amp;#x2019;t enforce that all of your users comply with a particular passcode policy, you must implement your own protection mechanism.\n
  • #10: Yes, so there is the NSFileProtection encryption. However, the ability to use that to actually protect data depends on the user having a passcode lock enabled, and you can&amp;#x2019;t test for that in your app. If you can&amp;#x2019;t enforce that all of your users comply with a particular passcode policy, you must implement your own protection mechanism.\n
  • #11: Yes, so there is the NSFileProtection encryption. However, the ability to use that to actually protect data depends on the user having a passcode lock enabled, and you can&amp;#x2019;t test for that in your app. If you can&amp;#x2019;t enforce that all of your users comply with a particular passcode policy, you must implement your own protection mechanism.\n
  • #12: Yes, so there is the NSFileProtection encryption. However, the ability to use that to actually protect data depends on the user having a passcode lock enabled, and you can&amp;#x2019;t test for that in your app. If you can&amp;#x2019;t enforce that all of your users comply with a particular passcode policy, you must implement your own protection mechanism.\n
  • #13: Yes, so there is the NSFileProtection encryption. However, the ability to use that to actually protect data depends on the user having a passcode lock enabled, and you can&amp;#x2019;t test for that in your app. If you can&amp;#x2019;t enforce that all of your users comply with a particular passcode policy, you must implement your own protection mechanism.\n
  • #14: The main problem with creating any new crypto format is the chance that you&amp;#x2019;ll introduce new vulnerabilities by misusing the crypto primitives, even if those primitives themselves are bug-free. Sidestep that risk and reduce development time by choosing an existing solution: but notice that solutions like GPG and OpenPGP have licensing restrictions that are incompatible with the app stores.\n
  • #15: The main problem with creating any new crypto format is the chance that you&amp;#x2019;ll introduce new vulnerabilities by misusing the crypto primitives, even if those primitives themselves are bug-free. Sidestep that risk and reduce development time by choosing an existing solution: but notice that solutions like GPG and OpenPGP have licensing restrictions that are incompatible with the app stores.\n
  • #16: The main problem with creating any new crypto format is the chance that you&amp;#x2019;ll introduce new vulnerabilities by misusing the crypto primitives, even if those primitives themselves are bug-free. Sidestep that risk and reduce development time by choosing an existing solution: but notice that solutions like GPG and OpenPGP have licensing restrictions that are incompatible with the app stores.\n
  • #17: The main problem with creating any new crypto format is the chance that you&amp;#x2019;ll introduce new vulnerabilities by misusing the crypto primitives, even if those primitives themselves are bug-free. Sidestep that risk and reduce development time by choosing an existing solution: but notice that solutions like GPG and OpenPGP have licensing restrictions that are incompatible with the app stores.\n
  • #18: This basically just exists to let you know you&amp;#x2019;re looking at the correct kind of file.\n
  • #19: Don&amp;#x2019;t spend too much time on this slide, you cretin :-P\n
  • #20: Don&amp;#x2019;t spend too much time on this slide, you cretin :-P\n
  • #21: Don&amp;#x2019;t spend too much time on this slide, you cretin :-P\n
  • #22: Remember not to leak any information in the metadata that should be a secret. For example: keeping photographs of a protest confidential may not be enough for a user if the photo timestamp and geolocation make their attendance public.\n
  • #23: Remember not to leak any information in the metadata that should be a secret. For example: keeping photographs of a protest confidential may not be enough for a user if the photo timestamp and geolocation make their attendance public.\n
  • #24: Remember not to leak any information in the metadata that should be a secret. For example: keeping photographs of a protest confidential may not be enough for a user if the photo timestamp and geolocation make their attendance public.\n
  • #25: Remember not to leak any information in the metadata that should be a secret. For example: keeping photographs of a protest confidential may not be enough for a user if the photo timestamp and geolocation make their attendance public.\n
  • #26: \n
  • #27: \n
  • #28: \n
  • #29: The point of the HMAC is to provide integrity checking. There&amp;#x2019;s no real attack against AES in the case of tampered ciphertext - you can replace real data with garbage, but you can&amp;#x2019;t replace real data with other real data. The point of this HMAC is that it&amp;#x2019;s the quickest way to verify that the key was recovered correctly.\n
  • #30: Notice that this is one of two choices: PKCS#7 padding is the other option.\n
  • #31: \n