Ë
    ÖÉ�j1õ  ã                  ó@  — U d dl mZ d dlZd dlZd dlZd dlZd dlZd dlmZ d dl	m
Z
 d dlmZ d dlmZmZmZ ej                  dk\  rd dlmZ nd dlmZ d d	lmZmZ d d
lmZmZmZmZmZ d dlmZ d dlmZ d dlm Z! d dlm"Z# d dlm$Z% d dlm&Z' d dlm(Z) g d¢Z*eejV                  ejX                  ejZ                  ej\                  ej^                  f   Z0eejb                  ejd                  ejf                  ejh                  ejj                  f   Z6ee0e6f   Z7ee8ede8f   f   Z9e%jt                  Z;de<d<   e%jz                  Z>de<d<   dZ?e%j€                  ZAde<d<   e%j„                  ZCde<d<   e%jˆ                  ZEde<d<   e%jŒ                  ZGde<d<    G d„ deH«      ZI ee!eI«      ZJ e'eI«      ZKdEdFd„ZLdGd„ZMdHd „ZNdId!„ZOdJd"„ZP G d#„ d$«      ZQ G d%„ d&«      ZR G d'„ d(«      ZS ed)«      dKd*„«       ZT ed+«      dLd,„«       ZU ed-«      ej¬                   G d.„ d/«      «       «       ZW G d0„ d1«      ZX G d2„ d3«      ZY G d4„ d5«      ZZ G d6„ d7eH«      Z[ G d8„ d9«      Z\dMd:„Z]dNd;„Z^dOd<„Z_	 	 dP	 	 	 	 	 	 	 	 	 dQd=„Z`e`Za ej"                  e`ebd>ecd?¬@«        G dA„ dB«      ZddRdC„Ze	 dE	 	 	 	 	 	 	 dSdD„Zfy)Té    )ÚannotationsN)Ú	b16encode)ÚSequence)Úpartial)ÚAnyÚCallableÚUnion)é   é   )Ú
deprecated)ÚutilsÚx509)ÚdsaÚecÚed448Úed25519Úrsa)ÚStrOrBytesPath)Úbyte_string)Úexception_from_error_queue)Úffi)Úlib)Úmake_assert)Ú
path_bytes)ÚFILETYPE_ASN1ÚFILETYPE_PEMÚFILETYPE_TEXTÚTYPE_DSAÚTYPE_RSAÚX509ÚErrorÚPKeyÚX509NameÚ	X509StoreÚX509StoreContextÚX509StoreContextErrorÚX509StoreFlagsÚdump_certificateÚdump_privatekeyÚdump_publickeyÚget_elliptic_curveÚget_elliptic_curvesÚload_certificateÚload_privatekeyÚload_publickey.Úintr   r   iÿÿ  r   r   ÚTYPE_DHÚTYPE_ECc                  ó   — e Zd ZdZy)r!   z7
    An error occurred in an `OpenSSL.crypto` API.
    N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__© ó    úO/home/uftp/webrtc-recorder/.venv/lib/python3.12/site-packages/OpenSSL/crypto.pyr!   r!   j   s   „ òr9   r!   c                óT  — | €8t        j                  t        j                  «       «      }t         j                  }n;t	        j
                  d| «      }t        j                  |t        | «      «      }|fdd„}t        |t        j                  k7  «       t	        j                  ||«      }|S )zÙ
    Allocate a new OpenSSL memory BIO.

    Arrange for the garbage collector to clean it up automatically.

    :param buffer: None or some bytes to use to put into the BIO so that they
        can be read out.
    úchar[]c                ó,   — t        j                  | «      S ©N)Ú_libÚBIO_free)ÚbioÚrefs     r:   Úfreez_new_mem_buf.<locals>.free…   s   € Ü—=‘= Ó%Ð%r9   )rA   r   rB   r   Úreturnr   )r?   ÚBIO_newÚ	BIO_s_memr@   Ú_ffiÚnewÚBIO_new_mem_bufÚlenÚ_openssl_assertÚNULLÚgc)ÚbufferrA   rC   Údatas       r:   Ú_new_mem_bufrP   t   s   € ð €~Ü�l‰lœ4Ÿ>™>Ó+Ó,ˆÜ�}‰}‰ä�x‰x˜ &Ó)ˆÜ×"Ñ" 4¬¨V«Ó5ˆð '+ô 	&ô �Cœ4Ÿ9™9Ñ$Ô%ä
�'‰'�#�tÓ
€CØ€Jr9   c                ó�   — t        j                  d«      }t        j                  | |«      }t        j                  |d   |«      dd S )zO
    Copy the contents of an OpenSSL BIO object into a Python byte string.
    zchar**r   N)rG   rH   r?   ÚBIO_get_mem_datarN   )rA   Úresult_bufferÚbuffer_lengths      r:   Ú_bio_to_stringrU   Ž   s?   € ô —H‘H˜XÓ&€MÜ×)Ñ)¨#¨}Ó=€MÜ�;‰;�} QÑ'¨Ó7¹Ð:Ð:r9   c                ó¾   — t        |t        «      st        d«      ‚t        | t        j
                  k7  «       t        j                  | |«      }|dk(  rt        d«      ‚y)aô  
    The the time value of an ASN1 time object.

    @param boundary: An ASN1_TIME pointer (or an object safely
        castable to that type) which will have its value set.
    @param when: A string representation of the desired time value.

    @raise TypeError: If C{when} is not a L{bytes} string.
    @raise ValueError: If C{when} does not represent a time in the required
        format.
    @raise RuntimeError: If the time value cannot be set for some other
        (unspecified) reason.
    zwhen must be a byte stringr   zInvalid stringN)	Ú
isinstanceÚbytesÚ	TypeErrorrK   rG   rL   r?   ÚASN1_TIME_set_stringÚ
ValueError)ÚboundaryÚwhenÚ
set_results      r:   Ú_set_asn1_timer_   —   sW   € ô �dœEÔ"ÜÐ4Ó5Ð5ô �H¤§	¡	Ñ)Ô*ä×*Ñ*¨8°TÓ:€JØ�Q‚ÜÐ)Ó*Ð*ð r9   c                óÆ   — t        j                  «       }t        |t        j                  k7  «       t        j
                  |t         j                  «      }t        || «       |S )aŒ  
    Behaves like _set_asn1_time but returns a new ASN1_TIME object.

    @param when: A string representation of the desired time value.

    @raise TypeError: If C{when} is not a L{bytes} string.
    @raise ValueError: If C{when} does not represent a time in the required
        format.
    @raise RuntimeError: If the time value cannot be set for some other
        (unspecified) reason.
    )r?   ÚASN1_TIME_newrK   rG   rL   rM   ÚASN1_TIME_freer_   )r]   Úrets     r:   Ú_new_asn1_timerd   °   sH   € ô ×
