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
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
Ë
ž¬`iq‘ãó—ddlZddlmZmZmZddlmZmZgd¢Zdd„Z    Gd„de
«Z Gd„d    e
«Z Gd
„d e «Z Gd „d e «ZGd„de «ZGd„de «ZGd„de «ZGd„de «ZGd„de «ZGd„de «Zy)éN)Ú byte_stringÚbchrÚbord)Ú long_to_bytesÚ bytes_to_long)    Ú    DerObjectÚ
DerIntegerÚ
DerBooleanÚDerOctetStringÚDerNullÚ DerSequenceÚ DerObjectIdÚ DerBitStringÚDerSetOfcóD—d}    ||z}| xs|dk\S#t$rYywxYw)NrF)Ú    TypeError)ÚxÚonly_non_negativeÚtests   õcH:\项目\archive\测试组\脚本\Change_password\venv_build\Lib\site-packages\Crypto/Util/asn1.pyÚ
_is_numberr(s=€Ø €Dðؐ4‰xˆð!Ð  Ò * A¨¡FÐ*øô òÙðús „“    žcó4—eZdZdZd„Zd„Zd„Zd„Zd„Zd„Z    y)    Ú BytesIO_EOFzeThis class differs from BytesIO in that a ValueError exception is
    raised whenever EOF is reached.có.—||_d|_d|_y©Nr)Ú_bufferÚ_indexÚ    _bookmark)ÚselfÚ initial_bytess  rÚ__init__zBytesIO_EOF.__init__5s€Ø$ˆŒ ؈Œ ؈ócó&—|j|_y©N)rr©rs rÚ set_bookmarkzBytesIO_EOF.set_bookmark:s €ØŸ™ˆr"cód—|j€J‚|j|j|jSr$)rrrr%s rÚdata_since_bookmarkzBytesIO_EOF.data_since_bookmark=s+€Ø~‰~Ð)Ð)Ð)؏|‰|˜DŸN™N¨4¯;©;Ð7Ð7r"cóF—t|j«|jz
Sr$)Úlenrrr%s rÚremaining_datazBytesIO_EOF.remaining_dataAs€Ü4—<‘<Ó  4§;¡;Ñ.Ð.r"cóڗ|j|z}|t|j«kDr#td|t|j«fz«‚|j|j|}||_|S)Nz@Not enough data for DER decoding: expected %d bytes and found %d)rr*rÚ
ValueError)rÚlengthÚ    new_indexÚresults    rÚreadzBytesIO_EOF.readDsr€Ø—K‘K &Ñ(ˆ    Ø ”s˜4Ÿ<™<Ó(Ò (ÜÐ_ÐclÔnqÐrv×r~Ñr~ÓnðcAñAóBð Bà—‘˜dŸk™k¨)Ð4ˆØˆŒ ؈ r"có<—t|jd«d«S)Nér)rr1r%s rÚ    read_bytezBytesIO_EOF.read_byteMs€ÜD—I‘I˜a“L ‘OÓ$Ð$r"N)
Ú__name__Ú
__module__Ú __qualname__Ú__doc__r!r&r(r+r1r4©r"rrr1s%„ñ'òò
%ò8ò/òó%r"rcóL—eZdZdZ        d
d„Zd„Zed„«Zd„Zd„Z    d d„Z
d    „Z y) rzpBase class for defining a single DER object.
 
        This class should never be directly instantiated.
        Ncó—|€d|_y|j|«}||_|rdnd}d||fvr td«‚|d|z|j|«z|_y|$d|j|«z|_||z|_y||z|_y)aùInitialize the DER object according to a specific ASN.1 type.
 
                :Parameters:
                  asn1Id : integer or byte
                    The universal DER tag number for this object
                    (e.g. 0x10 for a SEQUENCE).
                    If None, the tag is not known yet.
 
                  payload : byte string
                    The initial payload of the object (that it,
                    the content octets).
                    If not specified, the payload is empty.
 
                  implicit : integer or byte
                    The IMPLICIT tag number (< 0x1F) to use for the encoded object.
                    It overrides the universal tag *asn1Id*.
                    It cannot be combined with the ``explicit`` parameter.
                    By default, there is no IMPLICIT tag.
 
                  constructed : bool
                    True when the ASN.1 type is *constructed*.
                    False when it is *primitive* (default).
 
                  explicit : integer or byte
                    The EXPLICIT tag number (< 0x1F) to use for the encoded object.
                    It cannot be combined with the ``implicit`` parameter.
                    By default, there is no EXPLICIT tag.
                Né rz1Explicit and implicit tags are mutually exclusiveé€é )Ú
_tag_octetÚ _convertTagÚpayloadr-Ú_inner_tag_octet)rÚasn1IdrAÚimplicitÚ constructedÚexplicitÚconstructed_bits       rr!zDerObject.__init__Ws±€ð>>à&*D”OØØ×)Ñ)¨&Ó1à&” ñ +6¡$¸4à ¨(Ð3Ñ3Ü$ð&;ó<ð<ðÐ'à&*¨_Ñ&<¸t×?OÑ?OÐPXÓ?YÑ&YD•OØÐ)à&1°D×4DÑ4DÀXÓ4NÑ&ND”OØ,;¸fÑ,DDÕ)ð'6¸Ñ&>D•Or"có®—t|«st|«dk(rt|d«}t|«rd|cxkrdkstd«‚td«‚|S)zCheck if *tag* is a real DER tag (5 bits).
                Convert it from a character to number if necessary.
                r3réz Wrong DER tag)rr*rr-)rÚtags  rr@zDerObject._convertTagsT€ô" #”ܘ3“x 1’}Ü" 3 q¡6›l˜ä" 3œ¨A°¬O°tªOÜ$ _Ó5Ð5ð-<Ü$ _Ó5Ð5ؐ
r"cól—|dkDr%t|«}tt|«dz«|zSt|«S)zXBuild length octets according to BER/DER
                definite form.
                ér=)rrr*)r.Úencodings  rÚ_definite_formzDerObject._definite_form©s8€ð
˜C’<Ü#0°Ó#8˜Ü#¤C¨£M°CÑ$7Ó8¸8ÑCÐCܘF“|Ð#r"có&—|j}t|d«rGt|j«|j    t |j««z|jz}t|j «|j    t |««z|zS)z?Return this DER element, fully encoded as a binary byte string.rB)rAÚhasattrrrBrNr*r?)rÚoutput_payloads  rÚencodezDerObject.encode³s‡€ð "&§¡ô˜4Ð!3Ô4Ü&*¨4×+@Ñ+@Ó&AØ&*×&9Ñ&9¼#¸d¿l¹lÓ:KÓ&Lñ'Mà&*§l¡lñ'3Nô˜TŸ_™_Ó-Ø×+Ñ+¬C°Ó,?Ó@ñAà&ñ'ð(r"cóƗ|j«}|dkDrK|j|dz«}t|d«dk(r td«‚t    |«}|dkr td«‚|S)z%Decode DER length octets from a file.rLrz$Invalid DER: length has leading zeroz5Invalid DER: length in long form but smaller than 128)r4r1rr-r)rÚsr.Úencoded_lengths    rÚ
_decodeLenzDerObject._decodeLenÆsh€ðŸ™›à˜C’<Ø%&§V¡V¨F°T©MÓ%:NܘN¨1Ñ-Ó.°!Ò3Ü(Ð)OÓPÐPÜ*¨>Ó:FØ ’}Ü(Ð)`ÓaÐaà r"có¨—t|«s td«‚t|«}|j||«|j    «dkDr td«‚|S)aDecode a complete DER element, and re-initializes this
                object with it.
 
                Args:
                  der_encoded (byte string): A complete DER element.
 
                Raises:
                  ValueError: in case of parsing errors.
                zInput is not a byte stringrú-Unexpected extra data after the DER structure)rr-rÚ_decodeFromStreamr+)rÚ der_encodedÚstrictrTs    rÚdecodezDerObject.decodeÕsV€ô# ;Ô/Ü$Ð%AÓBÐBä  Ó,Ø×&Ñ& q¨&Ô1ð×#Ñ#Ó%¨Ò)Ü$Ð%TÓUÐUà r"cóî—|j«}|j||jk7rtd«‚||_|j|«}|j    |«|_t |d«r…t|j
