Security(一) 框架概述

Security(一) 框架概述


资源

– Apple Documentation Security Framework
https://developer.apple.com/documentation/security?language=objc


本框架用于加密你的应用数据,控制对你的应用的访问。

Overview

使用 Security 框架来保护信息,建立信任、管理对应用的访问。概括的说, Security 服务支持下列目标:

  • 发布用户的身份认证,选择性的授予资源访问权限;

  • 加密数据,包含在磁盘上的 和 在网络传输中的;

  • 确保代码 来实现特定目的有效性;


如下图所示,你也可以使用低层次的加密资源来创建新的加密服务。加密是复杂的,错误的成本很高,所以去实现自己的加密服务可能不是一个好的选择。当你的应用需要加密时,可以使用 Security 框架。

在这里插入图片描述


注意
建议最好使用高层的API 来实现需求。Security 框架不一定是最好的选择。
比如加密网络通信,最好考虑 Foundation 框架中的 URL Loading System,它也基于 Security 框架 。只有当你的应用需要访问底层加密协议功能时,才直接使用加密传输API。


核心模块

一、Authorization and Authentication

1、Password AutoFill 自动填充密码
Streamline your app’s login and onboarding procedures.

密码自动填充,适用于 iOS 和网页。


2、Shared Web Credentials 共享web证书
Share credentials between iOS apps and their website counterparts.

iOS 和 web 之间共享证书;

Figure 1 Using shared web credentials API and the iCloud keychain to bridge between your app and your website


3、Authorization Services 授权服务
Access restricted areas of the operating system, and control access to particular features of your macOS app.

访问操作系统限制的区域,控制你的应用中特别的功能。


4、Authorization Plug-ins 授权插件
Extend the authorization services API by creating plug-ins that can participate in authorization decisions.

创建插件来在授权中,扩展授权服务API(authorization services API)。


5、Sessions 会话
Manage login, authorization, and security sessions in macOS.

在 macOS 中管理登录、授权、加密回话。


二、Secure Data

1、Keychain Services Keychain服务

Securely store small chunks of data on behalf of the user.

为用户加密小块数据。


2、Preventing Insecure Network Connections 防止未加密的网络连接

Enforce secure network links in your app by relying on App Transport Security.

基于 App 传输加密,在你的应用中 实施加密网络连接。


三、Secure Code

1、Code Signing Services 代码签名服务

Examine and validate signed code running on the system.

检查和验证 在系统中签名的代码。


2、Notarizing macOS Software Before Distribution 在发布前公证 macOS 应用

Give users even more confidence in your macOS software by submitting it to Apple for notarization.

通过将应用提交到 Apple 来公证,来让用户对你的应用有更多信心。


3、Preparing Your App to Work with Pointer Authentication

Test your app against the arm64e architecture to ensure that it works seamlessly with enhanced security features.

检查你的应用来应对 arm64e架构,来确保它在增强的加密特征上无缝工作。


4、App Sandbox Entitlements App 沙盒权利

Manage access to system resources and user data in macOS apps to contain damage if an app becomes compromised.

管理系统资源的访问,和在 macOS 应用中


5、Hardened Runtime Entitlements 增强运行时权利

Manage security protections and resource access for your macOS apps.

管理加密保护,和你应用的资源访问。


四、Cryptography

1、Complying with Encryption Export Regulations 遵守加密出口法规

Declare the use of encryption in your app to streamline the app submission process.

声明在应用程序中使用加密,以简化应用程序提交过程。


2、Certificate, Key, and Trust Services

Establish trust using certificates and cryptographic keys.

使用证书和秘钥建立信任。


3、Cryptographic Message Syntax Services 加密消息语法服务

Cryptographically sign and encrypt S/MIME messages.

密码符号,加密 S/MIME 消息。


4、Randomization Services 随机化服务

Generate cryptographically secure random numbers.

生成加密的随机数


5、Security Transforms 加密传输

Perform cryptographic functions like encoding, encryption, signing, and signature verification.

实现加密功能,如编码,解码,签名和签名认证。


6、ASN.1

Encode and decode Distinguished Encoding Rules (DER) and Basic Encoding Rules (BER) data streams.

编码和解码 可辨别编码规则(DER) 和 基本编码规则(BER)数据流。

相关头文件

#import <Security/SecAsn1Coder.h>
#import <Security/SecAsn1Templates.h>

五、Result Codes 返回码

1、Security Framework Result Codes

Evaluate result codes common to many Security framework functions.

评估 Security 框架功能的返回码。


六、Legacy Interfaces

1、Common Security Services Manager 通用加密服务管理

A set of open source modules underpinning the legacy implementation of the Security framework.

一组支持 Security 旧版本实现的开源的代码模块。

这项技术从 macOS 10.7 开始过期,在 iOS 中不可用。建议使用其他高级服务来替代这个功能。


2、Secure Transport 加密传输

Secure network communication using standardized transport layer security mechanisms.

使用标准的传输层加密机制的加密网络传输。


这里的API 给与你访问苹果对 SSLv3 3.0 、TLS 1.0 – 1.2、DTLS 1.0 的实现。

这些 API 不需要依赖传输层,你可以用 BSD Socket 或其他协议 来使用它。

您还可以负责 设置原始网络连接。 您在SSL会话开始时,以 SSLConnectionRef对象的形式 传递对基础(连接)实体的不透明引用。

Important

这些 API 可能要过期,建议使用 Network 框架来替代。


3、Secure Download 加密下载

Implement Apple’s Secure Download System in macOS.

在 macOS 下实现苹果的加密下载系统。


伊织 2019-12-05

发布了164 篇原创文章 · 获赞 162 · 访问量 65万+

猜你喜欢

转载自blog.csdn.net/lovechris00/article/details/103565002