Ñ
Ó
€CÜ�Cœ4Ÿ9™9Ñ$Ô%Ü
�'‰'�#”t×*Ñ*Ó
+€CÜ�3˜ÔØ€Jr9   c                óJ  — t        j                  d| «      }t        j                  |«      dk(  ryt        j                  |«      t        j
                  k(  r(t        j                  t        j                  |«      «      S t        j                  d«      }t        j                  | |«       t        |d   t         j                  k7  «       t        j                  d|d   «      }t        j                  |«      }t        j                  |«      }t        j                  |d   «       |S )a]  
    Retrieve the time value of an ASN1 time object.

    @param timestamp: An ASN1_GENERALIZEDTIME* (or an object safely castable to
        that type) from which the time value will be retrieved.

    @return: The time value from C{timestamp} as a L{bytes} string in a certain
        format.  Or C{None} if the object contains no time value.
    zASN1_STRING*r   NzASN1_GENERALIZEDTIME**)rG   Úcastr?   ÚASN1_STRING_lengthÚASN1_STRING_typeÚV_ASN1_GENERALIZEDTIMEÚstringÚASN1_STRING_get0_datarH   ÚASN1_TIME_to_generalizedtimerK   rL   ÚASN1_GENERALIZEDTIME_free)Ú	timestampÚstring_timestampÚgeneralized_timestampÚstring_dataÚstring_results        r:   Ú_get_asn1_timers   Ã   sé   € ô —y‘y °Ó;ÐÜ×ÑÐ/Ó0°AÒ5Øä×ÑÐ.Ó/´4×3NÑ3NÒNä�{‰{œ4×5Ñ5Ð6FÓGÓHÐHä $§¡Ð)AÓ BÐÜ×)Ñ)¨)Ð5JÔKÜÐ-¨aÑ0´D·I±IÑ=Ô>äŸ9™9 ^Ð5JÈ1Ñ5MÓNÐÜ×0Ñ0Ð1AÓBˆÜŸ™ KÓ0ˆÜ×&Ñ&Ð'<¸QÑ'?Ô@ØÐr9   c                  ó$   — e Zd Zdd„Zdd„Zdd„Zy)Ú_X509NameInvalidatorc                ó   — g | _         y r>   )Ú_names©Úselfs    r:   Ú__init__z_X509NameInvalidator.__init__á   s	   € Ø&(ˆ�r9   c                ó:   — | j                   j                  |«       y r>   )rw   Úappend©ry   Únames     r:   Úaddz_X509NameInvalidator.addä   s   € Ø�‰×Ñ˜4Õ r9   c                ó*   — | j                   D ]  }|`Œ y r>   )rw   Ú_namer}   s     r:   Úclearz_X509NameInvalidator.clearç   s   € Ø—K‘Kò 	ˆDà‘
ñ	r9   N©rD   ÚNone©r~   r#   rD   r„   )r4   r5   r6   rz   r   r‚   r8   r9   r:   ru   ru   à   s   „ ó)ó!ôr9   ru   c                  ó†   — e Zd ZdZdZdZdd„Zdd„Zedd„«       Z	 e
d«      dd„«       Z e
d	«      dd
„«       Zdd„Zdd„Zy)r"   zD
    A class representing an DSA or RSA public key or key pair.
    FTc                óŒ   — t        j                  «       }t        j                  |t         j                  «      | _        d| _        y )NF)r?   ÚEVP_PKEY_newrG   rM   ÚEVP_PKEY_freeÚ_pkeyÚ_initialized©ry   Úpkeys     r:   rz   zPKey.__init__õ   s0   € Ü× Ñ Ó"ˆÜ—W‘W˜T¤4×#5Ñ#5Ó6ˆŒ
Ø!ˆÕr9   c                óî   — ddl m}m} | j                  r0t	        t
        | «      }t        j                  t         ||«      «      S t        t
        | «      }t        j                  t         ||d¬«      «      S )a  
        Export as a ``cryptography`` key.

        :rtype: One of ``cryptography``'s `key interfaces`_.

        .. _key interfaces: https://cryptography.io/en/latest/hazmat/            primitives/asymmetric/rsa/#key-interfaces

        .. versionadded:: 16.1.0
        r   )Úload_der_private_keyÚload_der_public_keyN)Úpassword)
Ú,cryptography.hazmat.primitives.serializationr�   r�   Ú_only_publicr*   r   Útypingrf   Ú_KeyÚ_dump_privatekey_internal)ry   r�   r�   Úders       r:   Úto_cryptography_keyzPKey.to_cryptography_keyú   sZ   € ÷	
ð
 ×ÒÜ ¤°Ó5ˆCÜ—;‘;œtÑ%8¸Ó%=Ó>Ð>ä+¬M¸4Ó@ˆCÜ—;‘;œtÑ%9¸#ÈÔ%MÓNÐNr9   c                ó  — t        |t        j                  t        j                  t        j
                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  f
«      st!        d«      ‚ddlm}m}m}m} t        |t        j                  t        j                  t        j                  t        j                  t        j                  f«      r4t-        t.        |j1                  |j2                  |j4                  «      «      S |j7                  |j2                  |j8                   |«       «      }t;        t.        |«      S )zø
        Construct based on a ``cryptography`` *crypto_key*.

        :param crypto_key: A ``cryptography`` key.
        :type crypto_key: One of ``cryptography``'s `key interfaces`_.

        :rtype: PKey

        .. versionadded:: 16.1.0
        zUnsupported key typer   )ÚEncodingÚNoEncryptionÚPrivateFormatÚPublicFormat)rW   r   ÚDSAPrivateKeyÚDSAPublicKeyr   ÚEllipticCurvePrivateKeyÚEllipticCurvePublicKeyr   ÚEd25519PrivateKeyÚEd25519PublicKeyr   ÚEd448PrivateKeyÚEd448PublicKeyr   ÚRSAPrivateKeyÚRSAPublicKeyrY   r’   rš   r›   rœ   r�   r/   r   Úpublic_bytesÚDERÚSubjectPublicKeyInfoÚprivate_bytesÚPKCS8r.   )ÚclsÚ
crypto_keyrš   r›   rœ   r�   r—   s          r:   Úfrom_cryptography_keyzPKey.from_cryptography_key  s(  € ô Øä×!Ñ!Ü× Ñ Ü×*Ñ*Ü×)Ñ)Ü×)Ñ)Ü×(Ñ(Ü×%Ñ%Ü×$Ñ$Ü×!Ñ!Ü× Ñ ðô
ô Ð2Ó3Ð3÷	
ó 	
ô Øä× Ñ Ü×)Ñ)Ü×(Ñ(Ü×$Ñ$Ü× Ñ ðô	
ô "ÜØ×'Ñ'Ø—L‘L ,×"CÑ"Cóóð ð ×*Ñ*Ø—‘˜m×1Ñ1±<³>óˆCô #¤=°#Ó6Ð6r9   z`PKey.generate_key is deprecated. You should use the key generation APIs in cryptography instead.c           	     ó’  — t        |t        «      st        d«      ‚t        |t        «      st        d«      ‚|t        k(  rê|dk  rt	        d«      ‚t        j                  «       }t        j                  |t
        j                  «      }t        j                  |t
        j                  «       t        j                  «       }t        j                  |||t        j                  «      }t        |dk(  «       t        j                   | j"                  |«      }t        |dk(  «       d| _        y|t$        k(  �r
t        j&                  «       }t        |t        j                  k7  «       t        j                  |t
        j(                  «      }t        j*                  ||t        j                  dt        j                  t        j                  t        j                  «      }t        |dk(  «       t        t        j,                  |«      dk(  «       t        t        j.                  | j"                  |«      dk(  «       d| _        yt1        d«      ‚)	a3  
        Generate a key pair of the given type, with the given number of bits.

        This generates a key "into" the this object.

        :param type: The key type.
        :type type: :py:data:`TYPE_RSA` or :py:data:`TYPE_DSA`
        :param bits: The number of bits.
        :type bits: :py:data:`int` ``>= 0``
        :raises TypeError: If :py:data:`type` or :py:data:`bits` isn't
            of the appropriate type.
        :raises ValueError: If the number of bits isn't an integer of
            the appropriate size.
        :return: ``None``
        ztype must be an integerzbits must be an integerr   zInvalid number of bitsé   zNo such key typeTN)rW   r0   rY   r   r[   r?   ÚBN_newrG   rM   ÚBN_freeÚBN_set_wordÚRSA_F4ÚRSA_newÚRSA_generate_key_exrL   rK   ÚEVP_PKEY_assign_RSArŠ   r   ÚDSA_newÚDSA_freeÚDSA_generate_parameters_exÚDSA_generate_keyÚEVP_PKEY_set1_DSAr!   r‹   )ry   ÚtypeÚbitsÚexponentr   Úresultr   Úress           r:   Úgenerate_keyzPKey.generate_keyK  s¢  € ô( ˜$¤Ô$ÜÐ5Ó6Ð6ä˜$¤Ô$ÜÐ5Ó6Ð6à”8ÒØ�qŠyÜ Ð!9Ó:Ð:ô —{‘{“}ˆHÜ—w‘w˜x¬¯©Ó6ˆHÜ×Ñ˜X¤t§{¡{Ô3ä—,‘,“.ˆCä×-Ñ-¨c°4¸Ä4Ç9Á9ÓMˆFÜ˜F a™KÔ(ä×-Ñ-¨d¯j©j¸#Ó>ˆFÜ˜F a™KÔ(ð" !ˆÕð ”XÓÜ—,‘,“.ˆCÜ˜C¤4§9¡9Ñ,Ô-ä—'‘'˜#œtŸ}™}Ó-ˆCÜ×1Ñ1Ø�Tœ4Ÿ9™9 a¬¯©´D·I±I¼t¿y¹yóˆCô ˜C 1™HÔ%äœD×1Ñ1°#Ó6¸!Ñ;Ô<ÜœD×2Ñ2°4·:±:¸sÓCÀqÑHÔIð !ˆÕô Ð*Ó+Ð+r9   zJPKey.check is deprecated. You should use the APIs in cryptography instead.c                ó€  — | j                   rt        d«      ‚t        j                  | j	                  «       «      t        j
                  k7  rt        d«      ‚t        j                  | j                  «      }t        j                  |t        j                  «      }t        j                  |«      }|dk(  ryt        «        y)ax  
        Check the consistency of an RSA private key.

        This is the Python equivalent of OpenSSL's ``RSA_check_key``.

        :return: ``True`` if key is consistent.

        :raise OpenSSL.crypto.Error: if the key is inconsistent.

        :raise TypeError: if the key is of a type which cannot be checked.
            Only RSA keys can currently be checked.
        zpublic key onlyz'Only RSA keys can currently be checked.r±   TN)r“   rY   r?   ÚEVP_PKEY_typer¾   ÚEVP_PKEY_RSAÚEVP_PKEY_get1_RSArŠ   rG   rM   ÚRSA_freeÚRSA_check_keyÚ_raise_current_error)ry   r   rÁ   s      r:   Úcheckz
PKey.check‡  sŒ   € ð" ×ÒÜÐ-Ó.Ð.ä×Ñ˜dŸi™i›kÓ*¬d×.?Ñ.?Ò?ÜÐEÓFÐFä×$Ñ$ T§Z¡ZÓ0ˆÜ�g‰g�cœ4Ÿ=™=Ó)ˆÜ×#Ñ# CÓ(ˆØ�QŠ;ØÜÕr9   c                ó@   — t        j                  | j                  «      S )zT
        Returns the type of the key

        :return: The type of the key.
        )r?   ÚEVP_PKEY_idrŠ   rx   s    r:   r¾   z	PKey.type¥  s   € ô ×Ñ §
¡
Ó+Ð+r9   c                ó@   — t        j                  | j                  «      S )zh
        Returns the number of bits of the key

        :return: The number of bits of the key.
        )r?   ÚEVP_PKEY_bitsrŠ   rx   s    r:   r¿   z	PKey.bits­  s   € ô ×!Ñ! $§*¡*Ó-Ð-r9   Nrƒ   )rD   r•   )r®   r•   rD   r"   )r¾   r0   r¿   r0   rD   r„   ©rD   Úbool©rD   r0   )r4   r5   r6   r7   r“   r‹   rz   r˜   Úclassmethodr¯   r   rÃ   rË   r¾   r¿   r8   r9   r:   r"   r"   í   sz   „ ñð €LØ€Ló"ó
Oð. ò77ó ð77ñr ð	3óò6!ó	ð6!ñp ð	 óòó	ðó4,ô.r9   r"   c                  óv   ‡ — e Zd ZdZdZd
ˆ fd„Zedd„«       Zedd„«       Zedd„«       Z	dd„Z
dd„Zdd	„Zˆ xZS )Ú_EllipticCurveaZ  
    A representation of a supported elliptic curve.

    @cvar _curves: :py:obj:`None` until an attempt is made to load the curves.
        Thereafter, a :py:type:`set` containing :py:type:`_EllipticCurve`
        instances each of which represents one curve supported by the system.
    @type _curves: :py:type:`NoneType` or :py:type:`set`
    Nc                óN   •— t        |t        «      rt        ‰| �  |«      S t        S )z·
        Implement cooperation with the right-hand side argument of ``!=``.

        Python 3 seems to have dropped this cooperation in this very narrow
        circumstance.
        )rW   rÕ   ÚsuperÚ__ne__ÚNotImplemented)ry   ÚotherÚ	__class__s     €r:   rØ   z_EllipticCurve.__ne__Â  s$   ø€ ô �eœ^Ô,Ü‘7‘> %Ó(Ð(ÜÐr9   c                óÀ   ‡ ‡— ‰j                  t        j                  d«      }t        j                  d|«      }‰j                  ||«       t	        ˆ ˆfd„|D «       «      S )zü
        Get the curves supported by OpenSSL.

        :param lib: The OpenSSL library binding object.

        :return: A :py:type:`set` of ``cls`` instances giving the names of the
            elliptic curves the underlying library supports.
        r   zEC_builtin_curve[]c              3  óV   •K  — | ]   }‰j                  ‰|j                  «      –— Œ" y ­wr>   )Úfrom_nidÚnid)Ú.0Úcr­   r   s     €€r:   ú	<genexpr>z7_EllipticCurve._load_elliptic_curves.<locals>.<genexpr>Ý  s    øè ø€ ÒD°�3—<‘<  Q§U¡U×+ÑDùs   ƒ&))ÚEC_get_builtin_curvesrG   rL   rH   Úset)r­   r   Ú
num_curvesÚbuiltin_curvess   ``  r:   Ú_load_elliptic_curvesz$_EllipticCurve._load_elliptic_curvesÍ  sO   ù€ ð ×.Ñ.¬t¯y©y¸!Ó<ˆ
ÜŸ™Ð"6¸
ÓCˆð 	×!Ñ! .°*Ô=ÜÔD°^ÔDÓDÐDr9   c                ó^   — | j                   €| j                  |«      | _         | j                   S )a  
        Get, cache, and return the curves supported by OpenSSL.

        :param lib: The OpenSSL library binding object.

        :return: A :py:type:`set` of ``cls`` instances giving the names of the
            elliptic curves the underlying library supports.
        )Ú_curvesrç   )r­   r   s     r:   Ú_get_elliptic_curvesz#_EllipticCurve._get_elliptic_curvesß  s*   € ð �;‰;ÐØ×3Ñ3°CÓ8ˆCŒKØ�{‰{Ðr9   c           	     óx   —  | ||t        j                  |j                  |«      «      j                  d«      «      S )aË  
        Instantiate a new :py:class:`_EllipticCurve` associated with the given
        OpenSSL NID.

        :param lib: The OpenSSL library binding object.

        :param nid: The OpenSSL NID the resulting curve object will represent.
            This must be a curve NID (and not, for example, a hash NID) or
            subsequent operations will fail in unpredictable ways.
        :type nid: :py:class:`int`

        :return: The curve object.
        Úascii)rG   rj   Ú
OBJ_nid2snÚdecode)r­   r   rß   s      r:   rÞ   z_EllipticCurve.from_nidí  s0   € ñ �3˜œTŸ[™[¨¯©¸Ó)<Ó=×DÑDÀWÓMÓNÐNr9   c                ó.   — || _         || _        || _        y)a‰  
        :param _lib: The :py:mod:`cryptography` binding instance used to
            interface with OpenSSL.

        :param _nid: The OpenSSL NID identifying the curve this object
            represents.
        :type _nid: :py:class:`int`

        :param name: The OpenSSL short name identifying the curve this object
            represents.
        :type name: :py:class:`unicode`
        N)r?   Ú_nidr~   )ry   r   rß   r~   s       r:   rz   z_EllipticCurve.__init__þ  s   € ð ˆŒ	ØˆŒ	Øˆ�	r9   c                ó"   — d| j                   ›d�S )Nz<Curve ú>©r~   rx   s    r:   Ú__repr__z_EllipticCurve.__repr__  s   € Ø˜Ÿ™˜ QÐ'Ð'r9   c                ó”   — | j                   j                  | j                  «      }t        j                  |t         j
                  «      S )zÅ
        Create a new OpenSSL EC_KEY structure initialized to use this curve.

        The structure is automatically garbage collected when the Python object
        is garbage collected.
        )r?   ÚEC_KEY_new_by_curve_namerð   rG   rM   ÚEC_KEY_free)ry   Úkeys     r:   Ú
