File: oscrypto.md

package info (click to toggle)
oscrypto 1.3.0-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,164 kB
  • sloc: python: 22,115; makefile: 7
file content (55 lines) | stat: -rw-r--r-- 2,000 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# oscrypto API Documentation

The *oscrypto* module provides functions to obtain information about the
backend being used, and allows a custom version of OpenSSL to be used on any
platform. *These functions are rarely necessary. Using the `backend()` function
for non-debugging purposes is likely a sign tight-coupling.*

 - [`backend()`](#backend-function)
 - [`use_openssl()`](#use_openssl-function)

### `backend()` function

> ```python
> def backend():
>     """
>     :return:
>         A unicode string of the backend being used: "openssl", "mac", "win",
>         "winlegacy"
>     """
> ```

### `use_openssl()` function

> ```python
> def use_openssl(libcrypto_path, libssl_path, trust_list_path=None):
>     """
>     :param libcrypto_path:
>         A unicode string of the file path to the OpenSSL/LibreSSL libcrypto
>         dynamic library.
>
>     :param libssl_path:
>         A unicode string of the file path to the OpenSSL/LibreSSL libssl
>         dynamic library.
>
>     :param trust_list_path:
>         An optional unicode string of the path to a file containing
>         OpenSSL-compatible CA certificates in PEM format. If this is not
>         provided and the platform is OS X or Windows, the system trust roots
>         will be exported from the OS and used for all TLS connections.
>
>     :raises:
>         ValueError - when one of the paths is not a unicode string
>         OSError - when the trust_list_path does not exist on the filesystem
>         oscrypto.errors.LibraryNotFoundError - when one of the path does not exist on the filesystem
>         RuntimeError - when this function is called after another part of oscrypto has been imported
>     """
> ```
>
> Forces using OpenSSL dynamic libraries on OS X (.dylib) or Windows (.dll),
> or using a specific dynamic library on Linux/BSD (.so).
>
> This can also be used to configure oscrypto to use LibreSSL dynamic
> libraries.
>
> This method must be called before any oscrypto submodules are imported.