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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
Ë
ž¬`iÜ|ãóì—gd¢ZddlZddlZddlmZddlmZmZmZddl    m
Z
m Z ddl m Z ddlmZddlmZmZmZdd    lmZmZmZGd
„d e«Zdd „Zdd „Zd„Zd„Zd„Zd„Zd„Z d„Z!d„Z"dd„Z#e#Z$dZ%y))ÚgenerateÚ    constructÚ
import_keyÚRsaKeyÚoidéN)ÚRandom)ÚtobytesÚbordÚtostr)Ú DerSequenceÚDerNull)Ú bytes_to_long)ÚInteger)Útest_probable_primeÚgenerate_probable_primeÚ    COMPOSITE)Ú_expand_subject_public_key_infoÚ_create_subject_public_key_infoÚ _extract_subject_public_key_infocóL—eZdZdZd„Zed„«Zed„«Zed„«Zed„«Z    ed„«Z
ed„«Z ed    „«Z ed
„«Z ed „«Zed „«Zd „Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z        d&d„Zd„Zd„Z d„Z!d „Z"d!„Z#d"„Z$d#„Z%d$„Z&d%„Z'y)'ra×Class defining an RSA key, private or public.
    Do not instantiate directly.
    Use :func:`generate`, :func:`construct` or :func:`import_key` instead.
 
    :ivar n: RSA modulus
    :vartype n: integer
 
    :ivar e: RSA public exponent
    :vartype e: integer
 
    :ivar d: RSA private exponent
    :vartype d: integer
 
    :ivar p: First factor of the RSA modulus
    :vartype p: integer
 
    :ivar q: Second factor of the RSA modulus
    :vartype q: integer
 
    :ivar invp: Chinese remainder component (:math:`p^{-1} \text{mod } q`)
    :vartype invp: integer
 
    :ivar invq: Chinese remainder component (:math:`q^{-1} \text{mod } p`)
    :vartype invq: integer
 
    :ivar u: Same as ``invp``
    :vartype u: integer
    c óx—t|j««}td«}|td«z}|||fvr td«‚|j«D]\}}t    |d|z|«Œ||k(rJ|j
|j dz
z|_|j
|jdz
z|_    d|_
yy)a.Build an RSA key.
 
        :Keywords:
          n : integer
            The modulus.
          e : integer
            The public exponent.
          d : integer
            The private exponent. Only required for private keys.
          p : integer
            The first factor of the modulus. Only required for private keys.
          q : integer
            The second factor of the modulus. Only required for private keys.
          u : integer
            The CRT coefficient (inverse of p modulo q). Only required for
            private keys.
        ©ÚnÚe)ÚpÚqÚdÚuzSome RSA components are missingÚ_éN) ÚsetÚkeysÚ
ValueErrorÚitemsÚsetattrÚ_dÚ_pÚ_dpÚ_qÚ_dqÚ_invq)ÚselfÚkwargsÚ    input_setÚ
public_setÚ private_setÚ    componentÚvalues       õgH:\项目\archive\测试组\脚本\Change_password\venv_build\Lib\site-packages\Crypto/PublicKey/RSA.pyÚ__init__zRsaKey.__init__Rs´€ô&˜Ÿ ™ › Ó&ˆ    Ü˜“_ˆ
Ø ¤3Ð';Ó#<Ñ<ˆ Ø ˜[¨*Ð5Ñ 5ÜÐ>Ó?Ð ?Ø &§ ¡ £ò    2Ñ ˆIuÜ D˜#     ™/¨5Õ 1ð    2à ˜ Ò #Ø—w‘w $§'¡'¨A¡+Ñ.ˆDŒHØ—w‘w $§'¡'¨A¡+Ñ.ˆDŒH؈DJð $ócó,—t|j«S©N)ÚintÚ_n©r,s r3rzRsaKey.nqó€ä4—7‘7‹|Ðr5có,—t|j«Sr7)r8Ú_er:s r3rzRsaKey.eur;r5cób—|j«s td«‚t|j«S)Nz-No private exponent available for public keys)Ú has_privateÚAttributeErrorr8r&r:s r3rzRsaKey.dys(€à×ÑÔ!Ü Ð!PÓQÐ Qܐ4—7‘7‹|Ðr5cób—|j«s td«‚t|j«S)Nz.No CRT component 'p' available for public keys)r?r@r8r'r:s r3rzRsaKey.pó(€à×ÑÔ!Ü Ð!QÓRÐ Rܐ4—7‘7‹|Ðr5cób—|j«s td«‚t|j«S)Nz.No CRT component 'q' available for public keys)r?r@r8r)r:s r3rzRsaKey.q…rBr5cób—|j«s td«‚t|j«S)Nz/No CRT component 'dp' available for public keys)r?r@r8r(r:s r3Údpz    RsaKey.dp‹ó(€à×ÑÔ!Ü Ð!RÓSÐ Sܐ4—8‘8‹}Ðr5cób—|j«s td«‚t|j«S)Nz/No CRT component 'dq' available for public keys)r?r@r8r*r:s r3Údqz    RsaKey.dq‘rFr5cóΗ|j«s td«‚|j€*|jj    |j
«|_t |j«S)Nz1No CRT component 'invq' available for public keys)r?r@r+r)Úinverser'r8r:s r3Úinvqz RsaKey.invq—sJ€à×ÑÔ!Ü Ð!TÓUÐ UØ :‰:Ð ØŸ™Ÿ™¨¯©Ó1ˆDŒJܐ4—:‘:‹Ðr5có—|jSr7)rr:s r3Úinvpz RsaKey.invpŸs €àv‰vˆ r5cób—|j«s td«‚t|j«S)Nz.No CRT component 'u' available for public keys)r?r@r8Ú_ur:s r3rzRsaKey.u£rBr5có6—|jj«S)zSize of the RSA modulus in bits©r9Ú size_in_bitsr:s r3rRzRsaKey.size_in_bits©s€àw‰w×#Ñ#Ó%Ð%r5cóH—|jj«dz
dzdzS)z9The minimal amount of bytes that can hold the RSA modulusr érQr:s r3Ú size_in_byteszRsaKey.size_in_bytes­s$€à—‘×$Ñ$Ó&¨Ñ*¨qÑ0°1Ñ4Ð4r5cóÀ—d|cxkr|jkstd«‚td«‚ttt    |«|j
|j««S)NrzPlaintext too large)r9r#r8Úpowrr=)r,Ú    plaintexts  r3Ú_encryptzRsaKey._encrypt±sQ€ØIÔ' §¡Ò'ÜÐ2Ó3Ð 3ð(ÜÐ2Ó3Ð 3Ü”3”w˜yÓ)¨4¯7©7°D·G±GÓ<Ó=Ð=r5có¤—d|cxkr|jkstd«‚td«‚|j«s td«‚t    j
d|j¬«}t    |«t ||j|j«z|jz}t ||j|j«}t ||j|j«}||z
|jz|jz}||jz|z}t    j|j|j«||j«}|S)NrzCiphertext too largezThis is not a private keyr )Ú min_inclusiveÚ max_exclusive)r9r#r?Ú    TypeErrorrÚ random_rangerWr=r(r'r*r)rOÚ_mult_modulo_bytesrJ)    r,Ú
ciphertextÚrÚcpÚm1Úm2ÚhÚmpÚresults             r3Ú_decrypt_to_byteszRsaKey._decrypt_to_bytes¶s€ØJÔ( §¡Ò(ÜÐ3Ó4Ð 4ð)ÜÐ3Ó4Ð 4Ø×ÑÔ!ÜÐ7Ó8Ð 8ô
×  Ñ  ¨qÀÇÁÔ Hˆä ZÓ  ¤3 q¨$¯'©'°4·7±7Ó#;Ñ ;¸d¿g¹gÑ Eˆä T—X‘X˜tŸw™wÓ 'ˆÜ T—X‘X˜tŸw™wÓ 'ˆØ2‰g˜Ÿ™Ñ   D§G¡GÑ +ˆØ —‘‰[˜2Ñ ˆô×+Ñ+Ø—I‘I˜dŸg™gÓ&ØØ—G‘Góˆðˆ r5có6—t|j|««S)zLegacy private method)rrh©r,r`s  r3Ú_decryptzRsaKey._decryptÏs€ô˜T×3Ñ3°JÓ?Ó@Ð@r5có—t|d«S)z"Whether this is an RSA private keyr&)Úhasattrr:s r3r?zRsaKey.has_privateÔs€ôt˜TÓ"Ð"r5có—y©NT©r:s r3Ú can_encryptzRsaKey.can_encryptÙó€Ør5có—yrorpr:s r3Úcan_signzRsaKey.can_signÜrrr5cóD—t|j|j¬«S)z^A matching RSA public key.
 
        Returns:
            a new :class:`RsaKey` object
        r)rr9r=r:s r3Ú