_to_EC_KEYz_EllipticCurve._to_EC_KEY  s3   € ð �i‰i×0Ñ0°·±Ó;ˆÜ�w‰w�sœD×,Ñ,Ó-Ð-r9   ©rÚ   r   rD   rÑ   )r   r   rD   úset[_EllipticCurve])r   r   rß   r0   rD   rÕ   )r   r   rß   r0   r~   ÚstrrD   r„   ©rD   rü   ©rD   r   )r4   r5   r6   r7   ré   rØ   rÓ   rç   rê   rÞ   rz   rô   rù   Ú__classcell__©rÛ   s   @r:   rÕ   rÕ   ¶  sc   ø„ ñð €Gõ	ð òEó ðEð" òó ðð òOó ðOó ó"(÷.r9   rÕ   zSget_elliptic_curves is deprecated. You should use the APIs in cryptography instead.c                 ó4   — t         j                  t        «      S )a“  
    Return a set of objects representing the elliptic curves supported in the
    OpenSSL build in use.

    The curve objects have a :py:class:`unicode` ``name`` attribute by which
    they identify themselves.

    The curve objects are useful as values for the argument accepted by
    :py:meth:`Context.set_tmp_ecdh` to specify which elliptical curve should be
    used for ECDHE key exchange.
    )rÕ   rê   r?   r8   r9   r:   r,   r,     s   € ô  ×.Ñ.¬tÓ4Ð4r9   zRget_elliptic_curve is deprecated. You should use the APIs in cryptography instead.c                ó^   — t        «       D ]  }|j                  | k(  sŒ|c S  t        d| «      ‚)aT  
    Return a single curve object selected by name.

    See :py:func:`get_elliptic_curves` for information about curve objects.

    :param name: The OpenSSL short name identifying the curve object to
        retrieve.
    :type name: :py:class:`unicode`

    If the named curve is not supported then :py:class:`ValueError` is raised.
    zunknown curve name)r,   r~   r[   )r~   Úcurves     r:   r+   r+   0  s7   € ô  %Ó&ò ˆØ�:‰:˜ÓØŠLðô Ð)¨4Ó
0Ð0r9   zUX509Name support in pyOpenSSL is deprecated. You should use the APIs in cryptography.c                  ód   ‡ — e Zd ZdZdd„Zdˆ fd„Zdd„Zdd„Zdd„Zdd„Z	dd„Z
dd	„Zdd
„Zˆ xZS )r#   a  
    An X.509 Distinguished Name.

    :ivar countryName: The country of the entity.
    :ivar C: Alias for  :py:attr:`countryName`.

    :ivar stateOrProvinceName: The state or province of the entity.
    :ivar ST: Alias for :py:attr:`stateOrProvinceName`.

    :ivar localityName: The locality of the entity.
    :ivar L: Alias for :py:attr:`localityName`.

    :ivar organizationName: The organization name of the entity.
    :ivar O: Alias for :py:attr:`organizationName`.

    :ivar organizationalUnitName: The organizational unit of the entity.
    :ivar OU: Alias for :py:attr:`organizationalUnitName`

    :ivar commonName: The common name of the entity.
    :ivar CN: Alias for :py:attr:`commonName`.

    :ivar emailAddress: The e-mail address of the entity.
    c                ó”   — t        j                  |j                  «      }t        j                  |t         j
                  «      | _        y)zž
        Create a new X509Name, copying the given X509Name instance.

        :param name: The name to copy.
        :type name: :py:class:`X509Name`
        N)r?   ÚX509_NAME_dupr�   rG   rM   ÚX509_NAME_freer}   s     r:   rz   zX509Name.__init__d  s0   € ô ×!Ñ! $§*¡*Ó-ˆÜŸ'™' $¬×(;Ñ(;Ó<ˆ�
r9   c           	     óª  •— |j                  d«      rt        ‰	| �	  ||«      S t        |«      t        ur#t        dt        |«      j                  d›d�«      ‚t        j                  t        |«      «      }|t        j                  k(  r	 t        «        t        d«      ‚t        t        j                  | j                   «      «      D ]ˆ  }t        j"                  | j                   |«      }t        j$                  |«      }t        j&                  |«      }||k(  sŒSt        j(                  | j                   |«      }t        j*                  |«        n t-        |t        «      r|j/                  d«      }t        j0                  | j                   |t        j2                  |t5        |«      dd«      }|st        «        y y # t        $ r Y t        d«      ‚w xY w)	NÚ_z$attribute name must be string, not 'z.200ú'úNo such attributeúutf-8éÿÿÿÿr   )Ú
startswithr×   Ú__setattr__r¾   rü   rY   r4   r?   ÚOBJ_txt2nidÚ_byte_stringÚ	NID_undefrÊ   r!   ÚAttributeErrorÚrangeÚX509_NAME_entry_countr�   ÚX509_NAME_get_entryÚX509_NAME_ENTRY_get_objectÚOBJ_obj2nidÚX509_NAME_delete_entryÚX509_NAME_ENTRY_freerW   ÚencodeÚX509_NAME_add_entry_by_NIDÚMBSTRING_UTF8rJ   )
ry   r~   Úvaluerß   ÚiÚentÚent_objÚent_nidÚ
add_resultrÛ   s
            €r:   r  zX509Name.__setattr__n  s–  ø€ Ø�?‰?˜3ÔÜ‘7Ñ& t¨UÓ3Ð3ô �‹:œSÑ ÜðÜ˜“K×(Ñ(¨Ð.¨að1óð ô
 ×Ñœ|¨DÓ1Ó2ˆØ”$—.‘.Ò ðÜ$Ô&ô !Ð!4Ó5Ð5ô ”t×1Ñ1°$·*±*Ó=Ó>ò 	ˆAÜ×*Ñ*¨4¯:©:°qÓ9ˆCÜ×5Ñ5°cÓ:ˆGÜ×&Ñ& wÓ/ˆGØ�g‹~Ü×1Ñ1°$·*±*¸aÓ@�Ü×)Ñ)¨#Ô.Ùð	ô �eœSÔ!Ø—L‘L Ó)ˆEä×4Ñ4Ø�J‰J˜œT×/Ñ/°¼¸E»
ÀBÈó
ˆ
ñ Ü Õ"ð øô) ò ØÜ Ð!4Ó5Ð5ðús   Â	
F< Æ<	GÇGc                ó²  — t        j                  t        |«      «      }|t         j                  k(  r	 t	        «        t        d«      ‚t        j                  | j                  |d«      }|dk(  ryt        j                  | j                  |«      }t        j                  |«      }t        j                  d«      }t        j                  ||«      }t        |dk\  «       	 t        j                  |d   |«      dd j!                  d«      }t        j"                  |d   «       |S # t
        $ r Y t        d«      ‚w xY w# t        j"                  |d   «       w xY w)a
  
        Find attribute. An X509Name object has the following attributes:
        countryName (alias C), stateOrProvince (alias ST), locality (alias L),
        organization (alias O), organizationalUnit (alias OU), commonName
        (alias CN) and more...
        r  r  Núunsigned char**r   r  )r?   r  r  r  rÊ   r!   r  ÚX509_NAME_get_index_by_NIDr�   r  ÚX509_NAME_ENTRY_get_datarG   rH   ÚASN1_STRING_to_UTF8rK   rN   rî   ÚOPENSSL_free)	ry   r~   rß   Úentry_indexÚentryrO   rS   Údata_lengthrÁ   s	            r:   Ú__getattr__zX509Name.__getattr__•  s2  € ô ×Ñœ|¨DÓ1Ó2ˆØ”$—.‘.Ò ðÜ$Ô&ô !Ð!4Ó5Ð5ä×5Ñ5°d·j±jÀ#ÀrÓJˆØ˜"ÒØä×(Ñ(¨¯©°[ÓAˆÜ×,Ñ,¨UÓ3ˆäŸ™Ð!2Ó3ˆÜ×.Ñ.¨}¸dÓCˆÜ˜ qÑ(Ô)ð	0Ü—[‘[ ¨qÑ!1°;Ó?ÁÐB×IÑIØóˆFô
 ×Ñ˜m¨AÑ.Ô/Øˆøô- ò ØÜ Ð!4Ó5Ð5ðûô* ×Ñ˜m¨AÑ.Õ/ús   ³
D# Ã+D< Ä#	D9Ä8D9Ä<Ec                óˆ   — t        |t        «      st        S t        j                  | j
                  |j
                  «      dk(  S ©Nr   ©rW   r#   rÙ   r?   ÚX509_NAME_cmpr�   ©ry   rÚ   s     r:   Ú__eq__zX509Name.__eq__½  s2   € Ü˜%¤Ô*Ü!Ð!ä×!Ñ! $§*¡*¨e¯k©kÓ:¸aÑ?Ð?r9   c                óˆ   — t        |t        «      st        S t        j                  | j
                  |j
                  «      dk  S r/  r0  r2  s     r:   Ú__lt__zX509Name.__lt__Ã  s2   € Ü˜%¤Ô*Ü!Ð!ä×!Ñ! $§*¡*¨e¯k©kÓ:¸QÑ>Ð>r9   c                ó   — t        j                  dd«      }t        j                  | j                  |t        |«      «      }t        |t         j                  k7  «       dj                  t        j                  |«      j                  d«      «      S )z6
        String representation of an X509Name
        r<   i   z<X509Name object '{}'>r  )rG   rH   r?   ÚX509_NAME_oneliner�   rJ   rK   rL   Úformatrj   rî   )ry   rS   Úformat_results      r:   rô   zX509Name.__repr__É  sq   € ô Ÿ™ ¨3Ó/ˆÜ×.Ñ.Ø�J‰J˜¤s¨=Ó'9ó
ˆô 	˜¬¯©Ñ2Ô3à'×.Ñ.Ü�K‰K˜Ó&×-Ñ-¨gÓ6ó
ð 	
r9   c                ó@   — t        j                  | j                  «      S )a&  
        Return an integer representation of the first four bytes of the
        MD5 digest of the DER representation of the name.

        This is the Python equivalent of OpenSSL's ``X509_NAME_hash``.

        :return: The (integer) hash of this name.
        :rtype: :py:class:`int`
        )r?   ÚX509_NAME_hashr�   rx   s    r:   ÚhashzX509Name.hash×  s   € ô ×"Ñ" 4§:¡:Ó.Ð.r9   c                óô   — t        j                  d«      }t        j                  | j                  |«      }t        |dk\  «       t        j                  |d   |«      dd }t        j                  |d   «       |S )zŽ
        Return the DER encoding of this name.

        :return: The DER encoded form of this name.
        :rtype: :py:class:`bytes`
        r%  r   N)rG   rH   r?   Úi2d_X509_NAMEr�   rK   rN   r)  )ry   rS   Úencode_resultrr   s       r:   r—   zX509Name.derã  si   € ô Ÿ™Ð!2Ó3ˆÜ×*Ñ*¨4¯:©:°}ÓEˆÜ˜¨Ñ*Ô+äŸ™ M°!Ñ$4°mÓDÁQÐGˆÜ×Ñ˜-¨Ñ*Ô+ØÐr9   c                ó  — g }t        t        j                  | j                  «      «      D ]Û  }t        j                  | j                  |«      }t        j
                  |«      }t        j                  |«      }t        j                  |«      }t        j                  |«      }t        j                  t        j                  |«      t        j                  |«      «      dd }|j                  t        j                  |«      |f«       ŒÝ |S )z¼
        Returns the components of this name, as a sequence of 2-tuples.

        :return: The components of this name.
        :rtype: :py:class:`list` of ``name, value`` tuples.
        N)r  r?   r  r�   r  r  r'  r  rí   rG   rN   rk   rg   r|   rj   )	ry   rÁ   r  r   ÚfnameÚfvalrß   r~   r  s	            r:   Úget_componentszX509Name.get_componentsò  sÖ   € ð ˆÜ”t×1Ñ1°$·*±*Ó=Ó>ò 	6ˆAÜ×*Ñ*¨4¯:©:°qÓ9ˆCä×3Ñ3°CÓ8ˆEÜ×0Ñ0°Ó5ˆDä×"Ñ" 5Ó)ˆCÜ—?‘? 3Ó'ˆDô —K‘KÜ×*Ñ*¨4Ó0´$×2IÑ2IÈ$Ó2OóáðˆEð �M‰Mœ4Ÿ;™; tÓ,¨eÐ4Õ5ð	6ð  ˆr9   r…   )r~   rü   r  r   rD   r„   )r~   rü   rD   ú
