
    N}bgl:                        d dl Z d dlmZ 	 d dlZn# e$ r d dlZY nw xY wd dlmZ d dlm	Z
 d dlmZ d dlZddlmZ ddlmZmZ ddlmZmZmZmZmZmZmZmZmZmZ  G d	 d
ej                  Z G d dej                  Z  G d dej                  Z! G d dej                  Z" G d dej                  Z# G d dej                  Z$ G d dej                  Z% G d dej                  Z& G d dej                  Z' G d dej                  Z(e
j)        ddz  dfd             Z* e e*                      d!             Z+dS )"    N)hexlify)b)given   )str_idx_as_int)NIST256pNIST224p)
remove_integerUnexpectedDERread_lengthencode_bitstringremove_bitstringremove_object
encode_oidremove_constructedremove_octet_stringremove_sequencec                   P    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd ZdS )TestRemoveIntegerc                     |                      t                    5  t          t          d                     d d d            d S # 1 swxY w Y   d S )Nz assertRaisesr   r
   r   selfs    a/home/e360mart.nyusoft.in/public_html/e360mart_env/lib/python3.11/site-packages/ecdsa/test_der.pytest_non_minimal_encodingz+TestRemoveInteger.test_non_minimal_encoding!   s    }-- 	2 	21/00111	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2   AA	A	c                     |                      t                    5  t          t          d                     d d d            d S # 1 swxY w Y   d S )Nu   r   r   s    r   test_negative_with_high_bit_setz1TestRemoveInteger.test_negative_with_high_bit_set%   s    }-- 	. 	.1^,,---	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.r   c                     t          t          d                    \  }}|                     |d           |                     |d           d S Nu           r
   r   assertEqualr   valrems      r   test_minimal_with_high_bit_setz0TestRemoveInteger.test_minimal_with_high_bit_set)   sN    !!$6"7"788Sd###c"""""r#   c                     |                      t                    5  t          t          d                     d d d            d S # 1 swxY w Y   d S )Nu     ÿr   r   s    r   %test_two_zero_bytes_with_high_bit_setz7TestRemoveInteger.test_two_zero_bytes_with_high_bit_set/   s    }-- 	6 	61344555	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6r   c                     |                      t                    5  t          t          d                     d d d            d S # 1 swxY w Y   d S )Nz r   r   s    r   test_zero_length_integerz*TestRemoveInteger.test_zero_length_integer3   s    }-- 	* 	*1Z==)))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	*r   c                     |                      t                    5  t          t          d                     d d d            d S # 1 swxY w Y   d S N r   r   s    r   test_empty_stringz#TestRemoveInteger.test_empty_string7   s    }-- 	" 	"1R55!!!	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	"r   c                     t          t          d                    \  }}|                     |d           |                     |d           d S )Nz r   r#   r$   r&   s      r   test_encoding_of_zeroz'TestRemoveInteger.test_encoding_of_zero;   sM    !!N"3"344Sa   c"""""r#   c                     t          t          d                    \  }}|                     |d           |                     |d           d S )Nz   r#   r$   r&   s      r   test_encoding_of_127z&TestRemoveInteger.test_encoding_of_127A   sM    !!N"3"344Sc"""c"""""r#   c                     t          t          d                    \  }}|                     |d           |                     |d           d S r!   r$   r&   s      r   test_encoding_of_128z&TestRemoveInteger.test_encoding_of_128G   sN    !!$6"7"788Sc"""c"""""r#   c                     |                      t                    5 }t          d           d d d            n# 1 swxY w Y   |                     dt	          |j                             d S )Ns    zwanted type 'integer'r   r   r
   assertInstr	exceptionr   es     r   test_wrong_tagz TestRemoveInteger.test_wrong_tagM   s    }-- 	0.///	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	-s1;/?/?@@@@@   7;;c                     |                      t                    5 }t          d           d d d            n# 1 swxY w Y   |                     dt	          |j                             d S )Ns    Length longerr:   r>   s     r   test_wrong_lengthz#TestRemoveInteger.test_wrong_lengthS   s    }-- 	0.///	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	os1;'7'788888rA   N)__name__
