/var/opt/nydus/ops/asn1crypto/__pycache__
Edit: /var/opt/nydus/ops/asn1crypto/__pycache__/pem.cpython-312.pyc (7112B)
Mj d Z ddlmZmZmZmZ ddlZddlZddlZddl m
Z
ddlmZ
mZmZ ej dk rddlmZ ndd lmZ d
ZddZd Zdd
Zy)zq
Encoding DER to PEM and decoding PEM to DER. Exports the following items:
- armor()
- detect()
- unarmor()
)unicode_literalsdivisionabsolute_importprint_functionN )unwrap) type_namestr_clsbyte_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
-----BEGINs
---- BEGIN)
isinstancer TypeErrorr
_type_namefind)byte_strings ?/opt/nydus/tmp/pip-target-a90h98xg/lib/python/asn1crypto/pem.pydetectr s_ k8,
{#
M*b0YK4D4D]4SWY4YY 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 r3|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
upperencoder writebase64 b64encodelengetvalue)r der_bytesheadersoutputkey b64_bytesb64_lenis r armorr+ 2 s ( i*
Y'
(
i)
y!
!((1I
YF
LL
LL
LLCLLG,-LLLL,,W56LL
U +I)nG A
g+YqR()U R g+ LL
LL
LL??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 ||
<