str | Nonerú   rý   rÒ   ©rD   rX   )rD   zlist[tuple[bytes, bytes]])r4   r5   r6   r7   rz   r  r-  r3  r5  rô   r<  r—   rC  rÿ   r   s   @r:   r#   r#   F  s8   ø„ ñó0=õ%#óN&óP@ó?ó
ó
/ó÷r9   r#   c                  ó(  — e Zd ZdZd-d„Zed.d„«       Zd/d„Zed0d„«       Z e	d«      d1d„«       Z
d2d„Zd3d	„Z e	d
«      d4d„«       Z e	d«      d5d„«       Zd6d„Zd7d„Zd2d„Z e	d«      d8d„«       Zd2d„Z e	d«      d9d„«       Z e	d«      d9d„«       Zd:d„Zd;d„Zd<d„Z	 	 	 	 	 	 d=d„Z e	d«      d>d„«       Zd<d„Z e	d«      d>d „«       Zd?d!„Zd@d"„Z e	d#«      dAd$„«       Z e	d%«      dBd&„«       Z  e	d'«      dAd(„«       Z! e	d)«      dCd*„«       Z"d2d+„Z#y,)Dr    z
    An X.509 certificate.
    c                óò   — t        j                  «       }t        |t        j                  k7  «       t        j
                  |t         j                  «      | _        t        «       | _	        t        «       | _
        y r>   )r?   ÚX509_newrK   rG   rL   rM   Ú	X509_freeÚ_x509ru   Ú_issuer_invalidatorÚ_subject_invalidator)ry   r   s     r:   rz   zX509.__init__  sJ   € Ü�}‰}‹ˆÜ˜¤§	¡	Ñ)Ô*Ü—W‘W˜T¤4§>¡>Ó2ˆŒ
ä#7Ó#9ˆÔ Ü$8Ó$:ˆÕ!r9   c                ó¶   — | j                  | «      }t        j                  |t        j                  «      |_        t        «       |_        t        «       |_        |S r>   )	Ú__new__rG   rM   r?   rI  rJ  ru   rK  rL  )r­   r   Úcerts      r:   Ú_from_raw_x509_ptrzX509._from_raw_x509_ptr  sA   € à�{‰{˜3ÓˆÜ—W‘W˜T¤4§>¡>Ó2ˆŒ
Ü#7Ó#9ˆÔ Ü$8Ó$:ˆÔ!Øˆr9   c                ó>   — ddl m} t        t        | «      } ||«      S )z�
        Export as a ``cryptography`` certificate.

        :rtype: ``cryptography.x509.Certificate``

        .. versionadded:: 17.1.0
        r   )Úload_der_x509_certificate)Úcryptography.x509rR  r(   r   )ry   rR  r—   s      r:   Úto_cryptographyzX509.to_cryptography"  s   € õ 	@äœ}¨dÓ3ˆÙ(¨Ó-Ð-r9   c                ó®   — t        |t        j                  «      st        d«      ‚ddlm} |j                  |j                  «      }t        t        |«      S )zü
        Construct based on a ``cryptography`` *crypto_cert*.

        :param crypto_key: A ``cryptography`` X.509 certificate.
        :type crypto_key: ``cryptography.x509.Certificate``

        :rtype: X509

        .. versionadded:: 17.1.0
        zMust be a certificater   ©rš   )
rW   r   ÚCertificaterY   r’   rš   r¨   r©   r-   r   )r­   Úcrypto_certrš   r—   s       r:   Úfrom_cryptographyzX509.from_cryptography/  sD   € ô ˜+¤t×'7Ñ'7Ô8ÜÐ3Ó4Ð4åIà×&Ñ& x§|¡|Ó4ˆÜ¤¨sÓ3Ð3r9   zYX509.set_version is deprecated. You should use cryptography's CertificateBuilder instead.c                ó’   — t        |t        «      st        d«      ‚t        t	        j
                  | j                  |«      dk(  «       y)a	  
        Set the version number of the certificate. Note that the
        version value is zero-based, eg. a value of 0 is V1.

        :param version: The version number of the certificate.
        :type version: :py:class:`int`

        :return: ``None``
        zversion must be an integerr±   N)rW   r0   rY   rK   r?   ÚX509_set_versionrJ  )ry   Úversions     r:   Úset_versionzX509.set_versionC  s8   € ô ˜'¤3Ô'ÜÐ8Ó9Ð9äœ×-Ñ-¨d¯j©j¸'ÓBÀaÑGÕHr9   c                ó@   — t        j                  | j                  «      S )z˜
        Return the version number of the certificate.

        :return: The version number of the certificate.
        :rtype: :py:class:`int`
        )r?   ÚX509_get_versionrJ  rx   s    r:   Úget_versionzX509.get_versionV  s   € ô ×$Ñ$ T§Z¡ZÓ0Ð0r9   c                óB  — t         j                  t         «      }t        j                  | j                  «      |_        |j
                  t        j                  k(  r
t        «        t        j                  |j
                  t        j                  «      |_        d|_        |S )z{
        Get the public key of the certificate.

        :return: The public key.
        :rtype: :py:class:`PKey`
        T)r"   rN  r?   ÚX509_get_pubkeyrJ  rŠ   rG   rL   rÊ   rM   r‰   r“   rŒ   s     r:   Ú
get_pubkeyzX509.get_pubkey_  sg   € ô �|‰|œDÓ!ˆÜ×)Ñ)¨$¯*©*Ó5ˆŒ
Ø�:‰:œŸ™Ò"Ü Ô"Ü—W‘W˜TŸZ™Z¬×);Ñ);Ó<ˆŒ
Ø ˆÔØˆr9   zXX509.set_pubkey is deprecated. You should use cryptography's CertificateBuilder instead.c                óª   — t        |t        «      st        d«      ‚t        j                  | j
                  |j                  «      }t        |dk(  «       y)z¥
        Set the public key of the certificate.

        :param pkey: The public key.
        :type pkey: :py:class:`PKey`

        :return: :py:data:`None`
        úpkey must be a PKey instancer±   N)rW   r"   rY   r?   ÚX509_set_pubkeyrJ  rŠ   rK   )ry   r�   r^   s      r:   Ú
set_pubkeyzX509.set_pubkeyn  s@   € ô ˜$¤Ô%ÜÐ:Ó;Ð;ä×)Ñ)¨$¯*©*°d·j±jÓAˆ
Ü˜
 a™Õ(r9   zRX509.sign is deprecated. You should use cryptography's CertificateBuilder instead.c                ó€  — t        |t        «      st        d«      ‚|j                  rt	        d«      ‚|j
                  st	        d«      ‚t        j                  t        |«      «      }|t        j                  k(  rt	        d«      ‚t        j                  | j                  |j                  |«      }t        |dkD  «       y)a  
        Sign the certificate with this key and digest type.

        :param pkey: The key to sign with.
        :type pkey: :py:class:`PKey`

        :param digest: The name of the message digest to use.
        :type digest: :py:class:`str`

        :return: :py:data:`None`
        re  zKey only has public partzKey is uninitializedúNo such digest methodr   N)rW   r"   rY   r“   r[   r‹   r?   ÚEVP_get_digestbynamer  rG   rL   Ú	X509_signrJ  rŠ   rK   )ry   r�   ÚdigestÚevp_mdÚsign_results        r:   Úsignz	X509.sign�  s—   € ô  ˜$¤Ô%ÜÐ:Ó;Ð;à×ÒÜÐ7Ó8Ð8à× Ò ÜÐ3Ó4Ð4ä×*Ñ*¬<¸Ó+?Ó@ˆØ”T—Y‘YÒÜÐ4Ó5Ð5ä—n‘n T§Z¡Z°·±¸VÓDˆÜ˜ a™Õ(r9   c                óŽ  — t        j                  | j                  «      }t        j                  d«      }t        j
                  |t        j                  t        j                  |«       t        j                  |d   «      }|t         j                  k(  rt        d«      ‚t        j                  t        j                  |«      «      S )zþ
        Return the signature algorithm used in the certificate.

        :return: The name of the algorithm.
        :rtype: :py:class:`bytes`

        :raises ValueError: If the signature algorithm is undefined.

        .. versionadded:: 0.13
        zASN1_OBJECT **r   zUndefined signature algorithm)r?   ÚX509_get0_tbs_sigalgrJ  rG   rH   ÚX509_ALGOR_get0rL   r  r  r[   rj   Ú
OBJ_nid2ln)ry   Úsig_algÚalgrß   s       r:   Úget_signature_algorithmzX509.get_signature_algorithm¡  s‡   € ô ×+Ñ+¨D¯J©JÓ7ˆÜ�h‰hÐ'Ó(ˆÜ×Ñ˜S¤$§)¡)¬T¯Y©Y¸Ô@Ü×Ñ˜s 1™vÓ&ˆØ”$—.‘.Ò ÜÐ<Ó=Ð=Ü�{‰{œ4Ÿ?™?¨3Ó/Ó0Ð0r9   c                ó  — t        j                  t        |«      «      }|t        j                  k(  rt        d«      ‚t        j                  dt         j                  «      }t        j                  dd«      }t        |«      |d<   t        j                  | j                  |||«      }t        |dk(  «       dj                  t        j                  ||d   «      D �cg c]  }t        |«      j                  «       ‘Œ c}«      S c c}w )a5  
        Return the digest of the X509 object.

        :param digest_name: The name of the digest algorithm to use.
        :type digest_name: :py:class:`str`

        :return: The digest of the object, formatted as
            :py:const:`b":"`-delimited hex pairs.
        :rtype: :py:class:`bytes`
        ri  zunsigned char[]zunsigned int[]r±   r   ó   :)r?   rj  r  rG   rL   r[   rH   ÚEVP_MAX_MD_SIZErJ   ÚX509_digestrJ  rK   ÚjoinrN   r   Úupper)ry   Údigest_namerl  rS   Úresult_lengthÚdigest_resultÚchs          r:   rl  zX509.digest´  sß   € ô ×*Ñ*¬<¸Ó+DÓEˆØ”T—Y‘YÒÜÐ4Ó5Ð5äŸ™Ð!2´D×4HÑ4HÓIˆÜŸ™Ð!1°1Ó5ˆÜ˜}Ó-ˆ�aÑä×(Ñ(Ø�J‰J˜ ¨}ó
ˆô 	˜¨Ñ*Ô+à�y‰yô Ÿ+™+ m°]À1Ñ5EÓFöàô ˜"“×#Ñ#Õ%òó
ð 	
ùòs   Ã Dc                ó@   — t        j                  | j                  «      S )z�
        Return the hash of the X509 subject.

        :return: The hash of the subject.
        :rtype: :py:class:`int`
        )r?   ÚX509_subject_name_hashrJ  rx   s    r:   Úsubject_name_hashzX509.subject_name_hashÓ  s   € ô ×*Ñ*¨4¯:©:Ó6Ð6r9   z_X509.set_serial_number is deprecated. You should use cryptography's CertificateBuilder instead.c                ó`  — t        |t        «      st        d«      ‚t        |«      dd }|j	                  d«      }t        j                  d«      }t        j                  ||«      }t        |t
        j                  k7  «       t        j                  |d   t
        j                  «      }t        j                  |d   «       t        |t
        j                  k7  «       t        j                  |t        j                  «      }t        j                  | j                   |«      }t        |dk(  «       y)z±
        Set the serial number of the certificate.

        :param serial: The new serial number.
        :type serial: :py:class:`int`

        :return: :py:data`None`
        zserial must be an integeré   Nrì   zBIGNUM**r   r±   )rW   r0   rY   Úhexr  rG   rH   r?   Ú	BN_hex2bnrK   rL   ÚBN_to_ASN1_INTEGERr³   rM   ÚASN1_INTEGER_freeÚX509_set_serialNumberrJ  )ry   ÚserialÚ
