Пример #1
0
 def set_security(self, policy, certificate_path, private_key_path,
                  server_certificate_path=None,
                  mode=ua.MessageSecurityMode.SignAndEncrypt):
     """
     Set SecureConnection mode.
     Call this before connect()
     """
     if server_certificate_path is None:
         # load certificate from server's list of endpoints
         endpoints = self.connect_and_get_server_endpoints()
         endpoint = Client.find_endpoint(endpoints, mode, policy.URI)
         server_cert = uacrypto.x509_from_der(endpoint.ServerCertificate)
     else:
         server_cert = uacrypto.load_certificate(server_certificate_path)
     cert = uacrypto.load_certificate(certificate_path)
     pk = uacrypto.load_private_key(private_key_path)
     self.security_policy = policy(server_cert, cert, pk, mode)
     self.bclient.set_security(self.security_policy)
Пример #2
0
 def set_security(self, policy, certificate_path, private_key_path,
                  server_certificate_path=None,
                  mode=ua.MessageSecurityMode.SignAndEncrypt):
     """
     Set SecureConnection mode.
     Call this before connect()
     """
     if server_certificate_path is None:
         # load certificate from server's list of endpoints
         endpoints = self.connect_and_get_server_endpoints()
         endpoint = Client.find_endpoint(endpoints, mode, policy.URI)
         server_cert = uacrypto.x509_from_der(endpoint.ServerCertificate)
     else:
         server_cert = uacrypto.load_certificate(server_certificate_path)
     cert = uacrypto.load_certificate(certificate_path)
     pk = uacrypto.load_private_key(private_key_path)
     self.security_policy = policy(server_cert, cert, pk, mode)
     self.uaclient.set_security(self.security_policy)
Пример #3
0
 def load_client_certificate(self, path):
     """
     load our certificate from file, either pem or der
     """
     self.user_certificate = uacrypto.load_certificate(path)
Пример #4
0
 def load_certificate(self, path):
     """
     load server certificate from file, either pem or der
     """
     self.certificate = uacrypto.load_certificate(path)
Пример #5
0
 def load_certificate(self, path):
     """
     load server certificate from file, either pem or der
     """
     self.certificate = uacrypto.load_certificate(path)
Пример #6
0
 def load_client_certificate(self, path):
     """
     load our certificate from file, either pem or der
     """
     self.user_certificate = uacrypto.load_certificate(path)