«}|j«}||jk7r td«‚|j|«}|j    |«|_|j«dkDr td«‚yy)z*Decode a complete DER element from a file.NzUnexpected DER tagrBzUnexpected internal DER tagrrX)
r4r?r-rVr1rArPrrBr+)rrTr[ÚidOctetr.ÚpÚ inner_octets       rrYzDerObject._decodeFromStreamìsۀðŸ+™+›-Ø—?‘?Ð.Ø $§/¡/Ò1Ü(Ð)=Ó>Ð>à&-D”OØŸ™¨Ó+Ø Ÿv™v f›~” ô˜4Ð!3Ô4Ü# D§L¡LÓ1AØ"#§+¡+£-KØ" d×&;Ñ&;Ò;Ü(Ð)FÓGÐGØ!Ÿ_™_¨QÓ/FØ#$§6¡6¨&£>D”Lð×'Ñ'Ó)¨AÒ-Ü(Ð)XÓYÐYð.ð5r")Nr"NFN©F) r5r6r7r8r!r@Ú staticmethodrNrRrVr\rYr9r"rrrQsE„ñ     ð
?CØ15óD    ?òL
    ð
ñ    $ó
ð    $ò    (ò&     ó    ó.    Zr"rcó,—eZdZdZdd„Zd„Zdd„Zd„Zy)    r    aÈClass to model a DER INTEGER.
 
        An example of encoding is::
 
          >>> from Crypto.Util.asn1 import DerInteger
          >>> from binascii import hexlify, unhexlify
          >>> int_der = DerInteger(9)
          >>> print hexlify(int_der.encode())
 
        which will show ``020109``, the DER encoding of 9.
 
        And for decoding::
 
          >>> s = unhexlify(b'020109')
          >>> try:
          >>>   int_der = DerInteger()
          >>>   int_der.decode(s)
          >>>   print int_der.value
          >>> except ValueError:
          >>>   print "Not a valid DER INTEGER"
 
        the output will be ``9``.
 
        :ivar value: The integer value
        :vartype value: integer
        NcóF—tj|dd|d|«||_y)aUInitialize the DER object as an INTEGER.
 
                :Parameters:
                  value : integer
                    The value of the integer.
 
                  implicit : integer
                    The IMPLICIT tag to use for the encoded object.
                    It overrides the universal tag for INTEGER (2).
                ér"FN©rr!Úvalue©rrgrDrFs    rr!zDerInteger.__init__#s&€ô×"Ñ" 4¨¨s°HØ#(¨(ô4à"•
r"có&—|j}d|_    tt|dz««|jz|_d|cxkrdkr nntd«|jz|_d|cxkrdkrnnn|dz}Œitj |«S)zIReturn the DER INTEGER, fully encoded as a
                binary string.r"éÿr=ri€ÿÿÿé)rgrArÚintrrR)rÚnumbers  rrRzDerInteger.encode3s‡€ðŸ™Ø"” ØÜ#'¬¨F°S©LÓ(9Ó#:¸T¿\¹\Ñ#ID”LؘfÔ+¨Õ+Ü'+¨D£z°D·L±LÑ'@˜œ ؘvÔ,¨Õ,ØØ˜q‘LFð ô!×'Ñ'¨Ó-Ð-r"có2—tj|||¬«S)aDecode a DER-encoded INTEGER, and re-initializes this
                object with it.
 
                Args:
                  der_encoded (byte string): A complete INTEGER DER element.
 
                Raises:
                  ValueError: in case of parsing errors.
                ©r[©rr\©rrZr[s   rr\zDerInteger.decodeBs€ô!×'Ñ'¨¨kÀ&Ð'ÓIÐIr"có4—tj|||«|rot|j«dk(r t    d«‚t|j«dk\r4t j d|jdd«ddkr t    d«‚d|_d}|jD]:}|xjd    zc_|xjt|«z c_|d
z}Œ<|jr2t|jd«dzr|xj|zc_yyy) z*Decode a complete DER INTEGER from a file.rz/Invalid encoding for DER INTEGER: empty payloadrez>HNr=z.Invalid encoding for DER INTEGER: leading zeror3érk)    rrYr*rAr-ÚstructÚunpackrgr)rrTr[ÚbitsÚis     rrYzDerInteger._decodeFromStreamOsö€ô×+Ñ+¨D°!°VÔ<áܘ4Ÿ<™<Ó(¨AÒ-Ü(Ð)ZÓ[Ð[ܘ4Ÿ<™<Ó(¨AÒ-´&·-±-ÀÀdÇlÁlÐSUÐTUÐFVÓ2WÐXYÑ2ZÐ]aÒ2aÜ(Ð)YÓZÐZð”
ؐ؟™òAØ—J’J #Ñ%•JØ—J’J¤$ q£'Ñ)•JؘQ‘J‘Dðð—<’<¤D¨¯©°a©Ó$9¸DÒ$@Ø—J’J $Ñ&–Jð%A<r")rNNra©r5r6r7r8r!rRr\rYr9r"rr    r    s„ñ     ó6    #ò      .ó     Jó    'r"r    có,—eZdZdZdd„Zd„Zdd„Zd„Zy)    r
aRClass to model a DER-encoded BOOLEAN.
 
    An example of encoding is::
 
    >>> from Crypto.Util.asn1 import DerBoolean
    >>> bool_der = DerBoolean(True)
    >>> print(bool_der.encode().hex())
 
    which will show ``0101ff``, the DER encoding of True.
 
    And for decoding::
 
    >>> s = bytes.fromhex('0101ff')
    >>> try:
    >>>   bool_der = DerBoolean()
    >>>   bool_der.decode(s)
    >>>   print(bool_der.value)
    >>> except ValueError:
    >>>   print "Not a valid DER BOOLEAN"
 
    the output will be ``True``.
 
    :ivar value: The boolean value
    :vartype value: boolean
    NcóF—tj|dd|d|«||_y)ažInitialize the DER object as a BOOLEAN.
 
        Args:
          value (boolean):
            The value of the boolean. Default is False.
 
          implicit (integer or byte):
            The IMPLICIT tag number (< 0x1F) to use for the encoded object.
            It overrides the universal tag for BOOLEAN (1).
            It cannot be combined with the ``explicit`` parameter.
            By default, there is no IMPLICIT tag.
 
          explicit (integer or byte):
            The EXPLICIT tag number (< 0x1F) to use for the encoded object.
            It cannot be combined with the ``implicit`` parameter.
            By default, there is no EXPLICIT tag.
        r3r"FNrfrhs    rr!zDerBoolean.__init__€s#€ô&    ×ј4  s¨H°e¸XÔF؈
r"cóV—|jrdnd|_tj|«S)z9Return the DER BOOLEAN, fully encoded as a binary string.óÿó©rgrArrRr%s rrRzDerBoolean.encode–s$€ð#'§*¢*‘w°'ˆŒ Ü×Ñ Ó%Ð%r"có0—tj|||«S)zßDecode a DER-encoded BOOLEAN, and re-initializes this object with it.
 
        Args:
            der_encoded (byte string): A DER-encoded BOOLEAN.
 
        Raises:
            ValueError: in case of parsing errors.
        rprqs   rr\zDerBoolean.decodeœs€ô×Ñ  k°6Ó:Ð:r"có—tj|||«t|j«dk7r t    d«‚t |jd«dk(rd|_yt |jd«dk(rd|_yt    d«‚)    z)Decode a DER-encoded BOOLEAN from a file.r3z7Invalid encoding for DER BOOLEAN: payload is not 1 byterFrjTzInvalid payload for DER BOOLEANN)rrYr*rAr-rrg©rrTr[s   rrYzDerBoolean._decodeFromStream¨sw€ô    ×#Ñ# D¨!¨VÔ4ä ˆt|‰|Ó  Ò !ÜÐVÓWÐ Wä — ‘ ˜Q‘Ó   AÒ %؈DJÜ $—,‘,˜q‘/Ó " dÒ *؈DJäÐ>Ó?Ð ?r")FNNrarxr9r"rr
r
fs„ñó2ò,&ó
;ó@r"r
cóx—eZdZdZdd„Zd„Zd„Zd„Zd„Zd„Z    d    „Z
d
„Z d „Z d „Z d „Zdd„Zdd„Zd„Zdd„Zd„Zy)r aÏClass to model a DER SEQUENCE.
 
        This object behaves like a dynamic Python sequence.
 
        Sub-elements that are INTEGERs behave like Python integers.
 
        Any other sub-element is a binary string encoded as a complete DER
        sub-element (TLV).
 
        An example of encoding is:
 
          >>> from Crypto.Util.asn1 import DerSequence, DerInteger
          >>> from binascii import hexlify, unhexlify
          >>> obj_der = unhexlify('070102')
          >>> seq_der = DerSequence([4])
          >>> seq_der.append(9)
          >>> seq_der.append(obj_der.encode())
          >>> print hexlify(seq_der.encode())
 
        which will show ``3009020104020109070102``, the DER encoding of the
        sequence containing ``4``, ``9``, and the object with payload ``02``.
 
        For decoding:
 
          >>> s = unhexlify(b'3009020104020109070102')
          >>> try:
          >>>   seq_der = DerSequence()
          >>>   seq_der.decode(s)
          >>>   print len(seq_der)
          >>>   print seq_der[0]
          >>>   print seq_der[:]
          >>> except ValueError:
          >>>   print "Not a valid DER SEQUENCE"
 
        the output will be::
 
          3
          4
          [4, 9, b'']
 
        NcóZ—tj|dd|d|«|€g|_y||_y)aCInitialize the DER object as a SEQUENCE.
 
                :Parameters:
                  startSeq : Python sequence
                    A sequence whose element are either integers or
                    other DER objects.
 
                  implicit : integer or byte
                    The IMPLICIT tag number (< 0x1F) to use for the encoded object.
                    It overrides the universal tag for SEQUENCE (16).
                    It cannot be combined with the ``explicit`` parameter.
                    By default, there is no IMPLICIT tag.
 
                  explicit : integer or byte
                    The EXPLICIT tag number (< 0x1F) to use for the encoded object.
                    It cannot be combined with the ``implicit`` parameter.
                    By default, there is no EXPLICIT tag.
                ér"TN)rr!Ú_seq)rÚstartSeqrDrFs    rr!zDerSequence.__init__äs0€ô(×"Ñ" 4¨¨s°H¸dÀHÔMØÐ#Ø "D•Ià (D•Ir"có—|j|=yr$©r…©rÚns  rÚ __delitem__zDerSequence.__delitem__s €Ø—I‘I˜a‘Lr"có —|j|Sr$rˆr‰s  rÚ __getitem__zDerSequence.__getitem__s€Ø—y‘y ‘|Ð#r"có"—||j|<yr$rˆ)rÚkeyrgs   rÚ __setitem__zDerSequence.__setitem__s€Ø!&—    ‘    ˜#’r"có"—||j||yr$rˆ)rrwÚjÚsequences    rÚ __setslice__zDerSequence.__setslice__    s€Ø!)—    ‘    ˜!˜A‘r"có"—|j||…=yr$rˆ©rrwr’s   rÚ __delslice__zDerSequence.__delslice__ s€Ø—I‘I˜a ˜c‘Nr"cóH—|jtd|«td|«Sr)r…Úmaxr–s   rÚ __getslice__zDerSequence.__getslice__s€Ø—y‘y¤ Q¨£¬3¨q°!«9Ð5Ð5r"có,—t|j«Sr$©r*r…r%s rÚ__len__zDerSequence.__len__s€Ü˜4Ÿ9™9“~Ð%r"có<—|jj|«|Sr$©r…Úappend©rÚitems  rÚ__iadd__zDerSequence.__iadd__󀨗    ‘    × Ñ  Ô&ؐ r"có<—|jj|«|Sr$rŸr¡s  rr zDerSequence.appendr¤r"có>—|jj||«|Sr$)r…Úinsert)rÚindexr¢s   rr§zDerSequence.inserts€Ø—    ‘    × Ñ  ¨Ô-ؐ r"cón—|jDcgc]}t||«sŒ|‘Œ}}t|«Scc}w)zìReturn the number of items in this sequence that are
                integers.
 
                Args:
                  only_non_negative (boolean):
                    If ``True``, negative integers are not counted in.
                )r…rr*)rrrÚitemss    rÚhasIntszDerSequence.hasInts!s5€ð%)§I¡IÖR˜q´¸AÐ?PÕ1QšÐRÐRܘ5“zÐ!ùòSs2¡2cól—|jxr'|j|«t|j«k(S)a©Return ``True`` if all items in this sequence are integers
                or non-negative integers.
 
                This function returns False is the sequence is empty,
                or at least one member is not an integer.
 
                Args:
                  only_non_negative (boolean):
                    If ``True``, the presence of negative integers
                    causes the method to return ``False``.)r…r«r*)rrs  rÚ hasOnlyIntszDerSequence.hasOnlyInts-s*€ð—y‘yÒV T§\¡\Ð2CÓ%DÌÈDÏIÉIËÑ%VÐVr"cóT—d|_|jD]~}t|«r|xj|z c_Œ$t|«r-|xjt    |«j «z c_Œ\|xj|j «z c_Œ€t j |«S)zùReturn this DER SEQUENCE, fully encoded as a
                binary string.
 
                Raises:
                  ValueError: if some elements in the sequence are neither integers
                              nor byte strings.
                r")rAr…rrr    rRrr¡s  rrRzDerSequence.encode:s€ð #” Ø ŸI™Iò6DÜ" 4Ô(ØŸ š ¨Ñ,ž Ü# DÔ)ØŸ š ¬
°4Ó(8×(?Ñ(?Ó(AÑAž àŸ š ¨¯ © « Ñ5ž ð 6ô!×'Ñ'¨Ó-Ð-r"có~—||_tj|||¬«}|r|j«s t    d«‚|S)a9Decode a complete DER SEQUENCE, and re-initializes this
                object with it.
 
                Args:
                  der_encoded (byte string):
                    A complete SEQUENCE DER element.
                  nr_elements (None or integer or list of integers):
                    The number of members the SEQUENCE can have
                  only_ints_expected (boolean):
                    Whether the SEQUENCE is expected to contain only integers.
                  strict (boolean):
                    Whether decoding must check for strict DER compliancy.
 
                Raises:
                  ValueError: in case of parsing errors.
 
                DER INTEGERs are decoded into Python integers. Any other DER
                element is not decoded. Its validity is not checked.
                rozSome members are not INTEGERs)Ú _nr_elementsrr\r­r-)rrZr[Ú nr_elementsÚonly_ints_expectedr0s      rr\zDerSequence.decodeLsB€ð*%0Ô!Ü"×)Ñ)¨$° ÀFÐ)ÓKá%¨d×.>Ñ.>Ô.@Ü$Ð%DÓEÐEà r"có.—g|_tj|||«t|j«}|j «dkDrË|j «t«}|j||«|jdk7r*|jj|j««nRt«}|j«}|j||¬«|jj|j«|j «dkDrŒËd}|j"    t|j«|jv}|s!t!dt|j«z«‚y#t$r%t|j«|jk(}YŒQwxYw)z+Decode a complete DER SEQUENCE from a file.rreroTNz1Unexpected number of members (%d) in the sequence)r…rrYrrAr+r&r?r r(r    r\rgr°r*rr-)rrTr[r_ÚderÚderIntÚdataÚoks        rrYzDerSequence._decodeFromStreamisc€ð”    ô×+Ñ+¨D°!°VÔ<ô  § ¡ Ó-Ø×&Ñ&Ó(¨1Ò,Ø—N‘NÔ$ä#›+CØ×)Ñ)¨!¨VÔ4ð—~‘~¨Ò-ØŸ    ™    ×(Ñ(¨×)>Ñ)>Ó)@ÕAä!+£˜Ø ×4Ñ4Ó6˜ØŸ ™  d°6˜ Ô:ØŸ    ™    ×(Ñ(¨¯©Ô6ð×&Ñ&Ó(¨1Ó,ðØ×$Ñ$Ð0ðAÜ  §¡›^¨t×/@Ñ/@Ð@˜ñÜ$ð&8Ü:=¸d¿i¹i».ñ&IóJðJðøô%òAÜ  §¡›^¨t×/@Ñ/@Ñ@šðAúsÄ!!E&Å&+FÆF)NNN)T)FNF)r5r6r7r8r!r‹rrr”r—ršrr£r r§r«r­rRr\rYr9r"rr r ¹sZ„ñ(     óT    )ò8    !ò    $ò    'ò    *ò    #ò    6ò    &ò    ò    ò    ó
    "ó     Wò    .ó$    ó:"    Jr"r có—eZdZdZdd„Zy)r aâClass to model a DER OCTET STRING.
 
    An example of encoding is:
 
    >>> from Crypto.Util.asn1 import DerOctetString
    >>> from binascii import hexlify, unhexlify
    >>> os_der = DerOctetString(b'\xaa')
    >>> os_der.payload += b'\xbb'
    >>> print hexlify(os_der.encode())
 
    which will show ``0402aabb``, the DER encoding for the byte string
    ``b'\xAA\xBB'``.
 
    For decoding:
 
    >>> s = unhexlify(b'0402aabb')
    >>> try:
    >>>   os_der = DerOctetString()
    >>>   os_der.decode(s)
    >>>   print hexlify(os_der.payload)
    >>> except ValueError:
    >>>   print "Not a valid DER OCTET STRING"
 
    the output will be ``aabb``.
 
    :ivar payload: The content of the string
    :vartype payload: byte string
    Ncó6—tj|d||d«y)ahInitialize the DER object as an OCTET STRING.
 
        :Parameters:
          value : byte string
            The initial payload of the object.
            If not specified, the payload is empty.
 
          implicit : integer
            The IMPLICIT tag to use for the encoded object.
            It overrides the universal tag for OCTET STRING (4).
        éFN©rr!)rrgrDs   rr!zDerOctetString.__init__¬s€ô    ×ј4  u¨h¸Õ>r")r"N©r5r6r7r8r!r9r"rr r Žs „ñô: ?r"r có—eZdZdZd„Zy)r z"Class to model a DER NULL element.có6—tj|dddd«y)z$Initialize the DER object as a NULL.ér"NFr»r%s rr!zDerNull.__init__¾s€ô    ×ј4  s¨D°%Õ8r"Nr¼r9r"rr r »s
