From 4866176b15eb654e6cef257cdc02812ad93da0e0 Mon Sep 17 00:00:00 2001 From: Hien Hoang Date: Thu, 29 Oct 2026 08:03:00 +0700 Subject: [PATCH 1/2] [paramiko] Update to 5.1.* --- stubs/paramiko/METADATA.toml | 2 +- stubs/paramiko/paramiko/kex_mlkem.pyi | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 stubs/paramiko/paramiko/kex_mlkem.pyi diff --git a/stubs/paramiko/METADATA.toml b/stubs/paramiko/METADATA.toml index 3cde7708908c..e6f4fee5e375 100644 --- a/stubs/paramiko/METADATA.toml +++ b/stubs/paramiko/METADATA.toml @@ -1,4 +1,4 @@ -version = "5.0.*" +version = "5.1.*" upstream-repository = "https://github.com/paramiko/paramiko" # Requires a version of cryptography where cryptography.hazmat.primitives.ciphers.Cipher is generic dependencies = ["cryptography>=37.0.0"] diff --git a/stubs/paramiko/paramiko/kex_mlkem.pyi b/stubs/paramiko/paramiko/kex_mlkem.pyi new file mode 100644 index 000000000000..3517f3ef0115 --- /dev/null +++ b/stubs/paramiko/paramiko/kex_mlkem.pyi @@ -0,0 +1,23 @@ +from _typeshed import Incomplete, ReadableBuffer +from collections.abc import Callable +from hashlib import _Hash + +from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey +from paramiko.message import Message +from paramiko.transport import Transport + +c_MSG_KEX_HYBRID_INIT: bytes +c_MSG_KEX_HYBRID_REPLY: bytes + +class KexMLKEM768X25519: + name: str + hash_algo: Callable[[ReadableBuffer], _Hash] + transport: Transport + # cryptography.hazmat.primitives.asymmetric.mlkem.MLKEM768PrivateKey, added in cryptography 48 + mlkem_key: Incomplete | None + x25519_key: X25519PrivateKey | None + def __init__(self, transport: Transport) -> None: ... + @classmethod + def is_available(cls) -> bool: ... + def start_kex(self) -> None: ... + def parse_next(self, ptype: int, m: Message) -> None: ... From e0aae182ef3e6a5a4e14aa35b9f330c7556dd4bb Mon Sep 17 00:00:00 2001 From: Hien Hoang Date: Thu, 29 Oct 2026 20:16:20 +0700 Subject: [PATCH 2/2] Apply review: Final constants, ClassVar hash_algo, MLKEM768PrivateKey --- stubs/paramiko/METADATA.toml | 4 ++-- stubs/paramiko/paramiko/kex_mlkem.pyi | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/stubs/paramiko/METADATA.toml b/stubs/paramiko/METADATA.toml index e6f4fee5e375..452714e2f143 100644 --- a/stubs/paramiko/METADATA.toml +++ b/stubs/paramiko/METADATA.toml @@ -1,7 +1,7 @@ version = "5.1.*" upstream-repository = "https://github.com/paramiko/paramiko" -# Requires a version of cryptography where cryptography.hazmat.primitives.ciphers.Cipher is generic -dependencies = ["cryptography>=37.0.0"] +# Requires a version of cryptography with cryptography.hazmat.primitives.asymmetric.mlkem +dependencies = ["cryptography>=47.0.0"] [tool.stubtest] # linux and darwin are equivalent diff --git a/stubs/paramiko/paramiko/kex_mlkem.pyi b/stubs/paramiko/paramiko/kex_mlkem.pyi index 3517f3ef0115..060236e06a32 100644 --- a/stubs/paramiko/paramiko/kex_mlkem.pyi +++ b/stubs/paramiko/paramiko/kex_mlkem.pyi @@ -1,20 +1,21 @@ -from _typeshed import Incomplete, ReadableBuffer +from _typeshed import ReadableBuffer from collections.abc import Callable from hashlib import _Hash +from typing import ClassVar, Final +from cryptography.hazmat.primitives.asymmetric.mlkem import MLKEM768PrivateKey from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey from paramiko.message import Message from paramiko.transport import Transport -c_MSG_KEX_HYBRID_INIT: bytes -c_MSG_KEX_HYBRID_REPLY: bytes +c_MSG_KEX_HYBRID_INIT: Final = b"\x1e" +c_MSG_KEX_HYBRID_REPLY: Final = b"\x1f" class KexMLKEM768X25519: - name: str - hash_algo: Callable[[ReadableBuffer], _Hash] + name: Final = "mlkem768x25519-sha256" + hash_algo: ClassVar[Callable[[ReadableBuffer], _Hash]] transport: Transport - # cryptography.hazmat.primitives.asymmetric.mlkem.MLKEM768PrivateKey, added in cryptography 48 - mlkem_key: Incomplete | None + mlkem_key: MLKEM768PrivateKey | None x25519_key: X25519PrivateKey | None def __init__(self, transport: Transport) -> None: ... @classmethod