2 class IntegrationHelper:
5 username=None, password=None, sharedKey=None,
6 certChain=None, privateKey=None,
7 cryptoID=None, protocol=None,
9 x509TrustList=None, x509CommonName=None,
16 self.privateKey = None
20 if username and password and not \
21 (sharedKey or certChain or privateKey):
22 self.username = username
23 self.password = password
25 #Shared Key Authentication
26 elif username and sharedKey and not \
27 (password or certChain or privateKey):
28 self.username = username
29 self.sharedKey = sharedKey
31 #Certificate Chain Authentication
32 elif certChain and privateKey and not \
33 (username or password or sharedKey):
34 self.certChain = certChain
35 self.privateKey = privateKey
38 elif not password and not username and not \
39 sharedKey and not certChain and not privateKey:
43 raise ValueError("Bad parameters")
45 #Authenticate the server based on its cryptoID or fingerprint
46 if sharedKey and (cryptoID or protocol or x509Fingerprint):
47 raise ValueError("Can't use shared keys with other forms of"\
50 self.checker = Checker(cryptoID, protocol, x509Fingerprint,
51 x509TrustList, x509CommonName)
52 self.settings = settings