a ¹a“ ã@sPddlZddlmZddlmZddlmZdd„Zdd„Zd d „Z d d „Z dS) éN)Úutils)Úhashes)Ú PrehashedcCs|j ||jj¡}| ||jjk¡|j ||jj¡}|j |¡}| |dk¡|j ||j ¡}| |dk¡|j  d¡}|j  ||jj|¡}| |dk¡| |ddk¡|j  d|d¡}|j  |||¡}|dkrê|  ¡}t d|ƒ‚|j ||d¡dd…S)Nézsize_t *rzunsigned char[]zError computing shared key.)Z_libZEVP_PKEY_CTX_newZ_ffiZNULLZopenssl_assertÚgcZEVP_PKEY_CTX_freeZEVP_PKEY_derive_initZEVP_PKEY_derive_set_peerZ _evp_pkeyÚnewZEVP_PKEY_deriveZ_consume_errors_with_textÚ ValueErrorÚbuffer)ÚbackendZevp_pkeyZpeer_public_keyÚctxÚresZkeylenÚbufZerrors_with_text©rúP/usr/lib64/python3.9/site-packages/cryptography/hazmat/backends/openssl/utils.pyÚ_evp_pkey_derive s"   rcCsNt|tƒs*t ||¡}| |¡| ¡}n|j}t|ƒ|jkrFt dƒ‚||fS)NzNThe provided data must be the same length as the hash algorithm's digest size.) Ú isinstancerrZHashÚupdateÚfinalizeZ _algorithmÚlenZ digest_sizer)r ÚdataÚ algorithmZhash_ctxrrrÚ_calculate_digest_and_algorithm"s    ÿrcCst|tƒrtdƒ‚dS)NzƒPrehashed is only supported in the sign and verify methods. It cannot be used with signer, verifier or recover_data_from_signature.)rrÚ TypeError)Zsignature_algorithmrrrÚ_check_not_prehashed3s ÿrcCstjdtjdddS)Nz¯signer and verifier have been deprecated since 2.1. Please use sign and verify instead. Support for these functions will be dropped in the next release of cryptography (37.0).é)Ú stacklevel)ÚwarningsÚwarnrZPersistentlyDeprecated2017rrrrÚ_warn_sign_verify_deprecated<s ûr) rZ cryptographyrZcryptography.hazmat.primitivesrZ/cryptography.hazmat.primitives.asymmetric.utilsrrrrrrrrrÚs