blob: d62aa101d04eed8acc11fb9375dea4f06efb86c1 [file] [log] [blame]
Alex Stapleton940eee22014-02-05 20:25:30 +00001.. hazmat::
2
3RSA
4===
5
6.. currentmodule:: cryptography.hazmat.primitives.asymmetric.rsa
7
8`RSA`_ is a `public-key`_ algorithm for encrypting and signing messages.
9
10.. class:: RSAPrivateKey(p, q, private_exponent, public_exponent, modulus)
11
12 .. versionadded:: 0.2
13
14 An RSA private key is required for decryption and signing of messages.
15
16 Normally you do not need to directly construct private keys because you'll
17 be loading them from a file or generating them automatically.
18
Alex Stapletonbe5da2d2014-02-07 08:15:39 +000019 .. warning::
20 This method only checks a limited set of properties of its arguments.
21 Using an RSA that you do not trust or with incorrect parameters may
22 lead to insecure operation, crashes, and other undefined behavior. We
23 recommend that you only ever load private keys that were generated with
24 software you trust.
25
Alex Stapleton940eee22014-02-05 20:25:30 +000026 This class conforms to the
27 :class:`~cryptography.hazmat.primitives.interfaces.RSAPrivateKey`
28 interface.
29
30 :raises TypeError: This is raised when the arguments are not all integers.
31
Alex Stapleton4eaab172014-02-06 21:06:18 +000032 :raises ValueError: This is raised when the values of `p`, `q`,
33 `private_exponent`, `public_exponent` or `modulus` do
34 not match the bounds specified in `RFC 3447`_.
Alex Stapleton940eee22014-02-05 20:25:30 +000035
36.. class:: RSAPublicKey(public_exponent, modulus)
37
38 .. versionadded:: 0.2
39
40 An RSA public key is required for encryption and verification of messages.
41
42 Normally you do not need to directly construct public keys because you'll
43 be loading them from a file, generating them automatically or receiving
44 them from a 3rd party.
45
46 This class conforms to the
47 :class:`~cryptography.hazmat.primitives.interfaces.RSAPublicKey`
48 interface.
49
50 :raises TypeError: This is raised when the arguments are not all integers.
51
52 :raises ValueError: This is raised when the values of `public_exponent` or
53 `modulus` do not match the bounds specified in
54 `RFC 3447`_
55
56.. _`RSA`: https://en.wikipedia.org/wiki/RSA_(cryptosystem)
57.. _`public-key`: https://en.wikipedia.org/wiki/Public-key_cryptography
58.. _`RFC 3447`: https://tools.ietf.org/html/rfc3447