class SSHCliSignatureVendor(SignatureSigner, SignatureVerifier):
Constructors: SSHCliSignatureVendor.from_config(config, keyids), SSHCliSignatureVendor(ssh_command, allowed_signers_file, revocation_file, default_key_command, ...)
Signature vendor that uses ssh-keygen command-line tool for SSH signatures.
Supports git config options: - gpg.ssh.allowedSignersFile: File containing allowed SSH public keys - gpg.ssh.revocationFile: File containing revoked SSH public keys - gpg.ssh.program: Path to ssh-keygen command - gpg.ssh.defaultKeyCommand: Command to get default SSH key for signing
| Class Method | available |
Check if the ssh-keygen command is available. |
| Class Method | from |
Create an SSH CLI vendor from git configuration. |
| Method | __init__ |
Initialize the SSH CLI vendor. |
| Method | sign |
Sign data with an SSH key using ssh-keygen. |
| Method | verify |
Verify an SSH signature using ssh-keygen. |
| Instance Variable | allowed |
Undocumented |
| Instance Variable | default |
Undocumented |
| Instance Variable | revocation |
Undocumented |
| Instance Variable | ssh |
Undocumented |
Inherited from SignatureVerifier (via SignatureSigner):
| Instance Variable | keyids |
Undocumented |
Check if the ssh-keygen command is available.
| Returns | |
bool | True if ssh-keygen command is in PATH, False otherwise |
str = 'ssh-keygen', allowed_signers_file: str | None = None, revocation_file: str | None = None, default_key_command: str | None = None, keyids: Iterable[ str] | None = None):
¶
Initialize the SSH CLI vendor.
| Parameters | |
sshstr | Path to ssh-keygen command (default: "ssh-keygen") |
allowedstr | None | Path to allowed signers file |
revocationstr | None | Path to revocation file |
defaultstr | None | Command to get default SSH key for signing |
keyids:Iterable[ | Optional iterable of trusted SSH key fingerprints for verification. If provided, only signatures from these keys will be trusted. |
dulwich.signature.SignatureSigner.signSign data with an SSH key using ssh-keygen.
| Parameters | |
data:bytes | The data to sign |
keyid:str | None | Path to SSH private key. If not specified, will try to get default key from gpg.ssh.defaultKeyCommand |
| Returns | |
bytes | The signature as bytes |
| Raises | |
subprocess.CalledProcessError | if ssh-keygen command fails |
ValueError | if keyid is not provided and no default key available |
Verify an SSH signature using ssh-keygen.
| Parameters | |
data:bytes | The data that was signed |
signature:bytes | The signature to verify |
| Raises | |
BadSignature | if signature verification fails |
UntrustedSignature | if allowedSignersFile is not configured |