Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/cryptography/hazmat/primitives/serialization/base.py: 43%
21 statements
« prev ^ index » next coverage.py v7.0.1, created at 2022-12-25 06:11 +0000
« prev ^ index » next coverage.py v7.0.1, created at 2022-12-25 06:11 +0000
1# This file is dual licensed under the terms of the Apache License, Version
2# 2.0, and the BSD License. See the LICENSE file in the root of this repository
3# for complete details.
6import typing
8from cryptography.hazmat.primitives.asymmetric import dh
9from cryptography.hazmat.primitives.asymmetric.types import (
10 PRIVATE_KEY_TYPES,
11 PUBLIC_KEY_TYPES,
12)
15def load_pem_private_key(
16 data: bytes,
17 password: typing.Optional[bytes],
18 backend: typing.Any = None,
19) -> PRIVATE_KEY_TYPES:
20 from cryptography.hazmat.backends.openssl.backend import backend as ossl
22 return ossl.load_pem_private_key(data, password)
25def load_pem_public_key(
26 data: bytes, backend: typing.Any = None
27) -> PUBLIC_KEY_TYPES:
28 from cryptography.hazmat.backends.openssl.backend import backend as ossl
30 return ossl.load_pem_public_key(data)
33def load_pem_parameters(
34 data: bytes, backend: typing.Any = None
35) -> "dh.DHParameters":
36 from cryptography.hazmat.backends.openssl.backend import backend as ossl
38 return ossl.load_pem_parameters(data)
41def load_der_private_key(
42 data: bytes,
43 password: typing.Optional[bytes],
44 backend: typing.Any = None,
45) -> PRIVATE_KEY_TYPES:
46 from cryptography.hazmat.backends.openssl.backend import backend as ossl
48 return ossl.load_der_private_key(data, password)
51def load_der_public_key(
52 data: bytes, backend: typing.Any = None
53) -> PUBLIC_KEY_TYPES:
54 from cryptography.hazmat.backends.openssl.backend import backend as ossl
56 return ossl.load_der_public_key(data)
59def load_der_parameters(
60 data: bytes, backend: typing.Any = None
61) -> "dh.DHParameters":
62 from cryptography.hazmat.backends.openssl.backend import backend as ossl
64 return ossl.load_der_parameters(data)