a ‚oe ã@s¸dZddlZddlZddlmZddlmZddlZddl m Z ddl m Z ej dkrdddlmZnddlZdd „Zd d „Zd d „Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„ZdS)zJTest utilities. .. warning:: This module is not part of the public API. éN)Údefault_backend)Ú serialization)ÚComparableECKey)Úcrypto)éé cGs t t¡jdg|¢RŽ}| ¡S)zLoad contents of a test vector.Ztestdata)Úimportlib_resourcesÚfilesÚ __package__ÚjoinpathÚ read_bytes)ÚnamesZ vector_ref©rú?C:\Program Files\Certbot\pkgs\acme\_internal\tests\test_util.pyÚ load_vectorsrcCs<tj |¡\}}| ¡dkr |S| ¡dkr0|Stdƒ‚dS)Nz.pemz.derz1Loader could not be recognized based on extension)ÚosÚpathÚsplitextÚlowerÚ ValueError)ÚfilenameZ loader_pemZ loader_derÚ_ÚextrrrÚ _guess_loaders   rcGs$t|dtjtjƒ}t |t|Ž¡S)zLoad certificate.éÿÿÿÿ)rrÚ FILETYPE_PEMÚ FILETYPE_ASN1Zload_certificater©r ÚloaderrrrÚ load_cert%sÿrcGst t|Ž¡S)zLoad ComparableX509 cert.)ÚjoseÚComparableX509r©r rrrÚload_comparable_cert,sr#cGs$t|dtjtjƒ}t |t|Ž¡S)zLoad certificate request.r)rrrrZload_certificate_requestrrrrrÚload_csr1sÿr$cGst t|Ž¡S)z(Load ComparableX509 certificate request.)r r!r$r"rrrÚload_comparable_csr8sr%cGs.t|dtjtjƒ}t |t|Ždtƒd¡S)zLoad RSA private key.rN©ÚpasswordZbackend)rrÚload_pem_private_keyÚload_der_private_keyr ZComparableRSAKeyrrrrrrÚload_rsa_private_key=s  ÿ ÿr*cGs,t|dtjtjƒ}t|t|ŽdtƒdƒS)zLoad ECDSA private key.rNr&)rrr(r)rrrrrrrÚload_ecdsa_private_keyEs  ÿ ÿr+cGs$t|dtjtjƒ}t |t|Ž¡S)zLoad pyOpenSSL private key.r)rrrrZload_privatekeyrrrrrÚload_pyopenssl_private_keyMsÿr,)Ú__doc__rÚsysZcryptography.hazmat.backendsrZcryptography.hazmat.primitivesrZjosepyr Z josepy.utilrZOpenSSLrÚ version_infoZimportlib.resourcesZ resourcesrrrrr#r$r%r*r+r,rrrrÚs&