def open_secure_channel(self, algohdr, seqhdr, body): request = struct_from_binary(ua.OpenSecureChannelRequest, body) self._connection.select_policy( algohdr.SecurityPolicyURI, algohdr.SenderCertificate, request.Parameters.SecurityMode) channel = self._connection.open(request.Parameters, self.iserver) # send response response = ua.OpenSecureChannelResponse() response.Parameters = channel self.send_response(request.RequestHeader.RequestHandle, seqhdr, response, ua.MessageType.SecureOpen)
def open_secure_channel(self, algohdr, seqhdr, body): request = struct_from_binary(ua.OpenSecureChannelRequest, body) if not self._connection.is_open(): # Only call select_policy if the channel isn't open. Otherwise # it will break the Secure channel renewal. self._connection.select_policy(algohdr.SecurityPolicyURI, algohdr.SenderCertificate, request.Parameters.SecurityMode) channel = self._connection.open(request.Parameters, self.iserver) # send response response = ua.OpenSecureChannelResponse() response.Parameters = channel self.send_response(request.RequestHeader.RequestHandle, seqhdr, response, ua.MessageType.SecureOpen)