U aðf—ã@s–ddlmZmZmZmZddlmZddlmZm Z m Z eƒdkrPddl m Z n ddl m Z dd d d d gZdd d „Zdd „Zdd „ZGdd „d ƒZdS)é)Úunicode_literalsÚdivisionÚabsolute_importÚprint_functioné)Úffi)ÚnewÚnullÚunwrapZcffié)Úbcryptr Ú BcryptConstÚclose_alg_handleÚ handle_errorÚopen_alg_handlecCs,ttdƒ}t ||tƒ|¡}t|ƒt|ƒS)NzBCRYPT_ALG_HANDLE *)rr ZBCryptOpenAlgorithmProviderr rr )ZconstantÚflagsZhandle_pointerÚres©rúC/opt/nydus/tmp/pip-target-53d1vnqk/lib/python/oscrypto/_win/_cng.pyrs cCst |d¡}t|ƒdS)Nr)r ZBCryptCloseAlgorithmProviderr)Úhandlerrrrrs cCst|dkr dStjdtjdtjdtjdtjdtjdtjd tjd i}d |}|dk rh||krh|d ||7}t |ƒ‚dS) zÉ Extracts the last Windows error message into a python unicode string :param error_num: The number to get the error string for :return: A unicode string error message rNzThe object was not foundz8An invalid parameter was passed to a service or functionz_Not enough virtual memory or paging file quota is available to complete the specified operationzAn invalid HANDLE was specifiedz&The cryptographic signature is invalidzThe request is not supportedz,The buffer is too small to contain the entryz=The size of the buffer is invalid for the specified operationzNTSTATUS error 0x%0.2Xz: ) r ÚSTATUS_NOT_FOUNDÚSTATUS_INVALID_PARAMETERÚSTATUS_NO_MEMORYÚSTATUS_INVALID_HANDLEÚSTATUS_INVALID_SIGNATUREÚSTATUS_NOT_SUPPORTEDÚSTATUS_BUFFER_TOO_SMALLÚSTATUS_INVALID_BUFFER_SIZEÚOSError)Z error_numÚmessagesÚoutputrrrr#s. ö c@seZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#dZ$d Z%d!Z&d"Z'd#Z(d$Z)dZ*d%Z+dZ,d&Z-dZ.d'Z/d(Z0d)Z1d*Z2d+Z3d,Z4d-Z5d.Z6d/Z7d0Z8d1Z9d2Z:d3Z;d4ZdZ?dZ@d7S)8r ZRNGZ KeyLengthZEffectiveKeyLengthZRSAPRIVATEBLOBZRSAFULLPRIVATEBLOBZ RSAPUBLICBLOBZDSAPRIVATEBLOBZ DSAPUBLICBLOBZECCPRIVATEBLOBZ ECCPUBLICBLOBiRSA1iRSA2iRSA3iDSPBiDSPViDPB2iDPV2rr réiECS1iECS2iECS3iECS4iECS5iECS6l%l lll l»l#liKDBMZ KeyDataBlobéZ3DESZ3DES_112ÚAESZDESZRC2ZRC4ZDSAZ ECDSA_P256Z ECDSA_P384Z ECDSA_P521ZRSAÚMD5ÚSHA1ÚSHA256ÚSHA384ÚSHA512N)AÚ__name__Ú __module__Ú __qualname__ZBCRYPT_RNG_ALGORITHMZBCRYPT_KEY_LENGTHZBCRYPT_EFFECTIVE_KEY_LENGTHZBCRYPT_RSAPRIVATE_BLOBZBCRYPT_RSAFULLPRIVATE_BLOBZBCRYPT_RSAPUBLIC_BLOBZBCRYPT_DSA_PRIVATE_BLOBZBCRYPT_DSA_PUBLIC_BLOBZBCRYPT_ECCPRIVATE_BLOBZBCRYPT_ECCPUBLIC_BLOBZBCRYPT_RSAPUBLIC_MAGICZBCRYPT_RSAPRIVATE_MAGICZBCRYPT_RSAFULLPRIVATE_MAGICZBCRYPT_DSA_PUBLIC_MAGICZBCRYPT_DSA_PRIVATE_MAGICZBCRYPT_DSA_PUBLIC_MAGIC_V2ZBCRYPT_DSA_PRIVATE_MAGIC_V2ZDSA_HASH_ALGORITHM_SHA1ZDSA_HASH_ALGORITHM_SHA256ZDSA_HASH_ALGORITHM_SHA512Z DSA_FIPS186_2Z DSA_FIPS186_3ZBCRYPT_NO_KEY_VALIDATIONZBCRYPT_ECDSA_PUBLIC_P256_MAGICZBCRYPT_ECDSA_PRIVATE_P256_MAGICZBCRYPT_ECDSA_PUBLIC_P384_MAGICZBCRYPT_ECDSA_PRIVATE_P384_MAGICZBCRYPT_ECDSA_PUBLIC_P521_MAGICZBCRYPT_ECDSA_PRIVATE_P521_MAGICZSTATUS_SUCCESSrrrrrrrrZBCRYPT_KEY_DATA_BLOB_MAGICZBCRYPT_KEY_DATA_BLOB_VERSION1ZBCRYPT_KEY_DATA_BLOBZBCRYPT_PAD_PKCS1ZBCRYPT_PAD_OAEPZBCRYPT_PAD_PSSZBCRYPT_3DES_ALGORITHMZBCRYPT_3DES_112_ALGORITHMZBCRYPT_AES_ALGORITHMZBCRYPT_DES_ALGORITHMZBCRYPT_RC2_ALGORITHMZBCRYPT_RC4_ALGORITHMZBCRYPT_DSA_ALGORITHMZBCRYPT_ECDSA_P256_ALGORITHMZBCRYPT_ECDSA_P384_ALGORITHMZBCRYPT_ECDSA_P521_ALGORITHMZBCRYPT_RSA_ALGORITHMZBCRYPT_MD5_ALGORITHMZBCRYPT_SHA1_ALGORITHMZBCRYPT_SHA256_ALGORITHMZBCRYPT_SHA384_ALGORITHMZBCRYPT_SHA512_ALGORITHMZBCRYPT_ALG_HANDLE_HMAC_FLAGZBCRYPT_BLOCK_PADDINGrrrrr Fs|N)r)Ú __future__rrrrÚrZ_ffirr r Z _cng_cffir Z _cng_ctypesÚ__all__rrrr rrrrÚs   û #