HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //proc/self/root/usr/lib/python3.6/site-packages/rsa/__pycache__/util.cpython-36.pyc
3

�Cb`�@s2dZddlZddlmZddlZdd�dd�ZdS)zUtility functions.�N)�OptionParser)�returnc	Cs�tddd�}|jdddddd	�|jd
dddd
d	�|jdddd dd�|jdddd!dd�|jtj�\}}|jr�td|j|jftjd�t	|jd��}|j
�}WdQRXn$td|jtjd�tjj
�jd�}t
|�tks�tt
|���tjjj||j�}tjj|j|j�}|j|j�}|j�r`td|j|jftjd�t	|jd��}|j|�WdQRXn&td|jtjd�tjj|jd��dS)"z=Reads a private key and outputs the corresponding public key.zusage: %prog [options]z�Reads a private key and outputs the corresponding public key. Both private and public keys use the format described in PKCS#1 v1.5)Zusage�descriptionz-iz--input�
infilename�stringz1Input filename. Reads from stdin if not specified)�dest�type�helpz-oz--output�outfilenamez2Output filename. Writes to stdout of not specifiedz--inform�informz!key format of input - default PEM�PEM�DER)rr	�choices�defaultz	--outform�outformz"key format of output - default PEMz(Reading private key from %s in %s format)�file�rbNz+Reading private key from stdin in %s format�asciiz%Writing public key to %s in %s format�wbz)Writing public key to stdout in %s format)rr
)rr
)rZ
add_option�
parse_args�sys�argvr�printr�stderr�open�read�stdin�encoder�bytes�AssertionError�rsa�keyZ
PrivateKeyZ
load_pkcs1Z	PublicKey�n�eZ
save_pkcs1rr
�write�stdout�decode)	�parserZcliZcli_argsZinfileZin_dataZpriv_keyZpub_keyZout_dataZoutfile�r(�/usr/lib/python3.6/util.py�private_to_publics`

r*)�__doc__rZoptparserZrsa.keyr r*r(r(r(r)�<module>s