o
    ib                     @  sH  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mZmZ d dl	m
Z
mZmZmZmZmZmZmZ 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mZmZmZm Z  zd d	l!m"Z"m#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-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4 d dl5m6Z6m7Z7 d dl8m9Z9m:Z: d dl;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZC d dlDmEZEmFZFmGZGmHZHmIZImJZJmKZK e<e>fZLe1e3fZMe9e:e6e7fZNeLeM eN ZOe<e1e9e6fZPe>e3e:e7fZQe
seReSddrLd dlTZTeTjUdkrd dl	mVZV nd dlWmVZV d dlXmYZYmZZZ ee<e>f Z[de\d< ee1e3f Z]de\d< ee9e:e6e7f Z^de\d< ee[e]e^f Z_de\d< ee<e1e9e6f Z`de\d< ee>e3e:e7f Zade\d< dZbW n ecy[   dZbY nw h d Zdd3d#d$ZeG d%d& d&eZfG d'd( d(efZgG d)d* d*efZhebrG d+d, d,efZiG d-d. d.efZjG d/d0 d0eiZkG d1d2 d2efZldS dS )4    )annotationsN)ABCabstractmethod)TYPE_CHECKINGAnyClassVarLiteralNoReturnUnioncastoverload   InvalidKeyError)HashlibHashJWKDict)	base64url_decodebase64url_encodeder_to_raw_signatureforce_bytesfrom_base64url_uintis_pem_format
is_ssh_keyraw_to_der_signatureto_base64url_uint)InvalidSignatureUnsupportedAlgorithm)default_backend)hashes)padding)
ECDSA	SECP256K1	SECP256R1	SECP384R1	SECP521R1EllipticCurveEllipticCurvePrivateKeyEllipticCurvePrivateNumbersEllipticCurvePublicKeyEllipticCurvePublicNumbers)Ed448PrivateKeyEd448PublicKey)Ed25519PrivateKeyEd25519PublicKey)RSAPrivateKeyRSAPrivateNumbersRSAPublicKeyRSAPublicNumbersrsa_crt_dmp1rsa_crt_dmq1rsa_crt_iqmprsa_recover_prime_factors)EncodingNoEncryptionPrivateFormatPublicFormatload_pem_private_keyload_pem_public_keyload_ssh_public_keyZSPHINX_BUILD )   
   )	TypeAlias)PrivateKeyTypesPublicKeyTypesr@   AllowedRSAKeysAllowedECKeysAllowedOKPKeysAllowedKeysAllowedPrivateKeysAllowedPublicKeysTF>   RS512RS384RS256ES384ES256KPS384ES256ES521PS256PS512EdDSAES512returndict[str, Algorithm]c                  C  s   t  ttjttjttjd} trL| ttjttjttjttjt	ttjt
ttjtttjtttjtttjttjttjt d | S )zE
    Returns the algorithms that are implemented by the library.
    )noneZHS256ZHS384ZHS512)rK   rJ   rI   rO   rM   rL   rP   rT   rQ   rN   rR   rS   )NoneAlgorithmHMACAlgorithmSHA256SHA384SHA512
has_cryptoupdateRSAAlgorithmECAlgorithmr"   r!   r#   r$   RSAPSSAlgorithmOKPAlgorithm)Zdefault_algorithms rc   E/home/app/Keep/.python/lib/python3.10/site-packages/jwt/algorithms.pyget_default_algorithms   s0   



re   c                   @  s   e Zd ZU dZdZded< d,dd	Zd-ddZed.ddZ	ed/ddZ
ed0ddZeeed1ddZeee	d2d3d"dZeed2d4d$dZeed5d'd(Zd6d*d+ZdS )7	AlgorithmzH
    The interface for an algorithm used to sign and verify tokens.
    Nz$tuple[type[AllowedKeys], ...] | None_crypto_key_typesbytestrbytesrU   c                 C  sj   t | dd}|du rttr-t|tr-t|tjr-tj| t	 d}|
| t| S t|| S )z
        Compute a hash digest using the specified algorithm's hash algorithm.

        If there is no hash algorithm, raises a NotImplementedError.
        hash_algN)backend)getattrNotImplementedErrorr]   
isinstancetype
issubclassr   ZHashAlgorithmZHashr   r^   ri   finalizedigest)selfrh   rj   rr   rc   rc   rd   compute_hash_digest   s   

zAlgorithm.compute_hash_digestkey PublicKeyTypes | PrivateKeyTypesNonec                 C  s`   t r| jdu rtdt|| js.dd | jD }|jj}| jj}td| d| d| dS )ac  Check that the key belongs to the right cryptographic family.

        Note that this method only works when ``cryptography`` is installed.

        :param key: Potentially a cryptography key
        :type key: :py:data:`PublicKeyTypes <cryptography.hazmat.primitives.asymmetric.types.PublicKeyTypes>` | :py:data:`PrivateKeyTypes <cryptography.hazmat.primitives.asymmetric.types.PrivateKeyTypes>`
        :raises ValueError: if ``cryptography`` is not installed, or this method is called by a non-cryptography algorithm
        :raises InvalidKeyError: if the key doesn't match the expected key classes
        NzhThis method requires the cryptography library, and should only be used by cryptography-based algorithms.c                 s  s    | ]}|j V  qd S N)__name__).0clsrc   rc   rd   	<genexpr>   s    z2Algorithm.check_crypto_key_type.<locals>.<genexpr>zExpected one of z, got: z. Invalid Key type for )r]   rg   
