✏️ 正在编辑: pem.cpython-312.pyc
路径:
/var/opt/nydus/ops/asn1crypto/__pycache__/pem.cpython-312.pyc
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
� ��'j � � � d Z ddlmZmZmZmZ ddlZddlZddlZddl m Z ddlmZ mZmZ ej dk rddlmZ ndd lmZ d � Zdd�Zd� Zdd �Zy)zq Encoding DER to PEM and decoding PEM to DER. Exports the following items: - armor() - detect() - unarmor() � )�unicode_literals�division�absolute_import�print_functionN� )�unwrap)� type_name�str_cls�byte_cls)� )�StringIO)�BytesIOc � � t | t � st t dt | � � � �| j d� dk7 xs | j d� dk7 S )z� Detect if a byte string seems to contain a PEM-encoded block :param byte_string: A byte string to look through :return: A boolean, indicating if a PEM-encoded block is contained in the byte string zC byte_string must be a byte string, not %s s -----BEGIN���s ---- BEGIN)� isinstancer � TypeErrorr � _type_name�find)�byte_strings �?/opt/nydus/tmp/pip-target-k0fmikie/lib/python/asn1crypto/pem.py�detectr s_ � � �k�8�,��� � �{�#� � � � ���M�*�b�0�Y�K�4D�4D�]�4S�WY�4Y�Y� c � � t |t � s t t dt |� z � � �t | t � st t dt | � � � �| j � j d� } t � }|j d� |j | � |j d� |r}|D ]g }|j |j d� � |j d� |j || j d� � |j d� �i |j d� t j |� }t |� }d}||k r3|j |||d z � |j d� |d z }||k r�3|j d � |j | � |j d� |j � S )a Armors a DER-encoded byte string in PEM :param type_name: A unicode string that will be capitalized and placed in the header and footer of the block. E.g. "CERTIFICATE", "PRIVATE KEY", etc. This will appear as "-----BEGIN CERTIFICATE-----" and "-----END CERTIFICATE-----". :param der_bytes: A byte string to be armored :param headers: An OrderedDict of the header lines to write after the BEGIN line :return: A byte string of the PEM block zA der_bytes must be a byte string, not %s zD type_name must be a unicode string, not %s �asciis -----BEGIN s ----- s : � r �@ s -----END )r r r r r r �upper�encoder �write�base64� b64encode�len�getvalue)r � der_bytes�headers�output�key� b64_bytes�b64_len�is r �armorr+ 2 s� � �( �i��*��� ��Y�'� (� � � � �i��)��� � �y�!� � � � ���!�(�(��1�I� �Y�F� �L�L�� � �L�L��� �L�L�����C��L�L����G�,�-��L�L����L�L����,�,�W�5�6��L�L��� � ���U��� � ��+�I��)�n�G� �A� �g�+����Y�q��R��(�)����U�� �R��� �g�+� �L�L��� �L�L��� �L�L����?�?��r c # � K � t | t � st t dt | � � � �d}i }d}d}d}d}| j d� D ]� }|dk( r� |dk( r>t j d|� }|s�'|j d� j d� }d }d }�L|d k( rQ|j d� dk( rd }n:|j d� } | j dd� \ } }|j � || <