class documentation

Signature vendor that uses the GPG command-line tool for signing and verification.

Class Method available Check if the gpg command is available.
Class Method from_config Create a GPG CLI vendor from git configuration.
Method __init__ Initialize the GPG CLI vendor.
Method sign Sign data with a GPG key using the command-line tool.
Method verify Verify a GPG signature using the command-line tool.
Instance Variable gpg_command Undocumented

Inherited from SignatureVerifier (via SignatureSigner):

Instance Variable keyids Undocumented
def available(cls) -> bool:

Check if the gpg command is available.

Returns
boolTrue if gpg command is in PATH, False otherwise
def from_config(cls, config: Config | None = None, keyids: Iterable[str] | None = None) -> GPGCliSignatureVendor:

Create a GPG CLI vendor from git configuration.

Parameters
config:Config | NoneGit configuration to read settings from
keyids:Iterable[str] | NoneOptional iterable of trusted GPG key IDs for verification
Returns
GPGCliSignatureVendorGPGCliSignatureVendor instance configured from the config
def __init__(self, gpg_command: str = 'gpg', keyids: Iterable[str] | None = None):

Initialize the GPG CLI vendor.

Parameters
gpg_command:strPath to the GPG command (default: "gpg")
keyids:Iterable[str] | NoneOptional iterable of trusted GPG key IDs for verification. If provided, only signatures from these keys will be trusted.
def sign(self, data: bytes, keyid: str | None = None) -> bytes:

Sign data with a GPG key using the command-line tool.

Parameters
data:bytesThe data to sign
keyid:str | NoneOptional GPG key ID to use for signing. If not specified, the default GPG key will be used.
Returns
bytesThe signature as bytes
Raises
subprocess.CalledProcessErrorif GPG command fails
def verify(self, data: bytes, signature: bytes):

Verify a GPG signature using the command-line tool.

Parameters
data:bytesThe data that was signed
signature:bytesThe signature to verify
Raises
BadSignatureif GPG signature verification fails
UntrustedSignatureif signature was not created by a trusted key
gpg_command =

Undocumented