Reputation: 234
Can someone please explain difference between these 2 properties? They accept same set of values defined in https://developer.apple.com/documentation/corefoundation/cfstream/cfstream_socket_security_level_constants
kCFStreamSSLLevel
is set in kCFStreamPropertySSLSettings
dictionary and kCFStreamPropertySocketSecurityLevel
directly.
Documentation doesn't say much about any of them.
Upvotes: 2
Views: 238
Reputation: 132869
Looking at the source code, setting the property kCFStreamPropertySocketSecurityLevel
internally just creates a dictionary where the property value is stored for the key kCFStreamSSLLevel
and the created dictionary is passed to a function that is also called when the property kCFStreamPropertySSLSettings
is set.
So this code:
CFReadStreamSetProperty(
stream,
kCFStreamPropertySocketSecurityLevel,
kCFStreamSocketSecurityLevelNegotiatedSSL);
is equivalent to this code
CFMutableDictionaryRef settings =
CFDictionaryCreateMutable(
NULL, 0,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
CFDictionaryAddValue(
settings,
kCFStreamSSLLevel,
kCFStreamSocketSecurityLevelNegotiatedSSL);
CFReadStreamSetProperty(
stream,
kCFStreamPropertySSLSettings,
settings);
Upvotes: 0