public_keyzRsaKey.public_keyßs€ô ˜Ÿ™ 4§7¡7Ô+Ð+r5có—|j«|j«k7ry|j|jk7s|j|jk7ry|j«sy|j|jk(S)NFT)r?rrr©r,Úothers  r3Ú__eq__z RsaKey.__eq__çsc€Ø × Ñ Ó  ×!2Ñ!2Ó!4Ò 4ØØ 6‰6U—W‘WÒ  §¡¨%¯'©'Ò 1ØØ×ÑÔ!ØØ—‘˜%Ÿ'™'Ñ!Ð"r5có—||k( Sr7rprxs  r3Ú__ne__z RsaKey.__ne__ðs€Ø˜E‘MÐ"Ð"r5có—ddlm}|‚)Nr)Ú PicklingError)Úpickler~)r,r~s  r3Ú __getstate__zRsaKey.__getstate__ós €å(ØÐr5có.—|j«rVdt|j«t|j«t|j«t|j
«fz}nd}dt|j «t|j«|fzS)Nz, d=%d, p=%d, q=%d, u=%dÚzRsaKey(n=%d, e=%d%s))r?r8r&r'r)rOr9r=)r,Úextras  r3Ú__repr__zRsaKey.__repr__øsq€Ø × Ñ Ô Ø.´#°d·g±g³,ÄÀDÇGÁGà Ü25°d·g±g³,ÄÀDÇGÁGà ð2NñN‰EðˆEØ%¬¨T¯W©W«´s¸4¿7¹7³|ÀUÐ(KÑKÐKr5cóL—|j«rd}nd}d|t|«fzS)NÚPrivateÚPublicz%s RSA key at 0x%X)r?Úid)r,Úkey_types  r3Ú__str__zRsaKey.__str__s,€Ø × Ñ Ô Ø ‰HàˆHØ# x´°D³Ð&:Ñ:Ð:r5Nc ód—| t|«}|€tj}|dk(rÂ|j|jfDcgc]}|j «‘Œc}\}}    t |d«dzrd|z}t |    d«dzrd|    z}    d||    g}
dj|
D cgc]$} tjdt| ««| z‘Œ&c} «} d    tj| «dd
zS|j«r7td|j|j |j"|j$|j&|j"|j$d z
z|j"|j&d z
zt)|j&«j+|j$«g    «j-«} |d k(rd }|d k(r±|r¯t/d«‚ddlm}|dk(r&|€$d}|j5| t6dt9«¬«} nsd}|s|r t/d«‚d}|j5| t6|||t9«¬«} d}n:d}t;t6t|j|j g«t9««} |d k(r| S|dk(r%ddlm}|j-| |||«}t|«St/d|z«‚cc}wcc} w)aØ Export this RSA key.
 
        Keyword Args:
          format (string):
            The desired output format:
 
            - ``'PEM'``. (default) Text output, according to `RFC1421`_/`RFC1423`_.
            - ``'DER'``. Binary output.
            - ``'OpenSSH'``. Text output, according to the OpenSSH specification.
              Only suitable for public keys (not private keys).
 
            Note that PEM contains a DER structure.
 
          passphrase (bytes or string):
            (*Private keys only*) The passphrase to protect the
            private key.
 
          pkcs (integer):
            (*Private keys only*) The standard to use for
            serializing the key: PKCS#1 or PKCS#8.
 
            With ``pkcs=1`` (*default*), the private key is encoded with a
            simple `PKCS#1`_ structure (``RSAPrivateKey``). The key cannot be
            securely encrypted.
 
            With ``pkcs=8``, the private key is encoded with a `PKCS#8`_ structure
            (``PrivateKeyInfo``). PKCS#8 offers the best ways to securely
            encrypt the key.
 
            .. note::
                This parameter is ignored for a public key.
                For DER and PEM, the output is always an
                ASN.1 DER ``SubjectPublicKeyInfo`` structure.
 
          protection (string):
            (*For private keys only*)
            The encryption scheme to use for protecting the private key
            using the passphrase.
 
            You can only specify a value if ``pkcs=8``.
            For all possible protection schemes,
            refer to :ref:`the encryption parameters of PKCS#8<enc_params>`.
            The recommended value is
            ``'PBKDF2WithHMAC-SHA512AndAES256-CBC'``.
 
            If ``None`` (default), the behavior depends on :attr:`format`:
 
            - if ``format='PEM'``, the obsolete PEM encryption scheme is used.
              It is based on MD5 for key derivation, and 3DES for encryption.
 
            - if ``format='DER'``, the ``'PBKDF2WithHMAC-SHA1AndDES-EDE3-CBC'``
              scheme is used.
 
          prot_params (dict):
            (*For private keys only*)
 
            The parameters to use to derive the encryption key
            from the passphrase. ``'protection'`` must be also specified.
            For all possible values,
            refer to :ref:`the encryption parameters of PKCS#8<enc_params>`.
            The recommendation is to use ``{'iteration_count':21000}`` for PBKDF2,
            and ``{'iteration_count':131072}`` for scrypt.
 
          randfunc (callable):
            A function that provides random bytes. Only used for PEM encoding.
            The default is :func:`Crypto.Random.get_random_bytes`.
 
        Returns:
          bytes: the encoded key
 
        Raises:
          ValueError:when the format is unknown or when you try to encrypt a private
            key with *DER* format and PKCS#1.
 
        .. warning::
            If you don't provide a pass phrase, the private key will be
            exported in the clear!
 
        .. _RFC1421:    http://www.ietf.org/rfc/rfc1421.txt
        .. _RFC1423:    http://www.ietf.org/rfc/rfc1423.txt
        .. _`PKCS#1`:   http://www.ietf.org/rfc/rfc3447.txt
        .. _`PKCS#8`:   http://www.ietf.org/rfc/rfc5208.txt
        NÚOpenSSHré€ósssh-rsar5ú>Ióssh-rsa éÿÿÿÿr zRSA PRIVATE KEYÚDERz&PKCS#1 private key cannot be encrypted©ÚPKCS8ÚPEMz PRIVATE KEY)Ú
