U aðfþã@sìddlmZmZmZmZddlZddlmZddlm Z ddl m Z ddl m Z mZmZdd lmZeƒd kr€dd lmZmZndd lmZmZd d dgZe ¡ZededfZddd„Zdd„Zdd„ZGdd „d ƒZedkrède_dS)é)Úunicode_literalsÚdivisionÚabsolute_importÚprint_functionNé)Úffié)Ú _try_decode)ÚSignatureError)ÚnewÚunwrapÚnull)Ústr_clsZcffi)Úadvapi32Ú get_errorrÚ Advapi32ConstÚ handle_errorTcCsª|tjkrtj}n|tjkr$tj}n td|ƒ‚|s>|tjkrLtƒ}tj}n tj}tj }t t dƒ}t   |||||¡}|sšt ƒdtjkršt   ||||d¡}t|ƒt|ƒS)NzInvalid provider specified: %sz HCRYPTPROV *r)rÚMS_ENH_RSA_AES_PROVÚ PROV_RSA_AESÚMS_ENH_DSS_DH_PROVÚ PROV_DSS_DHÚ ValueErrorr ÚCRYPT_VERIFYCONTEXTÚCONTAINER_NAMEÚCRYPT_NEWKEYSETr rZCryptAcquireContextWrÚ NTE_EXISTSrr )ÚproviderZ verify_onlyZ provider_typeZcontainer_nameÚflagsZcontext_handle_pointerÚres©rúH/opt/nydus/tmp/pip-target-53d1vnqk/lib/python/oscrypto/_win/_advapi32.pyÚopen_context_handles8    ûûr!cCst |d¡}t|ƒdS)Nr)rZCryptReleaseContextr)Úhandlerrrr Úclose_context_handleDs r#cCsB|rdStƒ\}}|tjkr$tdƒ‚t|tƒs6t|ƒ}t|ƒ‚dS)zÎ Extracts the last Windows error message into a python unicode string :param result: A function result, 0 or None indicates failure :return: A unicode string error message NzSignature is invalid)rrÚNTE_BAD_SIGNATUREr Ú isinstancerr ÚOSError)ÚresultÚcodeZ error_stringrrr rIs    c@sÄeZdZdZdZdZdZdZdZdZ dZ d Z d Z dZ d Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Zd Z dZ!dZ"dZ#dZ$d Z%dZ&d Z'd!Z(d"Z)d#Z*d$Z+dZ,d%Z-d&Z.d'Z/d(Z0d)S)*rzoscrypto temporary DSS keysetéé éé,é(éz@Microsoft Enhanced DSS and Diffie-Hellman Cryptographic Providerz5Microsoft Enhanced RSA and AES Cryptographic Providerrl`i€i€i €i €i€ifihifi fififififi"i$i¤réééééé@i €i €iRSA1iRSA2iDSS1iDSS2N)1Ú__name__Ú __module__Ú __qualname__rrrZX509_PUBLIC_KEY_INFOZPKCS_PRIVATE_KEY_INFOZX509_DSS_SIGNATUREZ CRYPT_NO_SALTrrZCRYPT_EXPORTABLErrZCALG_MD5Z CALG_SHA1Z CALG_SHA_256Z CALG_SHA_384Z CALG_SHA_512ZCALG_RC2ZCALG_RC4ZCALG_DESZ CALG_3DES_112Z CALG_3DESZ CALG_AES_128Z CALG_AES_192Z CALG_AES_256Z CALG_DSS_SIGNZ CALG_RSA_SIGNZ CALG_RSA_KEYXZCRYPT_MODE_CBCZ PKCS5_PADDINGZCUR_BLOB_VERSIONZ PUBLICKEYBLOBZPRIVATEKEYBLOBZPLAINTEXTKEYBLOBZKP_IVZ KP_PADDINGZKP_MODEZKP_EFFECTIVE_KEYLENZ CRYPT_OAEPr$rZ AT_SIGNATUREZRSA1ZRSA2ZDSS1ZDSS2rrrr rbs\)érzAMicrosoft Enhanced RSA and AES Cryptographic Provider (Prototype))T)Ú __future__rrrrÚsysÚrÚ_decoder Úerrorsr Z_ffir r r Ú_typesrZ_advapi32_cffirrZ_advapi32_ctypesÚ__all__ÚgetwindowsversionZ_gwvZ_win_version_infor!r#rrrrrrr Ús*     ý 'A