ValueErrorrn   	__class__ry   r   )rs   ru   Zvalid_classesZactual_classZ
self_classrc   rc   rd   check_crypto_key_type   s   
zAlgorithm.check_crypto_key_typer   c                 C     dS )z
        Performs necessary validation and conversions on the key and returns
        the key value in the proper format for sign() and verify().
        Nrc   rs   ru   rc   rc   rd   prepare_key       zAlgorithm.prepare_keymsgc                 C  r   )zn
        Returns a digital signature for the specified message
        using the specified key value.
        Nrc   rs   r   ru   rc   rc   rd   sign   r   zAlgorithm.signsigboolc                 C  r   )zz
        Verifies that the specified digital signature is valid
        for the specified message and key values.
        Nrc   rs   r   ru   r   rc   rc   rd   verify  r   zAlgorithm.verifykey_objas_dictLiteral[True]r   c                 C     d S rx   rc   r   r   rc   rc   rd   to_jwk	  s   zAlgorithm.to_jwkFLiteral[False]strc                 C  r   rx   rc   r   rc   rc   rd   r        JWKDict | strc                 C  r   )z3
        Serializes a given key into a JWK
        Nrc   r   rc   rc   rd   r     r   jwkstr | JWKDictc                 C  r   )zJ
        Deserializes a given key from JWK back into a key object
        Nrc   r   rc   rc   rd   from_jwk  r   zAlgorithm.from_jwk
str | Nonec                 C  r   )z
        Return a warning message if the key is below the minimum
        recommended length for this algorithm, or None if adequate.
        Nrc   r   rc   rc   rd   check_key_length#  r   zAlgorithm.check_key_length)rh   ri   rU   ri   )ru   rv   rU   rw   )ru   r   rU   r   )r   ri   ru   r   rU   ri   )r   ri   ru   r   r   ri   rU   r   )r   r   r   r   rU   r   F)r   r   r   r   rU   r   )r   r   r   r   rU   r   )r   r   rU   r   )ru   r   rU   r   )ry   
__module____qualname____doc__rg   __annotations__rt   r   r   r   r   r   r   staticmethodr   r   r   rc   rc   rc   rd   rf      s6   
 