hex_serialÚhex_serial_bytesÚbignum_serialrÁ   Úasn1_serialr^   s           r:   Úset_serial_numberzX509.set_serial_numberÜ  sá   € ô ˜&¤#Ô&ÜÐ7Ó8Ð8ä˜“[  �_ˆ
Ø%×,Ñ,¨WÓ5ÐäŸ™ Ó,ˆô —‘ Ð/?Ó@ˆÜ˜¤$§)¡)Ñ+Ô,ä×-Ñ-¨m¸AÑ.>ÄÇ	Á	ÓJˆÜ�‰�] 1Ñ%Ô&Ü˜¤t§y¡yÑ0Ô1Ü—g‘g˜k¬4×+AÑ+AÓBˆÜ×/Ñ/°·
±
¸KÓHˆ
Ü˜
 a™Õ(r9   c                ó¸  — t        j                  | j                  «      }t        j                  |t        j
                  «      }	 t        j                  |«      }	 t	        j                  |«      }t        |d«      }|t        j                  |«       t        j                  |«       S # t        j                  |«       w xY w# t        j                  |«       w xY w)zx
        Return the serial number of this certificate.

        :return: The serial number.
        :rtype: int
        é   )r?   ÚX509_get_serialNumberrJ  ÚASN1_INTEGER_to_BNrG   rL   Ú	BN_bn2hexrj   r0   r)  r³   )ry   r�  rŽ  rŒ  Úhexstring_serialr‹  s         r:   Úget_serial_numberzX509.get_serial_numberü  sž   € ô ×0Ñ0°·±Ó<ˆÜ×/Ñ/°¼T¿Y¹YÓGˆð		(ÜŸ™¨Ó6ˆJð.Ü#'§;¡;¨zÓ#:Ð ÜÐ-¨rÓ2�Øä×!Ñ! *Ô-ä�L‰L˜Õ'øô ×!Ñ! *Õ-ûä�L‰L˜Õ'ús$   ÁC Á"B( Á=C Â(B?Â?C ÃCzaX509.gmtime_adj_notAfter is deprecated. You should use cryptography's CertificateBuilder instead.c                ó¤   — t        |t        «      st        d«      ‚t        j                  | j
                  «      }t        j                  ||«       y)zÍ
        Adjust the time stamp on which the certificate stops being valid.

        :param int amount: The number of seconds by which to adjust the
            timestamp.
        :return: ``None``
        úamount must be an integerN)rW   r0   rY   r?   ÚX509_getm_notAfterrJ  ÚX509_gmtime_adj)ry   ÚamountÚnotAfters      r:   Úgmtime_adj_notAfterzX509.gmtime_adj_notAfter  s>   € ô ˜&¤#Ô&ÜÐ7Ó8Ð8ä×*Ñ*¨4¯:©:Ó6ˆÜ×Ñ˜X vÕ.r9   zbX509.gmtime_adj_notBefore is deprecated. You should use cryptography's CertificateBuilder instead.c                ó¤   — t        |t        «      st        d«      ‚t        j                  | j
                  «      }t        j                  ||«       y)z½
        Adjust the timestamp on which the certificate starts being valid.

        :param amount: The number of seconds by which to adjust the timestamp.
        :return: ``None``
        r™  N)rW   r0   rY   r?   ÚX509_getm_notBeforerJ  r›  )ry   rœ  Ú	notBefores      r:   Úgmtime_adj_notBeforezX509.gmtime_adj_notBefore"  s>   € ô ˜&¤#Ô&ÜÐ7Ó8Ð8ä×,Ñ,¨T¯Z©ZÓ8ˆ	Ü×Ñ˜Y¨Õ/r9   c                ó:  — | j                  «       }|€t        d«      ‚|j                  d«      }t        j                  j	                  |d«      }t        j
                  j                  }t        j                  j                  |«      j                  d¬«      }||k  S )z¡
        Check whether the certificate has expired.

        :return: ``True`` if the certificate has expired, ``False`` otherwise.
        :rtype: bool
        NzUnable to determine notAfterr  z%Y%m%d%H%M%SZ)Útzinfo)	Úget_notAfterr[   rî   ÚdatetimeÚstrptimeÚtimezoneÚutcÚnowÚreplace)ry   Ú
time_bytesÚtime_stringÚ	not_afterÚUTCÚutcnows         r:   Úhas_expiredzX509.has_expired3  sŒ   € ð ×&Ñ&Ó(ˆ
ØÐÜÐ;Ó<Ð<Ø ×'Ñ'¨Ó0ˆÜ×%Ñ%×.Ñ.¨{¸OÓLˆ	ä×Ñ×#Ñ#ˆÜ×"Ñ"×&Ñ& sÓ+×3Ñ3¸4Ð3Ó@ˆØ˜6Ñ!Ð!r9   c                ó8   — t         || j                  «      «      S r>   )rs   rJ  )ry   Úwhichs     r:   Ú_get_boundary_timezX509._get_boundary_timeD  s   € Ü™e D§J¡JÓ/Ó0Ð0r9   c                ó@   — | j                  t        j                  «      S )a
  
        Get the timestamp at which the certificate starts being valid.

        The timestamp is formatted as an ASN.1 TIME::

            YYYYMMDDhhmmssZ

        :return: A timestamp string, or ``None`` if there is none.
        :rtype: bytes or NoneType
        )r´  r?   r   rx   s    r:   Úget_notBeforezX509.get_notBeforeG  s   € ð ×&Ñ&¤t×'?Ñ'?Ó@Ð@r9   c                ó:   — t         || j                  «      |«      S r>   )r_   rJ  )ry   r³  r]   s      r:   Ú_set_boundary_timezX509._set_boundary_timeT  s   € ô ™e D§J¡JÓ/°Ó6Ð6r9   z[X509.set_notBefore is deprecated. You should use cryptography's CertificateBuilder instead.c                óB   — | j                  t        j                  |«      S )zî
        Set the timestamp at which the certificate starts being valid.

        The timestamp is formatted as an ASN.1 TIME::

            YYYYMMDDhhmmssZ

        :param bytes when: A timestamp string.
        :return: ``None``
        )r¸  r?   r   ©ry   r]   s     r:   Úset_notBeforezX509.set_notBeforeY  s   € ð ×&Ñ&¤t×'?Ñ'?ÀÓFÐFr9   c                ó@   — | j                  t        j                  «      S )a	  
        Get the timestamp at which the certificate stops being valid.

        The timestamp is formatted as an ASN.1 TIME::

            YYYYMMDDhhmmssZ

        :return: A timestamp string, or ``None`` if there is none.
        :rtype: bytes or NoneType
        )r´  r?   rš  rx   s    r:   r¥  zX509.get_notAfterj  s   € ð ×&Ñ&¤t×'>Ñ'>Ó?Ð?r9   zZX509.set_notAfter is deprecated. You should use cryptography's CertificateBuilder instead.c                óB   — | j                  t        j                  |«      S )zí
        Set the timestamp at which the certificate stops being valid.

        The timestamp is formatted as an ASN.1 TIME::

            YYYYMMDDhhmmssZ

        :param bytes when: A timestamp string.
        :return: ``None``
        )r¸  r?   rš  rº  s     r:   Úset_notAfterzX509.set_notAfterw  s   € ð ×&Ñ&¤t×'>Ñ'>ÀÓEÐEr9   c                óÀ   — t         j                  t        «      } || j                  «      |_        t        |j                  t        j                  k7  «       | |_        |S r>   )	ÚobjectrN  r#   rJ  r�   rK   rG   rL   Ú_owner)ry   r³  r~   s      r:   Ú	_get_namezX509._get_nameˆ  sE   € ô �~‰~œhÓ'ˆÙ˜4Ÿ:™:Ó&ˆŒ
Ü˜Ÿ
™
¤d§i¡iÑ/Ô0ð ˆŒàˆr9   c                ó�   — t        |t        «      st        d«      ‚ || j                  |j                  «      }t        |dk(  «       y )Nzname must be an X509Namer±   )rW   r#   rY   rJ  r�   rK   )ry   r³  r~   r^   s       r:   Ú	_set_namezX509._set_name•  s8   € Ü˜$¤Ô)ÜÐ6Ó7Ð7Ù˜4Ÿ:™: t§z¡zÓ2ˆ
Ü˜
 a™Õ(r9   zPX509.get_issuer is deprecated. You should use cryptography's X.509 APIs instead.c                óz   — | j                  t        j                  «      }| j                  j	                  |«       |S )a¥  
        Return the issuer of this certificate.

        This creates a new :class:`X509Name` that wraps the underlying issuer
        name field on the certificate. Modifying it will modify the underlying
        certificate, and will have the effect of modifying any other
        :class:`X509Name` that refers to this issuer.

        :return: The issuer of this certificate.
        :rtype: :class:`X509Name`
        )rÂ  r?   ÚX509_get_issuer_namerK  r   r}   s     r:   Ú
get_issuerzX509.get_issuer›  s1   € ð  �~‰~œd×7Ñ7Ó8ˆØ× Ñ ×$Ñ$ TÔ*Øˆr9   zXX509.set_issuer is deprecated. You should use cryptography's CertificateBuilder instead.c                óx   — | j                  t        j                  |«       | j                  j	                  «        y)zŸ
        Set the issuer of this certificate.

        :param issuer: The issuer.
        :type issuer: :py:class:`X509Name`

        :return: ``None``
        N)rÄ  r?   ÚX509_set_issuer_namerK  r‚   )ry   Úissuers     r:   Ú
set_issuerzX509.set_issuer¯  s*   € ð 	�‰”t×0Ñ0°&Ô9Ø× Ñ ×&Ñ&Õ(r9   zQX509.get_subject is deprecated. You should use cryptography's X.509 APIs instead.c                óz   — | j                  t        j                  «      }| j                  j	                  |«       |S )a©  
        Return the subject of this certificate.

        This creates a new :class:`X509Name` that wraps the underlying subject
        name field on the certificate. Modifying it will modify the underlying
        certificate, and will have the effect of modifying any other
        :class:`X509Name` that refers to this subject.

        :return: The subject of this certificate.
        :rtype: :class:`X509Name`
        )rÂ  r?   ÚX509_get_subject_namerL  r   r}   s     r:   Úget_subjectzX509.get_subject¿  s1   € ð  �~‰~œd×8Ñ8Ó9ˆØ×!Ñ!×%Ñ% dÔ+Øˆr9   zYX509.set_subject is deprecated. You should use cryptography's CertificateBuilder instead.c                óx   — | j                  t        j                  |«       | j                  j	                  «        y)z£
        Set the subject of this certificate.

        :param subject: The subject.
        :type subject: :py:class:`X509Name`

        :return: ``None``
        N)rÄ  r?   ÚX509_set_subject_namerL  r‚   )ry   Úsubjects     r:   Úset_subjectzX509.set_subjectÓ  s*   € ð 	�‰”t×1Ñ1°7Ô;Ø×!Ñ!×'Ñ'Õ)r9   c                ó@   — t        j                  | j                  «      S )z¯
        Get the number of extensions on this certificate.

        :return: The number of extensions.
        :rtype: :py:class:`int`

        .. versionadded:: 0.12
        )r?   ÚX509_get_ext_countrJ  rx   s    r:   Úget_extension_countzX509.get_extension_countã  s   € ô ×&Ñ& t§z¡zÓ2Ð2r9   Nrƒ   )r   r   rD   r    )rD   úx509.Certificate)rX  rÖ  rD   r    )r\  r0   rD   r„   rÒ   )rD   r"   )r�   r"   rD   r„   )r�   r"   rl  rü   rD   r„   rE  )r}  rü   rD   rX   )r‹  r0   rD   r„   )rœ  r0   rD   r„   rÐ   )r³  r   rD   úbytes | None)rD   r×  )r³  zCallable[..., Any]r]   rX   rD   r„   )r]   rX   rD   r„   )r³  r   rD   r#   )r³  r   r~   r#   rD   r„   )rD   r#   )rÊ  r#   rD   r„   )rÑ  r#   rD   r„   )$r4   r5   r6   r7   rz   rÓ   rP  rT  rY  r   r]  r`  rc  rg  ro  rv  rl  rƒ  r�  r—  rž  r¢  r±  r´  r¶  r¸  r»  r¥  r¾  rÂ  rÄ  rÇ  rË  rÎ  rÒ  rÕ  r8   r9   r:   r    r      s  „ ñó;ð òó ðó.ð ò4ó ð4ñ& ð	5óòIó	ðIó1óñ ð	5óò)ó	ð)ñ ð	5óò)ó	ð)ó81ó&
