ó Ü_e[c@`sÍdZddlmZmZmZmZddlmZddlm Z ddl m Z m Z ddl mZmZmZmZmZmZmZmZdefd „ƒYZd efd „ƒYZd efd „ƒYZdefd„ƒYZdefd„ƒYZdeefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZ defd„ƒYZ!defd„ƒYZ"d eefd!„ƒYZ#d"efd#„ƒYZ$d$efd%„ƒYZ%d&efd'„ƒYZ&d(efd)„ƒYZ'd*efd+„ƒYZ(d,efd-„ƒYZ)d.efd/„ƒYZ*d0efd1„ƒYZ+d2efd3„ƒYZ,d4efd5„ƒYZ-d6efd7„ƒYZ.d8efd9„ƒYZ/d:efd;„ƒYZ0d<efd=„ƒYZ1d>efd?„ƒYZ2d@efdA„ƒYZ3dBeefdC„ƒYZ4dDefdE„ƒYZ5dFefdG„ƒYZ6dHefdI„ƒYZ7dJefdK„ƒYZ8e5e4j9dL Signature algorithm not known for %s N(Rt ValueErrorR(Rt algorithmtalgo_map((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pytsignature_algos4   cC`sÈ|dj}idd6dd6dd6dd 6d d 6d d 6dd6dd6dd6d d6dd6dd6d d6d d6dd6}||kr||S|dkr¯|dddjSttd|ƒƒ‚dS(uŸ :return: A unicode string of "md2", "md5", "sha1", "sha224", "sha256", "sha384", "sha512", "sha512_224", "sha512_256" u algorithmumd2umd2_rsaumd5umd5_rsausha1usha1_rsausha224u sha224_rsausha256u sha256_rsausha384u sha384_rsausha512u sha512_rsausha1_dsau sha224_dsau sha256_dsau sha1_ecdsau sha224_ecdsau sha256_ecdsau sha384_ecdsau sha512_ecdsau rsassa_pssu parametersuhash_algorithmu9 Hash algorithm not known for %s N(RR5R(RR6R7((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pyt hash_algoDs0    (u algorithmu parameters( RRR2RRRRR1RtpropertyR8R9(((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pyR4s  )t Pbkdf2SaltcB`s eZdefdefgZRS(u specifiedu other_source(RRR Rt _alternatives(((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pyR;ms t Pbkdf2Paramsc B`sMeZdefdefdeied6fdeiidd6d6fgZRS(usaltuiteration_countu key_lengthuoptionaluprfusha1u algorithmudefault(RRR;R RR*R(((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pyR=ts  tKdfAlgorithmIdcB`seZidd6ZRS(upbkdf2u1.2.840.113549.1.5.12(RRR)(((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pyR>}st KdfAlgorithmcB`s=eZdefdeied6fgZdZied6ZRS(u algorithmu parametersuoptionalupbkdf2(u algorithmu parameters( RRR>RRRRR=R(((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pyR?ƒs  t DHParameterscB`s9eZdZdefdefdeied6fgZRS(un Original Name: DHParameter Source: ftp://ftp.rsasecurity.com/pub/pkcs/ascii/pkcs-3.asc section 9 upuguprivate_value_lengthuoptional(RRR%R RR(((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pyR@Žs  tKeyExchangeAlgorithmIdcB`seZidd6ZRS(udhu1.2.840.113549.1.3.1(RRR)(((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pyRA›stKeyExchangeAlgorithmcB`s=eZdefdeied6fgZdZied6ZRS(u algorithmu parametersuoptionaludh(u algorithmu parameters( RRRARRRRR@R(((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pyRB¡s  t Rc2ParamscB`s*eZdeied6fdefgZRS(urc2_parameter_versionuoptionaluiv(RRR RR R(((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pyRC¬stRc5ParamVersioncB`seZidd6ZRS(uv1-0i(RRR)(((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pyRD³st Rc5ParamscB`s<eZdefdefdefdeied6fgZRS(uversionuroundsublock_size_in_bitsuivuoptional(RRRDR R RR(((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pyRE¹s   t Pbes1ParamscB`s eZdefdefgZRS(usaltu iterations(RRR R R(((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pyRFÂs tPSourceAlgorithmIdcB`seZidd6ZRS(u p_specifiedu1.2.840.113549.1.1.9(RRR)(((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pyRGÉstPSourceAlgorithmcB`s=eZdefdeied6fgZdZied6ZRS(u algorithmu parametersuoptionalu p_specified(u algorithmu parameters( RRRGRRRRR R(((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pyRHÏs  tRSAESOAEPParamscB`s†eZdeidd6idd6d6fdeidd6idd6idd6d 6d6fd eid d6id d6d d 6d6fgZRS(uhash_algorithmiuexplicitusha1u algorithmudefaultumask_gen_algorithmiumgf1u parametersup_source_algorithmiu p_specifiedt(RRR,R/RHR(((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pyRIÛs&t DSASignaturecB`s>eZdZdefdefgZed„ƒZd„ZRS(u  An ASN.1 class for translating between the OS crypto library's representation of an (EC)DSA signature and the ASN.1 structure that is part of various RFCs. Original Name: DSS-Sig-Value Source: https://tools.ietf.org/html/rfc3279#section-2.2.2 uruscC`sOt|dt|ƒd!ƒ}t|t|ƒdƒ}|i|d6|d6ƒS(u Reads a signature from a byte string encoding accordint to IEEE P1363, which is used by Microsoft's BCryptSignHash() function. :param data: A byte string from BCryptSignHash() :return: A DSASignature object iiurus(Rtlen(tclstdatatrts((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pyt from_p1363 s cC`sgt|djƒ}t|djƒ}tt|ƒt|ƒƒ}t||ƒ}t||ƒ}||S(uÎ Dumps a signature to a byte string compatible with Microsoft's BCryptVerifySignature() function. :return: A byte string compatible with BCryptVerifySignature() urus(RRtmaxRLR(Rtr_bytests_bytestint_byte_length((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pytto_p1363s (RRR%R Rt classmethodRQRV(((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pyRKþs  tEncryptionAlgorithmIdcB`s;eZi+dd6dd6dd6dd6dd 6d d 6d d 6dd6dd6dd6dd6dd6dd6dd6dd6dd6d d!6d"d#6d$d%6d&d'6d(d)6d*d+6d,d-6d.d/6d0d16d2d36d4d56d6d76d8d96d:d;6d<d=6d>d?6d@dA6dBdC6dDdE6dFdG6dHdI6dJdK6dLdM6dNdO6dPdQ6dRdS6dTdU6ZRS(Vudesu 1.3.14.3.2.7utripledes_3keyu1.2.840.113549.3.7urc2u1.2.840.113549.3.2urc5u1.2.840.113549.3.9u aes128_ecbu2.16.840.1.101.3.4.1.1u aes128_cbcu2.16.840.1.101.3.4.1.2u aes128_ofbu2.16.840.1.101.3.4.1.3u aes128_cfbu2.16.840.1.101.3.4.1.4u aes128_wrapu2.16.840.1.101.3.4.1.5u aes128_gcmu2.16.840.1.101.3.4.1.6u aes128_ccmu2.16.840.1.101.3.4.1.7uaes128_wrap_padu2.16.840.1.101.3.4.1.8u aes192_ecbu2.16.840.1.101.3.4.1.21u aes192_cbcu2.16.840.1.101.3.4.1.22u aes192_ofbu2.16.840.1.101.3.4.1.23u aes192_cfbu2.16.840.1.101.3.4.1.24u aes192_wrapu2.16.840.1.101.3.4.1.25u aes192_gcmu2.16.840.1.101.3.4.1.26u aes192_ccmu2.16.840.1.101.3.4.1.27uaes192_wrap_padu2.16.840.1.101.3.4.1.28u aes256_ecbu2.16.840.1.101.3.4.1.41u aes256_cbcu2.16.840.1.101.3.4.1.42u aes256_ofbu2.16.840.1.101.3.4.1.43u aes256_cfbu2.16.840.1.101.3.4.1.44u aes256_wrapu2.16.840.1.101.3.4.1.45u aes256_gcmu2.16.840.1.101.3.4.1.46u aes256_ccmu2.16.840.1.101.3.4.1.47uaes256_wrap_padu2.16.840.1.101.3.4.1.48upbes2u1.2.840.113549.1.5.13u pbes1_md2_desu1.2.840.113549.1.5.1u pbes1_md5_desu1.2.840.113549.1.5.3u pbes1_md2_rc2u1.2.840.113549.1.5.4u pbes1_md5_rc2u1.2.840.113549.1.5.6upbes1_sha1_desu1.2.840.113549.1.5.10upbes1_sha1_rc2u1.2.840.113549.1.5.11upkcs12_sha1_rc4_128u1.2.840.113549.1.12.1.1upkcs12_sha1_rc4_40u1.2.840.113549.1.12.1.2upkcs12_sha1_tripledes_3keyu1.2.840.113549.1.12.1.3upkcs12_sha1_tripledes_2keyu1.2.840.113549.1.12.1.4upkcs12_sha1_rc2_128u1.2.840.113549.1.12.1.5upkcs12_sha1_rc2_40u1.2.840.113549.1.12.1.6ursaes_pkcs1v15u1.2.840.113549.1.1.1u rsaes_oaepu1.2.840.113549.1.1.7(RRR)(((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pyRX1sXtEncryptionAlgorithmcB`s^eZdefdeied6fgZd#Zied6ed6ed6e d6ed6ed6ed 6ed 6ed 6ed 6e d 6e d6e d6e d6e d6e d6e d6e d6e d6e d6e d6e d6e d6Z e d„ƒZe d„ƒZe d„ƒZe d„ƒZe d„ƒZe d„ƒZe d „ƒZe d!„ƒZe d"„ƒZRS($u algorithmu parametersuoptionaludesutripledes_3keyurc2urc5u aes128_cbcu aes192_cbcu aes256_cbcu aes128_ofbu aes192_ofbu aes256_ofbu pbes1_md2_desu pbes1_md5_desu pbes1_md2_rc2u pbes1_md5_rc2upbes1_sha1_desupbes1_sha1_rc2upkcs12_sha1_rc4_128upkcs12_sha1_rc4_40upkcs12_sha1_tripledes_3keyupkcs12_sha1_tripledes_2keyupkcs12_sha1_rc2_128upkcs12_sha1_rc2_40u rsaes_oaepcC`sÂ|dj}|dkr,|dddjS|jdƒdkr©|jdƒdkr‘|jddƒ\}}|d kr~d S|d kr‘d Snttd |ƒƒ‚nttd|ƒƒ‚dS(u¼ Returns the name of the key derivation function to use. :return: A unicode from of one of the following: "pbkdf1", "pbkdf2", "pkcs12_kdf" u algorithmupbes2u parametersukey_derivation_funcu.iÿÿÿÿu_iupbes1upbkdf1upkcs12u pkcs12_kdfu~ Encryption algorithm "%s" does not have a registered key derivation function uw Unrecognized encryption algorithm "%s", can not determine key derivation function N(RtfindtsplitR5R(Rtencryption_algot_((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pytkdf‰s    cC`s®|dj}|dkr4|dddddjS|jdƒdkr•|jdƒdkr}|jdd ƒ\}}}|Sttd |ƒƒ‚nttd |ƒƒ‚d S( uÒ Returns the HMAC algorithm to use with the KDF. :return: A unicode string of one of the following: "md2", "md5", "sha1", "sha224", "sha256", "sha384", "sha512" u algorithmupbes2u parametersukey_derivation_funcuprfu.iÿÿÿÿu_iu~ Encryption algorithm "%s" does not have a registered key derivation function u} Unrecognized encryption algorithm "%s", can not determine key derivation hmac algorithm N(RRZR[R5R(RR\R]t hmac_algo((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pytkdf_hmac²s  cC`sÄ|dj}|dkrZ|dddd}|jdkrSttdƒƒ‚n|jS|jdƒd kr«|jd ƒd kr“|ddjSttd |ƒƒ‚nttd |ƒƒ‚d S(uu Returns the byte string to use as the salt for the KDF. :return: A byte string u algorithmupbes2u parametersukey_derivation_funcusaltu other_sourceuÛ Can not determine key derivation salt - the reserved-for-future-use other source salt choice was specified in the PBKDF2 params structure u.iÿÿÿÿu_u~ Encryption algorithm "%s" does not have a registered key derivation function us Unrecognized encryption algorithm "%s", can not determine key derivation salt N(RtnameR5RRZ(RR\tsalt((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pytkdf_saltÖs  cC`sš|dj}|dkr0|ddddjS|jdƒdkr|jdƒdkri|dd jSttd |ƒƒ‚nttd |ƒƒ‚d S( u{ Returns the number of iterations that should be run via the KDF. :return: An integer u algorithmupbes2u parametersukey_derivation_funcuiteration_countu.iÿÿÿÿu_u iterationsu~ Encryption algorithm "%s" does not have a registered key derivation function uy Unrecognized encryption algorithm "%s", can not determine key derivation iterations N(RRZR5R(RR\((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pytkdf_iterationss  cC`sÏ|dj}|dd!dkrDidd6dd6d d 6|dd !Sid d 6dd6}||krl||S|dkr|djddj}|dj}idd6d d6dd6}||krÌ||S|dkrÜ|S|d,krìdSttdƒƒ‚n|dkrE|ddddj}|d,k r6|S|ddjS|jdƒdkr¶i d d6d d 6d d!6d d"6d d#6d d$6dd%6dd&6dd'6dd(6dd)6dd*6|Sttd+|ƒƒ‚d,S(-uî Returns the key length to pass to the cipher/kdf. The PKCS#5 spec does not specify a way to store the RC5 key length, however this tends not to be a problem since OpenSSL does not support RC5 in PKCS#8 and OS X does not provide an RC5 cipher for use in the Security Transforms library. :raises: ValueError - when the key length can not be determined :return: An integer representing the length in bytes u algorithmiiuaesiuaes128_iuaes192_i uaes256_iiudesutripledes_3keyurc2u parametersuencryption_schemeurc2_parameter_versionii ixi:iiuw Invalid RC2 parameter version found in EncryptionAlgorithm parameters upbes2ukey_derivation_funcu key_lengthu.iÿÿÿÿu pbes1_md2_desu pbes1_md5_desu pbes1_md2_rc2u pbes1_md5_rc2upbes1_sha1_desupbes1_sha1_rc2upkcs12_sha1_rc4_128upkcs12_sha1_rc4_40upkcs12_sha1_tripledes_3keyupkcs12_sha1_tripledes_2keyupkcs12_sha1_rc2_128upkcs12_sha1_rc2_40u@ Unrecognized encryption algorithm "%s" N(RtparsedRR5Rt key_lengthRZ(RR\tcipher_lengthst rc2_paramstrc2_parameter_versiontencoded_key_bits_mapRf((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pyRf%sd            cC`s»|dj}|dd!tdddgƒkr7|dS|dd!dkrNd S|dd!d kred S|td d d dgƒkr‡d S|dkr¢|ddjSttd|ƒƒ‚dS(uÔ Returns the name of the encryption mode to use. :return: A unicode string from one of the following: "cbc", "ecb", "ofb", "cfb", "wrap", "gcm", "ccm", "wrap_pad" u algorithmiiuaes128_uaes192_uaes256_iupbes1_ucbcupkcs12_udesutripledes_3keyurc2urc5upbes2u parametersuencryption_schemeu@ Unrecognized encryption algorithm "%s" N(RR&tencryption_modeR5R(RR\((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pyRk…s " cC`s|dj}|dd!tdddgƒkr3dS|tdd d gƒkrR|S|d krbd S|d kr}|ddjS|jdƒdkrîi dd6dd6d d6d d6dd6d d6dd6dd6d d6d d6d d6d d6|Sttd|ƒƒ‚d S(!ul Returns the name of the symmetric encryption cipher to use. The key length can be retrieved via the .key_length property to disabiguate between different variations of TripleDES, AES, and the RC* ciphers. :return: A unicode string from one of the following: "rc2", "rc5", "des", "tripledes", "aes" u algorithmiiuaes128_uaes192_uaes256_uaesudesurc2urc5utripledes_3keyu tripledesupbes2u parametersuencryption_schemeu.iÿÿÿÿu pbes1_md2_desu pbes1_md5_desu pbes1_md2_rc2u pbes1_md5_rc2upbes1_sha1_desupbes1_sha1_rc2urc4upkcs12_sha1_rc4_128upkcs12_sha1_rc4_40upkcs12_sha1_tripledes_3keyupkcs12_sha1_tripledes_2keyupkcs12_sha1_rc2_128upkcs12_sha1_rc2_40u@ Unrecognized encryption algorithm "%s" N(RR&tencryption_cipherRZR5R(RR\((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pyRl§s6 "  cC`s)|dj}|dd!tdddgƒkr3dSidd 6dd 6dd 6}||krb||S|d kr„|d jdjdS|dkrŸ|d djS|jdƒdkri dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6|Sttd|ƒƒ‚d S(!u• Returns the block size of the encryption cipher, in bytes. :return: An integer that is the block size in bytes u algorithmiiuaes128_uaes192_uaes256_iiudesutripledes_3keyurc2urc5u parametersublock_size_in_bitsupbes2uencryption_schemeu.iÿÿÿÿu pbes1_md2_desu pbes1_md5_desu pbes1_md2_rc2u pbes1_md5_rc2upbes1_sha1_desupbes1_sha1_rc2upkcs12_sha1_rc4_128upkcs12_sha1_rc4_40upkcs12_sha1_tripledes_3keyupkcs12_sha1_tripledes_2keyupkcs12_sha1_rc2_128upkcs12_sha1_rc2_40u@ Unrecognized encryption algorithm "%s" N(RR&Retencryption_block_sizeRZR5R(RR\t cipher_map((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pyRmØs> "    c C`s¿|dj}|tddgƒkr7|djdjStdddd d d d d gƒ}||krr|djS|dkr|ddjS|jdƒdkr¦dSttd|ƒƒ‚dS(u Returns the byte string of the initialization vector for the encryption scheme. Only the PBES2 stores the IV in the params. For PBES1, the IV is derived from the KDF and this property will return None. :return: A byte string or None u algorithmurc2urc5u parametersuivudesutripledes_3keyu aes128_cbcu aes192_cbcu aes256_cbcu aes128_ofbu aes192_ofbu aes256_ofbupbes2uencryption_schemeu.iÿÿÿÿu@ Unrecognized encryption algorithm "%s" N(RR&Ret encryption_ivRZRR5R(RR\toctet_string_iv_oids((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pyRo s*     (u algorithmu parameters(RRRXRRRRR RCRERFRIRR:R^R`RcRdRfRkRlRmRo(((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pyRYesH  )$-"`"13t Pbes2ParamscB`s eZdefdefgZRS(ukey_derivation_funcuencryption_scheme(RRR?RYR(((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pyRq<s t Pbmac1ParamscB`s eZdefdefgZRS(ukey_derivation_funcumessage_auth_scheme(RRR?R*R(((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pyRrCs t Pkcs5MacIdcB`seZidd6ZRS(upbmac1u1.2.840.113549.1.5.14(RRR)(((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pyRsJstPkcs5MacAlgorithmcB`s3eZdefdefgZdZied6ZRS(u algorithmu parametersupbmac1(u algorithmu parameters(RRRsRRRRrR(((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pyRtPs  upbes2tAnyAlgorithmIdcB`seZiZd„ZRS(cC`sT|jj}xAtttfD]0}x'|jjƒD]\}}|||ttfD]0}x'|jjƒD]\}}|||R?R@RARBRCRDRERFRGRHRIRKRXRYRqRrRsRtRRuRz(((s6/tmp/pip-install-KP2Jbq/asn1crypto/asn1crypto/algos.pytsV":9  (4]      #34ÿØ