Apache License 2.0

项目介绍

trailofbits/SecureEnclaveCrypto 是一个托管在 GitHub 上的开源项目,主要使用 Swift 编写,采用 Apache License 2.0 许可证,目前获得 287 个 Star、36 次 Fork。

仓库全名
trailofbits/SecureEnclaveCrypto
开源许可证
Apache License 2.0
Star 数
287
Fork 数
36
未关闭 Issue
4

README 摘要

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)…

完整内容见 GitHub 原始 README 或本页 。

常见问题

SecureEnclaveCrypto 用什么语言开发?

主要使用 Swift 编写,采用 Apache License 2.0 许可证,目前有 287 个 Star。

SecureEnclaveCrypto 可以免费商用吗?

仓库采用 Apache License 2.0 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 SecureEnclaveCrypto 的源码?

可以直接克隆仓库:git clone https://github.com/trailofbits/SecureEnclaveCrypto.git,默认分支为 master;安装与运行步骤见仓库 README。

SecureEnclaveCrypto 最近还在维护吗?

仓库最近一次更新为 2021年2月3日,当前有 4 个未关闭 Issue;Star 数为 287,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

Demonstration library for using the Secure Enclave on iOS

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
369
价值分
183
活跃状态
归档

语言占比

Objective-C
Ruby
Swift

README

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-----

评论

暂无评论