__module____qualname__r   r   r)   r+   r-   r1   r3   r6   r8   r@   rD    r#   r   r   r      s        2 2 2. . .# # #6 6 6* * *" " "# # ## # ## # #A A A9 9 9 9 9r#   r   c                   D    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
S )TestReadLengthc                 f    |                      dt          t          d                               d S )N)r   r    r%   r   r   r   s    r   test_zero_lengthzTestReadLength.test_zero_length^   s,    QvYY!7!788888r#   c                     |                      t                    5  t          t          d                     d d d            d S # 1 swxY w Y   d S )Nu    r   r   r   r   r   s    r   test_two_byte_zero_lengthz(TestReadLength.test_two_byte_zero_lengtha       }-- 	' 	'*&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	'r   c                     |                      t                    5  t          t          d                     d d d            d S # 1 swxY w Y   d S )Nu   rP   r   s    r   test_two_byte_small_lengthz)TestReadLength.test_two_byte_small_lengthe   rR   r   c                     |                      t                    5  t          t          d                     d d d            d S # 1 swxY w Y   d S )N   rP   r   s    r   test_long_form_with_zero_lengthz.TestReadLength.test_long_form_with_zero_lengthi   s    }-- 	# 	#&		"""	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	#r   c                 f    |                      dt          t          d                               d S )N)r"      u   rM   r   s    r   test_smallest_two_byte_lengthz,TestReadLength.test_smallest_two_byte_lengthm   s,    ;q}}#=#=>>>>>r#   c                     |                      t                    5  t          t          d                     d d d            d S # 1 swxY w Y   d S )Nu    rP   r   s    r   test_zero_padded_lengthz&TestReadLength.test_zero_padded_lengthp       }-- 	+ 	+.))***	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+r   c                 L    |                      dt          d                     d S )N)      s    )r%   r   r   s    r   test_two_three_byte_lengthz)TestReadLength.test_two_three_byte_lengtht   s&    ;#?#?@@@@@r#   c                     |                      t                    5  t          t          d                     d d d            d S # 1 swxY w Y   d S r/   rP   r   s    r   r1   z TestReadLength.test_empty_stringw   s    }-- 	 	"	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	r   c                     |                      t                    5  t          t          d                     d d d            d S # 1 swxY w Y   d S )Nu    rP   r   s    r   test_length_overflowz#TestReadLength.test_length_overflow{   r]   r   N)rE   rF   rG   rN   rQ   rT   rW   rZ   r\   ra   r1   rd   rH   r#   r   rJ   rJ   Z   s        9 9 9' ' '' ' '# # #? ? ?+ + +A A A  + + + + +r#   rJ   c                   >    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	S )
TestEncodeBitstringc                 x   t          j        d           t          j        t                    5 }t          d          }ddd           n# 1 swxY w Y   |                     t          |          d           |                     d|d         j	        j
        d                    |                     |d           dS )z(This is the old way to use the function.always    Nr   zunused= needs to be specifiedr       )warningssimplefilterpytestwarnsDeprecationWarningr   r%   lenr;   messageargsr   rn   ders      r   test_old_call_conventionz,TestEncodeBitstring.test_old_call_convention   s    h'''\,-- 	0";//C	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	UQ'''+U1X-=-B1-E	
 	
 	
 	122222s   A

