hyb
2026-01-30 7657e1b2fa251a2ea372710ad75cb395a3c0e374
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
Ë
ž¬`ieãóf—ddl­ddlmZmZmZmZddlmZmZm    Z    ddgZ
ddde«dfd„Z d    d„Z y)
é)Ú*)ÚDerNullÚ DerSequenceÚ DerObjectIdÚDerOctetString)ÚPBES1ÚPBES2Ú    PbesErrorÚwrapÚunwrapNcó—|€tt|«g«}ntt|«|g«}td|t|«g«}|j«}    |€|    S|s t    d«‚t |«}|€d}t j|    ||||«S)a2Wrap a private key into a PKCS#8 blob (clear or encrypted).
 
    Args:
 
      private_key (bytes):
        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)
        or ``'1.2.840.10045.2.1'`` (for ECC keys).
 
    Keyword Args:
 
      passphrase (bytes 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.
        Refer to :ref:`the encryption parameters<enc_params>` .
        The default value is ``'PBKDF2WithHMAC-SHA1AndDES-EDE3-CBC'``.
 
      prot_params (dictionary):
        Parameters for the key derivation function (KDF).
        Refer to :ref:`the encryption parameters<enc_params>` .
 
      key_params (DER object or None):
        The ``parameters`` field to use in the ``AlgorithmIdentifier``
        SEQUENCE. If ``None``, no ``parameters`` field will be added.
        By default, the ASN.1 type ``NULL`` is used.
 
      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`.
 
    Returns:
      bytes: The PKCS#8-wrapped private key (possibly encrypted).
    rzEmpty passphrasez"PBKDF2WithHMAC-SHA1AndDES-EDE3-CBC)rrrÚencodeÚ
ValueErrorÚtobytesr    Úencrypt)
Ú private_keyÚkey_oidÚ
passphraseÚ
protectionÚ prot_paramsÚ
key_paramsÚrandfuncÚ    algorithmÚpk_infoÚ pk_info_ders
          õbH:\项目\archive\测试组\脚本\Change_password\venv_build\Lib\site-packages\Crypto/IO/PKCS8.pyr r 2sª€ðjÐܤ¨WÓ!5Р6Ó7‰    ä¤¨WÓ!5°zРBÓCˆ    äØØÜ˜{Ó+ðó€Gð
—.‘.Ó"€KàÐØÐá ÜÐ+Ó,Ð,ô˜Ó$€JØÐØ9ˆ
Ü =‰=˜ jØ# [°(ó <ð<ócóÔ—|Qt|«}d}    tj||«}d}|s    t j||«}d}|st dz«‚t«j|d    ¬
«}t|«d k(r |s t d «‚|d d k(rt|«dvr6t d«‚|d dk(rt|«dvrt d«‚t d«‚t«j|dd¬
«}t«j|d «j}t|«dk(rd}n    t«j|d«d}t«j|d «j}    ||    |fS#t$r}dt    |«z}Yd}~Œhd}~wt
$rd}YŒywxYw#t$r}dt    |«zz }Yd}~Œ‚d}~wt
$r    dz }YŒ–wxYw#|d}YŒžxYw)aNUnwrap a private key from a PKCS#8 blob (clear or encrypted).
 
    Args:
      p8_private_key (bytes):
        The private key wrapped into a PKCS#8 container, DER encoded.
 
    Keyword Args:
      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 (bytes, DER encoded)
       #. the associated parameters (bytes, DER encoded) or ``None``
 
    Raises:
      ValueError : if decoding fails
    NFTz    PBES1[%s]zPBES1[Invalid]z
,PBES2[%s]z,PBES2[Invalid]zError decoding PKCS#8 (%s))éééé)Ú nr_elementsrz;Not a valid clear PKCS#8 structure (maybe it is encrypted?)r)r r!z#Not a valid PrivateKeyInfo SEQUENCEé)r r!r")r$r)rrÚdecryptr
Ústrrr    rÚdecodeÚlenrÚvaluerrÚpayload)
Úp8_private_keyrÚfoundÚeÚ    error_strrÚalgoÚalgo_oidÚ algo_paramsrs
          rr r sû€ð,ÐܘZÓ(ˆ
àˆð    )Ü"Ÿ]™]¨>¸:ÓFˆN؈Eñ ð /Ü!&§¡¨~¸zÓ!JØñ ÜÐ9¸IÑEÓFÐ Fä‹m×"Ñ" >¸|Ð"ÓL€GÜ
ˆ7ƒ|qÒ¡Üð4ó5ð    5ð0ˆqzQ‚Ü ˆw‹<˜vÑ %ÜÐBÓCÐ CØ    ‰qŠÜ ˆw‹<˜yÑ (ÜÐBÓCÐ CäÐ>Ó?Ð?ä ‹=× Ñ  ¨¡
¸Ð Ó ?€DÜ‹}×#Ñ# D¨¡GÓ,×2Ñ2€HÜ
ˆ4ƒyA‚~؉ ð    "Ü ‹I× Ñ ˜T !™WÔ %؈Kô
!Ó"×)Ñ)¨'°!©*Ó5×=Ñ=€Kð k ;Ð /Ð/øôIò    -Ø#¤c¨!£fÑ,ŽIûÜò    )Ø(‹Ið    )ûôò 3ؘ\¬C°«FÑ2Ñ2–    ûÜò /ØÐ.Ñ.“    ð /ûðb    "ؘq™'ŠKúsF‘E4¬F&Ä+GÅ4    F#Å=FÆF#Æ"F#Æ&    GÆ/GÇGÇGÇG')N) ÚCrypto.Util.py3compatÚCrypto.Util.asn1rrrrÚCrypto.IO._PBESrr    r
Ú__all__r r ©rrú<module>r7sFðôF$÷ó÷4Ñ3ð 8Ð
€ð+/¸4Ø¡g£i¸$óL<ô^a0r