All Projects → trailofbits → Secureenclavecrypto

trailofbits / Secureenclavecrypto

Licence: apache-2.0
Demonstration library for using the Secure Enclave on iOS

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Secureenclavecrypto

LAPSforMac
Local Administrator Password Solution for Mac
Stars: ✭ 29 (-88.45%)
Mutual labels:  apple, keychain
MSession
A simple and sophisticated session and authentication solution written in Swift
Stars: ✭ 26 (-89.64%)
Mutual labels:  apple, keychain
Ios
Most usable tools for iOS penetration testing
Stars: ✭ 563 (+124.3%)
Mutual labels:  apple, keychain
onepile
Playground for the future of private notes and document management
Stars: ✭ 41 (-83.67%)
Mutual labels:  apple, crypto
Csvkeychain
Import/export between Apple Keychain.app and plain CSV file.
Stars: ✭ 281 (+11.95%)
Mutual labels:  apple, keychain
Valet
Valet lets you securely store data in the iOS, tvOS, or macOS Keychain without knowing a thing about how the Keychain works. It’s easy. We promise.
Stars: ✭ 3,712 (+1378.88%)
Mutual labels:  crypto, keychain
Ghostunnel
A simple SSL/TLS proxy with mutual authentication for securing non-TLS services
Stars: ✭ 1,296 (+416.33%)
Mutual labels:  crypto, keychain
Ruby Scripts
A collection of ruby scripts for those who live in the command line
Stars: ✭ 234 (-6.77%)
Mutual labels:  crypto
Musish
Apple Music...ish
Stars: ✭ 2,775 (+1005.58%)
Mutual labels:  apple
Pass Js
Apple Wallet Passes generating library for Node.JS
Stars: ✭ 230 (-8.37%)
Mutual labels:  apple
Unshaky
A software attempt to address the "double key press" issue on Apple's butterfly keyboard [not actively maintained]
Stars: ✭ 2,711 (+980.08%)
Mutual labels:  apple
Resources
📖 Huge curated collection (archive) of links of Tech, Science, Economics, Politics, Life, Philosophy, Conferences, Videos and much more resources from everyday surfing. ⭐️ Since October 21, 2017.
Stars: ✭ 236 (-5.98%)
Mutual labels:  crypto
Web3swift
Elegant Web3js functionality in Swift. Native ABI parsing and smart contract interactions.
Stars: ✭ 237 (-5.58%)
Mutual labels:  crypto
Ipsw
iOS/macOS Research Swiss Army Knife
Stars: ✭ 230 (-8.37%)
Mutual labels:  apple
Applereserver
Apple 官方预约监控助手
Stars: ✭ 245 (-2.39%)
Mutual labels:  apple
Wwdc
You don't have the time to watch all the WWDC session videos yourself? No problem me and many contributors extracted the gist for you 🥳
Stars: ✭ 2,561 (+920.32%)
Mutual labels:  apple
Nativepopup
Clone of Apple iOS App's feedback popup, and easily customizable.
Stars: ✭ 247 (-1.59%)
Mutual labels:  apple
Swiftui Sliders
🚀 SwiftUI Sliders with custom styles
Stars: ✭ 241 (-3.98%)
Mutual labels:  apple
Watusi For Whatsapp
Your all-in-one tweak for WhatsApp Messenger!
Stars: ✭ 240 (-4.38%)
Mutual labels:  apple
Openradar Mirror
A mirror of radars pulled from http://openradar.me/.
Stars: ✭ 238 (-5.18%)
Mutual labels:  apple

SecureEnclaveCrypto

This project shows you how to

  • create a keypair where as the private key is stored in the secure enclave
  • sign a string / some data with the private key
  • use the security functions like SecKeyRawVerify, SecKeyGeneratePair and SecItemCopyMatching in Swift 3 and Objective-C
  • store the public key in the keychain

Apple quietly released a new API in iOS 9 (kSecAttrTokenIDSecureEnclave) that allowed developers to create and use keys stored directly in the Secure Enclave (see "Security and Your Apps" starting from slide 195). This feature opens enormous possibilities for security by enabling applications to use private keys that are safely stored outside of iOS and away from any potential malware.

We tried to use this API shortly after it was released and found it lacking: the required attribute was entirely undocumented, the key format is not compatible with OpenSSL, and Apple didn't even say what cipher suite was used (it's secp256r1). The code in this repository is an attempt to fix these issues by providing an easy-to-use wrapper around the Secure Enclave Crypto API.

Show me the code

This project thus contains two codebases, one in Swift (from @hfossli) and one in Objective-C which show how to use this API for basic functionality. Both directories contain a README.md file with more specific documentation.

Creating OpenSSL-compatible public key

The public key returned from the Secure Enclave can be fed to key_builder.rb to create an OpenSSL-compatible representation of the ECC public key. The key_builder.rb script takes one parameter: the public key as hex / base 16.

$ ruby key_builder.rb "045ac9bd 7c4d8e77 b37fd14f bf2822ac 4ad4d62f 1bce4019 60bdbdc7 1102da0c 78603266 7dd0fe8b 2a847135 1d1d0e01 a2cd019e ab9c4b7c 9a3fed15 1f20bcc2 9a"

-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEsng2kkyuVVqyK1BRo8EZhJTM
Mubz1P4MvF6TVwmnbCEUGv4IssA8FXqNb2txbLtlYvNiJPjss/62HKMvR2tm
uA==
-----END PUBLIC KEY-----
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].