@@ -456,7 +456,7 @@ An example ECDSA key in OpenSSH format::
456
456
:class: `~cryptography.hazmat.primitives.asymmetric.ed25519.Ed25519PrivateKey `.
457
457
458
458
459
- .. function :: load_ssh_private_key(data, password)
459
+ .. function :: load_ssh_private_key(data, password, *, unsafe_skip_rsa_key_validation=False )
460
460
461
461
.. versionadded :: 3.0
462
462
@@ -474,6 +474,19 @@ An example ECDSA key in OpenSSH format::
474
474
:param bytes password: Password bytes to use to decrypt
475
475
password-protected key. Or ``None `` if not needed.
476
476
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
+
477
490
:returns: One of :data: `SSHPrivateKeyTypes ` depending on the contents of
478
491
``data ``.
479
492
@@ -1289,11 +1302,11 @@ contain certificates, CRLs, and much more. PKCS7 files commonly have a ``p7b``,
1289
1302
1290
1303
.. method :: set_content_encryption_algorithm(content_encryption_algorithm)
1291
1304
1292
- :param content_encryption_algorithm: the content encryption algorithm to use.
1305
+ :param content_encryption_algorithm: the content encryption algorithm to use.
1293
1306
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 `
1297
1310
1298
1311
.. method :: add_recipient(certificate)
1299
1312
@@ -1361,10 +1374,10 @@ contain certificates, CRLs, and much more. PKCS7 files commonly have a ``p7b``,
1361
1374
associated with the certificate provided. Only private RSA keys are supported.
1362
1375
1363
1376
:param options: A list of
1364
- :class: `~cryptography.hazmat.primitives.serialization.pkcs7.PKCS7Options `. For
1377
+ :class: `~cryptography.hazmat.primitives.serialization.pkcs7.PKCS7Options `. For
1365
1378
this operation only
1366
1379
:attr: `~cryptography.hazmat.primitives.serialization.pkcs7.PKCS7Options.Text ` is supported.
1367
-
1380
+
1368
1381
:returns bytes: The decrypted message.
1369
1382
1370
1383
: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``,
1377
1390
another algorithm than AES (with key sizes 128 and 256), with CBC mode.
1378
1391
1379
1392
:raises ValueError: If the PKCS7 data does not contain encrypted content.
1380
-
1393
+
1381
1394
:raises ValueError: If the PKCS7 data is not of the enveloped data type.
1382
1395
1383
1396
.. 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``,
1416
1429
associated with the certificate provided. Only private RSA keys are supported.
1417
1430
1418
1431
:param options: A list of
1419
- :class: `~cryptography.hazmat.primitives.serialization.pkcs7.PKCS7Options `. For
1432
+ :class: `~cryptography.hazmat.primitives.serialization.pkcs7.PKCS7Options `. For
1420
1433
this operation only
1421
1434
:attr: `~cryptography.hazmat.primitives.serialization.pkcs7.PKCS7Options.Text ` is supported.
1422
-
1435
+
1423
1436
:returns bytes: The decrypted message.
1424
1437
1425
1438
: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``,
1434
1447
another algorithm than AES (with key sizes 128 and 256), with CBC mode.
1435
1448
1436
1449
:raises ValueError: If the PKCS7 data does not contain encrypted content.
1437
-
1450
+
1438
1451
:raises ValueError: If the PKCS7 data is not of the enveloped data type.
1439
1452
1440
1453
.. 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``,
1474
1487
associated with the certificate provided. Only private RSA keys are supported.
1475
1488
1476
1489
:param options: A list of
1477
- :class: `~cryptography.hazmat.primitives.serialization.pkcs7.PKCS7Options `. For
1490
+ :class: `~cryptography.hazmat.primitives.serialization.pkcs7.PKCS7Options `. For
1478
1491
this operation only
1479
1492
:attr: `~cryptography.hazmat.primitives.serialization.pkcs7.PKCS7Options.Text ` is supported.
1480
-
1493
+
1481
1494
:returns bytes: The decrypted message.
1482
1495
1483
1496
: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``,
1492
1505
another algorithm than AES (with key sizes 128 and 256), with CBC mode.
1493
1506
1494
1507
:raises ValueError: If the PKCS7 data does not contain encrypted content.
1495
-
1508
+
1496
1509
:raises ValueError: If the PKCS7 data is not of the enveloped data type.
1497
1510
1498
1511
@@ -1505,7 +1518,7 @@ contain certificates, CRLs, and much more. PKCS7 files commonly have a ``p7b``,
1505
1518
.. attribute :: Text
1506
1519
1507
1520
For signing, the text option adds ``text/plain `` headers to an S/MIME message when
1508
- serializing to
1521
+ serializing to
1509
1522
:attr: `~cryptography.hazmat.primitives.serialization.Encoding.SMIME `.
1510
1523
This option is disallowed with ``DER `` serialization.
1511
1524
For envelope creation, it adds ``text/plain `` headers to the encrypted content, regardless
0 commit comments