blob: d80416a91a79bbba4840a12ceea8588e969bff0a [file] [log] [blame]
Sybren A. Stüveld92b6672011-07-31 17:44:44 +02001Reference
2==================================================
3
Sybren A. Stüveldbea2132011-08-03 13:31:57 +02004This is the class and function reference. For more usage information
5see the :ref:`usage` page.
6
Sybren A. Stüveld92b6672011-07-31 17:44:44 +02007Functions
8--------------------------------------------------
9
10.. autofunction:: rsa.encrypt
11
12.. autofunction:: rsa.decrypt
13
14.. autofunction:: rsa.sign
15
16.. autofunction:: rsa.verify
17
18.. autofunction:: rsa.newkeys(keysize)
19
Sybren A. Stüvelc1c455d2011-08-01 23:04:30 +020020
Sybren A. Stüveld92b6672011-07-31 17:44:44 +020021Classes
22--------------------------------------------------
23
24.. autoclass:: rsa.PublicKey
25 :members:
26 :inherited-members:
27
28.. autoclass:: rsa.PrivateKey
29 :members:
30 :inherited-members:
31
Sybren A. Stüvel1f011e12011-07-31 19:20:46 +020032Exceptions
33--------------------------------------------------
34
35.. autoclass:: rsa.pkcs1.CryptoError(Exception)
36
37.. autoclass:: rsa.pkcs1.DecryptionError(CryptoError)
38
39.. autoclass:: rsa.pkcs1.VerificationError(CryptoError)
40
Sybren A. Stüveld92b6672011-07-31 17:44:44 +020041
Sybren A. Stüvelc1c455d2011-08-01 23:04:30 +020042.. index:: VARBLOCK (file format)
43
Sybren A. Stüveldbea2132011-08-03 13:31:57 +020044Module: rsa.bigfile
Sybren A. Stüvelc1c455d2011-08-01 23:04:30 +020045--------------------------------------------------
46
Sybren A. Stüvel1681a0b2016-01-22 13:54:52 +010047.. warning::
48
49 The :py:mod:`rsa.bigfile` module is NOT recommended for general use, has been
50 deprecated since Python-RSA 3.4, and will be removed in a future release. It's
51 vulnerable to a number of attacks. See :ref:`bigfiles` for more information.
52
Sybren A. Stüveldbea2132011-08-03 13:31:57 +020053The :py:mod:`rsa.bigfile` module contains functions for encrypting and
54decrypting files that are larger than the RSA key. See
55:ref:`bigfiles` for more information.
56
57.. autofunction:: rsa.bigfile.encrypt_bigfile
58
59.. autofunction:: rsa.bigfile.decrypt_bigfile
60
61.. _VARBLOCK:
62
63The VARBLOCK file format
64++++++++++++++++++++++++++++++++++++++++++++++++++
65
Sybren A. Stüvel1681a0b2016-01-22 13:54:52 +010066.. warning::
67
68 The VARBLOCK format is NOT recommended for general use, has been deprecated since
69 Python-RSA 3.4, and will be removed in a future release. It's vulnerable to a
70 number of attacks. See :ref:`bigfiles` for more information.
71
Sybren A. Stüvelc1c455d2011-08-01 23:04:30 +020072The VARBLOCK file format allows us to encrypt files that are larger
73than the RSA key. The format is as follows; || denotes byte string
74concatenation::
75
76 VARBLOCK := VERSION || BLOCK || BLOCK || ...
77
78 VERSION := 1
79
80 BLOCK := LENGTH || DATA
81
Sybren A. Stüveldbea2132011-08-03 13:31:57 +020082 LENGTH := varint-encoded length of the following data, in bytes
Sybren A. Stüvelc1c455d2011-08-01 23:04:30 +020083
84 DATA := the data to store in the block
85
86The varint-format was taken from Google's Protobuf_, and allows us to
87efficiently encode an arbitrarily long integer.
88
89.. _Protobuf:
90 http://code.google.com/apis/protocolbuffers/docs/encoding.html#varints
Sybren A. Stüveld92b6672011-07-31 17:44:44 +020091
Sybren A. Stüveldbea2132011-08-03 13:31:57 +020092
93Module: rsa.core
94--------------------------------------------------
95
96At the core of the RSA encryption method lie these functions. They
97both operate on (arbitrarily long) integers only. They probably aren't
98of much use to you, but I wanted to document them anyway as they are
99the core of the entire library.
100
101.. autofunction:: rsa.core.encrypt_int
102
103.. autofunction:: rsa.core.decrypt_int
104