„Ù,ó9r"r có,—eZdZdZdd„Zd„Zdd„Zd„Zy)    ra(Class to model a DER OBJECT ID.
 
    An example of encoding is:
 
    >>> from Crypto.Util.asn1 import DerObjectId
    >>> from binascii import hexlify, unhexlify
    >>> oid_der = DerObjectId("1.2")
    >>> oid_der.value += ".840.113549.1.1.1"
    >>> print hexlify(oid_der.encode())
 
    which will show ``06092a864886f70d010101``, the DER encoding for the
    RSA Object Identifier ``1.2.840.113549.1.1.1``.
 
    For decoding:
 
    >>> s = unhexlify(b'06092a864886f70d010101')
    >>> try:
    >>>   oid_der = DerObjectId()
    >>>   oid_der.decode(s)
    >>>   print oid_der.value
    >>> except ValueError:
    >>>   print "Not a valid DER OBJECT ID"
 
    the output will be ``1.2.840.113549.1.1.1``.
 
    :ivar value: The Object ID (OID), a dot separated list of integers
    :vartype value: string
    NcóF—tj|dd|d|«||_y)a’Initialize the DER object as an OBJECT ID.
 
        :Parameters:
          value : string
            The initial Object Identifier (e.g. "1.2.0.0.6.2").
          implicit : integer
            The IMPLICIT tag to use for the encoded object.
            It overrides the universal tag for OBJECT ID (6).
          explicit : integer
            The EXPLICIT tag to use for the encoded object.
        ér"FNrfrhs    rr!zDerObjectId.__init__âs#€ô    ×ј4  s¨H°e¸XÔF؈
