⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.191
Server IP:
97.74.87.16
Server:
Linux 16.87.74.97.host.secureserver.net 5.14.0-503.38.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 18 08:52:10 EDT 2025 x86_64
Server Software:
Apache
PHP Version:
8.2.28
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
var
/
opt
/
nydus
/
ops
/
oscrypto
/
__pycache__
/
View File Name :
_pkcs12.cpython-39.pyc
a ���g � @ s� d dl mZmZmZmZ d dlZd dlZd dlZddlm Z m Z ddlmZ ddl mZmZmZ ejdk rpeZndd � Zd gZdd � ZdS )� )�unicode_literals�division�absolute_import�print_functionN� )�int_from_bytes�int_to_bytes)�pretty_message)� type_name�byte_cls� int_types)� c C s t | g�S )N)�bytes)�num� r �A/opt/nydus/tmp/pip-target-mke_irhy/lib/python/oscrypto/_pkcs12.py�chr_cls s r � pkcs12_kdfc C sb t |t�sttdt|����t |t�s8ttdt|����t |t�sTttdt|����|dk rnttdt|����t |t�s�ttdt|����|dk r�ttdt|����| tg d��vr�ttd t| ����|tg d ��vr�ttdt|����|� d�� d �d }tt| �}ddddddd�| }| dv �r,d} nd} t |�| } d}|dk�r�| tt�tt|��| �� }t|�|k �r�||7 }�qh|d|� }d} |dk�r�| tt�tt|��| �� }t| �|k �r�| |7 } �q�| d|� } || }tt�t|�| ��}d|| }td|d �D �]:}|| | ��� }td|d �D ]}||��� }�q<||k �rd}t|�| k �rx||7 }�q^t|d| � �d }tdt|�| �D ]t}|| }|d | }|||� }tt|�| �}t|�}|| k�r�||| d� }|d|� | ||d� }�q�|d | }t||�}|d|� |d|� ||| d� }�q|d|� S )a� KDF from RFC7292 appendix b.2 - https://tools.ietf.org/html/rfc7292#page-19 :param hash_algorithm: The string name of the hash algorithm to use: "md5", "sha1", "sha224", "sha256", "sha384", "sha512" :param password: A byte string of the password to use an input to the KDF :param salt: A cryptographic random byte string :param iterations: The numbers of iterations to use when deriving the key :param key_length: The length of the desired key in bytes :param id_: The ID of the usage - 1 for key, 2 for iv, 3 for mac :return: The derived key as a byte string z@ password must be a byte string, not %s z< salt must be a byte string, not %s z? iterations must be an integer, not %s r zC iterations must be greater than 0 - is %s z? key_length must be an integer, not %s zC key_length must be greater than 0 - is %s )�md5�sha1�sha224�sha256�sha384�sha512z� hash_algorithm must be one of "md5", "sha1", "sha224", "sha256", "sha384", "sha512", not %s )r � r z< id_ must be one of 1, 2, 3, not %s zutf-8zutf-16bes � � � � �0 �@ )r r � � r � r N)� isinstancer � TypeErrorr r r � ValueError�repr�set�decode�encode�getattr�hashlibr �int�math�ceil�float�len�range�digestr r �min)Zhash_algorithm�passwordZsaltZ iterationsZ key_lengthZid_Zutf16_password�algo�u�v�d�sZs_len�pZp_len�i�c�ar Za2�_�bZnum2�start�endZi_num2Zi_num2_l�beginZto_copyr r r r s� � � �� ���� �� ,)� __future__r r r r �sysr, r. Z_asn1r r �_errorsr �_typesr r r �version_info�chrr �__all__r r r r r �<module> s �