Check if the cryptography module is present, and if it supports X25519, ChaCha20Poly1305 and such. Notes: - cryptography >= 2.0 is required - OpenSSL >= 1.1.0 is required
()
| 756 | |
| 757 | |
| 758 | def isCryptographyAdvanced(): |
| 759 | # type: () -> bool |
| 760 | """ |
| 761 | Check if the cryptography module is present, and if it supports X25519, |
| 762 | ChaCha20Poly1305 and such. |
| 763 | |
| 764 | Notes: |
| 765 | - cryptography >= 2.0 is required |
| 766 | - OpenSSL >= 1.1.0 is required |
| 767 | """ |
| 768 | try: |
| 769 | from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey # noqa: E501 |
| 770 | X25519PrivateKey.generate() |
| 771 | except Exception: |
| 772 | return False |
| 773 | else: |
| 774 | return True |
| 775 | |
| 776 | |
| 777 | def isCryptographyBackendCompatible() -> bool: |