【问题标题】:Secure Enclave keys exists even after app uninstallation即使在应用程序卸载后仍存在 Secure Enclave 密钥
【发布时间】:2018-08-04 12:16:55
【问题描述】:

我已使用以下代码片段在 Secure enclave 内生成了密钥,

func generateKeyPair(accessControl: SecAccessControl) throws -> (`public`: SecureEnclaveKeyReference, `private`: SecureEnclaveKeyReference) {

        let privateKeyParams: [String: Any] = [
            kSecAttrLabel as String: privateLabel,
            kSecAttrIsPermanent as String: true,
            kSecAttrAccessControl as String: accessControl,
        ]
        let params: [String: Any] =
        [
            kSecAttrKeyType as String: attrKeyTypeEllipticCurve,
            kSecAttrKeySizeInBits as String: 256,
            kSecAttrTokenID as String: kSecAttrTokenIDSecureEnclave,
            kSecPrivateKeyAttrs as String: privateKeyParams
        ]
        var publicKey, privateKey: SecKey?

        let status = SecKeyGeneratePair(params as CFDictionary, &publicKey, &privateKey)

        guard status == errSecSuccess else {

            throw SecureEnclaveHelperError(message: "Could not generate keypair", osStatus: status)
        }

        return (public: SecureEnclaveKeyReference(publicKey!), private: SecureEnclaveKeyReference(privateKey!))
    }

卸载应用程序后密钥仍然存在,有没有办法从安全飞地中删除密钥?

提前谢谢你:)

【问题讨论】:

  • 你找到方法了吗?
  • 不,我没有找到

标签: ios swift3 cryptography enclave


【解决方案1】:

从设备中删除应用时,不会触发执行代码。对钥匙串的访问取决于用于签署应用程序的配置文件。因此,没有其他应用程序能够访问钥匙串中的这些信息。

https://stackoverflow.com/a/5711090/7350472

如果您想从 Secure Enclave 中删除密钥,您可以调用:

SecItemDelete(query as CFDictionary)

https://developer.apple.com/documentation/security/1395547-secitemdelete

【讨论】:

    猜你喜欢
    • 2021-05-07
    • 2011-04-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-11
    • 1970-01-01
    • 2022-01-02
    • 2021-12-24
    相关资源
    最近更新 更多