@@ -631,8 +631,43 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
631
631
* are finished. This allows one the option of sending a protocol dependent StartTLS message, and queuing
632
632
* the upgrade to TLS at the same time, without having to wait for the write to finish.
633
633
* Any reads or writes scheduled after this method is called will occur over the secured connection.
634
- *
635
- * The available keys are:
634
+ *
635
+ * ==== The available TOP-LEVEL KEYS are:
636
+ *
637
+ * - GCDAsyncSocketManuallyEvaluateTrust
638
+ * The value must be of type NSNumber, encapsulating a BOOL value.
639
+ * If you set this to YES, then the underlying SecureTransport system will not evaluate the SecTrustRef of the peer.
640
+ * Instead it will pause at the moment evaulation would typically occur,
641
+ * and allow us to handle the security evaluation however we see fit.
642
+ * So GCDAsyncSocket will invoke the delegate method socket:shouldTrustPeer: passing the SecTrustRef.
643
+ *
644
+ * Note that if you set this option, then all other configuration keys are ignored.
645
+ * Evaluation will be completely up to you during the socket:shouldTrustPeer: delegate method.
646
+ *
647
+ * For more information on trust evaluation see:
648
+ * Apple's Technical Note TN2232 - HTTPS Server Trust Evaluation
649
+ * https://developer.apple.com/library/ios/technotes/tn2232/_index.html
650
+ *
651
+ * If unspecified, the default value is NO.
652
+ *
653
+ * - GCDAsyncSocketUseCFStreamForTLS (iOS only)
654
+ * The value must be of type NSNumber, encapsulating a BOOL value.
655
+ * By default GCDAsyncSocket will use the SecureTransport layer to perform encryption.
656
+ * This gives us more control over the security protocol (many more configuration options),
657
+ * plus it allows us to optimize things like sys calls and buffer allocation.
658
+ *
659
+ * However, if you absolutely must, you can instruct GCDAsyncSocket to use the old-fashioned encryption
660
+ * technique by going through the CFStream instead. So instead of using SecureTransport, GCDAsyncSocket
661
+ * will instead setup a CFRead/CFWriteStream. And then set the kCFStreamPropertySSLSettings property
662
+ * (via CFReadStreamSetProperty / CFWriteStreamSetProperty) and will pass the given options to this method.
663
+ *
664
+ * Thus all the other keys in the given dictionary will be ignored by GCDAsyncSocket,
665
+ * and will passed directly CFReadStreamSetProperty / CFWriteStreamSetProperty.
666
+ * For more infomation on these keys, please see the documentation for kCFStreamPropertySSLSettings.
667
+ *
668
+ * If unspecified, the default value is NO.
669
+ *
670
+ * ==== The available CONFIGURATION KEYS are:
636
671
*
637
672
* - kCFStreamSSLPeerName
638
673
* The value must be of type NSString.
@@ -661,35 +696,36 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
661
696
* See the documentation for SSLSetProtocolVersionMin & SSLSetProtocolVersionMax.
662
697
* See also the SSLProtocol typedef.
663
698
*
664
- * - GCDAsyncSocketSSLDiffieHellmanParameters () [ Mac OS X only]
699
+ * - GCDAsyncSocketSSLDiffieHellmanParameters (Mac OS X only)
665
700
*
666
- * The following keys are NOT available (and with throw an exception):
701
+ * ==== The following UNAVAILABLE KEYS are: ( with throw an exception)
667
702
*
668
703
* - kCFStreamSSLAllowsAnyRoot (UNAVAILABLE)
669
- * You MUST use manualTrustEvaluation .
704
+ * You MUST use manual trust evaluation instead (see GCDAsyncSocketManuallyEvaluateTrust) .
670
705
* Corresponding deprecated method: SSLSetAllowsAnyRoot
671
706
*
672
707
* - kCFStreamSSLAllowsExpiredRoots (UNAVAILABLE)
673
- * You MUST use manualTrustEvaluation .
708
+ * You MUST use manual trust evaluation instead (see GCDAsyncSocketManuallyEvaluateTrust) .
674
709
* Corresponding deprecated method: SSLSetAllowsExpiredRoots
675
710
*
676
711
* - kCFStreamSSLAllowsExpiredCertificates (UNAVAILABLE)
677
- * You MUST use manualTrustEvaluation .
712
+ * You MUST use manual trust evaluation instead (see GCDAsyncSocketManuallyEvaluateTrust) .
678
713
* Corresponding deprecated method: SSLSetAllowsExpiredCerts
679
714
*
680
715
* - kCFStreamSSLValidatesCertificateChain (UNAVAILABLE)
681
- * You MUST use manualTrustEvaluation .
716
+ * You MUST use manual trust evaluation instead (see GCDAsyncSocketManuallyEvaluateTrust) .
682
717
* Corresponding deprecated method: SSLSetEnableCertVerify
683
718
*
684
719
* - kCFStreamSSLLevel (UNAVAILABLE)
685
- * You MUST use GCDAsyncSocketSSLProtocolVersionMin / Max instead.
720
+ * You MUST use GCDAsyncSocketSSLProtocolVersionMin & GCDAsyncSocketSSLProtocolVersionMin instead.
686
721
* Corresponding deprecated method: SSLSetProtocolVersionEnabled
687
722
*
688
723
*
689
724
* Please refer to Apple's documentation for corresponding SSLFunctions.
690
- *
725
+ *
691
726
* If you pass in nil or an empty dictionary, the default settings will be used.
692
727
*
728
+ * IMPORTANT SECURITY NOTE:
693
729
* The default settings will check to make sure the remote party's certificate is signed by a
694
730
* trusted 3rd party certificate agency (e.g. verisign) and that the certificate is not expired.
695
731
* However it will not verify the name on the certificate unless you
@@ -702,7 +738,7 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
702
738
* To properly secure your connection in this particular scenario you
703
739
* should set the kCFStreamSSLPeerName property to "MySecureServer.com".
704
740
*
705
- * You can also perform additional validation via the certificate provided in socketDidSecure.
741
+ * You can also perform additional validation in socketDidSecure.
706
742
**/
707
743
- (void )startTLS : (NSDictionary *)tlsSettings ;
708
744
0 commit comments