rf   c                   @  sL   e Zd ZdZdddZdd
dZdddZedd ddZed!ddZ	dS )"rX   zZ
    Placeholder for use when no signing or verification
    operations are required.
    ru   r   rU   rw   c                 C  s    |dkrd }|d urt d|S )Nr=   z*When alg = "none", key value must be None.r   r   rc   rc   rd   r   1  s
   zNoneAlgorithm.prepare_keyr   ri   c                 C  r   )N    rc   r   rc   rc   rd   r   :     zNoneAlgorithm.signr   r   c                 C  r   )NFrc   r   rc   rc   rd   r   =  r   zNoneAlgorithm.verifyFr   r   r   r	   c                 C     t  rx   rm   r   rc   rc   rd   r   @     zNoneAlgorithm.to_jwkr   r   c                 C  r   rx   r   r   rc   rc   rd   r   D  r   zNoneAlgorithm.from_jwkN)ru   r   rU   rw   )r   ri   ru   rw   rU   ri   )r   ri   ru   rw   r   ri   rU   r   r   )r   r   r   r   rU   r	   )r   r   rU   r	   )
ry   r   r   r   r   r   r   r   r   r   rc   rc   rc   rd   rX   +  s    

	
rX   c                   @  s   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< d,d
dZd-ddZeed.ddZeed/d0ddZed/d1ddZed2d d!Zd3d#d$Zd4d&d'Zd5d)d*Zd+S )6rY   zf
    Performs signing and verification operations using HMAC
    and the specified hash function.
    zClassVar[HashlibHash]rZ   r[   r\   rj   r   rU   rw   c                 C  
   || _ d S rx   rj   rs   rj   rc   rc   rd   __init__S     
zHMACAlgorithm.__init__ru   str | bytesri   c                 C  s$   t |}t|st|rtd|S )NzdThe specified key is an asymmetric key or x509 certificate and should not be used as an HMAC secret.)r   r   r   r   )rs   ru   	key_bytesrc   rc   rd   r   V  s   zHMACAlgorithm.prepare_keyr   r   r   r   c                 C  r   rx   rc   r   rc   rc   rd   r   a     zHMACAlgorithm.to_jwkFr   r   c                 C  r   rx   rc   r   rc   rc   rd   r   e  r   r   r   c                 C  s(   t t|  dd}|r|S t|S )Noct)kkty)r   r   decodejsondumps)r   r   r   rc   rc   rd   r   i  s   
r   r   c                 C  sj   zt | trt| }n
t | tr| }ntW n ty#   tdd w |ddkr/tdt|d S )NKey is not valid JSONr   r   zNot an HMAC keyr   )	rn   r   r   loadsdictr}   r   getr   )r   objrc   rc   rd   r   u  s   