r"có`—|jjd«Dcgc] }t|«‘Œ}}t|«dkr t    d«‚|ddkDr t    d«‚|ddkr|ddkDr t    d«‚d    |dz|dzg|dd
z}g}t |«D]=}|j |d z«|d z}|sŒ|j |d zd z«|d z}|rŒŒ?djt |«Dcgc] }t|«‘Œc}«|_    tj|«Scc}wcc}w)zCReturn the DER OBJECT ID, fully encoded as a
        binary string.ú.rez$Not a valid Object Identifier stringrz!First component must be 0, 1 or 2r3é'z#Second component must be 39 at mosté(NrLér=r") rgÚsplitrlr*r-Úreversedr ÚjoinrrArrR)rrÚcompsÚsubcompsrMÚvs      rrRzDerObjectId.encodeñs7€ð"&§¡×!1Ñ!1°#Ó!6Ö7˜A”Q•Ð7ˆÐ7ä ˆu‹:˜Š>ÜÐCÓDÐ DØ ‰8aŠ<ÜÐ@ÓAÐ AØ ‰8aŠ<˜E !™H ršMÜÐBÓCÐ Cà˜˜q™‘M E¨!¡HÑ,Ð-°°a°b°    Ñ9ˆàˆÜ˜(Ó#ò    ˆAØ O‰O˜A ™HÔ %Ø !‰GˆAÚØ—‘  T¡¨TÑ 1Ô2ؐa‘óð    ð—x‘x´(¸8Ó2DÖ E¨Q¤ a¥Ò EÓFˆŒ Ü×Ñ Ó%Ð%ùò)8ùò&!Fs žD&Ã3D+có0—tj|||«S)abDecode a complete DER OBJECT ID, and re-initializes this
        object with it.
 
        Args:
            der_encoded (byte string):
                A complete DER OBJECT ID.
            strict (boolean):
                Whether decoding must check for strict DER compliancy.
 
        Raises:
            ValueError: in case of parsing errors.
        rprqs   rr\zDerObjectId.decode s€ô×Ñ  k°6Ó:Ð:r"có—tj|||«t|j«}g}d}|j    «rD|j «}|dz|dzz}|dzs|j |«d}|j    «rŒDt|«dk(r td«‚|ddkr d|dg|ddn#|dd    krd|ddz