ó>7ñ ð	5óò)ó	ð)ó8(ñ( ð	5óò/ó	ð/ñ ð	5óò0ó	ð0ó"ó"1óAð7Ø'ð7Ø/4ð7à	ó7ñ
 ð	5óòGó	ðGó@ñ ð	5óòFó	ðFóó)ñ ð	-óòó	ðñ  ð	5óò
)ó	ð
)ñ ð	-óòó	ðñ  ð	5óò
*ó	ð
*ô	3r9   r    c                  óf  — e Zd ZU dZej
                  Zded<   ej                  Z	ded<   ej                  Zded<   ej                  Zded<   ej                  Zded<   ej                   Zded<   ej$                  Zded	<   ej(                  Zded
<   ej,                  Zded<   ej0                  Zded<   y)r'   a  
    Flags for X509 verification, used to change the behavior of
    :class:`X509Store`.

    See `OpenSSL Verification Flags`_ for details.

    .. _OpenSSL Verification Flags:
        https://www.openssl.org/docs/manmaster/man3/X509_VERIFY_PARAM_set_flags.html
    r0   Ú	CRL_CHECKÚCRL_CHECK_ALLÚIGNORE_CRITICALÚX509_STRICTÚALLOW_PROXY_CERTSÚPOLICY_CHECKÚEXPLICIT_POLICYÚINHIBIT_MAPÚCHECK_SS_SIGNATUREÚPARTIAL_CHAINN)r4   r5   r6   r7   r?   ÚX509_V_FLAG_CRL_CHECKrÙ  Ú__annotations__ÚX509_V_FLAG_CRL_CHECK_ALLrÚ  ÚX509_V_FLAG_IGNORE_CRITICALrÛ  ÚX509_V_FLAG_X509_STRICTrÜ  ÚX509_V_FLAG_ALLOW_PROXY_CERTSrÝ  ÚX509_V_FLAG_POLICY_CHECKrÞ  ÚX509_V_FLAG_EXPLICIT_POLICYrß  ÚX509_V_FLAG_INHIBIT_MAPrà  ÚX509_V_FLAG_CHECK_SS_SIGNATURErá  ÚX509_V_FLAG_PARTIAL_CHAINrâ  r8   r9   r:   r'   r'   ï  s«   … ñð ×/Ñ/€IˆsÓ/Ø×7Ñ7€M�3Ó7Ø×;Ñ;€O�SÓ;Ø×3Ñ3€K�Ó3Ø!×?Ñ?Ð�sÓ?Ø×5Ñ5€L�#Ó5Ø×;Ñ;€O�SÓ;Ø×3Ñ3€K�Ó3Ø"×AÑAÐ˜ÓAØ×7Ñ7€M�3Ô7r9   r'   c                  óN   — e Zd ZdZd	d„Zd
d„Zdd„Zdd„Zdd„Z	 d	 	 	 	 	 dd„Z	y)r$   aº  
    An X.509 store.

    An X.509 store is used to describe a context in which to verify a
    certificate. A description of a context may include a set of certificates
    to trust, a set of certificate revocation lists, verification flags and
    more.

    An X.509 store, being only a description, cannot be used by itself to
    verify a certificate. To carry out the actual verification process, see
    :class:`X509StoreContext`.
    c                ó~   — t        j                  «       }t        j                  |t         j                  «      | _        y r>   )r?   ÚX509_STORE_newrG   rM   ÚX509_STORE_freeÚ_store©ry   Ústores     r:   rz   zX509Store.__init__  s(   € Ü×#Ñ#Ó%ˆÜ—g‘g˜e¤T×%9Ñ%9Ó:ˆ�r9   c                ó¨   — t        |t        «      s
t        «       ‚t        j                  | j
                  |j                  «      }t        |dk(  «       y)aÔ  
        Adds a trusted certificate to this store.

        Adding a certificate with this method adds this certificate as a
        *trusted* certificate.

        :param X509 cert: The certificate to add to this store.

        :raises TypeError: If the certificate is not an :class:`X509`.

        :raises OpenSSL.crypto.Error: If OpenSSL was unhappy with your
            certificate.

        :return: ``None`` if the certificate was added successfully.
        r±   N)rW   r    rY   r?   ÚX509_STORE_add_certrò  rJ  rK   )ry   rO  rÂ   s      r:   Úadd_certzX509Store.add_cert  s<   € ô  ˜$¤Ô%Ü“+Ðä×&Ñ& t§{¡{°D·J±JÓ?ˆÜ˜˜q™Õ!r9   c                óÄ  — t        |t        j                  «      r�ddlm} t        |j                  |j                  «      «      }t        j                  |t        j                  «      }t        |t        j                  k7  «       t        j                  |t        j                  «      }nt        d«      ‚t        t        j                   | j"                  |«      dk7  «       y)aþ  
        Add a certificate revocation list to this store.

        The certificate revocation lists added to a store will only be used if
        the associated flags are configured to check certificate revocation
        lists.

        .. versionadded:: 16.1.0

        :param crl: The certificate revocation list to add to this store.
        :type crl: ``cryptography.x509.CertificateRevocationList``
        :return: ``None`` if the certificate revocation list was added
            successfully.
        r   rV  z?CRL must be of type cryptography.x509.CertificateRevocationListN)rW   r   ÚCertificateRevocationListr’   rš   rP   r¨   r©   r?   Úd2i_X509_CRL_biorG   rL   rK   rM   ÚX509_CRL_freerY   ÚX509_STORE_add_crlrò  )ry   Úcrlrš   rA   Úopenssl_crls        r:   Úadd_crlzX509Store.add_crl.  sŸ   € ô �cœ4×9Ñ9Ô:ÝMä˜s×/Ñ/°·±Ó=Ó>ˆCÜ×/Ñ/°´T·Y±YÓ?ˆKÜ˜K¬4¯9©9Ñ4Ô5Ü—'‘'˜+¤t×'9Ñ'9Ó:‰Cäð>óð ô
 	œ×/Ñ/°·±¸SÓAÀQÑFÕGr9   c                ó\   — t        t        j                  | j                  |«      dk7  «       y)aÒ  
        Set verification flags to this store.

        Verification flags can be combined by oring them together.

        .. note::

          Setting a verification flag sometimes requires clients to add
          additional information to the store, otherwise a suitable error will
          be raised.

          For example, in setting flags to enable CRL checking a
          suitable CRL must be added to the store otherwise an error will be
          raised.

        .. versionadded:: 16.1.0

        :param int flags: The verification flags to set on this store.
            See :class:`X509StoreFlags` for available constants.
        :return: ``None`` if the verification flags were successfully set.
        r   N)rK   r?   ÚX509_STORE_set_flagsrò  )ry   Úflagss     r:   Ú	set_flagszX509Store.set_flagsL  s"   € ô, 	œ×1Ñ1°$·+±+¸uÓEÈÑJÕKr9   c                ó:  — t        j                  «       }t        j                  |t         j                  «      }t        j
                  |t        j                  |j                  «       «      «       t        t        j                  | j                  |«      dk7  «       y)a¤  
        Set the time against which the certificates are verified.

        Normally the current time is used.

        .. note::

          For example, you can determine if a certificate was valid at a given
          time.

        .. versionadded:: 17.0.0

        :param datetime vfy_time: The verification time to set on this store.
        :return: ``None`` if the verification time was successfully set.
        r   N)r?   ÚX509_VERIFY_PARAM_newrG   rM   ÚX509_VERIFY_PARAM_freeÚX509_VERIFY_PARAM_set_timeÚcalendarÚtimegmÚ	timetuplerK   ÚX509_STORE_set1_paramrò  )ry   Úvfy_timeÚparams      r:   Úset_timezX509Store.set_timed  sm   € ô  ×*Ñ*Ó,ˆÜ—‘˜œt×:Ñ:Ó;ˆä×'Ñ'Ø”8—?‘? 8×#5Ñ#5Ó#7Ó8ô	