zHMACAlgorithm.from_jwkr   c                 C  s@   |   j}t||k rdt| d| d|   j  dS d S )NzThe HMAC key is z> bytes long, which is below the minimum recommended length of z bytes for z. See RFC 7518 Section 3.2.)rj   digest_sizelennameupper)rs   ru   
min_lengthrc   rc   rd   r     s   
zHMACAlgorithm.check_key_lengthr   c                 C  s   t ||| j S rx   )hmacnewrj   rr   r   rc   rc   rd   r        zHMACAlgorithm.signr   c                 C  s   t || ||S rx   )r   compare_digestr   r   rc   rc   rd   r     r   zHMACAlgorithm.verifyN)rj   r   rU   rw   )ru   r   rU   ri   )r   r   r   r   rU   r   r   )r   r   r   r   rU   r   )r   r   r   r   rU   r   )r   r   rU   ri   )ru   ri   rU   r   )r   ri   ru   ri   rU   ri   )r   ri   ru   ri   r   ri   rU   r   )ry   r   r   r   hashlibsha256rZ   r   sha384r[   sha512r\   r   r   r   r   r   r   r   r   r   rc   rc   rc   rd   rY   I  s(   
 



rY   c                   @  s   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	Z
dZded< d2ddZd3ddZd4ddZeed5ddZeed6d7d dZed6d8d#dZed9d&d'Zd:d+d,Zd;d/d0Zd1S )<r_   z~
        Performs signing and verification operations using
        RSASSA-PKCS-v1_5 and the specified hash function.
        $ClassVar[type[hashes.HashAlgorithm]]rZ   r[   r\   i   zClassVar[int]_MIN_KEY_SIZErj   type[hashes.HashAlgorithm]rU   rw   c                 C  r   rx   r   r   rc   rc   rd   r     r   zRSAAlgorithm.__init__ru   rC   r   c                 C  s&   |j | jk rd|j  d| j dS d S )NzThe RSA key is z; bits long, which is below the minimum recommended size of z bits. See NIST SP 800-131A.)key_sizer   r   rc   rc   rd   r     s   
zRSAAlgorithm.check_key_lengthAllowedRSAKeys | str | bytesc                 C  s   t || jr|S t |ttfstdt|}z%|dr,t|}| | t	t
|W S t|d d}| | t	t|W S  tyc   zt|}| | t	t
|W  Y S  ttfyb   tdd w w )NExpecting a PEM-formatted key.s   ssh-rsapasswordz(Could not parse the provided public key.)rn   rg   ri   r   	TypeErrorr   
startswithr<   r   r   r0   r:   r.   r}   r;   r   r   )rs   ru   r   
public_keyprivate_keyrc   rc   rd   r     s8   



zRSAAlgorithm.prepare_keyr   r   r   r   c                 C  r   rx   rc   r   rc   rc   rd   r     r   zRSAAlgorithm.to_jwkFr   r   c                 C  r   rx   rc   r   rc   rc   rd   r     r   r   r   c                 C  s   d }t | drD|  }ddgt|jj t|jj t|j t|j t|j	 t|j
 t|j t|j d
}n t | dr`|  }ddgt|j t|j d}ntd|rh|S t|S )Nprivate_numbersRSAr   )
r   key_opsnedpqdpdqqir   )r   r   r   r   Not a public or private key)hasattrr   r   public_numbersr   r   r   r   r   r   dmp1dmq1iqmpr   r   r   )r   r   r   numbersrc   rc   rd   r     s2   


r   r   c           	   	     s  zt | trt|  n
t | tr|  ntW n ty#   tdd w  ddkr0tdd d v rd v rd v rd v rDtd	g d
} fdd|D }t|}|r`t	|s`tdd t
t d t d }|rtt d t d t d t d t d t d |d}| S t d }t|j||j\}}t|||t||t||t|||d}| S d v rd v rt
t d t d  S td)Nr   r   r   zNot an RSA keyr   r   r   Zothz5Unsupported RSA private key: > 2 primes not supported)r   r   r   r   r   c                   s   g | ]}| v qS rc   rc   )rz   propr   rc   rd   
<listcomp>  s    z)RSAAlgorithm.from_jwk.<locals>.<listcomp>z@RSA key must include all parameters if any are present besides dr   r   r   r   r   )r   r   r   r   r   r   r   r   )rn   r   r   r   r   r}   r   r   anyallr1   r   r/   r5   r   r   r2   r3   r4   r   r   )	r   Zother_propsZprops_foundZany_props_foundr   r   r   r   r   rc   r   rd   r      s~   















zRSAAlgorithm.from_jwkr   ri   r.   c                 C  s   | |t |  }|S rx   )r   r   PKCS1v15rj   rs   r   ru   	signaturerc   rc   rd   r   H  s   zRSAAlgorithm.signr0   r   c                 C  s4   z| ||t |   W dS  ty   Y dS w )NTF)r   r   r   rj   r   r   rc   rc   rd   r   L  s   zRSAAlgorithm.verifyN)rj   r   rU   rw   )ru   rC   rU   r   )ru   r   rU   rC   )r   rC   r   r   rU   r   r   )r   rC   r   r   rU   r   )r   rC   r   r   rU   r   )r   r   rU   rC   r   ri   ru   r.   rU   ri   r   ri   ru   r0   r   ri   rU   r   )ry   r   r   r   r   rZ   r   r[   r\   ALLOWED_RSA_KEY_TYPESrg   r   r   r   r   r   r   r   r   r   r   rc   rc   rc   rd   r_     s,   
 


	&
Gr_   c                   @  s   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	Z
	d/d0ddZd1ddZd2ddZd3ddZd4ddZeed5d#d$Zeed6d7d(d$Zed6d8d*d$Zed9d-d.ZdS ):r`   zr
        Performs signing and verification operations using
        ECDSA and the specified hash function
        r   rZ   r[   r\   Nrj   r   expected_curvetype[EllipticCurve] | NonerU   rw   c                 C  s   || _ || _d S rx   )rj   r   )rs   rj   r   rc   rc   rd   r   _  s   