g|ddn d
|dd    z
g|ddd j|Dcgc] }t|«‘Œc}«|_ ycc}w) z,Decode a complete DER OBJECT ID from a file.rrÇrLr=z Empty payloadrÆNr3éPrerÄ) rrYrrAr+r4r r*r-rÊÚstrrg)rrTr[r_rÌrÍÚcrs        rrYzDerObjectId._decodeFromStreams€ô    ×#Ñ# D¨!¨VÔ4ô ˜Ÿ ™ Ó %ˆàˆØ ˆØ×ÑÔ Ø— ‘ “ ˆAؐa‘˜A ™HÑ%ˆAؘ’HØ—‘ Ô"ؐð ×ÑÕ ô ˆx‹=˜AÒ Ü˜_Ó-Ð -à A‰;˜Ò ؘx¨™{Ð+ˆHRa‰LØ a‰[˜2Ò Ø˜x¨™{¨RÑ/Ð0ˆHRa‰Là˜x¨™{¨RÑ/Ð0ˆHRaˆLà—X‘X¨xÖ8¨!œs 1vÒ8Ó9ˆ
ùÒ8sÃ#D)ÚNNrarxr9r"rrrÄs„ñó: ò&ó4;ó :r"rcó,—eZdZdZdd„Zd„Zdd„Zd„Zy)    ra¢Class to model a DER BIT STRING.
 
    An example of encoding is:
 
    >>> from Crypto.Util.asn1 import DerBitString
    >>> bs_der = DerBitString(b'\xAA')
    >>> bs_der.value += b'\xBB'
    >>> print(bs_der.encode().hex())
 
    which will show ``030300aabb``, the DER encoding for the bit string
    ``b'\xAA\xBB'``.
 
    For decoding:
 
    >>> s = bytes.fromhex('030300aabb')
    >>> try:
    >>>   bs_der = DerBitString()
    >>>   bs_der.decode(s)
    >>>   print(bs_der.value.hex())
    >>> except ValueError:
    >>>   print "Not a valid DER BIT STRING"
 
    the output will be ``aabb``.
 
    :ivar value: The content of the string
    :vartype value: byte string
    Ncó’—tj|dd|d|«t|t«r|j«|_y||_y)aÉInitialize the DER object as a BIT STRING.
 
        :Parameters:
          value : byte string or DER object
            The initial, packed bit string.
            If not specified, the bit string is empty.
          implicit : integer
            The IMPLICIT tag to use for the encoded object.
            It overrides the universal tag for BIT STRING (3).
          explicit : integer
            The EXPLICIT tag to use for the encoded object.
        ér"FN)rr!Ú
