# SPDX-FileCopyrightText: 2025 Marco Ricci <software@the13thletter.info>
#
# SPDX-License-Identifier: Zlib
"""Test OpenSSH key loading and signing."""
from __future__ import annotations
import base64
import contextlib
import io
import re
import socket
import types
from typing import TYPE_CHECKING
import click
import click.testing
import hypothesis
import pytest
from hypothesis import strategies
import tests
from derivepassphrase import _types, ssh_agent, vault
from derivepassphrase._internals import cli_helpers
if TYPE_CHECKING:
from collections.abc import Iterable
from typing_extensions import Any, Buffer
class Parametrize(types.SimpleNamespace):
SSH_STRING_EXCEPTIONS = pytest.mark.parametrize(
['input', 'exc_type', 'exc_pattern'],
[
pytest.param(
'some string', TypeError, 'invalid payload type', id='str'
),
],
)
SSH_UNSTRING_EXCEPTIONS = pytest.mark.parametrize(
['input', 'exc_type', 'exc_pattern', 'has_trailer', 'parts'],
[
pytest.param(
b'ssh',
ValueError,
'malformed SSH byte string',
False,
None,
id='unencoded',