         if options.useTLS {
             input.setProperty(options.securityLevel, forKey: .socketSecurityLevelKey)
             output.setProperty(options.securityLevel, forKey: .socketSecurityLevelKey)
+        }
+        
+        if options.allowUntrustCACertificate {
+            input.setProperty(false, forKey: kCFStreamSSLValidatesCertificateChain as Stream.PropertyKey)
+            output.setProperty(false, forKey: kCFStreamSSLValidatesCertificateChain as Stream.PropertyKey)
         }
         
         input.setProperty(options.networkServiceType, forKey: .networkServiceType)

        public var pingInterval: UInt16 = 10
        public var useTLS = false
        public var securityLevel = StreamSocketSecurityLevel.tlSv1
        public var networkServiceType = StreamNetworkServiceTypeValue.background
        public var username: String? = nil
        public var password: String? = nil

            return result
        }

        public init(port: Int? = nil, pingInterval: UInt16 = 10, useTLS: Bool = false, securityLevel: StreamSocketSecurityLevel = StreamSocketSecurityLevel.tlSv1, allowUntrustCACertificate: Bool = false, networkServiceType: StreamNetworkServiceTypeValue = StreamNetworkServiceTypeValue.background, username: String? = nil, password: String? = nil, clientId: String? = nil, bufferSize: Int = 4096, readQosClass: DispatchQoS.QoSClass = .background) {
            self.port = port
            self.pingInterval = pingInterval
            self.useTLS = useTLS
            self.securityLevel = securityLevel
            self.allowUntrustCACertificate = allowUntrustCACertificate
            self.networkServiceType = networkServiceType
            self.username = username
            self.password = password