isinstancerRrgrhs    rr!zDerBitString.__init__Ws<€ô    ×ј4  s¨H°e¸XÔFô eœYÔ 'ØŸ™›ˆDJàˆDJr"cóT—d|jz|_tj|«S)zBReturn the DER BIT STRING, fully encoded as a
        byte string.r}r~r%s rrRzDerBitString.encodels%€ð
 §¡Ñ+ˆŒ Ü×Ñ Ó%Ð%r"có0—tj|||«S)aTDecode a complete DER BIT STRING, and re-initializes this
        object with it.
 
        Args:
            der_encoded (byte string): a complete DER BIT STRING.
            strict (boolean):
                Whether decoding must check for strict DER compliancy.
 
        Raises:
            ValueError: in case of parsing errors.
        rprqs   rr\zDerBitString.decodets€ô×Ñ  k°6Ó:Ð:r"cóæ—tj|||«|jr&t|jd«dk7r t    d«‚d|_|jr|jdd|_yy)z1Decode a complete DER BIT STRING DER from a file.rzNot a valid BIT STRINGr"r3N)rrYrArr-rgrs   rrYzDerBitString._decodeFromStreamƒsd€ô    ×#Ñ# D¨!¨VÔ4à <Š<œD §¡¨a¡Ó1°QÒ6ÜÐ5Ó6Ð 6ðˆŒ