AAc                    t          j        d           t          j        d          5 }t	          dd          }ddd           n# 1 swxY w Y   |                     t          |          d           |                     |d           dS )z$This is how it should be called now.rh   N   r   rj   rk   rl   rm   rn   r   r%   rp   rs   s      r   test_new_call_conventionz,TestEncodeBitstring.test_new_call_convention   s    h'''\$ 	/5"7A..C	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	UQ'''122222   AA
A
c                    t          j        d           t          j        d          5 }t	          dd          }ddd           n# 1 swxY w Y   |                     t          |          d           |                     |d           dS )zU
        Writing bit string with already included the number of unused bits.
        rh   Nri   r   rj   rx   rs   s      r   test_implicit_unused_bitsz-TestEncodeBitstring.test_implicit_unused_bits   s     	h'''\$ 	65";55C	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	UQ'''122222rz   c                 R    t          dd          }|                     |d           d S )Ns      s   )r   r%   )r   rt   s     r   test_explicit_unused_bitsz-TestEncodeBitstring.test_explicit_unused_bits   s.    {A..566666r#   c                 N    |                      t          dd          d           d S )Nr#   r   s    )r%   r   r   s    r   r1   z%TestEncodeBitstring.test_empty_string   s)    )#q11?CCCCCr#   c                     |                      t                    5  t          dd           d d d            d S # 1 swxY w Y   d S )Ns       r   
ValueErrorr   r   s    r   test_invalid_unused_countz-TestEncodeBitstring.test_invalid_unused_count   s    z** 	- 	-[!,,,	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	-   9= =c                     |                      t                    5  t          dd           d d d            d S # 1 swxY w Y   d S )Nr#   r   r   r   s    r   %test_invalid_unused_with_empty_stringz9TestEncodeBitstring.test_invalid_unused_with_empty_string   s    z** 	% 	%S!$$$	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	%r   c                     |                      t                    5  t          dd           d d d            d S # 1 swxY w Y   d S )Nrw   rY   r   r   s    r   test_non_zero_padding_bitsz.TestEncodeBitstring.test_non_zero_padding_bits   s    z** 	) 	)Wa(((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)r   N)rE   rF   rG   ru   ry   r|   r   r1   r   r   r   rH   r#   r   rf   rf      s        3 3 3	3 	3 	33 3 37 7 7
D D D- - -% % %) ) ) ) )r#   rf   c                   V    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd ZdS )TestRemoveBitstringc                    t          j        d           t          j        t                    5 }t          d          \  }}ddd           n# 1 swxY w Y   |                     t          |          d           |                     d|d         j	        j
        d                    |                     |d           |                     |d           dS )	z)This is the old way to call the function.rh   rj   Nr   z$expect_unused= needs to be specifiedr   ri   r#   )rk   rl   rm   rn   ro   r   r%   rp   r;   rq   rr   r   rn   bitsrests       r   ru   z,TestRemoveBitstring.test_old_call_convention   s   h'''\,-- 	?)*=>>JD$	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	UQ'''2E!H4D4I!4L	
 	
 	
 	{+++s#####s   AAAc                 J   t          j        d           t          j        d           5 }t	          dd          \  }}d d d            n# 1 swxY w Y   |                     t          |          d           |                     |d           |                     |d           d S )Nrh   rj   r   rw   r#   rk   rl   rm   rn   r   r%   rp   r   s       r   ry   z,TestRemoveBitstring.test_new_call_convention   s    h'''\$ 	B5)*=qAAJD$	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	UQ'''w'''s#####   A		AAc                 J   t          j        d           t          j        d           5 }t	          dd           \  }}d d d            n# 1 swxY w Y   |                     t          |          d           |                     |d           |                     |d           d S )Nrh   rj   r   )rw   r   r#   r   r   s       r   test_implicit_unexpected_unusedz3TestRemoveBitstring.test_implicit_unexpected_unused   s    h'''\$ 	E5)*=tDDJD$	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	UQ'''|,,,s#####r   c                     t          dd           \  }}|                     |d           |                     |d           d S )Ns   )   r~   r#   )r   r%   )r   retr   s      r   test_with_paddingz%TestRemoveBitstring.test_with_padding   sH    $%8$??	Tl+++s#####r#   c                     |                      t                    5  t          dd            d d d            d S # 1 swxY w Y   d S )Ns    r   r   r   r   s    r   test_not_a_bitstringz(TestRemoveBitstring.test_not_a_bitstring       }-- 	8 	80$777	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8r   c                     |                      t                    5  t          dd            d d d            d S # 1 swxY w Y   d S )Ns    r   r   s    r   test_empty_encodingz'TestRemoveBitstring.test_empty_encoding   s    }-- 	0 	0[$///	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0r   c                     |                      t                    5  t          dd            d d d            d S # 1 swxY w Y   d S Nr#   r   r   s    r   r1   z%TestRemoveBitstring.test_empty_string   s    }-- 	( 	(S$'''	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(r   c                     |                      t                    5  t          dd            d d d            d S # 1 swxY w Y   d S )N   r   r   s    r   test_no_lengthz"TestRemoveBitstring.test_no_length   s    }-- 	, 	,Wd+++	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	,r   c                     |                      t                    5  t          dd           d d d            d S # 1 swxY w Y   d S )Nrj   r   r   r   s    r   %test_unexpected_number_of_unused_bitsz9TestRemoveBitstring.test_unexpected_number_of_unused_bits   s    }-- 	5 	50!444	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5r   c                     |                      t                    5  t          dd            d d d            d S # 1 swxY w Y   d S )Ns    r   r   s    r   $test_invalid_encoding_of_unused_bitsz8TestRemoveBitstring.test_invalid_encoding_of_unused_bits   s    }-- 	< 	<4d;;;	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	<r   c                     |                      t                    5  t          dd            d d d            d S # 1 swxY w Y   d S )Ns   r   r   s    r   %test_invalid_encoding_of_empty_stringz9TestRemoveBitstring.test_invalid_encoding_of_empty_string   s    }-- 	4 	4_d333	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4r   c                     |                      t                    5  t          dd            d d d            d S # 1 swxY w Y   d S )Ns   r   r   s    r   test_invalid_padding_bitsz-TestRemoveBitstring.test_invalid_padding_bits  r   r   N)rE   rF   rG   ru   ry   r   r   r   r   r1   r   r   r   r   r   rH   r#   r   r   r      s        $ $ $$ $ $$ $ $$ $ $8 8 80 0 0( ( (, , ,5 5 5< < <4 4 48 8 8 8 8r#   r   c                        e Zd Zd Zd Zd ZdS )TestStrIdxAsIntc                 N    |                      dt          dd                     d S )Ns   r<   r   r%   r   r   s    r   test_strzTestStrIdxAsInt.test_str	  s(    nUA6677777r#   c                 N    |                      dt          dd                     d S Nr   s   strr   r   r   s    r   
test_byteszTestStrIdxAsInt.test_bytes  s(    nVQ7788888r#   c                 h    |                      dt          t          d          d                     d S r   )r%   r   	bytearrayr   s    r   test_bytearrayzTestStrIdxAsInt.test_bytearray  s0    nYv->->BBCCCCCr#   N)rE   rF   rG   r   r   r   rH   r#   r   r   r     sF        8 8 89 9 9D D D D Dr#   r   c                   J    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 ZdS )TestEncodeOidc                     t          dddddd          }|                     t          |          t          d                     d S )Nr   rY   H  ='  06072a8648ce3d0201)r   r%   r   r   )r   oid_ecPublicKeys     r   test_pub_key_oidzTestEncodeOid.test_pub_key_oid  sF    $Q3q!<<1115I3J3JKKKKKr#   c                 z    |                      t          t          j                  t	          d                     d S )N06052b81040021)r%   r   r	   encoded_oidr   r   s    r   test_nist224p_oidzTestEncodeOid.test_nist224p_oid  s2    !566:J8K8KLLLLLr#   c                 `    |                      t          t          j                  d           d S )Ns   06082a8648ce3d030107)r%   r   r   r   r   s    r   test_nist256p_oidzTestEncodeOid.test_nist256p_oid  s5    H())+B	
 	
 	
 	
 	
r#   c                 T    t          ddd          }|                     |d           d S )NrY     r`      7r   r%   r   oids     r   test_large_second_subidz%TestEncodeOid.test_large_second_subid   s0    C##566666r#   c                 R    t          dd          }|                     |d           d S )NrY   r      7r   r   s     r   test_with_two_subidsz"TestEncodeOid.test_with_two_subids%  s.    C  122222r#   c                 R    t          dd          }|                     |d           d S )Nr       r   r   s     r   test_zero_zerozTestEncodeOid.test_zero_zero)  s-    Ao.....r#   c                     |                      t          t          f          5  t          dd            d d d            d S # 1 swxY w Y   d S )Nr   )r   	TypeErrorAssertionErrorr   r   s    r   test_with_wrong_typesz#TestEncodeOid.test_with_wrong_types-  s    	>:;; 	  	 q$	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 s   A  AAc                     |                      t                    5  t          dd           d d d            d S # 1 swxY w Y   d S )Nr   (   r   r   r   r   s    r   "test_with_small_first_large_secondz0TestEncodeOid.test_with_small_first_large_second1      ~.. 	 	q"	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	r   c                 R    t          dd          }|                     |d           d S )Nr   '   s   Or   r   s     r   test_small_first_max_secondz)TestEncodeOid.test_small_first_max_second5  s-    Bo.....r#   c                     |                      t                    5  t          dd           d d d            d S # 1 swxY w Y   d S )Nr`   r   r   r   s    r   test_with_invalid_firstz%TestEncodeOid.test_with_invalid_first9  r   r   N)rE   rF   rG   r   r   r   r   r   r   r   r   r   r   rH   r#   r   r   r     s        L L LM M M
 
 

7 7 7
3 3 3/ / /       / / /    r#   r   c                   x    e Zd Zed             Zd Zd Zd Zd Zd Z	d Z
d Zd	 Zd
 Zd Zd Zd Zd Zd ZdS )TestRemoveObjectc                 8    t          dddddd          | _        d S )Nr   rY   r   r   )r   r   )clss    r   