key_paramszENCRYPTED PRIVATE KEYz"'protection' parameter must be setz"PBKDF2WithHMAC-SHA1AndDES-EDE3-CBC)Ú prot_paramsr–z
PUBLIC KEY©r•z3Unknown key format '%s'. Cannot export the RSA key.)r    rÚget_random_bytesr=r9Úto_bytesr
ÚjoinÚstructÚpackÚlenÚbinasciiÚ
b2a_base64r?r rrrrrrrJÚencoder#Ú    Crypto.IOr”Úwraprr rr•)r,ÚformatÚ
passphraseÚpkcsÚ
protectionÚrandfuncr—ÚxÚe_bytesÚn_bytesÚkeypartsÚkpÚ    keystringÚ
binary_keyr‰r”r•Úpem_strs                  r3Ú
export_keyzRsaKey.export_keysœ€ðl Ð !Ü  Ó,ˆJà Ð Ü×.Ñ.ˆHà YÒ Ø7;·w±wÀÇÁÐ6HÖI° §
¡
¥ ÒIÑ ˆGWܐG˜A‘JÓ $Ò&Ø! GÑ+ÜG˜A‘JÓ $Ò&Ø! GÑ+Ø" G¨WÐ5ˆHØŸ™ÈHÖ!UÀb¤&§+¡+¨d´C¸³GÓ"<¸rÓ"AÒ!UÓVˆIؤ×!4Ñ!4°YÓ!?ÀÀÐ!DÑDÐ Dð × Ñ Õ Ü$ aØ&*§f¡fØ&*§f¡fØ&*§f¡fØ&*§f¡fØ&*§f¡fØ&*§f¡f°·±°q±Ñ&9Ø&*§f¡f°·±°q±Ñ&9Ü&-¨d¯f©f£o×&=Ñ&=¸d¿f¹fÓ&Eð    &(ó    )÷*0©«ð ðqŠyØ,Ø˜U’?¡zÜ$Ð%MÓNÐNå+à˜U’? zÐ'9Ø,HØ!&§¡¨J¼¸TÜ7>³yð",ó"B‘Jð 7HÙ%Ù&Ü",Ð-QÓ"RÐRØ%I˜
Ø!&§¡¨J¼Ø,6¸
Ø8CÜ7>³yð",ó"BJð"&‘Jà#ˆHÜ8¼Ü9DÀdÇfÁfØFJÇfÁfðFNó:Oä9@»ó;ˆJð UŠ?ØÐ Ø UŠ?Ý %à—j‘j ¨X°zÀ8ÓLˆGܘ7Ó#Ð #äÐNÐQWÑWÓXÐXùòy Jùò "Vs ¿J(Â)J-có&—|j|i|¤ŽS©ú:meta private:)r±)r,Úargsr-s   r3Ú    exportKeyzRsaKey.exportKey£s€àˆt‰ Ð/¨Ñ/Ð/r5có"—|j«Sr³)rvr:s r3Ú    publickeyzRsaKey.publickey§s€à‰Ó Ð r5có—td«‚©r´z,Use module Crypto.Signature.pkcs1_15 instead©ÚNotImplementedError)r,ÚMÚKs   r3Úsignz RsaKey.sign¬ó€ä!Ð"PÓQÐQr5có—td«‚rºr»)r,r½Ú    signatures   r3Úverifyz RsaKey.verify°rÀr5có—td«‚©r´z+Use module Crypto.Cipher.PKCS1_OAEP insteadr»)r,rXr¾s   r3ÚencryptzRsaKey.encrypt´ó€ä!Ð"OÓPÐPr5có—td«‚rÅr»rjs  r3ÚdecryptzRsaKey.decrypt¸rÇr5có—t‚r³r»©r,r½ÚBs   r3Úblindz RsaKey.blind¼ó€ä!Ð!r5có—t‚r³r»rËs   r3ÚunblindzRsaKey.unblindÀrÎr5có—t‚r³r»r:s r3Úsizez RsaKey.sizeÄrÎr5)r•Nr NNN)(Ú__name__Ú
__module__Ú __qualname__Ú__doc__r4ÚpropertyrrrrrrErHrKrMrrRrUrYrhrkr?rqrtrvrzr|r€r„rŠr±r¶r¸r¿rÃrÆrÉrÍrÐrÒrpr5r3rr4s]„ñò:ð>ñóððñóððñóðð
ñóðð
ñóðð
ñóðð
ñóðð
ñóððñóððñóðò
&ò5ò>ò
ò2Aò
#ò
òò,ò#ò#òò
Lò;ð>?Ø?CóYYòx0ò!ò
RòRòQòQò"ò"ó"r5rcó‡‡ ‡ ‡‡—|dkr td«‚‰dzdk(s‰dkr td«‚|€tj}td«x}}t‰«Š|j    «|k7rê|d|dzzkrß|dz}||z
}td«d|zdz
zj «xŠ Š||k7r"td«d|zdz
zj «Š ˆˆ fd„}t |||¬    «Štd«|dzd
z
zŠ ˆˆ ˆˆfd „}t |||¬    «}    ‰|    z}‰dz
j|    dz
«}
‰j|
«}|j    «|k7r |d|dzzkrŒß‰    kDr|    ‰cŠ}    ‰j|    «} t|‰|‰|    | ¬ «S) aBCreate a new RSA key pair.
 
    The algorithm closely follows NIST `FIPS 186-4`_ in its
    sections B.3.1 and B.3.3. The modulus is the product of
    two non-strong probable primes.
    Each prime passes a suitable number of Miller-Rabin tests
    with random bases and a single Lucas test.
 
    Args:
      bits (integer):
        Key length, or size (in bits) of the RSA modulus.
        It must be at least 1024, but **2048 is recommended.**
        The FIPS standard only defines 1024, 2048 and 3072.
    Keyword Args:
      randfunc (callable):
        Function that returns random bytes.
        The default is :func:`Crypto.Random.get_random_bytes`.
      e (integer):
        Public RSA exponent. It must be an odd positive integer.
        It is typically a small number with very few ones in its
        binary representation.
        The FIPS standard requires the public exponent to be
        at least 65537 (the default).
 
    Returns: an RSA key object (:class:`RsaKey`, with private key).
 
    .. _FIPS 186-4: http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf
    iz"RSA modulus length must be >= 1024érézBRSA public exponent must be a positive, odd integer larger than 2.r có@•—|‰kDxr|dz
