@@ -456,7 +456,7 @@ An example ECDSA key in OpenSSH format::
456456 :class: `~cryptography.hazmat.primitives.asymmetric.ed25519.Ed25519PrivateKey `.
457457
458458
459- .. function :: load_ssh_private_key(data, password)
459+ .. function :: load_ssh_private_key(data, password, *, unsafe_skip_rsa_key_validation=False )
460460
461461 .. versionadded :: 3.0
462462
@@ -474,6 +474,19 @@ An example ECDSA key in OpenSSH format::
474474 :param bytes password: Password bytes to use to decrypt
475475 password-protected key. Or ``None `` if not needed.
476476
477+ :param unsafe_skip_rsa_key_validation:
478+
479+ .. versionadded :: 45.0.0
480+
481+ A keyword-only argument that defaults to ``False ``. If ``True ``
482+ RSA private keys will not be validated. This significantly speeds up
483+ loading the keys, but is :term: `unsafe ` unless you are certain the
484+ key is valid. User supplied keys should never be loaded with this
485+ parameter set to ``True ``. If you do load an invalid key this way and
486+ attempt to use it OpenSSL may hang, crash, or otherwise misbehave.
487+
488+ :type unsafe_skip_rsa_key_validation: bool
489+
477490 :returns: One of :data: `SSHPrivateKeyTypes ` depending on the contents of
478491 ``data ``.
479492
@@ -1289,11 +1302,11 @@ contain certificates, CRLs, and much more. PKCS7 files commonly have a ``p7b``,
12891302
12901303 .. method :: set_content_encryption_algorithm(content_encryption_algorithm)
12911304
1292- :param content_encryption_algorithm: the content encryption algorithm to use.
1305+ :param content_encryption_algorithm: the content encryption algorithm to use.
12931306 Only AES is supported, with a key size of 128 or 256 bits.
1294- :type content_encryption_algorithm:
1295- :class: `~cryptography.hazmat.primitives.ciphers.algorithms.AES128 `
1296- or :class: `~cryptography.hazmat.primitives.ciphers.algorithms.AES256 `
1307+ :type content_encryption_algorithm:
1308+ :class: `~cryptography.hazmat.primitives.ciphers.algorithms.AES128 `
1309+ or :class: `~cryptography.hazmat.primitives.ciphers.algorithms.AES256 `
12971310
12981311 .. method :: add_recipient(certificate)
12991312
@@ -1361,10 +1374,10 @@ contain certificates, CRLs, and much more. PKCS7 files commonly have a ``p7b``,
13611374 associated with the certificate provided. Only private RSA keys are supported.
13621375
13631376 :param options: A list of
1364- :class: `~cryptography.hazmat.primitives.serialization.pkcs7.PKCS7Options `. For
1377+ :class: `~cryptography.hazmat.primitives.serialization.pkcs7.PKCS7Options `. For
13651378 this operation only
13661379 :attr: `~cryptography.hazmat.primitives.serialization.pkcs7.PKCS7Options.Text ` is supported.
1367-
1380+
13681381 :returns bytes: The decrypted message.
13691382
13701383 :raises ValueError: If the recipient certificate does not match any of the encrypted keys in the
@@ -1377,7 +1390,7 @@ contain certificates, CRLs, and much more. PKCS7 files commonly have a ``p7b``,
13771390 another algorithm than AES (with key sizes 128 and 256), with CBC mode.
13781391
13791392 :raises ValueError: If the PKCS7 data does not contain encrypted content.
1380-
1393+
13811394 :raises ValueError: If the PKCS7 data is not of the enveloped data type.
13821395
13831396.. function :: pkcs7_decrypt_pem(data, certificate, private_key, options)
@@ -1416,10 +1429,10 @@ contain certificates, CRLs, and much more. PKCS7 files commonly have a ``p7b``,
14161429 associated with the certificate provided. Only private RSA keys are supported.
14171430
14181431 :param options: A list of
1419- :class: `~cryptography.hazmat.primitives.serialization.pkcs7.PKCS7Options `. For
1432+ :class: `~cryptography.hazmat.primitives.serialization.pkcs7.PKCS7Options `. For
14201433 this operation only
14211434 :attr: `~cryptography.hazmat.primitives.serialization.pkcs7.PKCS7Options.Text ` is supported.
1422-
1435+
14231436 :returns bytes: The decrypted message.
14241437
14251438 :raises ValueError: If the PEM data does not have the PKCS7 tag.
@@ -1434,7 +1447,7 @@ contain certificates, CRLs, and much more. PKCS7 files commonly have a ``p7b``,
14341447 another algorithm than AES (with key sizes 128 and 256), with CBC mode.
14351448
14361449 :raises ValueError: If the PKCS7 data does not contain encrypted content.
1437-
1450+
14381451 :raises ValueError: If the PKCS7 data is not of the enveloped data type.
14391452
14401453.. function :: pkcs7_decrypt_smime(data, certificate, private_key, options)
@@ -1474,10 +1487,10 @@ contain certificates, CRLs, and much more. PKCS7 files commonly have a ``p7b``,
14741487 associated with the certificate provided. Only private RSA keys are supported.
14751488
14761489 :param options: A list of
1477- :class: `~cryptography.hazmat.primitives.serialization.pkcs7.PKCS7Options `. For
1490+ :class: `~cryptography.hazmat.primitives.serialization.pkcs7.PKCS7Options `. For
14781491 this operation only
14791492 :attr: `~cryptography.hazmat.primitives.serialization.pkcs7.PKCS7Options.Text ` is supported.
1480-
1493+
14811494 :returns bytes: The decrypted message.
14821495
14831496 :raises ValueError: If the S/MIME data is not one of the correct content types.
@@ -1492,7 +1505,7 @@ contain certificates, CRLs, and much more. PKCS7 files commonly have a ``p7b``,
14921505 another algorithm than AES (with key sizes 128 and 256), with CBC mode.
14931506
14941507 :raises ValueError: If the PKCS7 data does not contain encrypted content.
1495-
1508+
14961509 :raises ValueError: If the PKCS7 data is not of the enveloped data type.
14971510
14981511
@@ -1505,7 +1518,7 @@ contain certificates, CRLs, and much more. PKCS7 files commonly have a ``p7b``,
15051518 .. attribute :: Text
15061519
15071520 For signing, the text option adds ``text/plain `` headers to an S/MIME message when
1508- serializing to
1521+ serializing to
15091522 :attr: `~cryptography.hazmat.primitives.serialization.Encoding.SMIME `.
15101523 This option is disallowed with ``DER `` serialization.
15111524 For envelope creation, it adds ``text/plain `` headers to the encrypted content, regardless
0 commit comments