Dashboard
PHP:
8.2.30
OS:
Linux
User:
dh_nv8b2m
/
/
usr
/
share
/
dput
/
dput
/
__pycache__
📤 Upload
📝 New File
📁 New Folder
Close
Editing: crypto.cpython-310.pyc
o ��d� � @ sH d Z ddlZddlZddlZG dd� de�Zdd� Zdd� Zd d � ZdS )z* Cryptographic and hashing functionality. � Nc @ s e Zd ZdZdS )�SignatureVerifyErrorzD Exception raised when the signature verification returns an error. N)�__name__� __module__�__qualname__�__doc__� r r �/usr/share/dput/dput/crypto.pyr s r c C sL | j tjj@ rd}|S | j tjj@ rd}|S | j tjj@ r!d}|S t| j ��)a� Make a phrase characterising a GnuPG signature. :param signature: A `gpg.results.Signature` instance. :return: A simple text phrase characterising the `signature`. * If the signature is valid, the result is "valid". * If the signature is not valid, but is good, the result is "good". * If the signature is not good, the result is "bad". �valid�bad�good)�summary�gpg� constants�SIGSUM_VALID� SIGSUM_RED�SIGSUM_GREENr )� signature�textr r r �characterise_signature s �� �r c C sn d}d}d}zt | �}W n ty" } z |}d}W Y d}~nd}~ww d}|j||�� | j| d� d�}|S )am Make a message describing a GnuPG signature. :param signature: A `gpg.result.Signature` instance. :return: A text description of the salient points of the `signature`. The description includes the signature's character (whether it is valid, good, or bad); and the key ID used to create the signature. � �UNKNOWNNzHError checking signature from {fpr}: {error.__class__.__name__}: {error}z {character} signature from {fpr})�error� character�fpr)r r �format�titler )r � fpr_lengthr r �exc� text_templater r r r �describe_signature, s$ ����r c C s� t �� }z| � |�| �\}}W d � n1 sw Y W n t jjy> } ztj�dj| j |� � |jd�� � d}~ww |jD ]}t |�}tj�dj| j ||d�� qBdS )aW Verify the GnuPG signature on a file. :param infile: The file containing a signed message. :return: ``None``. :raise gpg.errors.GPGMEError: When the signature verification fails. The `infile` is a file-like object, open for reading, that contains a message signed with OpenPGP (e.g. GnuPG). Nz%gpg: {path}: error {code}: {message} )�path�code�messagezgpg: {path}: {description} )r �sig�description)r �Context�verify�errors� GPGMEError�sys�stderr�writer �name�getcoder"