Sybren A. Stüvel | d92b667 | 2011-07-31 17:44:44 +0200 | [diff] [blame] | 1 | Reference |
| 2 | ================================================== |
| 3 | |
Sybren A. Stüvel | dbea213 | 2011-08-03 13:31:57 +0200 | [diff] [blame] | 4 | This is the class and function reference. For more usage information |
| 5 | see the :ref:`usage` page. |
| 6 | |
Sybren A. Stüvel | d92b667 | 2011-07-31 17:44:44 +0200 | [diff] [blame] | 7 | Functions |
| 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üvel | c1c455d | 2011-08-01 23:04:30 +0200 | [diff] [blame] | 20 | |
Sybren A. Stüvel | d92b667 | 2011-07-31 17:44:44 +0200 | [diff] [blame] | 21 | Classes |
| 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üvel | 1f011e1 | 2011-07-31 19:20:46 +0200 | [diff] [blame] | 32 | Exceptions |
| 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üvel | d92b667 | 2011-07-31 17:44:44 +0200 | [diff] [blame] | 41 | |
Sybren A. Stüvel | c1c455d | 2011-08-01 23:04:30 +0200 | [diff] [blame] | 42 | .. index:: VARBLOCK (file format) |
| 43 | |
Sybren A. Stüvel | dbea213 | 2011-08-03 13:31:57 +0200 | [diff] [blame] | 44 | Module: rsa.bigfile |
Sybren A. Stüvel | c1c455d | 2011-08-01 23:04:30 +0200 | [diff] [blame] | 45 | -------------------------------------------------- |
| 46 | |
Sybren A. Stüvel | dbea213 | 2011-08-03 13:31:57 +0200 | [diff] [blame] | 47 | The :py:mod:`rsa.bigfile` module contains functions for encrypting and |
| 48 | decrypting 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 | |
| 57 | The VARBLOCK file format |
| 58 | ++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 59 | |
Sybren A. Stüvel | c1c455d | 2011-08-01 23:04:30 +0200 | [diff] [blame] | 60 | The VARBLOCK file format allows us to encrypt files that are larger |
| 61 | than the RSA key. The format is as follows; || denotes byte string |
| 62 | concatenation:: |
| 63 | |
| 64 | VARBLOCK := VERSION || BLOCK || BLOCK || ... |
| 65 | |
| 66 | VERSION := 1 |
| 67 | |
| 68 | BLOCK := LENGTH || DATA |
| 69 | |
Sybren A. Stüvel | dbea213 | 2011-08-03 13:31:57 +0200 | [diff] [blame] | 70 | LENGTH := varint-encoded length of the following data, in bytes |
Sybren A. Stüvel | c1c455d | 2011-08-01 23:04:30 +0200 | [diff] [blame] | 71 | |
| 72 | DATA := the data to store in the block |
| 73 | |
| 74 | The varint-format was taken from Google's Protobuf_, and allows us to |
| 75 | efficiently encode an arbitrarily long integer. |
| 76 | |
| 77 | .. _Protobuf: |
| 78 | http://code.google.com/apis/protocolbuffers/docs/encoding.html#varints |
Sybren A. Stüvel | d92b667 | 2011-07-31 17:44:44 +0200 | [diff] [blame] | 79 | |
Sybren A. Stüvel | dbea213 | 2011-08-03 13:31:57 +0200 | [diff] [blame] | 80 | |
| 81 | Module: rsa.core |
| 82 | -------------------------------------------------- |
| 83 | |
| 84 | At the core of the RSA encryption method lie these functions. They |
| 85 | both operate on (arbitrarily long) integers only. They probably aren't |
| 86 | of much use to you, but I wanted to document them anyway as they are |
| 87 | the core of the entire library. |
| 88 | |
| 89 | .. autofunction:: rsa.core.encrypt_int |
| 90 | |
| 91 | .. autofunction:: rsa.core.decrypt_int |
| 92 | |