ô 	œ×2Ñ2°4·;±;ÀÓFÈ!ÑKÕLr9   Nc                óØ   — |€t         j                  }nt        |«      }|€t         j                  }nt        |«      }t        j                  | j
                  ||«      }|st        «        yy)aˆ  
        Let X509Store know where we can find trusted certificates for the
        certificate chain.  Note that the certificates have to be in PEM
        format.

        If *capath* is passed, it must be a directory prepared using the
        ``c_rehash`` tool included with OpenSSL.  Either, but not both, of
        *cafile* or *capath* may be ``None``.

        .. note::

          Both *cafile* and *capath* may be set simultaneously.

          Call this method multiple times to add more than one location.
          For example, CA certificates, and certificate revocation list bundles
          may be passed in *cafile* in subsequent calls to this method.

        .. versionadded:: 20.0

        :param cafile: In which file we can find the certificates (``bytes`` or
                       ``unicode``).
        :param capath: In which directory we can find the certificates
                       (``bytes`` or ``unicode``).

        :return: ``None`` if the locations were set successfully.

        :raises OpenSSL.crypto.Error: If both *cafile* and *capath* is ``None``
            or the locations could not be set for any reason.

        N)rG   rL   Ú_path_bytesr?   ÚX509_STORE_load_locationsrò  rÊ   )ry   ÚcafileÚcapathÚload_results       r:   Úload_locationszX509Store.load_locations|  s`   € ðF ˆ>Ü—Y‘Y‰Fä  Ó(ˆFàˆ>Ü—Y‘Y‰Fä  Ó(ˆFä×4Ñ4Ø�K‰K˜ ó
ˆñ Ü Õ"ð r9   rƒ   )rO  r    rD   r„   )rý  zx509.CertificateRevocationListrD   r„   )r  r0   rD   r„   )r  zdatetime.datetimerD   r„   r>   )r  úStrOrBytesPath | Noner  r  rD   r„   )
r4   r5   r6   r7   rz   r÷  rÿ  r  r  r  r8   r9   r:   r$   r$     sI   „ ñó;ó"ó,Hó<Ló0Mð6 )-ð1#à%ð1#ð &ð1#ð 
ô	1#r9   r$   c                  ó4   ‡ — e Zd ZdZ	 	 	 	 	 	 	 	 dˆ fd„Zˆ xZS )r&   zù
    An exception raised when an error occurred while verifying a certificate
    using `OpenSSL.X509StoreContext.verify_certificate`.

    :ivar certificate: The certificate which caused verificate failure.
    :type certificate: :class:`X509`
    c                ó@   •— t         ‰| �  |«       || _        || _        y r>   )r×   rz   ÚerrorsÚcertificate)ry   Úmessager  r  rÛ   s       €r:   rz   zX509StoreContextError.__init__¹  s!   ø€ ô 	‰Ñ˜Ô!ØˆŒØ&ˆÕr9   )r  rü   r  z	list[Any]r  r    rD   r„   )r4   r5   r6   r7   rz   rÿ   r   s   @r:   r&   r&   °  s2   ø„ ñð'Øð'Ø$-ð'Ø<@ð'à	÷'ñ 'r9   r&   c                  óv   — e Zd ZdZ	 d
	 	 	 	 	 	 	 dd„Ze	 	 	 	 dd„«       Zedd„«       Zdd„Zdd„Z	dd„Z
dd	„Zy)r%   a9  
    An X.509 store context.

    An X.509 store context is used to carry out the actual verification process
    of a certificate in a described context. For describing such a context, see
    :class:`X509Store`.

    :param X509Store store: The certificates which will be trusted for the
        purposes of any verifications.
    :param X509 certificate: The certificate to be verified.
    :param chain: List of untrusted certificates that may be used for building
        the certificate chain. May be ``None``.
    :type chain: :class:`list` of :class:`X509`
    Nc                óL   — || _         || _        | j                  |«      | _        y r>   )rò  Ú_certÚ_build_certificate_stackÚ_chain)ry   rô  r  Úchains       r:   rz   zX509StoreContext.__init__Ñ  s$   € ð ˆŒØ ˆŒ
Ø×3Ñ3°EÓ:ˆ�r9   c                ó  — dd„}| �t        | «      dk(  rt        j                  S t        j                  «       }t        |t        j                  k7  «       t        j                  ||«      }| D ]•  }t        |t        «      st        d«      ‚t        t        j                  |j                  «      dkD  «       t        j                  ||j                  «      dk  sŒmt        j                  |j                  «       t        «        Œ— |S )Nc                óÊ   — t        t        j                  | «      «      D ]-  }t        j                  | |«      }t        j                  |«       Œ/ t        j
                  | «       y r>   )r  r?   Úsk_X509_numÚsk_X509_valuerI  Úsk_X509_free)Úsr  Úxs      r:   Úcleanupz:X509StoreContext._build_certificate_stack.<locals>.cleanupß  sQ   € ô œ4×+Ñ+¨AÓ.Ó/ò "�Ü×&Ñ& q¨!Ó,�Ü—‘˜qÕ!ð"ô ×Ñ˜aÕ r9   r   z+One of the elements is not an X509 instance)r'  r   rD   r„   )rJ   rG   rL   r?   Úsk_X509_new_nullrK   rM   rW   r    rY   ÚX509_up_refrJ  Úsk_X509_pushrI  rÊ   )Úcertificatesr)  ÚstackrO  s       r:   r  z)X509StoreContext._build_certificate_stackÛ  sË   € ó	!ð Ð¤3 |Ó#4¸Ò#9Ü—9‘9Ðä×%Ñ%Ó'ˆÜ˜¤§¡Ñ*Ô+Ü—‘˜˜wÓ'ˆà ò 	'ˆDÜ˜d¤DÔ)ÜÐ MÓNÐNäœD×,Ñ,¨T¯Z©ZÓ8¸1Ñ<Ô=Ü× Ñ  ¨¯
©
Ó3°qÓ8Ü—‘˜tŸz™zÔ*Ü$Õ&ð	'ð ˆr9   c                ó„  — t        j                  t        j                  t        j                  | «      «      «      j                  d«      }t        j                  | «      t        j                  | «      |g}t        j                  | «      }t        j                  |«      }t        j                  |«      }t        |||«      S )zú
        Convert an OpenSSL native context error failure into a Python
        exception.

        When a call to native OpenSSL X509_verify_cert fails, additional
        information about the failure can be obtained from the store context.
        r  )rG   rj   r?   ÚX509_verify_cert_error_stringÚX509_STORE_CTX_get_errorrî   ÚX509_STORE_CTX_get_error_depthÚX509_STORE_CTX_get_current_certÚX509_dupr    rP  r&   )Ú	store_ctxr  r  rJ  r  Úpycerts         r:   Ú_exception_from_contextz(X509StoreContext._exception_from_contextù  s£   € ô —+‘+Ü×.Ñ.Ü×-Ñ-¨iÓ8óó
÷ ‰&�‹/ð	 	ô ×)Ñ)¨)Ó4Ü×/Ñ/°	Ó:Øð
ˆô ×4Ñ4°YÓ?ˆÜ—‘˜eÓ$ˆÜ×(Ñ(¨Ó/ˆÜ$ W¨f°fÓ=Ð=r9   c                ó´  — t        j                  «       }t        |t        j                  k7  «       t        j
                  |t         j                  «      }t        j                  || j                  j                  | j                  j                  | j                  «      }t        |dk(  «       t        j                  |«      }|dk  r| j                  |«      ‚|S )a3  
        Verifies the certificate and runs an X509_STORE_CTX containing the
        results.

        :raises X509StoreContextError: If an error occurred when validating a
          certificate in the context. Sets ``certificate`` attribute to
          indicate which certificate caused the error.
        r±   r   )r?   ÚX509_STORE_CTX_newrK   rG   rL   rM   ÚX509_STORE_CTX_freeÚX509_STORE_CTX_initrò  r  rJ  r   ÚX509_verify_certr7  )ry   r5  rc   s      r:   Ú_verify_certificatez$X509StoreContext._verify_certificate  s¦   € ô ×+Ñ+Ó-ˆ	Ü˜	¤T§Y¡YÑ.Ô/Ü—G‘G˜I¤t×'?Ñ'?Ó@ˆ	ä×&Ñ&Ø�t—{‘{×)Ñ)¨4¯:©:×+;Ñ+;¸T¿[¹[ó
ˆô 	˜˜q™Ô!ä×#Ñ# IÓ.ˆØ�!Š8Ø×.Ñ.¨yÓ9Ð9àÐr9   c                ó   — || _         y)zÖ
        Set the context's X.509 store.

        .. versionadded:: 0.15

        :param X509Store store: The store description which will be used for
            the purposes of any *future* verifications.
        N)rò  ró  s     r:   Ú	set_storezX509StoreContext.set_store+  s   € ð ˆ�r9   c                ó$   — | j                  «        y)a"  
        Verify a certificate in a context.

        .. versionadded:: 0.15

        :raises X509StoreContextError: If an error occurred when validating a
          certificate in the context. Sets ``certificate`` attribute to
          indicate which certificate caused the error.
        N)r=  rx   s    r:   Úverify_certificatez#X509StoreContext.verify_certificate6  s   € ð 	× Ñ Õ"r9   c                ó¬  — | j                  «       }t        j                  |«      }t        |t        j
                  k7  «       g }t        t        j                  |«      «      D ]Z  }t        j                  ||«      }t        |t        j
                  k7  «       t        j                  |«      }|j                  |«       Œ\ t        j                  |«       |S )aR  
        Verify a certificate in a context and return the complete validated
        chain.

        :raises X509StoreContextError: If an error occurred when validating a
          certificate in the context. Sets ``certificate`` attribute to
          indicate which certificate caused the error.

        .. versionadded:: 20.0
        )r=  r?   ÚX509_STORE_CTX_get1_chainrK   rG   rL   r  r$  r%  r    rP  r|   r&  )ry   r5  Ú
cert_stackrÁ   r  rO  r6  s          r:   Úget_verified_chainz#X509StoreContext.get_verified_chainB  s­   € ð ×,Ñ,Ó.ˆ	ô ×3Ñ3°IÓ>ˆ
Ü˜
¤d§i¡iÑ/Ô0àˆÜ”t×'Ñ'¨
Ó3Ó4ò 	"ˆAÜ×%Ñ% j°!Ó4ˆDÜ˜D¤D§I¡IÑ-Ô.Ü×,Ñ,¨TÓ2ˆFØ�M‰M˜&Õ!ð		"ô 	×Ñ˜*Ô%Øˆr9   r>   )rô  r$   r  r    r!  úSequence[X509] | NonerD   r„   )r-  rF  rD   r„   )r5  r   rD   r&   rþ   )rô  r$   rD   r„   rƒ   )rD   z
list[X509])r4   r5   r6   r7   rz   Ústaticmethodr  r7  r=  r?  rA  rE  r8   r9   r:   r%   r%   Á  sƒ   „ ñð& (,ð	;àð;ð ð;ð %ð	;ð
 
ó;ð ðØ+ðà	òó ðð: ò>ó ð>ó2ó0	ó
#ôr9   r%   c                óÈ  — t        |t        «      r|j                  d«      }t        |«      }| t        k(  rCt        j                  |t        j                  t        j                  t        j                  «      }n9| t        k(  r%t        j                  |t        j                  «      }nt        d«      ‚|t        j                  k(  r
t        «        t        j                  |«      S )a  
    Load a certificate (X509) from the string *buffer* encoded with the
    type *type*.

    :param type: The file type (one of FILETYPE_PEM, FILETYPE_ASN1)

    :param bytes buffer: The buffer the certificate is stored in

    :return: The X509 object
    rì   ú3type argument must be FILETYPE_PEM or FILETYPE_ASN1)rW   rü   r  rP   r   r?   ÚPEM_read_bio_X509rG   rL   r   Úd2i_X509_bior[   rÊ   r    rP  )r¾   rN   rA   r   s       r:   r-   r-   _  s�   € ô �&œ#ÔØ—‘˜wÓ'ˆä
�vÓ
€CàŒ|ÒÜ×%Ñ% c¬4¯9©9´d·i±iÄÇÁÓK‰Ø	”Ò	Ü× Ñ  ¤d§i¡iÓ0‰äÐNÓOÐOàŒt�y‰yÒÜÔä×"Ñ" 4Ó(Ð(r9   c                ó^  — t        «       }| t        k(  r!t        j                  ||j                  «      }na| t
        k(  r!t        j                  ||j                  «      }n7| t        k(  r#t        j                  ||j                  dd«      }nt        d«      ‚t        |dk(  «       t        |«      S )a  
    Dump the certificate *cert* into a buffer string encoded with the type
    *type*.

    :param type: The file type (one of FILETYPE_PEM, FILETYPE_ASN1, or
        FILETYPE_TEXT)
    :param cert: The certificate to dump
    :return: The buffer with the dumped certificate in
    r   úCtype argument must be FILETYPE_PEM, FILETYPE_ASN1, or FILETYPE_TEXTr±   )rP   r   r?   ÚPEM_write_bio_X509rJ  r   Úi2d_X509_bior   ÚX509_print_exr[   rK   rU   )r¾   rO  rA   Úresult_codes       r:   r(   r(   |  s•   € ô ‹.€CàŒ|ÒÜ×-Ñ-¨c°4·:±:Ó>‰Ø	”Ò	Ü×'Ñ'¨¨T¯Z©ZÓ8‰Ø	”Ò	Ü×(Ñ(¨¨d¯j©j¸!¸QÓ?‰äðó
ð 	
ô
 �K 1Ñ$Ô%Ü˜#ÓÐr9   c                óî   — t        «       }| t        k(  rt        j                  }n%| t        k(  rt        j
                  }nt        d«      ‚ |||j                  «      }|dk7  r
t        «        t        |«      S )zú
    Dump a public key to a buffer.

    :param type: The file type (one of :data:`FILETYPE_PEM` or
        :data:`FILETYPE_ASN1`).
    :param PKey pkey: The public key to dump
    :return: The buffer with the dumped key in it.
    :rtype: bytes
    rI  r±   )
rP   r   r?   ÚPEM_write_bio_PUBKEYr   Úi2d_PUBKEY_bior[   rŠ   rÊ   rU   )r¾   r�   rA   Ú	write_biorQ  s        r:   r*   r*   ˜  sf   € ô ‹.€CØŒ|ÒÜ×-Ñ-‰	Ø	”Ò	Ü×'Ñ'‰	äÐNÓOÐOá˜C §¡Ó,€KØ�aÒÜÔä˜#ÓÐr9   c           	     ó²  — t        «       }t        |t        «      st        d«      ‚|�I|€t        d«      ‚t	        j
                  t        |«      «      }|t        j                  k(  rt        d«      ‚t        j                  }t        | |«      }| t        k(  rXt	        j                  ||j                  |t        j                  d|j                  |j                  «      }|j!                  «        nÒ| t"        k(  r!t	        j$                  ||j                  «      }n¨| t&        k(  r”t	        j(                  |j                  «      t        j*                  k7  rt        d«      ‚t        j,                  t	        j.                  |j                  «      t        j0                  «      }t	        j2                  ||d«      }nt        d«      ‚t5        |dk7  «       t7        |«      S )aù  
    Dump the private key *pkey* into a buffer string encoded with the type
    *type*.  Optionally (if *type* is :const:`FILETYPE_PEM`) encrypting it
    using *cipher* and *passphrase*.

    :param type: The file type (one of :const:`FILETYPE_PEM`,
        :const:`FILETYPE_ASN1`, or :const:`FILETYPE_TEXT`)
    :param PKey pkey: The PKey to dump
    :param cipher: (optional) if encrypted PEM format, the cipher to use
    :param passphrase: (optional) if encrypted PEM format, this can be either
        the passphrase to use, or a callback for providing the passphrase.

    :return: The buffer with the dumped key in
    :rtype: bytes

    .. deprecated:: 26.3.0
       Use the serialization APIs on ``cryptography`` private key types
       instead.
    zpkey must be a PKeyzDif a value is given for cipher one must also be given for passphrasezInvalid cipher namer   z-Only RSA keys are supported for FILETYPE_TEXTrM  )rP   rW   r"   rY   r?   ÚEVP_get_cipherbynamer  rG   rL   r[   Ú_PassphraseHelperr   ÚPEM_write_bio_PrivateKeyrŠ   ÚcallbackÚcallback_argsÚraise_if_problemr   Úi2d_PrivateKey_bior   rÍ   rÆ   rM   rÇ   rÈ   Ú	RSA_printrK   rU   )	r¾   r�   ÚcipherÚ
passphraserA   Ú
cipher_objÚhelperrQ  r   s	            r:   r)   r)   ±  s€  € ô2 ‹.€Cä�dœDÔ!ÜÐ-Ó.Ð.àÐØÐÜð8óð ô ×.Ñ.¬|¸FÓ/CÓDˆ
ØœŸ™Ò"ÜÐ2Ó3Ð3ä—Y‘Yˆ
ä˜t ZÓ0€FØŒ|ÒÜ×3Ñ3ØØ�J‰JØÜ�I‰IØØ�O‰OØ× Ñ ó
ˆð 	×ÑÕ!Ø	”Ò	Ü×-Ñ-¨c°4·:±:Ó>‰Ø	”Ò	Ü×Ñ˜DŸJ™JÓ'¬4×+<Ñ+<Ò<ÜÐKÓLÐLä�g‰g”d×,Ñ,¨T¯Z©ZÓ8¼$¿-¹-ÓHˆÜ—n‘n S¨#¨qÓ1‰äðó
ð 	
ô
 �K 1Ñ$Ô%ä˜#ÓÐr9   zGdump_privatekey is deprecated. You should use the APIs in cryptography.r)   ró   c                  óx   — e Zd Z	 	 d	 	 	 	 	 	 	 	 	 dd„Zed	d„«       Zed	d„«       Zefd
d„Z	 	 	 	 	 	 	 	 	 	 dd„Z	y)rX  c                óh   — |t         k7  r|�t        d«      ‚|| _        || _        || _        g | _        y )Nz0only FILETYPE_PEM key format supports encryption)r   r[   Ú_passphraseÚ
_more_argsÚ	_truncateÚ	_problems)ry   r¾   r`  Ú	more_argsÚtruncates        r:   rz   z_PassphraseHelper.__init__	  s@   € ð ”<Ò JÐ$:ÜØBóð ð &ˆÔØ#ˆŒØ!ˆŒØ*,ˆ�r9   c                óî   — | j                   €t        j                  S t        | j                   t        «      st        | j                   «      r t        j                  d| j                  «      S t        d«      ‚)NÚpem_password_cbú2Last argument must be a byte string or a callable.)	re  rG   rL   rW   rX   ÚcallablerZ  Ú_read_passphraserY   rx   s    r:   rZ  z_PassphraseHelper.callback  s]   € à×ÑÐ#Ü—9‘9ÐÜ˜×(Ñ(¬%Ô0´H¸T×=MÑ=MÔ4NÜ—=‘=Ð!2°D×4IÑ4IÓJÐJäØDóð r9   c                óÎ   — | j                   €t        j                  S t        | j                   t        «      st        | j                   «      rt        j                  S t        d«      ‚)Nrm  )re  rG   rL   rW   rX   rn  rY   rx   s    r:   r[  z_PassphraseHelper.callback_args$  sO   € à×ÑÐ#Ü—9‘9ÐÜ˜×(Ñ(¬%Ô0´H¸T×=MÑ=MÔ4NÜ—9‘9ÐäØDóð r9   c                ó€   — | j                   r'	 t        |«       | j                   j                  d«      ‚y # |$ r Y Œ#w xY wr/  )rh  Ú_exception_from_error_queueÚpop)ry   ÚexceptionTypes     r:   r\  z"_PassphraseHelper.raise_if_problem/  sF   € Ø�>Š>ðÜ+¨MÔ:ð —.‘.×$Ñ$ QÓ'Ð'ð øð !ò Ùðús   Ž5 µ=¼=c                ó  — 	 t        | j                  «      r2| j                  r| j                  |||«      }n,| j                  |«      }n| j                  €J ‚| j                  }t        |t        «      st        d«      ‚t        |«      |kD  r| j                  r|d | }nt        d«      ‚t        t        |«      «      D ]  }|||dz    ||<   Œ t        |«      S # t        $ r%}| j                  j                  |«       Y d }~yd }~ww xY w)NzBytes expectedz+passphrase returned by callback is too longr±   r   )rn  re  rf  rW   rX   r[   rJ   rg  r  Ú	Exceptionrh  r|   )ry   ÚbufÚsizeÚrwflagÚuserdatarÁ   r  Úes           r:   ro  z"_PassphraseHelper._read_passphrase9  sþ   € ð	Ü˜×(Ñ(Ô)Ø—?’?Ø!×-Ñ-¨d°F¸HÓE‘Fà!×-Ñ-¨fÓ5‘Fà×'Ñ'Ð3Ð3Ð3Ø×)Ñ)�Ü˜f¤eÔ,Ü Ð!1Ó2Ð2Ü�6‹{˜TÒ!Ø—>’>Ø# E T˜]‘Fä$ØEóð ô œ3˜v›;Ó'ò +�Ø  A¨¡EÐ*��A’ð+ä�v“;ÐøÜò 	Ø�N‰N×!Ñ! !Ô$Üûð	ús   ‚CC Ã	DÃ!DÄDN)FF)
r¾   r0   r`  úPassphraseCallableT | Noneri  rÑ   rj  rÑ   rD   r„   rþ   )rt  ztype[Exception]rD   r„   )
rw  r   rx  r0   ry  r   rz  r   rD   r0   )
r4   r5   r6   rz   ÚpropertyrZ  r[  r!   r\  ro  r8   r9   r:   rX  rX    s    „ ð
  Øð-àð-ð /ð-ð ð	-ð
 ð-ð 
ó-ð  òó ðð òó ðð AFô (ðØðØ!ðØ+.ðØ:=ðà	ôr9   rX  c                ó4  — t        |t        «      r|j                  d«      }t        |«      }| t        k(  rCt        j                  |t        j                  t        j                  t        j                  «      }n9| t        k(  r%t        j                  |t        j                  «      }nt        d«      ‚|t        j                  k(  r
t        «        t        j                  t        «      }t        j                  |t
        j                   «      |_        d|_        |S )a<  
    Load a public key from a buffer.

    :param type: The file type (one of :data:`FILETYPE_PEM`,
        :data:`FILETYPE_ASN1`).
    :param buffer: The buffer the key is stored in.
    :type buffer: A Python string object, either unicode or bytestring.
    :return: The PKey object.
    :rtype: :class:`PKey`
    rì   rI  T)rW   rü   r  rP   r   r?   ÚPEM_read_bio_PUBKEYrG   rL   r   Úd2i_PUBKEY_bior[   rÊ   r"   rN  rM   r‰   rŠ   r“   )r¾   rN   rA   Úevp_pkeyr�   s        r:   r/   r/   V  sÄ   € ô �&œ#ÔØ—‘˜wÓ'ˆä
�vÓ
€CàŒ|ÒÜ×+Ñ+Ø”—‘œDŸI™I¤t§y¡yó
‰ð 
”Ò	Ü×&Ñ& s¬D¯I©IÓ6‰äÐNÓOÐOà”4—9‘9ÒÜÔä�<‰<œÓ€DÜ—‘˜¤4×#5Ñ#5Ó6€D„JØ€DÔØ€Kr9   c                óN  — t        |t        «      r|j                  d«      }t        |«      }t	        | |«      }| t
        k(  rKt        j                  |t        j                  |j                  |j                  «      }|j                  «        n9| t        k(  r%t        j                  |t        j                  «      }nt        d«      ‚|t        j                  k(  r
t!        «        t"        j%                  t"        «      }t        j&                  |t        j(                  «      |_        |S )a³  
    Load a private key (PKey) from the string *buffer* encoded with the type
    *type*.

    :param type: The file type (one of FILETYPE_PEM, FILETYPE_ASN1)
    :param buffer: The buffer the key is stored in
    :param passphrase: (optional) if encrypted PEM format, this can be
                       either the passphrase to use, or a callback for
                       providing the passphrase.

    :return: The PKey object
    rì   rI  )rW   rü   r  rP   rX  r   r?   ÚPEM_read_bio_PrivateKeyrG   rL   rZ  r[  r\  r   Úd2i_PrivateKey_bior[   rÊ   r"   rN  rM   r‰   rŠ   )r¾   rN   r`  rA   rb  r�  r�   s          r:   r.   r.   x  sÖ   € ô" �&œ#ÔØ—‘˜wÓ'ˆä