zECAlgorithm.__init__ru   rD   c                 C  s>   | j du rdS t|j| j std|jj d| j j ddS )z9Validate that the key's curve matches the expected curve.NzThe key's curve 'z%' does not match the expected curve 'z' for this algorithm)r   rn   curver   r   r   rc   rc   rd   _validate_curveg  s   
zECAlgorithm._validate_curveAllowedECKeys | str | bytesc                 C  s   t || jr| | |S t |ttfstdt|}z |dr't|}nt	|}| 
| tt|}| | |W S  ty\   t|d d}| 
| tt|}| | | Y S w )Nr   s   ecdsa-sha2-r   )rn   rg   r   ri   r   r   r   r   r<   r;   r   r   r(   r}   r:   r&   )rs   ru   r   r   Zec_public_keyr   Zec_private_keyrc   rc   rd   r   r  s*   








zECAlgorithm.prepare_keyr   ri   r&   c                 C  s    | |t|  }t||jS rx   )r   r    rj   r   r   )rs   r   ru   der_sigrc   rc   rd   r     s   zECAlgorithm.signr   r   c                 C  sn   zt ||j}W n
 ty   Y dS w zt|tr| n|}|||t|   W dS  t	y6   Y dS w )NFT)
r   r   r}   rn   r&   r   r   r    rj   r   )rs   r   ru   r   r   r   rc   rc   rd   r     s   
zECAlgorithm.verifyr   r   r   r   c                 C  r   rx   rc   r   rc   rc   rd   r     r   zECAlgorithm.to_jwkFr   r   c                 C  r   rx   rc   r   rc   rc   rd   r     r   r   c                 C  s   t | tr|   }nt | tr|  }ntdt | jtr#d}n#t | jtr,d}nt | jt	r5d}nt | jt
r>d}ntd| j d|t|j| jjd t|j| jjd d	}t | trst|  j| jjd |d
< |rw|S t|S )Nr   P-256P-384P-521	secp256k1Invalid curve: EC)
bit_length)r   crvxyr   )rn   r&   r   r   r(   r   r   r"   r#   r$   r!   r   r   r   r   r   r   Zprivate_valuer   r   )r   r   r   r   r   rc   rc   rd   r     sJ   




r   r   c                 C  s  zt | trt| }n
t | tr| }ntW n ty#   tdd w |ddkr0tdd d|vs8d|vr=tdd t|d}t|d}|d}|dkrmt	|t	|  krbd	krhn nt
 }netd