j‰«dk(S©Nr )Úgcd)Ú    candidaterÚmin_ps €€r3Úfilter_pzgenerate.<locals>.filter_pýs'ø€Ø˜uÑ$ÒD¨)°a©-×)<Ñ)<¸QÓ)?À1Ñ)DÐ Dr5)Ú
exact_bitsr¨Ú prime_filterédcóf•—|‰kDxr*|dz
j‰«dk(xrt|‰z
«‰kDSrÜ)rÝÚabs)rÞrÚ min_distanceÚmin_qrs €€€€r3Úfilter_qzgenerate.<locals>.filter_qsBø€Ø Ñ%ò6Ø ‘]×'Ñ'¨Ó*¨aÑ/ò6䘠    A™ Ó&¨Ñ5ð 7r5©rrrrrr)
r#rr™rrRÚsqrtrÚlcmrJr)Úbitsr¨rrrÚsize_qÚsize_pràrèrrërrærßrçrs  `         @@@@r3rrÉs¬ü€ð< ˆd‚{ÜÐ=Ó>Ð>؈1u‚zQ˜’UÜÐ]Ó^Ð^àÐÜ×*Ñ*ˆä A‹JЀAˆÜ‹
€Aà
.‰.Ó
˜dÒ
" q¨A°$¸!±)Ñ,<Ò'=𘑈ؘ‘ˆä  ›¨¨F©
°Q©Ñ7×=Ñ=Ó?Ð?ˆØ VÒ Ü˜Q“Z A¨¡J°¡NÑ3×9Ñ9Ó;ˆEõ    Eô $¨vØ-5Ø19ô ;ˆô˜q“z d¨a¡i°#¡oÑ6ˆ ÷    7ô
$¨vØ-5Ø19ô ;ˆð ‰EˆØ1‰uk‰k˜!˜a™%Ó ˆØ I‰Ic‹Nˆð? .‰.Ó
˜dÒ
" q¨A°$¸!±)Ñ,<Ó'=ðB    ˆ1‚uؐ!ˆˆˆ1à        ‰    !‹ €Aä A˜˜a 1¨¨QÔ /Ð/r5có—Gd„dt«}|«}td|«D]\}}t||t|««Œ|j}|j
}t |d«st||¬«}n.|j}    t |d«r|j}
|j} nÂ|    |zdz
} | } | dzd    k(r| dz} | dzd    k(rŒd
}td«}|sw|d krrt| «}|| krUt|||«}|dk7r8||dz
k7r0t|d|«dk(r t|«j|dz«}
d }n |dz}|| krŒU|dz }|s|d krŒr|s td «‚|
zd    k(sJ‚||
z} t |d«r |j}n|
j| «}t|||    |
| |¬«}|rc|dks||k\r td«‚t|«j|«dk7r td«‚|dzs td«‚|j!«r    dks|    |k\r td«‚t|«j|    «dk7r td«‚
 z|k7r td«‚t#|