à <Š<ØŸ™ a bÐ)ˆDJð r")r"NNrarxr9r"rrr:s„ñó8ò*&ó ;ó *r"rcóD—eZdZdZd d„Zd„Zd„Zd„Zd„Zd d„Z    d    „Z
d
„Z y) ra…Class to model a DER SET OF.
 
    An example of encoding is:
 
    >>> from Crypto.Util.asn1 import DerBitString
    >>> from binascii import hexlify, unhexlify
    >>> so_der = DerSetOf([4,5])
    >>> so_der.add(6)
    >>> print hexlify(so_der.encode())
 
    which will show ``3109020104020105020106``, the DER encoding
    of a SET OF with items 4,5, and 6.
 
    For decoding:
 
    >>> s = unhexlify(b'3109020104020105020106')
    >>> try:
    >>>   so_der = DerSetOf()
    >>>   so_der.decode(s)
    >>>   print [x for x in so_der]
    >>> except ValueError:
    >>>   print "Not a valid DER SET OF"
 
    the output will be ``[4, 5, 6]``.
    Ncóˆ—tj|dd|d«g|_d|_|r|D]}|j    |«Œyy)a9Initialize the DER object as a SET OF.
 
        :Parameters:
          startSet : container
            The initial set of integers or DER encoded objects.
          implicit : integer
            The IMPLICIT tag to use for the encoded object.
            It overrides the universal tag for SET OF (17).
        ér"TN)rr!r…Ú