d |dkrt	|t	|  krdkrn nt }nHtdd |dkrt	|t	|  krdkrn nt }n+tdd |dkrt	|t	|  krd	krn tdt }ntdtd| ttj|ddtj|dd|d}d|vr| S t|d}t	|t	|krtdt	||ttj|dd| S )Nr   r   r   zNot an Elliptic curve keyr   r   r   r       z)Coords should be 32 bytes for curve P-256r   0   z)Coords should be 48 bytes for curve P-384r   B   z)Coords should be 66 bytes for curve P-521r   z-Coords should be 32 bytes for curve secp256k1r   big)	byteorder)r   r   r   r   z!D should be {} bytes for curve {})rn   r   r   r   r   r}   r   r   r   r   r"   r#   r$   r!   r)   int
from_bytesr   r'   r   )r   r   r   r   r   Z	curve_objr   r   rc   rc   rd   r     s   





   
zECAlgorithm.from_jwkrx   )rj   r   r   r   rU   rw   )ru   rD   rU   rw   )ru   r   rU   rD   )r   ri   ru   r&   rU   ri   )r   ri   ru   rD   r   ri   rU   r   )r   rD   r   r   rU   r   r   )r   rD   r   r   rU   r   )r   rD   r   r   rU   r   )r   r   rU   rD   )ry   r   r   r   r   rZ   r   r[   r\   ALLOWED_EC_KEY_TYPESrg   r   r   r   r   r   r   r   r   r   rc   rc   rc   rd   r`   S  s,   
 



+r`   c                   @  s$   e Zd ZdZdddZdddZdS )ra   zA
        Performs a signature using RSASSA-PSS with MGF1
        r   ri   ru   r.   rU   c                 C  s0   | |tjt|  |  jd|  }|S )NZmgfZsalt_length)r   r   PSSMGF1rj   r   r   rc   rc   rd   r   *  s   zRSAPSSAlgorithm.signr0   r   r   c              	   C  sJ   z| ||tjt|  |  jd|   W dS  ty$   Y dS w )Nr  TF)r   r   r  r	  rj   r   r   r   rc   rc   rd   r   5  s   	zRSAPSSAlgorithm.verifyNr   r   )ry   r   r   r   r   r   rc   rc   rc   rd   ra   %  s    
ra   c                   @  s   e Zd ZdZeZd'ddZd(ddZd)ddZd*ddZ	e
ed+ddZe
ed,d-ddZed,d.d!dZed/d$d%Zd&S )0rb   z
        Performs signing and verification operations using EdDSA

        This class requires ``cryptography>=2.6`` to be installed.
        kwargsr   rU   rw   c                 K  r   rx   rc   )rs   r
  rc   rc   rd   r   M  r   zOKPAlgorithm.__init__ru   AllowedOKPKeys | str | bytesrE   c                 C  s   t |ttfs| | |S t |tr|dn|}t |tr$|dn|}d|v r/t|}nd|v r:t|d d}n|dd dkrGt|}nt	d| | t
d	|S )
Nutf-8z-----BEGIN PUBLICz-----BEGIN PRIVATEr   r      zssh-r   rE   )rn   r   ri   r   r   encoder;   r:   r<   r   r   )rs   ru   Zkey_strr   Z
loaded_keyrc   rc   rd   r   P  s   




zOKPAlgorithm.prepare_keyr   r   #Ed25519PrivateKey | Ed448PrivateKeyri   c                 C  s&   t |tr
|dn|}||}|S )aS  
            Sign a message ``msg`` using the EdDSA private key ``key``
            :param str|bytes msg: Message to sign
            :param Ed25519PrivateKey}Ed448PrivateKey key: A :class:`.Ed25519PrivateKey`
                or :class:`.Ed448PrivateKey` isinstance
            :return bytes signature: The signature, as bytes
            r  )rn   r   r  r   )rs   r   ru   	msg_bytesr   rc   rc   rd   r   f  s   

zOKPAlgorithm.signr   r   c                 C  sr   z.t |tr|dn|}t |tr|dn|}t |ttfr$| n|}||| W dS  ty8   Y dS w )a  
            Verify a given ``msg`` against a signature ``sig`` using the EdDSA key ``key``

            :param str|bytes sig: EdDSA signature to check ``msg`` against
            :param str|bytes msg: Message to sign
            :param Ed25519PrivateKey|Ed25519PublicKey|Ed448PrivateKey|Ed448PublicKey key:
                A private or public EdDSA key instance
            :return bool verified: True if signature is valid, False if not.
            r  TF)rn   r   r  r,   r*   r   r   r   )rs   r   ru   r   r  Z	sig_bytesr   rc   rc   rd   r   t  s   
