%PDF- %PDF-
Direktori : /lib/python3/dist-packages/certbot/__pycache__/ |
Current File : //lib/python3/dist-packages/certbot/__pycache__/crypto_util.cpython-312.pyc |
� M/�e` � � � d Z ddlZddlZddlZddlZddlmZ ddlmZ ddlmZ ddlm Z ddlm Z ddlmZ dd lmZ dd l mZ ddlmZ ddlmZ dd lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z ddl!m"Z" ddl!m#Z# ddl!m$Z$ ddl%Z%ddl&m'Z' ddl&m(Z( ddl)Z)ddl*m+Z, ddl-m.Z. ddl-m/Z/ ddl-m0Z0 ddl1m2Z2 erddl3m4Z4 dd l5m6Z6 dd!l7m8Z8 dd"l9m:Z: ejv e<� Z= dhd#e>d$ee? d%e?d&e?d'e?d(e@d)e0j� fd*�ZB did+e0j� d,eee? e e? f d-ee? d.e@d(e@d)e0j� fd/�ZDd0eEd)e@fd1�ZFd0eEd+eEd)e@fd2�ZGd3e?d4eEd)e e>e0j� ee? f fd5�ZH djd6e>d%e?d&ee? d)eEfd7�ZId+ee?eEf d)e@fd8�ZJd9e/j� d)dfd:�ZLd9e/j� d)dfd;�ZMd<eed=d>ee d?d@f dAeEdBeEdCej� d)df dD�ZOdEe?dFe?d)dfdG�ZPd9e/j� d)dfdH�ZQd4eEd)e e'j� e>f fdI�ZSe'j� fdJeEdKee>eEgee'j� e'j� f f dLe>d)ee'j� e'j� f fdM�ZVe'j� fdJeEdKee>eEgee'j� e'j� f f dLe>d)ee? fdN�ZWe'j� fdOeEdLe>d)ee? fdP�ZXdQeEdKee>eEgee'j� e'j� f f dLe>d)ee? fdR�ZYdSee'j� e'j� f d)ee? fdT�ZZe'j� fdOeEdLe>d)ee? fdU�Z[e'j� fd0eEdLe>d)ee? fdV�Z\e'j� fdWeee'j� ee%j� f dXe>d)eEfdY�Z^dEe?d)ej fdZ�Z_dEe?d)ej fd[�Z`dEe?d\ee'j� geeE f d)ej fd]�Zad^e?d)e?fd_�Zb ej� d`ej� � Zedae?d)e e?e?f fdb�ZfdEe?d)e>fdc�Zg dkddee? dee?dfe@d)e?fdg�Zhy)lz�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)�Callable)�List)�Optional)�Set)�Tuple)� TYPE_CHECKING)�Union)�x509)�InvalidSignature)�UnsupportedAlgorithm)�default_backend)�hashes)�ec)�DSAPublicKey)�ECDSA)�EllipticCurvePublicKey)�PKCS1v15)�RSAPublicKey)�Encoding)�NoEncryption)� PrivateFormat)�crypto)�SSL)�crypto_util)�errors)� interfaces)�util)�os)�Ed448PublicKey)�Ed25519PublicKey)� X448PublicKey)�X25519PublicKey�key_size�key_dir�key_type�elliptic_curve�keyname�strict_permissions�returnc �D � t | |xs d|�� }d}|r�t j |d|� t j t j j ||� d d � \ } }| 5 | j |� ddd� |dk( rt j d| |� nt j d | |� t j ||� S # t $ r=}t j dd�� t j dt |� � |�d}~ww xY w# 1 sw Y ��xY w)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: Optional 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. � secp256r1)�bitsr&