«t$k(r td«‚t#| «t$k(r td«‚|
dz
| dz
z}||
dz
j| dz
«z}||    zt'|«zdk7r td«‚t |d«r+dks|| k\r td«‚|
|z| zdk7r td«‚|S)a3Construct an RSA key from a tuple of valid RSA components.
 
    The modulus **n** must be the product of two primes.
    The public exponent **e** must be odd and larger than 1.
 
    In case of a private key, the following equations must apply:
 
    .. math::
 
        \begin{align}
        p*q &= n \\
        e*d &\equiv 1 ( \text{mod lcm} [(p-1)(q-1)]) \\
        p*u &\equiv 1 ( \text{mod } q)
        \end{align}
 
    Args:
        rsa_components (tuple):
            A tuple of integers, with at least 2 and no
            more than 6 items. The items come in the following order:
 
            1. RSA modulus *n*.
            2. Public exponent *e*.
            3. Private exponent *d*.
               Only required if the key is private.
            4. First factor of *n* (*p*).
               Optional, but the other factor *q* must also be present.
            5. Second factor of *n* (*q*). Optional.
            6. CRT coefficient *q*, that is :math:`p^{-1} \text{mod }q`. Optional.
 
    Keyword Args:
        consistency_check (boolean):
            If ``True``, the library will verify that the provided components
            fulfil the main RSA properties.
 
    Raises:
        ValueError: when the key being imported fails the most basic RSA validity checks.
 
    Returns: An RSA key object (:class:`RsaKey`).
    có —eZdZy)úconstruct.<locals>.InputCompsN)rÓrÔrÕrpr5r3Ú