setUpClasszTestRemoveObject.setUpClass?  s"    (AsE1a@@r#   c                     t          | j                  \  }}|                     |d           |                     |d           d S )Nr#   r   rY   r   r   rY   r   r   r   r%   r   r   r   s      r   r   z!TestRemoveObject.test_pub_key_oidC  sI    !$"677	Ts###677777r#   c                     t          | j        dz             \  }}|                     |d           |                     |d           d S )Ns   morer   r   r   s      r   test_with_extra_bytesz&TestRemoveObject.test_with_extra_bytesH  sN    !$"6"@AA	Tw'''677777r#   c                     t          d          \  }}|                     |d           |                     |d           d S )Nr   r#   )rY   r   r`   r   r%   r   s      r   test_with_large_second_subidz-TestRemoveObject.test_with_large_second_subidM  sF    !"9::	Ts###k*****r#   c                     |                      t                    5  t          d           d d d            d S # 1 swxY w Y   d S )Ns    r   r   r   r   s    r   test_with_padded_first_subidz-TestRemoveObject.test_with_padded_first_subidS      }-- 	/ 	/-...	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/   8<<c                     |                      t                    5  t          d           d d d            d S # 1 swxY w Y   d S )Ns   7r   r   s    r   test_with_padded_second_subidz.TestRemoveObject.test_with_padded_second_subidW  s    }-- 	7 	75666	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7r   c                     |                      t                    5  t          d           d d d            d S # 1 swxY w Y   d S )Ns   7r   r   s    r   )test_with_missing_last_byte_of_multi_bytez:TestRemoveObject.test_with_missing_last_byte_of_multi_byte[  s    }-- 	3 	31222	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3r   c                     t          d          \  }}|                     |d           |                     |d           d S )Nr   r#   )rY   r   r   r   s      r   r   z%TestRemoveObject.test_with_two_subids_  sF    !"566	Ts###h'''''r#   c                     t          d          \  }}|                     |d           |                     |d           d S )Nr   r#   )r   r   r   r   s      r   r   zTestRemoveObject.test_zero_zerod  sE    !/22	Ts###f%%%%%r#   c                     |                      t                    5  t          d           d d d            d S # 1 swxY w Y   d S r   r   r   s    r   r1   z"TestRemoveObject.test_empty_stringi  s    }-- 	 	#	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	r   c                     |                      t                    5  t          d           d d d            d S # 1 swxY w Y   d S )N   r   r   s    r   test_missing_lengthz$TestRemoveObject.test_missing_lengthm  s    }-- 	# 	#'"""	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	#r   c                     |                      t                    5  t          d           d d d            d S # 1 swxY w Y   d S )Ns    r   r   s    r   test_empty_oidzTestRemoveObject.test_empty_oidq      }-- 	' 	'+&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	'r   c                     |                      t                    5  t          d           d d d            d S # 1 swxY w Y   d S )Ns   r   r   s    r   test_empty_oid_overflowz(TestRemoveObject.test_empty_oid_overflowu  r  r   c                     |                      t                    5  t          d           d d d            d S # 1 swxY w Y   d S )Ns   7r   r   s    r   test_with_wrong_typez%TestRemoveObject.test_with_wrong_typey  r   r   c                     |                      t                    5  t          d           d d d            d S # 1 swxY w Y   d S )Ns   7r   r   s    r   test_with_too_long_lengthz*TestRemoveObject.test_with_too_long_length}  r   r   N)rE   rF   rG   classmethodr   r   r   r   r   r   r   r   r   r1   r   r   r  r  r  rH   r#   r   r   r   >  s       A A [A8 8 8
8 8 8
+ + +/ / /7 7 73 3 3( ( (
& & &
  # # #' ' '' ' '/ / // / / / /r#   r   c                       e Zd Zd Zd ZdS )TestRemoveConstructedc                     d}t          |          \  }}}|                     |d           |                     |d           |                     |d           d S )Ns   r      r#   )r   r%   )r   datatagbodyr   s        r   test_simplez!TestRemoveConstructed.test_simple  sb    ",T22T4d###{+++s#####r#   c                     d}|                      t                    5 }t          |           d d d            n# 1 swxY w Y   |                     dt	          |j                             d S )Ns   zconstructed tag)r   r   r   r;   r<   r=   r   r  r?   s      r   test_with_malformed_tagz-TestRemoveConstructed.test_with_malformed_tag  s    "}-- 	%t$$$	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	'Q[)9)9:::::   9= =NrE   rF   rG   r  r  rH   r#   r   r
  r
    s2        $ $ $; ; ; ; ;r#   r
  c                       e Zd Zd Zd ZdS )TestRemoveOctetStringc                     d}t          |          \  }}|                     |d           |                     |d           d S )Ns   s   r#   )r   r%   r   r  r  r   s       r   r  z!TestRemoveOctetString.test_simple  sJ    &(..
