� J�g U����dZddlZddlZddlZddlZddlZddlmZddlm Z ddl m Z ddl m Z mZmZmZddlmZmZdd lmZdd lmZmZmZmZdd lmZ dd lmZmZdd l m!Z!m"Z"ddl#m$Z$dZ%n#e&$r Z'e'Z%YdZ'['ndZ'['wwxYwej(e)��Z*Gd�d��Z+Gd�d��Z,Gd�de��Z-Gd�d��Z.dee/e0fde/fd�Z1de2de2fd�Z3dS)a Utilities to perform encryption following the PDF standards. The contents of this module are internal to fpdf2, and not part of the public API. They may change at any time without prior warning or any deprecation period, in non-backward-compatible ways. �N)�hexlify)� BOM_UTF16_BE��urandom)�Callable�Iterable�Type�Union�)�AccessPermission�EncryptionMethod)� FPDFException)�Name� PDFObject� PDFString�build_obj_dict)�create_dictionary_string)�Cipher�modes)�AES128�AES256)�PKCS7c�f�eZdZdZdZdedefd�Zdedee fd�Z dede ee fdefd �Z d S) �ARC4az This is a simplified version of the ARC4 (alleged RC4) algorithm, created based on the following sources: * Wikipedia article on RC4 * github.com/manojpandey/rc4 (MIT License) * http://people.csail.mit.edu/rivest/pubs/RS14.pdf Having this ARC4 implementation makes it possible to have basic encryption functions without additional dependencies ��key�returnc��t|��}tt|j����}d}t|j��D]8}|||z|||zz|jz}||||c||<||<�9|S)Nr)�len�list�range�MOD)�selfr� key_length�S�j�is �_/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/fpdf/encryption.py�KSAzARC4.KSA4s�����X�X� � ��t�x��� !� !�� ���t�x��� $� $�A��Q�q�T��C��J��/�/�4�8�;�A��1��q��t�J�A�a�D�!�A�$�$���r%c#��K�d}d} |dz|jz}|||z|jz}||||c||<||<|||||z|jz}|V��[)NrTr )r")r#r%r'r&�Ks r(�PRGAz ARC4.PRGA=s���� �� �� ��Q��$�(�"�A��Q�q�T��T�X�%�A��1��q��t�J�A�a�D�!�A�$��1�Q�4�!�A�$�;�$�(�*�+�A��G�G�G�  r*�textc��|�|�|����}g}|D]'}|�|t|��z ���(|S�N)r-r)�append�next)r#rr.� keystream�res�cs r(�encryptz ARC4.encryptGsV���I�I�d�h�h�s�m�m�,�,� ���� ,� ,�A� �J�J�q�4� �?�?�*� +� +� +� +�� r*N)�__name__� __module__� __qualname__�__doc__r"�bytesr r)r�intr-r � bytearrayr6�r*r(rr&s������� � � �C��u��������d��x��}������5���e�Y�.>�(?��D������r*rc�<��eZdZdZdededdf�fd� Zdefd�Z�xZS)� CryptFilterzMRepresents one crypt filter, listed under CF inside the encryption dictionary�mode�lengthrNc����t�����td��|_t|��|_t |dz ��|_dS)Nr@�)�super�__init__r�type�c_f_mr<rB)r#rArB� __class__s �r(rFzCryptFilter.__init__RsJ��� ����������'�'�� ��$�Z�Z�� ��&�1�*�o�o�� � � r*c�r��t�fd�t���D����}t|��S)Nc�2��i|]}|t�|����Sr>)�getattr)�.0rr#s �r(� <dictcomp>z)CryptFilter.serialize.<locals>.<dictcomp>Ys%���"P�"P�"P�s�3���c�(:�(:�"P�"P�"Pr*)r�dir�pdf_dict)r#�obj_dicts` r(� serializezCryptFilter.serializeXs9���!�"P�"P�"P�"P�c�$�i�i�"P�"P�"P�Q�Q����!�!�!r*) r7r8r9r:�strr<rFrR� __classcell__�rIs@r(r@r@Oss�������W�W�&�S�&�#�&�$�&�&�&�&�&�&� "�3�"�"�"�"�"�"�"�"r*r@c�$��eZdZdZd�fd� Z�xZS)�EncryptionDictionaryz� This class represents an encryption dictionary PDF 32000 reference - Table 20 The PDF trailer must reference this object (/Encrypt) �security_handler�StandardSecurityHandlerrNc���t�����td��|_|j|_|j|_d|j� ���d�|_d|j � ���d�|_ |jdkrfd|j � ���d�|_ d|j � ���d�|_d|j� ���d�|_|j|_t%|j��|_|jsd|_|jr-t/d|j���i��|_|jt6jkr*td��|_td��|_dStd��|_td��|_dS) N�Standard�<�>��falsez/StdCF�Identity�StdCF)rErFr�filterr$rB�revision�r�o�upper�u�oe�o_e�ue�u_e�perms�version�v�int32�access_permission�p�encrypt_metadata�cfrPrR�c_f�encryption_methodr � NO_ENCRYPTION�stm_f�str_f)r#rXrIs �r(rFzEncryptionDictionary.__init__ds���� ���������:�&�&�� �&�1�� �!�*���2�%�'�-�-�/�/�2�2�2���2�%�'�-�-�/�/�2�2�2��� � $�� )� )�9�+�.�4�4�6�6�9�9�9�D�H�9�+�.�4�4�6�6�9�9�9�D�H�>�-�3�9�9�;�;�>�>�>�D�J�!�)����'�9�:�:����0� ,�$+�D� !� � � M���+;�+>�+H�+H�+J�+J� K�L�L�D�H� � -�1A�1O� O� O��j�)�)�D�J��j�)�)�D�J�J�J��g���D�J��g���D�J�J�Jr*)rXrYrN)r7r8r9r:rFrTrUs@r(rWrW]sG��������� '�'�'�'�'�'�'�'�'�'r*rWc ��eZdZdZdZdej��ejdfde de e dfdeded e f d �Z d e d dfd �Z d efd�Zde e eefded e e effd�Zde ded e fd�Zdeded efd�Zd e fd�Zdedefd�Zdeded efd�Zededded efd���Zededde d efd���Zde d efd �Zd e fd!�Zd e fd"�Zee��fdedd#ed$ed%ed ef d&���Z d+d'�Z!d+d(�Z"d+d)�Z#d efd*�Z$dS),rYa This class is referenced in the main PDF class and is used to handle all encryption functions * Calculate password and hashes * Provide encrypt method to be called by stream and strings * Set the access permissions on the document s (�N^Nu�AdNV��..��h>�/ ��dSizNF�owner_password� user_password� permissionrurrc�R�||_|�dnd|z|_||_|r|nd|_||_d|_d|_tr6|jtj tj fvrtdt�����|jtj kr?d|_ d|_ |�d��td|j���|_n�|jtj krFd |_ d |_ |�d ��d |_td |j���|_nw|jtjkr?d|_ d|_ |�d��td|j���|_n#d|_ d|_ |�d��||_dS)Nl�p���zucryptography module not available - Try: 'pip install cryptography' or use RC4 encryption method - Import error was: �z1.6�AESV2)rArB�r^z2.0r�AESV3�V2��z1.5)�fpdfrprzr{rursr$� import_errorr �AES_128�AES_256�EnvironmentErrorrmrc�_set_min_pdf_versionr@rvrr)r#r�rzr{r|rurrs r(rFz StandardSecurityHandler.__init__�s����� ��!� /� .�4�z�A� �� -���.;�C�]�]����!2��������� � �D�2� � $� � $�7 � � �#�7�(4�7�7��� � � !�%5�%=� =� =��D�L��D�M� � %� %�e� ,� ,� ,�!�w�t��G�G�G�D�G�G� � #�'7�'?� ?� ?��D�L��D�M� � %� %�e� ,� ,� ,�!�D�O�!�w�t��G�G�G�D�G�G� � #�'7�'E� E� E��D�L��D�M� � %� %�e� ,� ,� ,�!�t�D�O�D�D�D�D�G�G��D�L��D�M� � %� %�e� ,� ,� ,�!1����r*�file_idrc��||_|dd�|_|jdkrX|�d��|_|���|���|���dS|���|_ |� ��|_|� ��|_ dS)z,File_id is the first hash of the PDF file idr �!r^� N) r��info_idrc�get_random_bytes�k�generate_user_password_rev6�generate_owner_password_rev6�generate_perms_rev6�generate_owner_passwordre�generate_encryption_key�generate_user_passwordrg)r#r�s r(�generate_passwordsz*StandardSecurityHandler.generate_passwords�s����� ��q��t�}�� � �=�A� � ��*�*�2�.�.�D�F� � ,� ,� .� .� .� � -� -� /� /� /� � $� $� &� &� &� &� &��1�1�3�3�D�F��1�1�3�3�D�F��0�0�2�2�D�F�F�Fr*c� �t|��S)zReturn an encryption dictionary)rW�r#s r(�get_encryption_objz*StandardSecurityHandler.get_encryption_obj�s��#�D�)�)�)r*r.�obj_idc���t�d|��t|ttf��r|�||��n|�||��S)zOMethod invoked by PDFObject and PDFContentStream to encrypt strings and streamsz Encrypting %s)�LOGGER�debug� isinstancer=r;�encrypt_stream�encrypt_string)r#r.r�s r(r6zStandardSecurityHandler.encrypt�s^�� � � �_�d�+�+�+��$��E� 2�3�3� 3�D� � ��f� -� -� -��$�$�T�6�2�2� r*�stringc �t�|jtjkr#t|d������St �d|�� |�d��dt|� |�d��|����� ��� ���d�S#t$redtt|� t|�d��z|�������d���d�cYSwxYw)NF)r6zEncrypting string: %szlatin-1r\r]z utf-16-be)rur rvrrRr�r��encoder;� encrypt_bytes�hexrf�UnicodeEncodeErrorrr=r�decode)r#r�r�s r(r�z&StandardSecurityHandler.encrypt_string�sD�� � !�%5�%C� C� C��V�U�3�3�3�=�=�?�?� ?�� � �,�f�5�5�5� F� �M�M�)� $� $� $�c�u�T�/�/�� � �i�0H�0H�&�Q�Q�R�R�V�V�X�X�^�^�`�`�c�c�c� c��!� F� F� F�F�w�y��);�);�L�6�=�=�Yd�Ke�Ke�<e�gm�)n�)n�o�o�p�p�w�w�yB�C�C�F�F�F� F� F� F� F���s�A2C�A,D7�6D7�streamc�v�|jtjkr|St|�||����Sr0)rur rvr;r�)r#r�r�s r(r�z&StandardSecurityHandler.encrypt_stream�s7�� � !�%5�%C� C� C��M��T�'�'���7�7�8�8�8r*c�@�|jtjtjfvSr0)rur r�r�r�s r(�is_aes_algorithmz(StandardSecurityHandler.is_aes_algorithm�s#���%� � $� � $�* � � r*�datac�D�tjdd���}|�|j��|�|dz�ddd�����|�d�d dd�����|���r$|�t gd �����|���}|���r|�||��St��� ||��S) a PDF32000 reference - Algorithm 1: Encryption of data using the RC4 or AES algorithms Append object ID and generation ID to the key and encrypt the data Generation ID is fixed as 0. Will need to revisit if the application start changing generation ID �md5F��usedforsecurityi���r��little�� byteorder�signedrr�)�s�A�l�T) �hashlib�new�updater��to_bytesr�r;�digest�encrypt_AES_cryptographyrr6)r#r�r��hrs r(r�z%StandardSecurityHandler.encrypt_bytes�s�� �K��u� 5� 5� 5�� �������� ��� �h� � (� (��h�u� (� M� M� � � � ��� � !� !�!�x�� !� F� F� � � � � � � "� "� 6� �H�H�U�3�3�3�4�4� 5� 5� 5��h�h�j�j�� � � � "� "� <��0�0��d�;�;� ;��v�v�~�~�c�4�(�(�(r*rc�z�t|�d����}td�����}|�|��}||���z }|jtjkr/tt|��tj |����n3tt|j��tj |����}|���}|�|��|���z}|�|��|S)zDEncrypts an array of bytes using AES algorithms (AES 128 or AES 256)�r)r=r�r�padderr��finalizerur r�rrr�CBCrr�� encryptor�extend)r#rr��ivr�� padded_data�cipherr�s r(r�z0StandardSecurityHandler.encrypt_AES_cryptographys��� �t�,�,�R�0�0� 1� 1���s���"�"�$�$���m�m�D�)�)� ��v���(�(�(� ��%�)9�)A�A�A� �6�#�;�;�� �"� � � .� .� .���t�v���� �"� � �6�6� � �$�$�&�&� ���� �,�,�y�/A�/A�/C�/C�C�� � � �$����� r*�cls�sizec� �t|��S)z� https://docs.python.org/3/library/os.html#os.urandom os.urandom will use OS-specific sources to generate random bytes suitable for cryptographic use r)r�r�s r(r�z(StandardSecurityHandler.get_random_bytess���t�}�}�r*c����dtdtfd��t|��dkrt��Sd��fd�|D����}tj�d|��}dtdtfd�}|D] }||��rtd |�d �����!d td tdtfd �}||tj ��rp||tj ��rtd |�d����tj |d��rtj |d��std |�d����t|��dkr |dd�}|� d��S)al PDF2.0 - ISO 32000-2:2020 All passwords for revision 6 shall be based on Unicode. Preprocessing of a user-provided password consists first of normalizing its representation by applying the "SASLPrep" profile (Internet RFC 4013) of the "stringprep" algorithm (Internet RFC 3454) to the supplied password using the Normalize and BiDi options. Next, the password string shall be converted to UTF-8 encoding, and then truncated to the first 127 bytes if the string is longer than 127 bytes Python offers a stringprep module with the tables mapped in methods �charrc�f�|sdStj|��rdStj|��rdS|S)Nr~� )� stringprep� in_table_b1� in_table_c12�r�s r(�char_mapz8StandardSecurityHandler.prepare_string.<locals>.char_map/sD��� ��r��%�d�+�+� ��r��&�t�,�,� ��x��Kr*r r~c3�.�K�|]}�|��V��dSr0r>)rMr5r�s �r(� <genexpr>z9StandardSecurityHandler.prepare_string.<locals>.<genexpr>=s+�����!>�!>�!�(�(�1�+�+�!>�!>�!>�!>�!>�!>r*�NFKCc�j�tj|��p�tj|��p�tj|��pwtj|��pctj|��pOtj|��p;tj|��p'tj|��ptj |��Sr0) r�r��in_table_c21_c22� in_table_c3� in_table_c4� in_table_c5� in_table_c6� in_table_c7� in_table_c8� in_table_c9r�s r(� is_prohibitedz=StandardSecurityHandler.prepare_string.<locals>.is_prohibitedCs����'��-�-� 0��.�t�4�4� 0��)�$�/�/� 0��)�$�/�/� 0��)�$�/�/� 0� �)�$�/�/� 0� �)���� 0��)���� 0��)�$�/�/� r*z The password z contains prohibited charactersr��func�:��t�fd�|D����S)Nc3�.�K�|]}�|��V��dSr0r>)rMr�r�s �r(r�zPStandardSecurityHandler.prepare_string.<locals>.has_character.<locals>.<genexpr>\s+�����4�4�T�s�s�4�y�y�4�4�4�4�4�4r*)�any)r�r�s `r(� has_characterz=StandardSecurityHandler.prepare_string.<locals>.has_character[s&����4�4�4�4�V�4�4�4�4�4� 4r*z+ contains invalid bidirectional characters.r������NzUTF-8)rSrr;�join� unicodedata� ucd_3_2_0� normalize�boolrrr�� in_table_d1� in_table_d2r�)r�r��prepared_stringr�r�r�r�s @r(�prepare_stringz&StandardSecurityHandler.prepare_string!s���� �3� �3� � � � � �v�;�;��?�?��7�7�N��'�'�!>�!>�!>�!>�v�!>�!>�!>�>�>��&�/�9�9�&�/�R�R�� �� �� � � � �"$� � �D��}�T�"�"� �#�K�F�K�K�K���� �  5�#� 5�H� 5�� 5� 5� 5� 5� �=��*�*@� A� A� ��}�_�j�.D�E�E� �#�W�F�W�W�W���� �&��q�'9�:�:� ��*�?�2�+>�?�?� �$�W�F�W�W�W���� �� � �#� %� %�-�d�s�d�3�O��%�%�g�.�.�.r*�passwordc���t|��dkr |dd�}t|�d����}|�|jddt|��z ���|S)z� PDF32000 reference - Algorithm 2: Computing an encryption key Step (a) - Add the default padding at the end of provided password to make it 32 bit long r�N�latin1)rr=r�r��DEFAULT_PADDING)r#r�rqs r(�padded_passwordz'StandardSecurityHandler.padded_passwordssh�� �x�=�=�2� � �����}�H� �h�o�o�h�/�/� 0� 0�� ����%�o��c�!�f�f��o�6�7�7�7��r*c���|�|j��}td��D]}t|��}�|dt j|jdz ���}|�|j��}td��D]P}g}|D]}|�||z ���t��� t|��|��}�Qt|��� ��S)z� PDF32000 reference - Algorithm 3: Computing the encryption dictionary's O (owner password) value The security handler is only using revision 3 or 4, so the legacy r2 version is not implemented here �3NrD�) r�rzr!r��math�ceilr$r{r1rr6r;r�)r#�m�_�rc4key�resultr'�new_keyr�s r(r�z/StandardSecurityHandler.generate_owner_password~s��� � � ��!4� 5� 5���r��� � �A��A���A�A��5�d�i���!� 3�4�4�5�6���%�%�d�&8�9�9���r��� <� <�A��G�� &� &�����q�1�u�%�%�%�%��V�V�^�^�E�'�N�N�F�;�;�F�F��V�}�}� � �"�"�"r*c����tjdd���}|�t�j����|�t ��j����t|�������j }td��D]P}g}|D]}|� ||z ���t��� t |�������Q����fd�td��D����t ������S)z� PDF32000 reference - Algorithm 5: Computing the encryption dictionary's U (user password) value The security handler is only using revision 3 or 4, so the legacy r2 version is not implemented here r�Fr�r�c3�D�K�|]}�|�j|z V��dSr0)r�)rM�xrr#s ��r(r�zAStandardSecurityHandler.generate_user_password.<locals>.<genexpr>�sE����� � �67�V�A�Y��-�a�0� 0� � � � � � r*r�)r�r�r�r=r�r;�fromhexr�r�r�r!r1rr6r�r�)r#rrr'rr�rs` @r(r�z.StandardSecurityHandler.generate_user_password�s5���� �K��u� 5� 5� 5�� ����4�/�0�0�1�1�1� ������t�|�,�,�-�-�-��1�8�8�:�:�&�&���f���r��� <� <�A��G�� &� &�����q�1�u�%�%�%�%��V�V�^�^�E�'�N�N�F�;�;�F�F�� � � � � � � �;@��9�9� � � � � � ��V�}�}� � �"�"�"r*�input_password�salt�user_keyc���tj||z|z�����}d} |dz }||z|z}tt |dd���t j|dd�����}|���}|�|dz��|� ��z} t| dd���dz} | dkr'tj| �����}nS| dkr'tj | �����}n&tj | �����}|dkr| d |dz krn��?|dd�S) zz Algorithm 2B - section 7.6.4.3.4 of the ISO 32000-2:2020 Applied on Security handlers revision 6 rTr Nr�r��@r�r�) r��sha256r�rrrr�r�r�r��sum�sha384�sha512) r�r r r r�� round_number�k1r�r��e� remainders r(� compute_hashz$StandardSecurityHandler.compute_hash�si�� �N�>�D�0�8�;� <� <� C� C� E� E��� � � �A� �L��!�#�h�.�B��F�1�S�b�S�6�N�N�E�I�a��2��h�,?�,?�@�@�F��(�(�*�*�I�� � ��b��)�)�I�,>�,>�,@�,@�@�A��A�c�r�c�F� � �a��I��A�~�~��N�1�%�%�,�,�.�.����a����N�1�%�%�,�,�.�.����N�1�%�%�,�,�.�.���r�!�!�a��e�|�b�/@�&@�&@��' �*��"��v� r*c�^�|�|j��}|st��}|�d��}|�d��}|�||���|z|z}|���|_|�||���}tt|��tj d����}|� ��}|� |j ��|���z}|���|_dS)z� Generating the U (user password) and UE (user encryption) for security handlers of revision 6 Algorithm 8 - Section 7.6.4.4.7 of the ISO 32000-2:2020 rD)r r �N)r�r{r=r�rr�rgrrrr�r�r�r�r�rj) r#r{�user_validation_salt� user_key_saltrgrr�r�rjs r(r�z3StandardSecurityHandler.generate_user_password_rev6�s�� �+�+�D�,>�?�?� �� (�%�K�K�M�#�4�4�Q�7�7���-�-�a�0�0� � � � �]�AU� � V� V�"� #�� � � ����������}�=��Q�Q����s� � �U�Y�|�%<�%<�=�=���$�$�&�&� � � � �d�f� %� %� �(:�(:�(<�(<� <���&�&�(�(����r*c���|�|j��}|std|j�����|�d��}|�d��}|�||t �|j�����|z|z}|���|_ |�||t �|j�����}tt|��tj d����}|���}|�|j��|���z}|���|_dS)z� Generating the O (owner password) and OE (owner encryption) for security handlers of revision 6 Algorithm 9 - Section 7.6.4.4.8 of the ISO 32000-2:2020 zInvalid owner password rD)r r r rN)r�rzrr�rr;r rgr�rerrrr�r�r�r�r�rh) r#rz�owner_validation_salt�owner_key_saltrerr�r�rhs r(r�z4StandardSecurityHandler.generate_owner_password_rev6�sY�� �,�,�T�-@�A�A��� Q�� O�$�:M� O� O�P�P� P� $� 5� 5�a� 8� 8���.�.�q�1�1�� � � �-�*����t�v�.�.� � � � $�  $� �  � �����������)���]�]�4�6�*�*� � � �� ��s� � �U�Y�|�%<�%<�=�=���$�$�&�&� � � � �d�f� %� %� �(:�(:�(<�(<� <���&�&�(�(����r*c��d|jz}|jrdnd}|�ddd���|zdz|�d ��z}t t |j��tj����}|� ��}|� |��|� ��z}|� ��|_ d S) u� 7.6.4.4.9 Algorithm 10: Computing the encryption dictionary’s Perms (permissions) value (Security handlers of revision 6) of the ISO 32000-2:2020 l���T�FrDr�Fr�sadbr�N)rprrr�r�rrr�r�ECBr�r�r�r�rl)r#�perms64brr� perms_inputr�r�rls r(r�z+StandardSecurityHandler.generate_perms_rev6s��� &��(>�>��#'�#8�B�4�4�d�� � � �a�8�E� � B� B�� �� ��#�#�A�&�&� '� ���t�v���� � � �4�4���$�$�&�&� �� � ��-�-� �0B�0B�0D�0D�D���Y�Y�[�[�� � � r*c��tjdd���}|�|�|j����|�t �|j����|�|jdz� ddd�����|�t �|j ����|j dur/|j dkr$|�t gd�����|� ��d tj|jd z ���}t#d ��D]3}t%|��d tj|jd z ���}�4|S) zU PDF32000 reference Algorithm 2: Computing an encryption key r�Fr����r�r�r�)��r'r'r'NrD�2)r�r�r�r�r{r;r rerpr�r�rrrmr�r�rr$r!r�)r#rrrs r(r�z/StandardSecurityHandler.generate_encryption_keysc�� �K��u� 5� 5� 5�� ����%�%�d�&8�9�9�:�:�:� ������t�v�&�&�'�'�'� ��� � #�j� 0� :� :��X�e� ;� � � � � � ������t�|�,�,�-�-�-� � �E� )� )�d�l�a�.?�.?� �H�H�U�3�3�3�4�4� 5� 5� 5������>�t�y���1�)<�=�=�>�?���r��� E� E�A���[�[�!C�D�I�d�o��.A�$B�$B�!C�D�F�F�� r*)rN)%r7r8r9r:r�r �allr �RC4rSr r�rFr�rWr�r=r;r<r6r�r�r�r�r�� classmethodr r�r�r�r�r�rr�r�r�r�r>r*r(rYrY}sl�������� V��+/�';�'7�';�'=�'=�.>�.B�!&�51�51��51��S�$�Y�'� 51� %� 51� ,� 51��51�51�51�51�n 3�#� 3�$� 3� 3� 3� 3�*�$8�*�*�*�*�  ��#�y�%�/�0�  �:=�  � �s�E�z� �  �  �  �  �F�S�F�#�F�#�F�F�F�F�9�U�9�C�9�E�9�9�9�9�  �$� � � � � )�%�)��)�)�)�)�,�E����5����� ��d�#<�=��S��U�����[���O/�D�!:�;�O/�S�O/�U�O/�O/�O/��[�O/�b �� � � � � � �#��#�#�#�#�"#��#�#�#�#�(� $�)�+�+� !�!� �+� ,�!��!��!�� !� � !�!�!��[�!�F����0����B!�!�!�!�&�������r*rYr�rc��tjdd���}|�|��|���S)Nr�Fr�)r�r�r�r�)r�r�s r(r�r�)s3��� �E�5�1�1�1�A��H�H�T�N�N�N� �8�8�:�:�r*�nc��|dz}|dz dz S)z%convert long to signed 32 bit integerr&lr>)r-s r(roro/s�� �J��A� � �N�j� (�(r*)4r:r��loggingr�r�r��binasciir�codecsr�osr�typingrrr r �enumsr r �errorsr�syntaxrrrrrrP�&cryptography.hazmat.primitives.ciphersrr�1cryptography.hazmat.primitives.ciphers.algorithmsrr�&cryptography.hazmat.primitives.paddingrr�� ImportError�error� getLoggerr7r�rr@rWrYr;r=r�r<ror>r*r(�<module>r=s������������� � � � ���������������������������2�2�2�2�2�2�2�2�2�2�2�2�5�5�5�5�5�5�5�5�!�!�!�!�!�!�>�>�>�>�>�>�>�>�>�>�>�>�8�8�8�8�8�8��D�D�D�D�D�D�D�D�P�P�P�P�P�P�P�P�<�<�<�<�<�<��L�L�������L�L�L�L�L�L��������� �� �8� $� $��&�&�&�&�&�&�&�&�R "� "� "� "� "� "� "� "�'�'�'�'�'�9�'�'�'�@i�i�i�i�i�i�i�i�X �e�E�9�$�%��%����� )�S�)�S�)�)�)�)�)�)s�A/�/B�4A;�;B
Memory