Set SecureConnection mode. String format: Policy,Mode,certificate,private_key[,server_private_key] where Policy is Basic128Rsa15, Basic256 or Basic256Sha256, Mode is Sign or SignAndEncrypt certificate, private_key and server_private_key are
(self, string)
| 172 | self._password = pwd |
| 173 | |
| 174 | def set_security_string(self, string): |
| 175 | """ |
| 176 | Set SecureConnection mode. String format: |
| 177 | Policy,Mode,certificate,private_key[,server_private_key] |
| 178 | where Policy is Basic128Rsa15, Basic256 or Basic256Sha256, |
| 179 | Mode is Sign or SignAndEncrypt |
| 180 | certificate, private_key and server_private_key are |
| 181 | paths to .pem or .der files |
| 182 | Call this before connect() |
| 183 | """ |
| 184 | if not string: |
| 185 | return |
| 186 | parts = string.split(',') |
| 187 | if len(parts) < 4: |
| 188 | raise ua.UaError('Wrong format: `{0}`, expected at least 4 comma-separated values'.format(string)) |
| 189 | policy_class = getattr(security_policies, 'SecurityPolicy' + parts[0]) |
| 190 | mode = getattr(ua.MessageSecurityMode, parts[1]) |
| 191 | return self.set_security(policy_class, parts[2], parts[3], |
| 192 | parts[4] if len(parts) >= 5 else None, mode) |
| 193 | |
| 194 | def set_security(self, policy, certificate_path, private_key_path, |
| 195 | server_certificate_path=None, |