Server IP : 209.38.156.173 / Your IP : 216.73.216.122 [ Web Server : Apache/2.4.52 (Ubuntu) System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.1.2-1ubuntu2.22 Disable Function : NONE Domains : 2 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/lib/python3/dist-packages/certbot/__pycache__/ |
Upload File : |
o 6��aT_ � @ s� d Z ddlZddlZddlZddlmZ ddlmZ ddlZddlm Z ddl mZ ddl mZ ddl mZ dd lmZ dd lmZ ddlmZ ddlmZ dd lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlZddl Z!ddl"m#Z$ ddl%m&Z& ddl%m'Z' ddl%m(Z( ddl)m*Z* e�+e,�Z- dhde.de/de/de/d e/d!e0d"e(j1fd#d$�Z2 did%d&�Z3 djd(e(j1d)ee/ d*e/d+e0d!e0d"e(j4fd,d-�Z5d.d/� Z6d0d1� Z7d2d3� Z8d4d5� Z9dkd7d8�Z:d9d:� Z;d;d<� Z<d=d>� Z=d?d@� Z>dAdB� Z?dCdD� Z@dEdF� ZAejBfdGdH�ZCejBfdIdJ�ZDejBfdKdL�ZEdMdN� ZFdOdP� ZGejBfdQdR�ZHejBfdSe/dTe.d"ee/ fdUdV�ZIejBfdWdX�ZJdYdZ� ZKd[d\� ZLd]d^� ZMd_d`� ZNe�OdaejP�ZQdbdc� ZRddde� ZSdldfdg�ZTdS )mz�Certbot client crypto utility functions. .. todo:: Make the transition to use PSS rather than PKCS1_v1_5 when the server is capable of handling the signatures. � N)�List)�Set)�x509)�InvalidSignature)�UnsupportedAlgorithm)�default_backend)�ec)�ECDSA)�EllipticCurvePublicKey)�PKCS1v15)�RSAPublicKey)�Encoding)�NoEncryption)� PrivateFormat)�crypto)�SSL)�crypto_util)�errors)� interfaces)�util)�os�rsa� secp256r1�key-certbot.pemT�key_size�key_dir�key_type�elliptic_curve�keyname�strict_permissions�returnc C s� zt | |pd|d�}W n ty( } ztjddd� t�dt|�� |�d}~ww t�|d|� t�t j �||�d d �\}} |� |�|� W d � n1 sPw Y |dkrat�d| | � nt�d | | � t� | |�S )a Initializes and saves a privkey. Inits key and saves it in PEM format on the filesystem. .. note:: keyname is the attempted filename, it may be different if a file already exists at the path. :param int key_size: key size in bits if key size is rsa. :param str key_dir: Key save directory. :param str key_type: Key Type [rsa, ecdsa] :param str elliptic_curve: Name of the elliptic curve if key type is ecdsa. :param str keyname: Filename of key :param bool strict_permissions: If true and key_dir exists, an exception is raised if the directory doesn't have 0700 permissions or isn't owned by the current user. :returns: Key :rtype: :class:`certbot.util.Key` :raises ValueError: If unable to generate the key given key_size. r )�bitsr r � T��exc_infoz&Encountered error while making key: %sNi� i� �wbr z Generating RSA key (%d bits): %sz"Generating ECDSA key (%d bits): %s)�make_key� ValueError�logger�debug�error�strr �make_or_verify_dir�unique_filer �path�join�write�Key) r r r r r r �key_pem�err�key_f�key_path� r6 �5/usr/lib/python3/dist-packages/certbot/crypto_util.py�generate_key* s* �����r8 c C s0 t �dt� tj�tj�}t| |||||j d�S )a� Initializes and saves a privkey. Inits key and saves it in PEM format on the filesystem. .. note:: keyname is the attempted filename, it may be different if a file already exists at the path. .. deprecated:: 1.16.0 Use :func:`generate_key` instead. :param int key_size: key size in bits if key size is rsa. :param str key_dir: Key save directory. :param str key_type: Key Type [rsa, ecdsa] :param str elliptic_curve: Name of the elliptic curve if key type is ecdsa. :param str keyname: Filename of key :returns: Key :rtype: :class:`certbot.util.Key` :raises ValueError: If unable to generate the key given key_size. zecertbot.crypto_util.init_save_key is deprecated, please use certbot.crypto_util.generate_key instead.)r r r r ) �warnings�warn�DeprecationWarning�zope� component� getUtilityr �IConfigr8 r )r r r r r �configr6 r6 r7 � init_save_keyZ s � �rA F�privkey�namesr. �must_staplec C s� t j| j||d�}t�|d|� t�tj�|d�dd�\}}|� |� |� W d � n1 s0w Y t �d|� t�||d�S ) a: Initialize a CSR with the given private key. :param privkey: Key to include in the CSR :type privkey: :class:`certbot.util.Key` :param set names: `str` names to include in the CSR :param str path: Certificate save directory. :param bool must_staple: If true, include the TLS Feature extension "OCSP Must Staple" :param bool strict_permissions: If true and path exists, an exception is raised if the directory doesn't have 0755 permissions or isn't owned by the current user. :returns: CSR :rtype: :class:`certbot.util.CSR` )rD i� zcsr-certbot.pemi� r% NzCreating CSR: %s�pem) �acme_crypto_util�make_csrrE r r, r- r r. r/ r0 r( r) �CSR)rB rC r. rD r �csr_pem�csr_f�csr_filenamer6 r6 r7 �generate_csr{ s ���rL c C s0 t �dt� tj�tj�}t| |||j |j d�S )aw Initialize a CSR with the given private key. .. deprecated:: 1.16.0 Use :func:`generate_csr` instead. :param privkey: Key to include in the CSR :type privkey: :class:`certbot.util.Key` :param set names: `str` names to include in the CSR :param str path: Certificate save directory. :returns: CSR :rtype: :class:`certbot.util.CSR` zecertbot.crypto_util.init_save_csr is deprecated, please use certbot.crypto_util.generate_csr instead.)rD r )r9 r: r; r<