[英]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
. 我正在使用安全传输 ,但对以下功能有些困惑: SSLSetIOFuncs
, SSLWrite
和SSLRead
。
So SSLSetIOFuncs
sets callbacks that perform writing/reading operations (which I should implement). 因此SSLSetIOFuncs
设置执行写/读操作(我应该实现)的回调。 And a lot of questions appear at this point: 此时出现了许多问题:
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.