blob: 53dee63f2132431993d59e499219a9cd011433d2 [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üveldbea2132011-08-03 13:31:57 +020047The :py:mod:`rsa.bigfile` module contains functions for encrypting and
48decrypting files that are larger than the RSA key. See
49:ref:`bigfiles` for more information.
50
51.. autofunction:: rsa.bigfile.encrypt_bigfile
52
53.. autofunction:: rsa.bigfile.decrypt_bigfile
54
55.. _VARBLOCK:
56
57The VARBLOCK file format
58++++++++++++++++++++++++++++++++++++++++++++++++++
59
Sybren A. Stüvelc1c455d2011-08-01 23:04:30 +020060The VARBLOCK file format allows us to encrypt files that are larger
61than the RSA key. The format is as follows; || denotes byte string
62concatenation::
63
64 VARBLOCK := VERSION || BLOCK || BLOCK || ...
65
66 VERSION := 1
67
68 BLOCK := LENGTH || DATA
69
Sybren A. Stüveldbea2132011-08-03 13:31:57 +020070 LENGTH := varint-encoded length of the following data, in bytes
Sybren A. Stüvelc1c455d2011-08-01 23:04:30 +020071
72 DATA := the data to store in the block
73
74The varint-format was taken from Google's Protobuf_, and allows us to
75efficiently encode an arbitrarily long integer.
76
77.. _Protobuf:
78 http://code.google.com/apis/protocolbuffers/docs/encoding.html#varints
Sybren A. Stüveld92b6672011-07-31 17:44:44 +020079
Sybren A. Stüveldbea2132011-08-03 13:31:57 +020080
81Module: rsa.core
82--------------------------------------------------
83
84At the core of the RSA encryption method lie these functions. They
85both operate on (arbitrarily long) integers only. They probably aren't
86of much use to you, but I wanted to document them anyway as they are
87the core of the entire library.
88
89.. autofunction:: rsa.core.encrypt_int
90
91.. autofunction:: rsa.core.decrypt_int
92