简体   繁体   English

Apple SSL安全传输

[英]Apple SSL Secure Transport

I have just started to work with os x and have no experience with it at all. 我刚刚开始使用os x,并且完全没有经验。 But all I want to do now is to replace old OpenSSL code with Apple Security API. 但是我现在要做的就是用Apple Security API替换旧的OpenSSL代码。 I'm using Secure Transport and I'm a bit confused about with these functions: SSLSetIOFuncs , SSLWrite , and SSLRead . 我正在使用安全传输 ,但对以下功能有些困惑: SSLSetIOFuncsSSLWriteSSLRead

So SSLSetIOFuncs sets callbacks that perform writing/reading operations (which I should implement). 因此SSLSetIOFuncs设置执行写/读操作(我应该实现)的回调。 And a lot of questions appear at this point: 此时出现了许多问题:

  1. First, I just don't understand why I should implement it (in OpenSSL it is implemented already). 首先,我只是不明白为什么要实现它(在OpenSSL中已经实现了)。 But ok, I just have to. 但是好吧,我只需要。
  2. Should this implementation be encrypted? 是否应加密此实现? I guess no. 我觉得不是。

Also there are following 2 functions: 另外还有以下两个功能:

OSStatus
SSLWrite                    (SSLContextRef      context,
                             const void *       __nullable data,
                             size_t             dataLength,
                             size_t             *processed);

OSStatus
SSLRead                    (SSLContextRef       context,
                            void *              data,           
                            size_t              dataLength,
                            size_t          *processed);

And they are "Normal application-level read/write." 它们是“普通应用程序级别的读/写”。 according to code comments. 根据代码注释。 So why do I need to define those 2 callbacks for reading and writing then? 那么,为什么我需要定义那两个用于读取和写入的回调呢? And if first twos are callbacks which functions I should call for reading/writing in my code (when I really need to read some data from server)? 如果前两个是回调函数,则应该调用我的代码中的读/写功能(当我确实需要从服务器读取某些数据时)?

There are no good documentation and I got stuck with it all. 没有好的文档,我一无所获。 May be I'm just way too dump but little help would be just perfect anyway. 可能是我太弃用了,但几乎没有什么帮助是完美的。 Please help! 请帮忙!

SecureTransport is callback-based, unlike OpenSSL's SSL_read() and SSL_write() functions. 与OpenSSL的SSL_read()SSL_write()函数不同,SecureTransport是基于回调的。 This could require big changes to your code. 这可能需要对代码进行重大更改。 If you want a read / write -style API that can use SecureTransport for encryption, look at CFNetwork and specifically CFStream 如果您希望使用可以使用SecureTransport进行加密的read / write风格的API,请查看CFNetwork ,尤其是CFStream。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 苹果安全运输代码错误 - apple secure transport code error idVendor for apple.developer.driverkit.transport.usb - idVendor for apple.developer.driverkit.transport.usb 安全传输:从文件加载服务器证书 - Secure Transport: Load server certificate from file 确保向安全传输对等方提供完整的证书链 - Ensuring full certificate chains are provided to Secure Transport peers Secure Transport TLS如何与Swift中的BSD套接字一起使用? - How should Secure Transport TLS be used with BSD sockets in Swift? 错误:无法加载资源,因为“应用程序传输安全性”策略要求使用安全连接 - Error: The resource could not be loaded because the App Transport Security policy requires the use of a secure connection 具有真实证书的Ocj-C安全套接字服务器-SSL协议错误(基于GCDAsyncSockets) - Ocj-C Secure Sockets Server with real cert - SSL Protocol Error (GCDAsyncSockets based) 无法从服务器端连接到“ ssl://gateway.sandbox.push.apple.com:2195” - Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195' from server side 通过 Applescript 将 Apple Mail 附件添加到 Apple Notes - Apple Mail attachments to Apple Notes via Applescript 如何禁用脚本的App Transport Security? - How to disable App Transport Security for a script?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM