summaryrefslogtreecommitdiff
path: root/doc/reference.rst
blob: a1a7d3576510d4c5637b79f79e4d6b2248437246 (plain)
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
56
57
58
59
60
61
62
63
64
65
66
67
Reference
==================================================

Functions
--------------------------------------------------

.. autofunction:: rsa.encrypt

.. autofunction:: rsa.decrypt

.. autofunction:: rsa.sign

.. autofunction:: rsa.verify

.. autofunction:: rsa.newkeys(keysize)

.. autofunction:: rsa.bigfile.encrypt_bigfile

.. autofunction:: rsa.bigfile.decrypt_bigfile


Classes
--------------------------------------------------

.. autoclass:: rsa.PublicKey
    :members:
    :inherited-members:

.. autoclass:: rsa.PrivateKey
    :members:
    :inherited-members:

Exceptions
--------------------------------------------------

.. autoclass:: rsa.pkcs1.CryptoError(Exception)

.. autoclass:: rsa.pkcs1.DecryptionError(CryptoError)

.. autoclass:: rsa.pkcs1.VerificationError(CryptoError)


.. index:: VARBLOCK (file format)

The VARBLOCK file format
--------------------------------------------------

The VARBLOCK file format allows us to encrypt files that are larger
than the RSA key. The format is as follows; || denotes byte string
concatenation::

 VARBLOCK := VERSION || BLOCK || BLOCK || ...

 VERSION := 1

 BLOCK := LENGTH || DATA

 LENGTH := varint-encoded length of the followng data, in bytes

 DATA := the data to store in the block

The varint-format was taken from Google's Protobuf_, and allows us to
efficiently encode an arbitrarily long integer.

.. _Protobuf:
    http://code.google.com/apis/protocolbuffers/docs/encoding.html#varints