Debian Codegraph @

doc/api/crypto.rst

raw
1 .. _openssl-crypto:
2
3 :py:mod:`crypto` --- Generic cryptographic module
4 =================================================
5
6 .. py:module:: OpenSSL.crypto
7 :synopsis: Generic cryptographic module
8
9 .. danger::
10
11 **This module is pending deprecation, use pyca/cryptography instead.**
12
13 `pyca/cryptography`_ is likely a better choice than using this module.
14 It contains a complete set of cryptographic primitives as well as a significantly better and more powerful X509 API.
15 If necessary you can convert to and from cryptography objects using the ``to_cryptography`` and ``from_cryptography`` methods on ``X509``, ``CRL``, and ``PKey``.
16
17
18 Elliptic curves
19 ---------------
20
21 .. autofunction:: get_elliptic_curves
22
23 .. autofunction:: get_elliptic_curve
24
25 Serialization and deserialization
26 ---------------------------------
27
28 The following serialization functions take one of these constants to determine the format.
29
30 .. py:data:: FILETYPE_PEM
31
32 :data:`FILETYPE_PEM` serializes data to a Base64-encoded encoded representation of the underlying ASN.1 data structure. This representation includes delimiters that define what data structure is contained within the Base64-encoded block: for example, for a certificate, the delimiters are ``-----BEGIN CERTIFICATE-----`` and ``-----END CERTIFICATE-----``.
33
34 .. py:data:: FILETYPE_ASN1
35
36 :data:`FILETYPE_ASN1` serializes data to the underlying ASN.1 data structure. The format used by :data:`FILETYPE_ASN1` is also sometimes referred to as DER.
37
38 Certificates
39 ~~~~~~~~~~~~
40
41 .. autofunction:: dump_certificate
42
43 .. autofunction:: load_certificate
44
45 Private keys
46 ~~~~~~~~~~~~
47
48 .. autofunction:: dump_privatekey
49
50 .. autofunction:: load_privatekey
51
52 Public keys
53 ~~~~~~~~~~~
54
55 .. autofunction:: dump_publickey
56
57 .. autofunction:: load_publickey
58
59
60 .. _openssl-x509:
61
62 X509 objects
63 ------------
64
65 .. autoclass:: X509
66 :members:
67
68 .. _openssl-x509name:
69
70 X509Name objects
71 ----------------
72
73 .. autoclass:: X509Name
74 :members:
75 :special-members:
76 :exclude-members: __repr__, __getattr__, __weakref__
77
78 .. _openssl-x509store:
79
80 X509Store objects
81 -----------------
82
83 .. autoclass:: X509Store
84 :members:
85
86 .. _openssl-x509storecontexterror:
87
88 X509StoreContextError objects
89 -----------------------------
90
91 .. autoclass:: X509StoreContextError
92 :members:
93
94 .. _openssl-x509storecontext:
95
96 X509StoreContext objects
97 ------------------------
98
99 .. autoclass:: X509StoreContext
100 :members:
101
102 .. _openssl-pkey:
103
104 X509StoreFlags constants
105 ------------------------
106
107 .. autoclass:: X509StoreFlags
108
109 .. data:: CRL_CHECK
110 .. data:: CRL_CHECK_ALL
111 .. data:: IGNORE_CRITICAL
112 .. data:: X509_STRICT
113 .. data:: ALLOW_PROXY_CERTS
114 .. data:: POLICY_CHECK
115 .. data:: EXPLICIT_POLICY
116 .. data:: INHIBIT_MAP
117 .. data:: NOTIFY_POLICY
118 .. data:: CHECK_SS_SIGNATURE
119 .. data:: PARTIAL_CHAIN
120
121 .. _openssl-x509storeflags:
122
123 PKey objects
124 ------------
125
126 .. autoclass:: PKey
127 :members:
128
129 .. py:data:: TYPE_RSA
130 TYPE_DSA
131
132 Key type constants.
133
134 Exceptions
135 ----------
136
137 .. py:exception:: Error
138
139 Generic exception used in the :py:mod:`.crypto` module.
140
141
142 Digest names
143 ------------
144
145 Several of the functions and methods in this module take a digest name.
146 These must be strings describing a digest algorithm supported by OpenSSL (by ``EVP_get_digestbyname``, specifically).
147 For example, :const:`b"sha256"` or :const:`b"sha384"`.
148
149 More information and a list of these digest names can be found in the ``EVP_DigestInit(3)`` man page of your OpenSSL installation.
150 This page can be found online for the latest version of OpenSSL:
151 https://www.openssl.org/docs/manmaster/man3/EVP_DigestInit.html
152
153 .. _`pyca/cryptography`: https://cryptography.io