InputCompsrñDs„Ø r5ròrérrrr rÙrFrãTz2Unable to compute factors p and q from exponent d.rzInvalid RSA public exponentz-RSA public exponent is not coprime to moduluszRSA modulus is not oddzInvalid RSA private exponentz.RSA private exponent is not coprime to modulusz RSA factors do not match moduluszRSA factor p is compositezRSA factor q is compositezInvalid RSA conditionzInvalid RSA component uzInvalid RSA component u with p)ÚobjectÚzipr%rrrrmrrrrrWrÝr#rrJr?rrr8)Úrsa_componentsÚconsistency_checkròÚ input_compsÚcompr2rrÚkeyrrrÚktotÚtÚspottedÚaÚkÚcandrÚphirës                     r3rrs<€ôR ”Vô ñ“,€KÜÐ;¸^ÓLò3‰ ˆˆuܐ ˜T¤7¨5£>Õ2ð3ð     ‰ €A؏ ‰ €AÜ ; Ô $ܐq˜AÔŠà M‰MˆÜ ; Ô $Ø— ‘ ˆAØ— ‘ ‰Að
q‘5˜1‘9ˆDðˆAؐa‘%˜1’*ؐa‘ða‘%˜1“*ðˆGܘ“
ˆAÙ ! c¢'ܘA“Jà˜$’hܘq ! Q›<Dà˜q’y T¨a°!©e¢_¼¸TÀ1Àa»ÈAÒ9Mô$ A›JŸN™N¨4°!©8Ó4˜Ø"&˜ØØ˜‘FAð˜$“hðQ‘ñ ! c£'ñÜ Ð!UÓVÐVà˜‘U˜q’LÐ !LؐQ‘ˆAä ; Ô $Ø— ‘ ‰Aà—    ‘    ˜!“ ˆAôq˜A  a¨1°Ô2ˆò𠐊6Q˜!’VÜÐ:Ó;Ð ;Ü 1‹:>‰>˜!Ó  Ò !ÜÐLÓMÐ Mð1ŠuÜÐ5Ó6Ð 6à ?‰?Õ àAŠv˜˜ašÜ Ð!?Ó@Ð@ܐq‹z~‰~˜aÓ  AÒ%Ü Ð!QÓRÐRà1‰u˜ŠzÜ Ð!CÓDÐDÜ" 1Ó%¬Ò2Ü Ð!<Ó=Ð=Ü" 1Ó%¬Ò2Ü Ð!<Ó=Ð=àq‘5˜Q ™UÑ#ˆCؘ!˜a™%Ÿ™ Q¨¡UÓ+Ñ+ˆCؐA‘œ˜C›Ñ  QÒ&Ü Ð!8Ó9Ð9ܐs˜CÔ à˜’6˜Q !šVÜ$Ð%>Ó?Ð?ؘ‘E˜A‘I !Ò#Ü$Ð%EÓFÐFà €Jr5cóÀ—t«j|dd¬«}|ddk7r td«‚t|ddt    |d«j |d    «gz«S)
Né    T©Ú nr_elementsÚonly_ints_expectedrz(No PKCS#1 encoding of an RSA private keyr ééé)r Údecoder#rrrJ©Úencodedr-Úders   r3Ú_import_pkcs1_privater «sd€ô ‹-×
˜w°AÈ$Ð
O€CØ
ˆ1v‚{ÜÐCÓDÐDÜ S˜˜1X¤¨¨Q©£×!8Ñ!8¸¸Q¹Ó!@РAÑAÓ BÐBr5cóP—t«j|dd¬«}t|«S)NrÙTr)r r    rr
s   r3Ú_import_pkcs1_publicr¿s'€ô
‹-×
˜w°AÈ$Ð
O€CÜ S‹>Ðr5cóh—tdf}t|«\}}}||vs| td«‚t|«S)Nú1.2.840.113549.1.1.10zNo RSA subjectPublicKeyInfo)rrr#r)r r-ÚoidsÚalgoidÚ encoded_keyÚparamss      r3Ú_import_subjectPublicKeyInforÈsB€ä Ð(Ð )€Dä"AÀ'Ó"JÑ€FˆK˜Ø TјVÐ/ÜÐ6Ó7Ð7Ü   Ó ,Ð,r5có.—t|«}t|«Sr7)rr)r r-Úsp_infos   r3Ú_import_x509_certrÒs€ä.¨wÓ7€GÜ '¨Ó 0Ð0r5có„—ddlm}tdf}|j||«}|d|vr t    d«‚t |d|«S)Nrr“rzNo PKCS#8 encoded RSA keyr )r¢r”rÚunwrapr#Ú_import_keyDER)r r¥r”rrþs     r3Ú _import_pkcs8rØsI€Ýä Ð(Ð )€Dà  ‰ W˜jÓ)€A؈t4ÑÜÐ4Ó5Ð5Ü ˜!˜A™$ 
Ó +Ð+r5có—tttttf}|D] }    |||«cSt d«‚#t
$rYŒ&wxYw)z@Import an RSA key (public or private half), encoded in DER form.úRSA key format is not supported)r rrrrr#)Ú
extern_keyr¥Ú    decodingsÚdecodings    r3rrãs_€ô'Ü%Ü-Ü"Üð     €Ið òˆð    Ù˜J¨
Ó3Ò 3ðô Ð6Ó
7Ð7øôò    Ù ð    ús¢9¹    AÁAcól—ddlm}m}m}m}|||«\}}|dk7r t d«‚||«\}}||«\}    }||«\}
}||«\} }||«\} }||«\} }||«\}}||«||    |
| | | fDcgc]}t j|«‘Œ}}t|«Scc}w)Nr )Úimport_openssh_private_genericÚ
read_bytesÚ read_stringÚ check_paddingzssh-rsazThis SSH key is not RSA)    Ú_opensshr$r%r&r'r#rÚ
from_bytesr)ÚdataÚpasswordr$r%r&r'Ússh_nameÚ    decryptedrrrÚiqmprrrÚpaddedr©Úbuilds                  r3Ú_import_openssh_private_rsar1õsۀ÷CóCñ9¸¸xÓHÑ€Hˆià9ÒÜÐ2Ó3Ð3á˜iÓ(L€A€yÙ˜iÓ(L€A€yÙ˜iÓ(L€A€yÙ  Ó+O€Dˆ)Ù˜iÓ(L€A€yÙ˜iÓ(L€A€yá˜IÓ&I€A€vِ&Ôà-.°°1°a¸¸DÐ,AÖ B qŒW× Ñ  Õ "Ð B€EÐ BÜ UÓ Ðùò CsÂB1cóH—ddlm}t|«}| t|«}|jd«r/t    |«}|j ||«\}}}t ||«}|S|jd«r/|j t    |«|«\}}}|rd}t||«S|jd«r¾tj|jd«d«}    g}
t|    «d    kDrJtjd
|    dd    «d} |
j|    d    d    | z«|    d    | zd}    t|    «d    kDrŒJtj |
d«} tj |
d «} t#| | g«St|«dkDrt%|d«d k(r t||«St'd «‚)aéImport an RSA key (public or private).
 
    Args:
      extern_key (string or byte string):
        The RSA key to import.
 
        The following formats are supported for an RSA **public key**:
 
        - X.509 certificate (binary or PEM format)
        - X.509 ``subjectPublicKeyInfo`` DER SEQUENCE (binary or PEM
          encoding)
        - `PKCS#1`_ ``RSAPublicKey`` DER SEQUENCE (binary or PEM encoding)
        - An OpenSSH line (e.g. the content of ``~/.ssh/id_ecdsa``, ASCII)
 
        The following formats are supported for an RSA **private key**:
 
        - PKCS#1 ``RSAPrivateKey`` DER SEQUENCE (binary or PEM encoding)
        - `PKCS#8`_ ``PrivateKeyInfo`` or ``EncryptedPrivateKeyInfo``
          DER SEQUENCE (binary or PEM encoding)
        - OpenSSH (text format, introduced in `OpenSSH 6.5`_)
 
        For details about the PEM encoding, see `RFC1421`_/`RFC1423`_.
 
      passphrase (string or byte string):
        For private keys only, the pass phrase that encrypts the key.
 
    Returns: An RSA key object (:class:`RsaKey`).
 
    Raises:
      ValueError/IndexError/TypeError:
        When the given key cannot be parsed (possibly because the pass
        phrase is wrong).
 
    .. _RFC1421: http://www.ietf.org/rfc/rfc1421.txt
    .. _RFC1423: http://www.ietf.org/rfc/rfc1423.txt
    .. _`PKCS#1`: http://www.ietf.org/rfc/rfc3447.txt
    .. _`PKCS#8`: http://www.ietf.org/rfc/rfc5208.txt
    .. _`OpenSSH 6.5`: https://flak.tedunangst.com/post/new-openssh-key-format-and-bcrypt-pbkdf
    rr˜Ns-----BEGIN OPENSSH PRIVATE KEYs-----ró r rrrÙé0r)r¢r•r    Ú
