PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB` gi]O6ddlmZmZmZmZddlZddlZddlZddlZddl Z ddl Z ddl m Z ddl mZmZddlmZmZmZmZmZddlmZddlmZdd lmZmZmZej<d kreZ e!Z"nd Z e Z#gd Z$d Z%dZ&dZ'dZ(dZ)dZ*dZ+dZ,dZ-dZ.dZ/y))unicode_literalsdivisionabsolute_importprint_functionN)backend)constant_compare rand_bytes) Certificateint_from_bytes int_to_bytesPrivateKeyInfo PublicKeyInfo)pretty_message) fill_width) type_namebyte_cls int_types)ct|gS)N)bytes)nums @/opt/nydus/tmp/pip-target-bkdi07qp/lib/python/oscrypto/_pkcs1.pychr_clsrscU|)add_pss_paddingadd_pkcs1v15_signature_paddingraw_rsa_private_cryptraw_rsa_public_crypt"remove_pkcs1v15_encryption_padding!remove_pkcs1v15_signature_paddingverify_pss_paddingctjdk7rytjd}tt t |j ddddk(S)zM :return: A bool if the current machine is running OS X 10.7 darwinFr.) )sysplatformmac_vertuplemapintsplit)versions r _is_osx_107r1/sM  ||x #G S'--,- .q 3w >>rctdk7r'tjdk7rtt dt |t stt dt|t |tstt dt||dkrtt dt|t |tstt dt||d krtt d t||tgd vrtt d t|tt|}|d z }tt!j"|dz }||j%}t'|}|||zdzkrtt d|dkDrt)j*|} nd} d|z| z} || j%} d||z |z dz z} | dz| z} t-|| ||z d z }t/t1| t1|z }t3|t'|}d|z|z }d|zdd|z zz}t|d}|dk7r t5|t7|dd z|d dz}|| zdzS)a5 Pads a byte string using the EMSA-PSS-Encode operation described in PKCS#1 v2.2. :param hash_algorithm: The string name of the hash algorithm to use: "sha1", "sha224", "sha256", "sha384", "sha512" :param salt_length: The length of the salt as an integer - typically the same as the length of the output from the hash_algorithm :param key_length: The length of the RSA key, in bits :param message: A byte string of the message to pad :return: The encoded (passed) message winlegacyr$z~ Pure-python RSA PSS signature padding addition code is only for Windows XP/2003 and OS X ? message must be a byte string, not %s @ salt_length must be an integer, not %s r? salt_length must be 0 or more - is %s ? key_length must be an integer, not %s iz@ key_length must be 512 or more - is %s sha1sha224sha256sha384sha512z hash_algorithm must be one of "sha1", "sha224", "sha256", "sha384", "sha512", not %s rr&zq Key is not long enough to use with specified hash_algorithm and salt_length r01N)_backendr)r* SystemErrorr isinstancer TypeErrorrr ValueErrorreprsetgetattrhashlibr.mathceildigestlenosurandom_mgf1r r rrord)hash_algorithm salt_length key_lengthmessage hash_funcem_bitsem_lenmessage_digest hash_lengthsaltm_primem_prime_digestpaddingdbdb_mask masked_db zero_bits left_bit_mask left_int_masks rrr;s.;3<<8#;.     gx (  g      k9 -  k "    Q        j) ,  j !    C       S!QRR      0I1nG 7Q;' (Fw'..0Nn%K k)A--    Qzz+&n,t3Gw'..0N+- ;a?@G 7 T !BNNF[4H14LMG^B/.2IIJI9c'l3IVw&I9_I )>?M q)MMC !A,??@9QR=P ~ % //rchtdk7r'tjdk7rtt dt |t stt dt|t |t stt dt|t |tstt dt||dkrtt dt||tgd vrtt d t|tt|}|d z }tt!j"|d z }||j%}t'|} || |zd zkry|dddk7ryd |z|z } || z d z } |d| } t)| dd } | d | z z }|dk7ry|| | | z}t+|||| z d z }d| zdd | z zz}t|d }|dk7r t-|t)|dd z|d dz}t/t1| t1|z }t'|t'| krdt'| t'|z z|z}|| z |z d z }d|z}t3|d||sy|||d zdk7ry|d|z d}d|z|z}||j%}t3||S)aZ Verifies the PSS padding on an encoded message :param hash_algorithm: The string name of the hash algorithm to use: "sha1", "sha224", "sha256", "sha384", "sha512" :param salt_length: The length of the salt as an integer - typically the same as the length of the output from the hash_algorithm :param key_length: The length of the RSA key, in bits :param message: A byte string of the message to pad :param signature: The signature to verify :return: A boolean indicating if the signature is invalid r3r$z Pure-python RSA PSS signature padding verification code is only for Windows XP/2003 and OS X r4zA signature must be a byte string, not %s r5rr6r8r>rr?r&FNrFrCrDrErArBr@)rGr)r*rHrrIrrJrrrKrLrMrNrOr.rPrQrRrSrWrVrr r r )rXrYrZr[ signaturer\r]r^r_r`rhmasked_db_lengthrg first_bytebits_that_should_be_zerorcrfrirjre zero_length zero_stringrarbh_primes rr"r"s*2;3<<8#;.     gx (  g      i *  i     k9 -  k "    Q       S!QRR      0I1nG 7Q;' (Fw'..0Nn%K k)A--~ Vw&I +a/!,-IYq^$J)a)m<1$/0@;0NONNNF[4H14LMG9_I )>?M q)M-#gal*;;r 0@s>Ir)rIrrJrrrrKrLrMr.rPrQstructStructpackrNrOrangerR) rXseed mask_lengthoutputr` iterationsr|r\counterbs rrVrV:sk$ dH %  dO     k9 -  k "    Q       S!QRR      F   KTYY{[89:J ==  $ $D0IJ'/ M)D1H%,,../ !K  rcVtdk7rttdt||dS)z Adds PKCS#1 v1.5 padding to a message to be signed :param key_length: An integer of the number of bytes in the key :param data: A byte string to pad :return: The padded data as a byte string r3zz Pure-python RSA PKCSv1.5 signature padding addition code is only for Windows XP/2003 signing)rGrHr_add_pkcs1v15_paddingrZdatas rrrs6;.     !T9 ==rcVtdk7rttdt||dS)a Removes PKCS#1 v1.5 padding from a signed message using constant time operations :param key_length: An integer of the number of bytes in the key :param data: A byte string to unpad :return: The unpadded data as a byte string r3zy Pure-python RSA PKCSv1.5 signature padding removal code is only for Windows XP/2003 verifying)rGrHr_remove_pkcs1v15_paddingrs rr!r!s6;.     $Jk BBrcXtsttdt||dS)a Removes PKCS#1 v1.5 padding from a decrypted message using constant time operations :param key_length: An integer of the number of bytes in the key :param data: A byte string to unpad :return: The unpadded data as a byte string zt Pure-python RSA PKCSv1.5 encryption padding removal code is only for OS X 10.7 decrypting)r1rHrrrs rr r s3 =.     $Jl CCrc N|dk(rd}nd}t|tsttdt |t|t sttdt ||dkrt tdt|t||dz kDr"t td |dz t||d z t|z }d }|d kDrDt|}d j|jd }||z }|t|z}|d kDrDd |z|zd z|zS)a1 Adds PKCS#1 v1.5 padding to a message :param key_length: An integer of the number of bytes in the key :param data: A byte string to unpad :param operation: A unicode string of "encrypting" or "signing" :return: The padded data as a byte string encryptingrB< data must be a byte string, not %s r7ry? key_length must be 64 or more - is %s zJ data must be between 1 and %s bytes long - is %s rrrrA) rIrrJrrrrKrLrSr joinr/)rZr operation second_byterequired_bytesrd temp_paddings rrrs["L   dH %  dO     j) ,  j !    B        4y:?"  O I     !^c$i/NG 1 !.1 xx 2 27 ;< <#l++ 1  [ 7 *W 4t ;;rc|dk(rd}nd}t|tsttdt |t|t sttdt ||dkrt tdt|t||k7rt d|zd }d }d }td t|D]y}|||dz}t|} |d k(r|| z}!|dk(r|t| |z|k7z};|d kr|t| d z d k(z}U| d z} |d k(r| r||z}g||z}m| r||z}u||z}{|d k7rt d|z||dzd S) aY Removes PKCS#1 v1.5 padding from a message using constant time operations :param key_length: An integer of the number of bytes in the key :param data: A byte string to unpad :param operation: A unicode string of "decrypting" or "verifying" :return: The unpadded data as a byte string rr&rrr7ryrzError %srr'N) rIrrJrrrrKrLrSr}rWr.) rZrrrerrortrash padding_endibytebyte_numnon_zeros rrrs"L   dH %  dO     j) ,  j !    B        4yJi/00 E EK1c$i Aa!e}t9 6 X E!V S([0[@A AEV S(Q,1,- -E !|HaQJE1$KQJEQJE9< zi/00  a !!rcttdk7r tdt|drt|jt st tdt||jddj}|dk7r(|dk7r#ttd |jt|tst td t||jd j}tt||d j|d j}t!||jj"S)aa Performs a raw RSA algorithm in a byte string using a private key. This is a low-level primitive and is prone to disastrous results if used incorrectly. :param private_key: An oscrypto.asymmetric.PrivateKey object :param data: A byte string of the plaintext to be signed or ciphertext to be decrypted. Must be less than or equal to the length of the private key. In the case of signing, padding must already be applied. In the case of decryption, padding must be removed afterward. :return: A byte string of the transformed data r31Pure-python RSA crypt is only for Windows XP/2003asn1zy private_key must be an instance of the oscrypto.asymmetric.PrivateKey class, not %s private_key_algorithm algorithmrsa rsassa_pssz@ private_key must be an RSA key, not %s r private_keyprivate_exponentmoduluswidth)rGrHhasattrrIrrrJrrnativerKupperrparsedpowr r byte_size)rralgorsa_private_keytransformed_ints rrrns4&;MNN ; 'z+:J:JN/[  k "       3 4[ A H HD u}-  JJL     dH %  dO    "&&}5<rsRR   .$22dG E 9  ?{0|~5BF!R>2C4D4@