Conditions | 3 |
Total Lines | 10 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | from asyncua.crypto import uacrypto |
||
12 | async def trust_certificate(self, certificate_path: str, format: str = None, label: str = None, |
||
13 | user_role=UserRole.User): |
||
14 | certificate = await uacrypto.load_certificate(certificate_path, format) |
||
15 | if label is None: |
||
16 | label = certificate_path |
||
17 | user = User(role=user_role, name=label) |
||
18 | if label in self._trusted_certificates: |
||
19 | logging.warning(f"certificate with label {label} " |
||
20 | f"attempted to be added multiple times, only the last version will be kept.") |
||
21 | self._trusted_certificates[label] = {'certificate': uacrypto.der_from_x509(certificate), 'user':user} |
||
22 | |||
38 |