startswithr r    r1rrŸÚ
a2b_base64ÚsplitržrœÚunpackÚappendrr)rr
r#)r r¥r•Ú text_encodedÚopenssh_encodedÚmarkerÚenc_flagrgr r®r¬Úlengthrrs              r3rr sŸ€õRä˜Ó$€JØÐܘZÓ(ˆ
à×ÑÐ>Ô?ܘZÓ(ˆ Ø,/¯J©J°|ÀZÓ,PÑ)ˆ˜ Ü,¨_¸jÓIˆØˆ à×јXÔ&à"%§*¡*¬U°:Ó->À
Ó"Kшˆfh٠؈Jܘc :Ó.Ð.à×ј[Ô)ä×'Ñ'¨
×(8Ñ(8¸Ó(>¸qÑ(AÓBˆ    ØˆÜ)‹n˜qÒ Ü—]‘] 4¨°2°A¨Ó7¸Ñ:ˆFØ O‰O˜I a¨¨F©
Ð3Ô 4Ø! ! f¡* +Ð.ˆIô)‹n˜qÓ ô × Ñ ˜x¨™{Ó +ˆÜ × Ñ ˜x¨™{Ó +ˆÜ˜!˜Q˜Ó Ð ä
ˆ:ƒ˜Òœt J¨q¡MÓ2°dÒ:ä˜j¨*Ó5Ð5ä
Ð6Ó
7Ð7r5z1.2.840.113549.1.1.1)Ni)Tr7)&Ú__all__rŸrœÚCryptorÚCrypto.Util.py3compatr    r
r ÚCrypto.Util.asn1r r ÚCrypto.Util.numberrÚCrypto.Math.NumbersrÚCrypto.Math.PrimalityrrrÚCrypto.PublicKeyrrrrórrrr rrrrrr1rÚ    importKeyrrpr5r3ú<module>rHs•ðò@ €óÛ åß6Ñ6ß1Ý,å'÷GñG÷@ñ@ô
R"ˆVôR"ój O0ódMò`Cò(ò-ò1ò ,ò8ò$ó0L8ð` €    ðr5