d///s#####r#   c                     d}|                      t                    5 }t          |           d d d            n# 1 swxY w Y   |                     dt	          |j                             d S )Ns   octetstring)r   r   r   r;   r<   r=   r  s      r   r  z-TestRemoveOctetString.test_with_malformed_tag  s    &}-- 	&%%%	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	mS%5%566666r  Nr  rH   r#   r   r  r    s2        $ $ $7 7 7 7 7r#   r  c                   &    e Zd Zd Zd Zd Zd ZdS )TestRemoveSequencec                     d}t          |          \  }}|                     |d           |                     |d           d S )Ns   0r  r#   )r   r%   r  s       r   r  zTestRemoveSequence.test_simple  sJ    "$T**
d{+++s#####r#   c                     |                      t                    5 }t          d           d d d            n# 1 swxY w Y   |                     dt	          |j                             d S )Nr#   zEmpty stringr   r   r   r;   r<   r=   r>   s     r   test_with_empty_stringz)TestRemoveSequence.test_with_empty_string  s    }-- 	!C   	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	nc!+&6&677777rA   c                     d}|                      t                    5 }t          |           d d d            n# 1 swxY w Y   |                     dt	          |j                             d S )Ns    zwanted type 'sequence'r   r  s      r   test_with_wrong_tagz&TestRemoveSequence.test_with_wrong_tag  s    "}-- 	"D!!!	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	.AK0@0@AAAAAr  c                     d}|                      t                    5 }t          |           d d d            n# 1 swxY w Y   |                     dt	          |j                             d S )Ns   0rC   r   r  s      r   test_with_wrong_lengthz)TestRemoveSequence.test_with_wrong_length  s    "}-- 	"D!!!	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	os1;'7'788888r  N)rE   rF   rG   r  r!  r#  r%  rH   r#   r   r  r    sS        $ $ $8 8 8B B B9 9 9 9 9r#   r  rY   i   2   c                 X    | t          j        dd                    }|dk     r  | t          j        dd                    }n | t          j        d|                    } | t          j        t          j        d|          |                    }||ft          |          z   S )z
    Hypothesis strategy that returns valid OBJECT IDENTIFIERs as tuples

    :param max_value: maximum value of any single sub-identifier
    :param max_size: maximum length of the generated OID
    r   rY   )	min_value	max_valuer   )max_size)stintegersliststuple)drawr)  r*  firstsecondr   s         r   st_oidr2    s     DqA66677EqyybkA<<<==bkACCCDD4
K!y999H	
 	
 	
 D
 6?U4[[((r#   c                 \    t          |  }t          |          \  }}|dk    sJ || k    sJ d S r   )r   r   )idsr   decoded_oidr   s       r   	test_oidsr6    sB    c"K%k22K3;;;;#r#   ),rk   binasciir   	unittest2unittestImportErrorsixr   hypothesis.strategies
strategiesr+  
hypothesisr   rm   _compatr   curvesr   r	   rt   r
   r   r   r   r   r   r   r   r   r   TestCaser   rJ   rf   r   r   r   r   r
  r  r  	compositer2  r6  rH   r#   r   <module>rC     s}                 OOOOO       " " " " " "        # # # # # # & & & & & & & &                       99 99 99 99 99) 99 99 99x#+ #+ #+ #+ #+X& #+ #+ #+L;) ;) ;) ;) ;)(+ ;) ;) ;)|G8 G8 G8 G8 G8(+ G8 G8 G8TD D D D Dh' D D D( ( ( ( (H% ( ( (VA/ A/ A/ A/ A/x( A/ A/ A/H; ; ; ; ;H- ; ; ;&7 7 7 7 7H- 7 7 79 9 9 9 9* 9 9 9< c6B ) ) ) )( vvxx    s    	