Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/Crypto/IO/__pycache__/PKCS8.cpython-39.pyc
Ðазад
a c�h�! � @ sT d dl T d dlmZmZmZmZ d dlmZmZm Z ddgZ d dd�Zd dd�ZdS )� )�*)�DerNull�DerSequence�DerObjectId�DerOctetString)�PBES1�PBES2� PbesError�wrap�unwrapNc C sr |du rt � }tdtt|�|g�t| �g�}|�� }|du r@|S |sLtd��t|�}|du r`d}t�|||||�S )a� Wrap a private key into a PKCS#8 blob (clear or encrypted). Args: private_key (byte string): The private key encoded in binary form. The actual encoding is algorithm specific. In most cases, it is DER. key_oid (string): The object identifier (OID) of the private key to wrap. It is a dotted string, like ``1.2.840.113549.1.1.1`` (for RSA keys). passphrase (bytes string or string): The secret passphrase from which the wrapping key is derived. Set it only if encryption is required. protection (string): The identifier of the algorithm to use for securely wrapping the key. The default value is ``PBKDF2WithHMAC-SHA1AndDES-EDE3-CBC``. prot_params (dictionary): Parameters for the protection algorithm. +------------------+-----------------------------------------------+ | Key | Description | +==================+===============================================+ | iteration_count | The KDF algorithm is repeated several times to| | | slow down brute force attacks on passwords | | | (called *N* or CPU/memory cost in scrypt). | | | The default value for PBKDF2 is 1000. | | | The default value for scrypt is 16384. | +------------------+-----------------------------------------------+ | salt_size | Salt is used to thwart dictionary and rainbow | | | attacks on passwords. The default value is 8 | | | bytes. | +------------------+-----------------------------------------------+ | block_size | *(scrypt only)* Memory-cost (r). The default | | | value is 8. | +------------------+-----------------------------------------------+ | parallelization | *(scrypt only)* CPU-cost (p). The default | | | value is 1. | +------------------+-----------------------------------------------+ key_params (DER object): The algorithm parameters associated to the private key. It is required for algorithms like DSA, but not for others like RSA. randfunc (callable): Random number generation function; it should accept a single integer N and return a string of random data, N bytes long. If not specified, a new RNG will be instantiated from :mod:`Crypto.Random`. Return: The PKCS#8-wrapped private key (possibly encrypted), as a byte string. Nr zEmpty passphrasez"PBKDF2WithHMAC-SHA1AndDES-EDE3-CBC) r r r r �encode� ValueError�tobytesr Zencrypt) �private_keyZkey_oid� passphraseZ protectionZprot_paramsZ key_paramsZrandfunc�pk_infoZpk_info_der� r �/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/Crypto/IO/PKCS8.pyr 2 s* ; ���c C s� |r�t |�}d}zt�| |�} d}W nD tyT } zdt|� }W Y d}~nd}~0 tyh d}Y n0 |s�zt�| |�} d}W nL ty� } z|dt|� 7 }W Y d}~n"d}~0 ty� |d7 }Y n0 |s�td| ��t� j| d d �}t |�dk�r|�std��|d d k�r"td��t� j|d dd �}t � �|d �j}t |�dk�r\d}n.zt� �|d � d}W n |d }Y n0 t � �|d �j} || |fS )aH Unwrap a private key from a PKCS#8 blob (clear or encrypted). Args: p8_private_key (byte string): The private key wrapped into a PKCS#8 blob, DER encoded. passphrase (byte string or string): The passphrase to use to decrypt the blob (if it is encrypted). Return: A tuple containing #. the algorithm identifier of the wrapped key (OID, dotted string) #. the private key (byte string, DER encoded) #. the associated parameters (byte string, DER encoded) or ``None`` Raises: ValueError : if decoding fails FTz PBES1[%s]NzPBES1[Invalid]z ,PBES2[%s]z,PBES2[Invalid]zError decoding PKCS#8 (%s))� � � )Znr_elementsr z;Not a valid clear PKCS#8 structure (maybe it is encrypted?)r z#Not a valid PrivateKeyInfo SEQUENCE� )r r )r r Zdecryptr �strr r r �decode�lenr �valuer r �payload) Zp8_private_keyr �found�eZ error_strr �algoZalgo_oidZalgo_paramsr r r r r � sH $)NNNNN)N) ZCrypto.Util.py3compatZCrypto.Util.asn1r r r r ZCrypto.IO._PBESr r r �__all__r r r r r r �<module># s � ^
| ver. 1.1 | |
.
| PHP 8.3.30 | Ð“ÐµÐ½ÐµÑ€Ð°Ñ†Ð¸Ñ Ñтраницы: 0 |
proxy
|
phpinfo
|
ÐаÑтройка