Coverage for /home/martinb/.local/share/virtualenvs/camcops/lib/python3.6/site-packages/cryptography/hazmat/primitives/serialization/base.py : 45%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
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._types import (
9 _PRIVATE_KEY_TYPES,
10 _PUBLIC_KEY_TYPES,
11)
12from cryptography.hazmat.backends import _get_backend
13from cryptography.hazmat.primitives.asymmetric import dh
16def load_pem_private_key(
17 data: bytes, password: typing.Optional[bytes], backend=None
18) -> _PRIVATE_KEY_TYPES:
19 backend = _get_backend(backend)
20 return backend.load_pem_private_key(data, password)
23def load_pem_public_key(data: bytes, backend=None) -> _PUBLIC_KEY_TYPES:
24 backend = _get_backend(backend)
25 return backend.load_pem_public_key(data)
28def load_pem_parameters(data: bytes, backend=None) -> "dh.DHParameters":
29 backend = _get_backend(backend)
30 return backend.load_pem_parameters(data)
33def load_der_private_key(
34 data: bytes, password: typing.Optional[bytes], backend=None
35) -> _PRIVATE_KEY_TYPES:
36 backend = _get_backend(backend)
37 return backend.load_der_private_key(data, password)
40def load_der_public_key(data: bytes, backend=None) -> _PUBLIC_KEY_TYPES:
41 backend = _get_backend(backend)
42 return backend.load_der_public_key(data)
45def load_der_parameters(data: bytes, backend=None) -> "dh.DHParameters":
46 backend = _get_backend(backend)
47 return backend.load_der_parameters(data)