_elemOctetÚadd)rÚstartSetrDÚes    rr!zDerSetOf.__init__®sL€ô    ×ј4  s¨H°dÔ;؈Œ    ðˆŒá Øò Ø—‘˜• ñ ð r"có —|j|Sr$rˆr‰s  rrzDerSetOf.__getitem__Ãs€Øy‰y˜‰|Ðr"có,—t|j«Sr$)Úiterr…r%s rÚ__iter__zDerSetOf.__iter__Æs€ÜD—I‘I‹Ðr"có,—t|j«Sr$rœr%s rrzDerSetOf.__len__És€Ü4—9‘9‹~Ðr"có$—t|«rd}n+t|t«r |j}nt    |d«}|j
|k7r|j
 t d«‚||_||jvr|jj|«yy)zâAdd an element to the set.
 
        Args:
            elem (byte string or integer):
              An element of the same type of objects already in the set.
              It can be an integer or a DER encoded object.
        rerNz&New element does not belong to the set)    rr×rr?rrÞr-r…r )rÚelemÚeos   rrßz DerSetOf.addÌs}€ô dÔ Ø‰BÜ ˜œiÔ (Ø—‘‰Bäd˜1‘g“ˆBà ?‰?˜bÒ  Ø‰Ð*Ü Ð!IÓJÐJØ ˆDŒOà t—y‘yÑ  Ø I‰I× Ñ ˜TÕ "ð !r"có0—tj|||«S)aÞDecode a complete SET OF DER element, and re-initializes this
        object with it.
 
        DER INTEGERs are decoded into Python integers. Any other DER
        element is left undecoded; its validity is not checked.
 
        Args:
            der_encoded (byte string): a complete DER BIT SET OF.
            strict (boolean):
                Whether decoding must check for strict DER compliancy.
 
        Raises:
            ValueError: in case of parsing errors.
        rprqs   rr\zDerSetOf.decodeäs€ô ×Ñ  k°6Ó:Ð:r"cój—g|_tj|||«t|j«}d}|j «dkDrë|j «t«}|j||«|dkr |j}n||jk7r td«‚|dk7r*|jj|j««nOt«}|j|j«|«|jj|j«|j «dkDrŒêyy)z)Decode a complete DER SET OF from a file.éÿÿÿÿrz)Not all elements are of the same DER typereN)r…rrYrrAr+r&r?r-r r(r    r\rg)rrTr[r_Ú
setIdOctetr´rµs       rrYzDerSetOf._decodeFromStreamösü€ðˆŒ    ô    ×#Ñ# D¨!¨VÔ4ô ˜Ÿ ™ Ó %ˆØˆ
Ø×ÑÓ  1Ò$Ø N‰NÔ ä“+ˆCØ × !Ñ ! ! VÔ ,ð˜AŠ~Ø Ÿ^™^‘
à §¡Ò/Ü$Ð%PÓQÐQð˜TÒ!Ø—    ‘    × Ñ  ×!6Ñ!6Ó!8Õ9ä#›Ø— ‘ ˜a×3Ñ3Ó5°vÔ>Ø—    ‘    × Ñ  §¡Ô.ð'×ÑÓ  1Õ$r"cóP—g}|jD][}t|«rt|«j«}n#t    |t
«r|j«}n|}|j |«Œ]|j«dj|«|_    t
j|«S)zRReturn this SET OF DER element, fully encoded as a
        binary string.
        r")
r…rr    rRr×rr ÚsortrÊrA)rÚorderedr¢Úbyss    rrRzDerSetOf.encodes‰€ð ˆØ—I‘Iò     ˆDܘ$ÔÜ  Ó&×-Ñ-Ó/‘ܘD¤)Ô,Ø—k‘k“m‘àØ N‰N˜3Õ ð     ð     ‰ ŒØ—x‘x Ó(ˆŒ Ü×Ñ Ó%Ð%r")NNra) r5r6r7r8r!rrårrßr\rYrRr9r"rrr“s0„ñó4ò*òòò#ó0;ò$/óB&r"rra)rtÚCrypto.Util.py3compatrrrÚCrypto.Util.numberrrÚ__all__rÚobjectrrr    r
r r r rrrr9r"rú<module>rös´ðó.ç9Ñ9ç;ò P€ó+ô%&ô%ô@sZôsZôl\'ô\'ô~P@ôP@ôfRJ)ôRJôj*?Yô*?ôZ9ˆiô9ôs:)ôs:ôlV*9ôV*ôrU&ˆyõU&r"