�vÓ
€Cä˜t ZÓ0€FØŒ|ÒÜ×/Ñ/Ø”—‘˜FŸO™O¨V×-AÑ-Aó
ˆð 	×ÑÕ!Ø	”Ò	Ü×*Ñ*¨3´·	±	Ó:‰äÐNÓOÐOà”4—9‘9ÒÜÔä�<‰<œÓ€DÜ—‘˜¤4×#5Ñ#5Ó6€D„JØ€Kr9   r>   )rN   r×  rD   r   )rA   r   rD   rX   )r\   r   r]   rX   rD   r„   )r]   rX   rD   r   )rn   r   rD   r×  )rD   rû   )r~   rü   rD   rÕ   )r¾   r0   rN   rX   rD   r    )r¾   r0   rO  r    rD   rX   )r¾   r0   r�   r"   rD   rX   )NN)
r¾   r0   r�   r"   r_  rD  r`  r|  rD   rX   )r¾   r0   rN   ústr | bytesrD   r"   )r¾   r0   rN   r…  r`  r|  rD   r"   )gÚ
__future__r   r  r¦  Ú	functoolsÚsysr”   Úbase64r   Úcollections.abcr   r   r   r   r	   Úversion_infoÚwarningsr   Útyping_extensionsÚcryptographyr   r   Ú)cryptography.hazmat.primitives.asymmetricr   r   r   r   r   ÚOpenSSL._utilr   r   r  r   rr  r   rG   r   r?   r   Ú_make_assertr   r  Ú__all__rž   r    r¢   r¤   r¦   Ú_PrivateKeyrŸ   r¡   r£   r¥   r§   Ú
_PublicKeyr•   rX   ÚPassphraseCallableTÚSSL_FILETYPE_PEMr   rä  ÚSSL_FILETYPE_ASN1r   r   rÆ   r   ÚEVP_PKEY_DSAr   ÚEVP_PKEY_DHr1   ÚEVP_PKEY_ECr2   rv  r!   rÊ   rK   rP   rU   r_   rd   rs   ru   r"   rÕ   r,   r+   Útotal_orderingr#   r    r'   r$   r&   r%   r-   r(   r*   r)   r–   r4   ÚDeprecationWarningrX  r/   r.   r8   r9   r:   ú<module>r�     sV  ðÞ "ã Û Û Û 
Û Ý Ý $Ý ÷ñ ð ×Ñ�wÒÞ#å,ç $÷õ õ )õõõõõõò€ð2 Ø×ÑØ×ÑØ×ÑØ	×ÑØ×Ñð	ñ€ð Ø×ÑØ×ÑØ×ÑØ	×ÑØ×Ñð	ñ€
ð ˆ[˜*Ð$Ñ%€Ø˜E 8¨C°¨JÑ#7Ð7Ñ8Ð ð ×)Ñ)€ˆcÓ )Ø×+Ñ+€ˆsÓ +ð €à×!Ñ!€ˆ#Ó !Ø×!Ñ!€ˆ#Ó !Ø×Ñ€ˆÓ Ø×Ñ€ˆÓ ôˆIô ñ Ð:¸EÓBÐ Ù˜uÓ%€ôó4;ó+ó2ó&÷:
ñ 
÷F.ñ F.÷Rd.ñ d.ñN ðóò5ó	ð5ñ ðóò1ó	ð1ñ$ ðóð ×Ñ÷ð ó ó	ð
÷D_3ñ _3÷D8ñ 8÷.g#ñ g#ôT'˜Iô '÷"[ñ [ó|)ó:ó8ð8 Ø-1ð	FØ
ðFà
ðFð ðFð +ð	Fð
 óFðR ,Ð à €× Ñ ØØð	ð Ø	õ	÷Kñ Kó\ðJ .2ð&Ø
ð&àð&ð +ð&ð 
ô	&r9   