diff --git a/src/cryptography/hazmat/backends/openssl/backend.py b/src/cryptography/hazmat/backends/openssl/backend.py
--- a/src/cryptography/hazmat/backends/openssl/backend.py
+++ b/src/cryptography/hazmat/backends/openssl/backend.py
@@ -1528,6 +1528,15 @@ def _private_key_bytes(
                     "Passwords longer than 1023 bytes are not supported by "
                     "this backend"
                 )
+        elif (
+            isinstance(
+                encryption_algorithm, serialization._KeySerializationEncryption
+            )
+            and encryption_algorithm._format
+            is format
+            is serialization.PrivateFormat.OpenSSH
+        ):
+            password = encryption_algorithm.password
         else:
             raise ValueError("Unsupported encryption type")
 
@@ -1592,7 +1601,9 @@ def _private_key_bytes(
         # OpenSSH + PEM
         if format is serialization.PrivateFormat.OpenSSH:
             if encoding is serialization.Encoding.PEM:
-                return ssh.serialize_ssh_private_key(key, password)
+                return ssh._serialize_ssh_private_key(
+                    key, password, encryption_algorithm
+                )
 
             raise ValueError(
                 "OpenSSH private key format can only be used"
diff --git a/src/cryptography/hazmat/primitives/_serialization.py b/src/cryptography/hazmat/primitives/_serialization.py
--- a/src/cryptography/hazmat/primitives/_serialization.py
+++ b/src/cryptography/hazmat/primitives/_serialization.py
@@ -3,6 +3,7 @@
 # for complete details.
 
 import abc
+import typing
 
 from cryptography import utils
 
@@ -25,6 +26,13 @@ class PrivateFormat(utils.Enum):
     Raw = "Raw"
     OpenSSH = "OpenSSH"
 
+    def encryption_builder(self) -> "KeySerializationEncryptionBuilder":
+        if self is not PrivateFormat.OpenSSH:
+            raise ValueError(
+                "encryption_builder only supported with PrivateFormat.OpenSSH"
+            )
+        return KeySerializationEncryptionBuilder(self)
+
 
 class PublicFormat(utils.Enum):
     SubjectPublicKeyInfo = "X.509 subjectPublicKeyInfo with PKCS#1"
@@ -53,3 +61,44 @@ def __init__(self, password: bytes):
 
 class NoEncryption(KeySerializationEncryption):
     pass
+
+
+class KeySerializationEncryptionBuilder(object):
+    def __init__(
+        self,
+        format: PrivateFormat,
+        *,
+        _kdf_rounds: typing.Optional[int] = None,
+    ) -> None:
+        self._format = format
+
+        self._kdf_rounds = _kdf_rounds
+
+    def kdf_rounds(self, rounds: int) -> "KeySerializationEncryptionBuilder":
+        if self._kdf_rounds is not None:
+            raise ValueError("kdf_rounds already set")
+        return KeySerializationEncryptionBuilder(
+            self._format, _kdf_rounds=rounds
+        )
+
+    def build(self, password: bytes) -> KeySerializationEncryption:
+        if not isinstance(password, bytes) or len(password) == 0:
+            raise ValueError("Password must be 1 or more bytes.")
+
+        return _KeySerializationEncryption(
+            self._format, password, kdf_rounds=self._kdf_rounds
+        )
+
+
+class _KeySerializationEncryption(KeySerializationEncryption):
+    def __init__(
+        self,
+        format: PrivateFormat,
+        password: bytes,
+        *,
+        kdf_rounds: typing.Optional[int],
+    ):
+        self._format = format
+        self.password = password
+
+        self._kdf_rounds = kdf_rounds
diff --git a/src/cryptography/hazmat/primitives/serialization/__init__.py b/src/cryptography/hazmat/primitives/serialization/__init__.py
--- a/src/cryptography/hazmat/primitives/serialization/__init__.py
+++ b/src/cryptography/hazmat/primitives/serialization/__init__.py
@@ -11,6 +11,7 @@
     ParameterFormat,
     PrivateFormat,
     PublicFormat,
+    _KeySerializationEncryption,
 )
 from cryptography.hazmat.primitives.serialization.base import (
     load_der_parameters,
@@ -42,4 +43,5 @@
     "KeySerializationEncryption",
     "BestAvailableEncryption",
     "NoEncryption",
+    "_KeySerializationEncryption",
 ]
diff --git a/src/cryptography/hazmat/primitives/serialization/ssh.py b/src/cryptography/hazmat/primitives/serialization/ssh.py
--- a/src/cryptography/hazmat/primitives/serialization/ssh.py
+++ b/src/cryptography/hazmat/primitives/serialization/ssh.py
@@ -15,9 +15,11 @@
 from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
 from cryptography.hazmat.primitives.serialization import (
     Encoding,
+    KeySerializationEncryption,
     NoEncryption,
     PrivateFormat,
     PublicFormat,
+    _KeySerializationEncryption,
 )
 
 try:
@@ -601,13 +603,13 @@ def load_ssh_private_key(
     return private_key
 
 
-def serialize_ssh_private_key(
+def _serialize_ssh_private_key(
     private_key: _SSH_PRIVATE_KEY_TYPES,
-    password: typing.Optional[bytes] = None,
+    password: bytes,
+    encryption_algorithm: KeySerializationEncryption,
 ) -> bytes:
     """Serialize private key with OpenSSH custom encoding."""
-    if password is not None:
-        utils._check_bytes("password", password)
+    utils._check_bytes("password", password)
 
     if isinstance(private_key, ec.EllipticCurvePrivateKey):
         key_type = _ecdsa_key_type(private_key.public_key())
@@ -628,6 +630,11 @@ def serialize_ssh_private_key(
         blklen = _SSH_CIPHERS[ciphername][3]
         kdfname = _BCRYPT
         rounds = _DEFAULT_ROUNDS
+        if (
+            isinstance(encryption_algorithm, _KeySerializationEncryption)
+            and encryption_algorithm._kdf_rounds is not None
+        ):
+            rounds = encryption_algorithm._kdf_rounds
         salt = os.urandom(16)
         f_kdfoptions.put_sshstr(salt)
         f_kdfoptions.put_u32(rounds)

diff --git a/tests/hazmat/primitives/test_serialization.py b/tests/hazmat/primitives/test_serialization.py
--- a/tests/hazmat/primitives/test_serialization.py
+++ b/tests/hazmat/primitives/test_serialization.py
@@ -2335,9 +2335,10 @@ def test_serialize_ssh_private_key_errors(self, backend):
 
         # bad object type
         with pytest.raises(ValueError):
-            ssh.serialize_ssh_private_key(
+            ssh._serialize_ssh_private_key(
                 object(),  # type:ignore[arg-type]
-                None,
+                b"",
+                NoEncryption(),
             )
 
         private_key = ec.generate_private_key(ec.SECP256R1(), backend)
@@ -2362,11 +2363,26 @@ def test_serialize_ssh_private_key_errors(self, backend):
             b"x" * 100,
         ),
     )
-    def test_serialize_ssh_private_key_with_password(self, password, backend):
+    @pytest.mark.parametrize(
+        "kdf_rounds",
+        [
+            1,
+            10,
+            30,
+        ],
+    )
+    def test_serialize_ssh_private_key_with_password(
+        self, password, kdf_rounds, backend
+    ):
         original_key = ec.generate_private_key(ec.SECP256R1(), backend)
-        encoded_key_data = ssh.serialize_ssh_private_key(
-            private_key=original_key,
-            password=password,
+        encoded_key_data = original_key.private_bytes(
+            Encoding.PEM,
+            PrivateFormat.OpenSSH,
+            (
+                PrivateFormat.OpenSSH.encryption_builder()
+                .kdf_rounds(kdf_rounds)
+                .build(password)
+            ),
         )
 
         decoded_key = load_ssh_private_key(
@@ -2416,3 +2432,22 @@ def test_dsa_private_key_sizes(self, key_path, supported, backend):
                 key.private_bytes(
                     Encoding.PEM, PrivateFormat.OpenSSH, NoEncryption()
                 )
+
+
+class TestEncryptionBuilder:
+    def test_unsupported_format(self):
+        f = PrivateFormat.PKCS8
+        with pytest.raises(ValueError):
+            f.encryption_builder()
+
+    def test_duplicate_kdf_rounds(self):
+        b = PrivateFormat.OpenSSH.encryption_builder().kdf_rounds(12)
+        with pytest.raises(ValueError):
+            b.kdf_rounds(12)
+
+    def test_invalid_password(self):
+        b = PrivateFormat.OpenSSH.encryption_builder()
+        with pytest.raises(ValueError):
+            b.build(12)  # type: ignore[arg-type]
+        with pytest.raises(ValueError):
+            b.build(b"")

[WIP] feat: add kdf_rounds param to encryption algorithm
### Summary

Currently the number of `kdf_rounds` used when encrypting OpenSSH private keys is fixed at the `ssh-keygen` default of `16`. `ssh-keygen` however parameterizes this value with the `-a` flag. This PR permits the same parameterization through the `BestAvailableEncryption` class.

### Open Questions
- [] Should this parameter be passed through `BestAvailableEncryption` where it is generally not applicable or should another data structure e.g. `KDFOptions` be created and passed through `BestAvailableEncryption` to better indicate this is optional and specific behavior?
- [] It doesn't really make sense to mention the default of `16` at the level of `BestAvailableEncryption` because it is only applied in the `ssh` module, but I don't have a better way to express that without discussing interface boundaries.
- [] Not sure which version this would be a candidate for so `version_added` is missing from the docs.

Requested originally in https://github.com/ansible-collections/community.crypto/issues/449

Thank you for working on this! As you've discovered, our API doesn't have a clear place to override any options about how encryption is performed. Unfortunately, simply adding `kdf_rounds` to `BestAvailableEncryption` is probably not correct. We'll need to design an API that considers that KDF rounds may not be meaningful for some encryption options, and that it will have different meaning for different algorithms.

If you're interested in doing some of that design work, that's fantastic and we're very much up for working through these issues with you. https://github.com/pyca/cryptography/issues/4272 and https://github.com/pyca/cryptography/pull/5656 and https://github.com/pyca/cryptography/pull/6569 contain some of the background on the challenges here -- though we don't need to solve _all_ the problems discussed in them!
Thanks for the initial review. I'll put some thought into this, but my gut feeling is that OpenSSH private key encryption is not really aligned with the concept of `BestAvailableEncryption` to begin with i.e. it made reuse of this pattern for programming convenience and not for the sake of a coherent API. That being said to avoid breaking changes it is probably best to not touch that class for the time being so existing behavior remains intact and instead create a new encryption subclass closer to the OpenSSH domain. It may be a little clunky, but ultimately I think it's better than treating OpenSSH like it's OpenSSL.
Pushed a rough draft of a new `KeySerializationEncryption` interface which attempts to sprinkle in some polymorphism making new behavior less risky to implement. It does add some unnecessary detail to the abstract interface which could be pulled into a second abstraction layer like `PasswordBasedEncryption`, but not sure if that additional complexity is valuable at this point. The `options` property is a little loosely typed for my tastes, but then again adding a new data structure to contain the optional parameters isn't particularly 'pythonic'. Defaulted `kwargs` should avoid breaks and users shouldn't really instantiate `KeySerializationEncryption` directly, but it's public so a second set of eyes on that would  be nice. Choose not to update docs or address cov report until this draft is reviewed.
tests/hazmat/primitives/test_serialization.py::TestDERSerialization::test_load_der_dsa_public_key[asymmetric/DER_Serialization/dsa_public_key.der] tests/hazmat/primitives/test_serialization.py::TestDERSerialization::test_load_ec_public_key tests/hazmat/primitives/test_serialization.py::TestDERSerialization::test_missing_password[key_path0-] tests/hazmat/primitives/test_serialization.py::TestDERSerialization::test_wrong_parameters_format tests/hazmat/primitives/test_serialization.py::TestDERSerialization::test_missing_password[key_path1-None] tests/hazmat/primitives/test_serialization.py::TestDERSerialization::test_wrong_format tests/hazmat/primitives/test_serialization.py::TestDERSerialization::test_load_der_rsa_private_key[key_path2-None] tests/hazmat/primitives/test_serialization.py::TestBufferProtocolSerialization::test_load_der_rsa_private_key[key_path0-password0] tests/hazmat/primitives/test_serialization.py::TestDERSerialization::test_load_der_rsa_private_key[key_path3-None] tests/hazmat/primitives/test_serialization.py::TestDERSerialization::test_load_der_dsa_private_key[key_path0-None] tests/hazmat/primitives/test_serialization.py::TestDERSerialization::test_load_der_dsa_private_key[key_path1-None] tests/hazmat/primitives/test_serialization.py::TestBufferProtocolSerialization::test_load_der_rsa_private_key[key_path1-password1] tests/hazmat/primitives/test_serialization.py::TestDERSerialization::test_load_der_dsa_private_key[key_path2-None] tests/hazmat/primitives/test_serialization.py::TestBufferProtocolSerialization::test_load_der_rsa_private_key[key_path2-None] tests/hazmat/primitives/test_serialization.py::TestDERSerialization::test_invalid_rsa_even_q tests/hazmat/primitives/test_serialization.py::TestDERSerialization::test_corrupt_der_pkcs8 tests/hazmat/primitives/test_serialization.py::TestDERSerialization::test_load_der_dsa_private_key[key_path3-None] tests/hazmat/primitives/test_serialization.py::TestBufferProtocolSerialization::test_load_der_rsa_private_key[key_path3-None] tests/hazmat/primitives/test_serialization.py::TestDERSerialization::test_corrupt_traditional_format_der tests/hazmat/primitives/test_serialization.py::TestDERSerialization::test_password_not_bytes[key_path0] tests/hazmat/primitives/test_serialization.py::TestDERSerialization::test_load_der_rsa_public_key[asymmetric/DER_Serialization/unenc-rsa-pkcs8.pub.der] tests/hazmat/primitives/test_serialization.py::TestDERSerialization::test_load_der_ec_private_key[key_path0-None] tests/hazmat/primitives/test_serialization.py::TestDERSerialization::test_load_der_rsa_public_key[asymmetric/DER_Serialization/rsa_public_key.der] tests/hazmat/primitives/test_serialization.py::TestDERSerialization::test_load_der_rsa_public_key[asymmetric/public/PKCS1/rsa.pub.der] tests/hazmat/primitives/test_serialization.py::TestDERSerialization::test_load_der_invalid_public_key tests/hazmat/primitives/test_serialization.py::TestDERSerialization::test_load_der_ec_private_key[key_path1-123456] tests/hazmat/primitives/test_serialization.py::TestDERSerialization::test_load_der_dsa_public_key[asymmetric/DER_Serialization/unenc-dsa-pkcs8.pub.der] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_pem_rsa_public_key[asymmetric/PKCS8/unenc-rsa-pkcs8.pub.pem] tests/hazmat/primitives/test_serialization.py::TestDERSerialization::test_wrong_password[key_path0] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_pem_rsa_public_key[asymmetric/PEM_Serialization/rsa_public_key.pem] tests/hazmat/primitives/test_serialization.py::TestDERSerialization::test_unused_password[key_path0] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_pem_rsa_public_key[asymmetric/public/PKCS1/rsa.pub.pem] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_dsa_private_key[key_path0-None] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_pem_rsa_private_key[key_file0-123456] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_dsa_private_key[key_path1-None] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_pem_rsa_private_key[key_file1-None] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_dsa_private_key[key_path2-None] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_dsa_private_key[key_path3-None] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_pem_rsa_private_key[key_file2-foobar] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_dsa_private_key[key_path4-123456] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_pem_ec_private_key[key_path0-None] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_pem_ec_private_key[key_path1-123456] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_pem_ec_private_key[key_path2-None] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_pem_rsa_private_key[key_file3-baz] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_pem_ec_private_key[key_path3-123456] tests/hazmat/primitives/test_serialization.py::TestBufferProtocolSerialization::test_load_pem_rsa_private_key[key_path0-password0] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_missing_password[key_path2-] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_missing_password[key_path3-None] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_wrong_private_format tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_pem_rsa_private_key[key_file4-123456] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_wrong_public_format tests/hazmat/primitives/test_serialization.py::TestBufferProtocolSerialization::test_load_pem_rsa_private_key[key_path1-None] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_wrong_parameters_format tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_corrupt_traditional_format tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_traditional_encrypted_corrupt_format tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_unsupported_key_encryption tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_priv_key_with_public_key_api_fails tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_pem_rsa_private_key[key_file5-123456] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_pem_dsa_public_key[asymmetric/PKCS8/unenc-dsa-pkcs8.pub.pem] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_corrupt_pkcs8_format tests/hazmat/primitives/test_serialization.py::TestBufferProtocolSerialization::test_load_pem_rsa_private_key[key_path2-password2] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_pem_dsa_public_key[asymmetric/PEM_Serialization/dsa_public_key.pem] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_pks8_encrypted_corrupt_format tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_ec_public_key tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_rsa_traditional_encrypted_values tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_pem_rsa_private_key[key_file6-123456] tests/hazmat/primitives/test_serialization.py::TestBufferProtocolSerialization::test_load_pem_rsa_private_key[key_path3-password3] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_unused_password[key_path0] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_rsa_pkcs8_encrypted_values tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_unused_password[key_path1] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_pem_dsa_private_key tests/hazmat/primitives/test_serialization.py::TestBufferProtocolSerialization::test_load_pem_rsa_private_key[key_path4-password4] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_bad_oid_key[bad-oid-dsa-key.pem-None] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_bad_encryption_oid_key[bad-encryption-oid.pem-password] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_invalid_encoding_with_traditional tests/hazmat/primitives/test_serialization.py::TestRSASSHSerialization::test_load_ssh_public_key_unsupported tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_password_not_bytes[key_path0] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_pem_rsa_private_key[key_file7-123456] tests/hazmat/primitives/test_serialization.py::TestDSSSSHSerialization::test_load_ssh_public_key_dss_too_short tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_password_not_bytes[key_path1] tests/hazmat/primitives/test_serialization.py::TestDSSSSHSerialization::test_load_ssh_public_key_dss_comment_with_spaces tests/hazmat/primitives/test_serialization.py::TestDSSSSHSerialization::test_load_ssh_public_key_dss_extra_data_after_modulo tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_wrong_password[key_path0] tests/hazmat/primitives/test_serialization.py::TestDSSSSHSerialization::test_load_ssh_public_key_dss_different_string tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_wrong_password[key_path1] tests/hazmat/primitives/test_serialization.py::TestDSSSSHSerialization::test_load_ssh_public_key_dss tests/hazmat/primitives/test_serialization.py::TestDERSerialization::test_load_der_rsa_private_key[key_path0-foobar] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_missing_password[key_path0-] tests/hazmat/primitives/test_serialization.py::TestECDSASSHSerialization::test_load_ssh_public_key_ecdsa_nist_p256 tests/hazmat/primitives/test_serialization.py::TestECDSASSHSerialization::test_load_ssh_public_key_ecdsa_nist_p256_bad_curve_name tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_missing_password[key_path1-None] tests/hazmat/primitives/test_serialization.py::TestEd25519SSHSerialization::test_load_ssh_public_key tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_pem_rsa_private_key[key_file8-123456] tests/hazmat/primitives/test_serialization.py::TestEd25519SSHSerialization::test_public_bytes_openssh tests/hazmat/primitives/test_serialization.py::TestEd25519SSHSerialization::test_load_ssh_public_key_not_32_bytes tests/hazmat/primitives/test_serialization.py::TestECDSASSHSerialization::test_load_ssh_public_key_byteslike tests/hazmat/primitives/test_serialization.py::TestECDSASSHSerialization::test_load_ssh_public_key_ecdsa_nist_p384 tests/hazmat/primitives/test_serialization.py::TestECDSASSHSerialization::test_load_ssh_public_key_ecdsa_nist_p521 tests/hazmat/primitives/test_serialization.py::TestEd25519SSHSerialization::test_load_ssh_public_key_trailing_data tests/hazmat/primitives/test_serialization.py::TestECDSASSHSerialization::test_load_ssh_public_key_ecdsa_nist_p256_trailing_data tests/hazmat/primitives/test_serialization.py::TestKeySerializationEncryptionTypes::test_non_bytes_password tests/hazmat/primitives/test_serialization.py::TestKeySerializationEncryptionTypes::test_encryption_with_zero_length_password tests/hazmat/primitives/test_serialization.py::TestECDSASSHSerialization::test_load_ssh_public_key_ecdsa_nist_p256_missing_data tests/hazmat/primitives/test_serialization.py::TestECDSASSHSerialization::test_load_ssh_public_key_ecdsa_nist_p256_compressed tests/hazmat/primitives/test_serialization.py::TestDERSerialization::test_load_der_rsa_private_key[key_path1-baz] tests/hazmat/primitives/test_serialization.py::TestRSASSHSerialization::test_load_ssh_public_key_bad_format tests/hazmat/primitives/test_serialization.py::TestEd25519Serialization::test_openssl_serialization_unsupported tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_pem_rsa_private_key[key_file9-123456] tests/hazmat/primitives/test_serialization.py::TestRSASSHSerialization::test_load_ssh_public_key_rsa_too_short tests/hazmat/primitives/test_serialization.py::TestRSASSHSerialization::test_load_ssh_public_key_truncated_int tests/hazmat/primitives/test_serialization.py::TestEd25519Serialization::test_load_der_private_key tests/hazmat/primitives/test_serialization.py::TestRSASSHSerialization::test_load_ssh_public_key_rsa_comment_with_spaces tests/hazmat/primitives/test_serialization.py::TestEd25519Serialization::test_load_pem_private_key tests/hazmat/primitives/test_serialization.py::TestRSASSHSerialization::test_load_ssh_public_key_rsa_extra_data_after_modulo tests/hazmat/primitives/test_serialization.py::TestX448Serialization::test_load_der_private_key tests/hazmat/primitives/test_serialization.py::TestRSASSHSerialization::test_load_ssh_public_key_rsa_different_string tests/hazmat/primitives/test_serialization.py::TestEd25519Serialization::test_load_public_key[key_path0-Encoding.PEM-load_pem_public_key] tests/hazmat/primitives/test_serialization.py::TestX448Serialization::test_load_pem_private_key tests/hazmat/primitives/test_serialization.py::TestRSASSHSerialization::test_load_ssh_public_key_rsa tests/hazmat/primitives/test_serialization.py::TestEd25519Serialization::test_load_public_key[key_path1-Encoding.DER-load_der_public_key] tests/hazmat/primitives/test_serialization.py::TestX448Serialization::test_openssl_serialization_unsupported tests/hazmat/primitives/test_serialization.py::TestX25519Serialization::test_load_public_key[key_path1-Encoding.DER-load_der_public_key] tests/hazmat/primitives/test_serialization.py::TestX448Serialization::test_load_public_key[key_path0-Encoding.PEM-load_pem_public_key] tests/hazmat/primitives/test_serialization.py::TestX25519Serialization::test_openssl_serialization_unsupported tests/hazmat/primitives/test_serialization.py::TestX448Serialization::test_load_public_key[key_path1-Encoding.DER-load_der_public_key] tests/hazmat/primitives/test_serialization.py::TestX448Serialization::test_openssh_serialization_unsupported tests/hazmat/primitives/test_serialization.py::TestX25519Serialization::test_openssh_serialization_unsupported tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_pem_rsa_private_key[key_file10-123456] tests/hazmat/primitives/test_serialization.py::TestEd448Serialization::test_load_pem_private_key tests/hazmat/primitives/test_serialization.py::TestX25519Serialization::test_load_der_private_key tests/hazmat/primitives/test_serialization.py::TestEd448Serialization::test_load_public_key[key_path0-Encoding.PEM-load_pem_public_key] tests/hazmat/primitives/test_serialization.py::TestEd448Serialization::test_load_public_key[key_path1-Encoding.DER-load_der_public_key] tests/hazmat/primitives/test_serialization.py::TestX25519Serialization::test_load_pem_private_key tests/hazmat/primitives/test_serialization.py::TestEd448Serialization::test_load_der_private_key tests/hazmat/primitives/test_serialization.py::TestEd448Serialization::test_openssl_serialization_unsupported tests/hazmat/primitives/test_serialization.py::TestX25519Serialization::test_load_public_key[key_path0-Encoding.PEM-load_pem_public_key] tests/hazmat/primitives/test_serialization.py::TestEd448Serialization::test_openssh_serialization_unsupported tests/hazmat/primitives/test_serialization.py::TestDHSerialization::test_dh_public_key tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_pem_rsa_private_key[key_file11-123456] tests/hazmat/primitives/test_serialization.py::TestDHSerialization::test_dh_private_key tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_pem_rsa_private_key[key_file12-123456] tests/hazmat/primitives/test_serialization.py::TestOpenSSHSerialization::test_load_ssh_public_key[rsa-psw.key.pub-None] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_pem_rsa_private_key[key_file13-123456] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_pem_rsa_private_key[key_file14-123456] tests/hazmat/primitives/test_serialization.py::TestOpenSSHSerialization::test_load_ssh_public_key[ecdsa-nopsw.key.pub-ecdsa-nopsw.key-cert.pub] tests/hazmat/primitives/test_serialization.py::TestOpenSSHSerialization::test_load_ssh_public_key[ed25519-psw.key.pub-None] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_pem_rsa_private_key[key_file15-a123456] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_pem_rsa_private_key[key_file16-None] tests/hazmat/primitives/test_serialization.py::TestPEMSerialization::test_load_pem_rsa_private_key[key_file17-password] tests/hazmat/primitives/test_serialization.py::TestOpenSSHSerialization::test_load_ssh_public_key[ed25519-nopsw.key.pub-ed25519-nopsw.key-cert.pub] tests/hazmat/primitives/test_serialization.py::TestOpenSSHSerialization::test_load_ssh_private_key[ed25519-nopsw.key] tests/hazmat/primitives/test_serialization.py::TestOpenSSHSerialization::test_load_ssh_private_key[ecdsa-nopsw.key] tests/hazmat/primitives/test_serialization.py::TestOpenSSHSerialization::test_load_ssh_public_key[rsa-nopsw.key.pub-rsa-nopsw.key-cert.pub] tests/hazmat/primitives/test_serialization.py::TestOpenSSHSerialization::test_missing_bcrypt tests/hazmat/primitives/test_serialization.py::TestOpenSSHSerialization::test_fraglist_corners tests/hazmat/primitives/test_serialization.py::TestOpenSSHSerialization::test_load_ssh_private_key_errors tests/hazmat/primitives/test_serialization.py::TestOpenSSHSerialization::test_ssh_make_file tests/hazmat/primitives/test_serialization.py::TestOpenSSHSerialization::test_ssh_errors_bad_values tests/hazmat/primitives/test_serialization.py::TestOpenSSHSerialization::test_ssh_errors_pubpriv_mismatch tests/hazmat/primitives/test_serialization.py::TestOpenSSHSerialization::test_ssh_errors_bad_wrapper tests/hazmat/primitives/test_serialization.py::TestOpenSSHSerialization::test_load_ssh_public_key[dsa-psw.key.pub-None] tests/hazmat/primitives/test_serialization.py::TestOpenSSHSerialization::test_ssh_no_padding tests/hazmat/primitives/test_serialization.py::TestOpenSSHSerialization::test_ssh_errors_bad_secrets tests/hazmat/primitives/test_serialization.py::TestOpenSSHSerialization::test_serialize_ssh_private_key_errors_bad_curve tests/hazmat/primitives/test_serialization.py::TestOpenSSHSerialization::test_dsa_private_key_sizes[key_path0-True] tests/hazmat/primitives/test_serialization.py::TestOpenSSHSerialization::test_dsa_private_key_sizes[key_path1-False] tests/hazmat/primitives/test_serialization.py::TestOpenSSHSerialization::test_dsa_private_key_sizes[key_path2-False] tests/hazmat/primitives/test_serialization.py::TestOpenSSHSerialization::test_load_ssh_public_key[dsa-nopsw.key.pub-dsa-nopsw.key-cert.pub] tests/hazmat/primitives/test_serialization.py::TestOpenSSHSerialization::test_load_ssh_public_key[ecdsa-psw.key.pub-None] tests/hazmat/primitives/test_serialization.py::TestOpenSSHSerialization::test_load_ssh_private_key[rsa-nopsw.key] tests/hazmat/primitives/test_serialization.py::TestOpenSSHSerialization::test_load_ssh_private_key[dsa-nopsw.key]
tests/hazmat/primitives/test_serialization.py::TestOpenSSHSerialization::test_serialize_ssh_private_key_errors tests/hazmat/primitives/test_serialization.py::TestEncryptionBuilder::test_unsupported_format tests/hazmat/primitives/test_serialization.py::TestEncryptionBuilder::test_invalid_password tests/hazmat/primitives/test_serialization.py::TestEncryptionBuilder::test_duplicate_kdf_rounds