zOKPAlgorithm.verifyr   r   r   c                 C  r   rx   rc   ru   r   rc   rc   rd   r     r   zOKPAlgorithm.to_jwkFr   r   c                 C  r   rx   rc   r  rc   rc   rd   r     r   r   c                 C  s   t | ttfr.| jtjtjd}t | trdnd}tt|	 d|d}|r)|S t
|S t | ttfrp| jtjtjt d}|  jtjtjd}t | trRdnd}tt|	 tt|	 d|d}|rk|S t
|S td)	N)encodingformatEd25519Ed448OKP)r   r   r   )r  r  Zencryption_algorithm)r   r   r   r   r   )rn   r-   r+   public_bytesr6   ZRawr9   r   r   r   r   r   r,   r*   Zprivate_bytesr8   r7   r   r   )ru   r   r   r   r   r   rc   rc   rd   r     sB   

r   r   c              
   C  s  zt | trt| }n
t | tr| }ntW n ty#   tdd w |ddkr/td|d}|dkrC|dkrCtd| d	|vrKtd
t|d	}z+d|vrg|dkrat	
|W S t
|W S t|d}|dkrxt|W S t|W S  ty } ztd|d }~ww )Nr   r   r  zNot an Octet Key Pairr   r  r  r   r   zOKP should have "x" parameterr   zInvalid key parameter)rn   r   r   r   r   r}   r   r   r   r-   Zfrom_public_bytesr+   r,   Zfrom_private_bytesr*   )r   r   r   r   r   errrc   rc   rd   r     s>   




zOKPAlgorithm.from_jwkN)r
  r   rU   rw   )ru   r  rU   rE   )r   r   ru   r  rU   ri   )r   r   ru   rE   r   r   rU   r   )ru   rE   r   r   rU   r   r   )ru   rE   r   r   rU   r   )ru   rE   r   r   rU   r   )r   r   rU   rE   )ry   r   r   r   ALLOWED_OKP_KEY_TYPESrg   r   r   r   r   r   r   r   r   rc   rc   rc   rd   rb   D  s"    



.rb   )rU   rV   )m
__future__r   r   r   r   osabcr   r   typingr   r   r   r   r	   r
   r   r   
exceptionsr   typesr   r   utilsr   r   r   r   r   r   r   r   r   Zcryptography.exceptionsr   r   Zcryptography.hazmat.backendsr   Zcryptography.hazmat.primitivesr   Z)cryptography.hazmat.primitives.asymmetricr   Z,cryptography.hazmat.primitives.asymmetric.ecr    r!   r"   r#   r$   r%   r&   r'   r(   r)   Z/cryptography.hazmat.primitives.asymmetric.ed448r*   r+   Z1cryptography.hazmat.primitives.asymmetric.ed25519r,   r-   Z-cryptography.hazmat.primitives.asymmetric.rsar.   r/   r0   r1   r2   r3   r4   r5   Z,cryptography.hazmat.primitives.serializationr6   r7   r8   r9   r:   r;   r<   r   r  r  ZALLOWED_KEY_TYPESZALLOWED_PRIVATE_KEY_TYPESZALLOWED_PUBLIC_KEY_TYPESr   getenvsysversion_infor@   Ztyping_extensionsZ/cryptography.hazmat.primitives.asymmetric.typesrA   rB   rC   r   rD   rE   rF   rG   rH   r]   ModuleNotFoundErrorZrequires_cryptographyre   rf   rX   rY   r_   r`   ra   rb   rc   rc   rc   rd   <module>   s    (,0($






"lO : S   