+
    ^eòjsy  ã                   óô   € . ROt ^ RIt^ RIt^ RIHt ^ RIHtHtHt ^ RI	H
t
Ht ^ RIHt ^ RIHt ^ RIHtHtHt ^ R	IHtHtHt  ! R
 R]4      tRR ltRR ltR tR tR tR tR t R t!R t"RR lt#]#t$Rt%R# )ÚgenerateÚRsaKeyN)ÚRandom)ÚtobytesÚbordÚtostr)ÚDerSequenceÚDerNull)Úbytes_to_long)ÚInteger)Útest_probable_primeÚgenerate_probable_primeÚ	COMPOSITE)Ú_expand_subject_public_key_infoÚ_create_subject_public_key_infoÚ _extract_subject_public_key_infoc                   ó^  a € ] tR t^4t o RtR t]R 4       t]R 4       t]R 4       t	]R 4       t
]R 4       t]R 4       t]R	 4       t]R
 4       t]R 4       t]R 4       tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR'R ltR t R t!R t"R  t#R! t$R" t%R# t&R$ t'R% t(R&t)V t*R# )(r   a‹  Class defining an RSA key, private or public.
Do not instantiate directly.
Use :func:`generate`, :func:`construct` or :func:`import_key` instead.

:ivar n: RSA modulus
:vartype n: integer

:ivar e: RSA public exponent
:vartype e: integer

:ivar d: RSA private exponent
:vartype d: integer

:ivar p: First factor of the RSA modulus
:vartype p: integer

:ivar q: Second factor of the RSA modulus
:vartype q: integer

:ivar invp: Chinese remainder component (:math:`p^{-1} \text{mod } q`)
:vartype invp: integer

:ivar invq: Chinese remainder component (:math:`q^{-1} \text{mod } p`)
:vartype invq: integer

:ivar u: Same as ``invp``
:vartype u: integer
c                ó´  € \        VP                  4       4      p\        R4      pV\        R4      ,          pW$V39  d   \        R4      hVP                  4        F  w  rV\	        V RV,           V4       K  	  W$8X  d\   V P
                  V P                  ^,
          ,          V n        V P
                  V P                  ^,
          ,          V n	        RV n
        R# R# )a¶  Build an RSA key.

:Keywords:
  n : integer
    The modulus.
  e : integer
    The public exponent.
  d : integer
    The private exponent. Only required for private keys.
  p : integer
    The first factor of the modulus. Only required for private keys.
  q : integer
    The second factor of the modulus. Only required for private keys.
  u : integer
    The CRT coefficient (inverse of p modulo q). Only required for
    private keys.
zSome RSA components are missingÚ_N©ÚnÚe)ÚpÚqÚdÚu)ÚsetÚkeysÚ
ValueErrorÚitemsÚsetattrÚ_dÚ_pÚ_dpÚ_qÚ_dqÚ_invq)ÚselfÚkwargsÚ	input_setÚ
public_setÚprivate_setÚ	componentÚvalues   &,     Ú‹/opt/data/installs/351f81cc06284494/environments/aa258815729c481f8402f54f4c368f83/venv/lib/python3.14/site-packages/Crypto/PublicKey/RSA.pyÚ__init__ÚRsaKey.__init__R   s©   € ô& ˜Ÿ™›Ó&ˆ	Ü˜“_ˆ
Ø ¤3Ð';Ó#<Õ<ˆØ¨*Ð5Ô5ÜÐ>Ó?Ð?Ø &§¡¦ÑˆIÜ�D˜# 	�/¨5Ö1ñ !/àÔ#Ø—w‘w $§'¡'¨A¥+Õ.ˆDŒHØ—w‘w $§'¡'¨A¥+Õ.ˆDŒHØˆDŽJñ $ó    c                ó,   € \        V P                  4      # ©N)ÚintÚ_n©r'   s   &r.   r   ÚRsaKey.nq   ó   € ä�4—7‘7‹|Ðr1   c                ó,   € \        V P                  4      # r3   )r4   Ú_er6   s   &r.   r   ÚRsaKey.eu   r8   r1   c                ón   € V P                  4       '       g   \        R 4      h\        V P                  4      # )z-No private exponent available for public keys)Úhas_privateÚAttributeErrorr4   r!   r6   s   &r.   r   ÚRsaKey.dy   s+   € à×Ñ×!Ò!Ü Ð!PÓQÐQÜ�4—7‘7‹|Ðr1   c                ón   € V P                  4       '       g   \        R 4      h\        V P                  4      # )z.No CRT component 'p' available for public keys)r=   r>   r4   r"   r6   s   &r.   r   ÚRsaKey.p   ó+   € à×Ñ×!Ò!Ü Ð!QÓRÐRÜ�4—7‘7‹|Ðr1   c                ón   € V P                  4       '       g   \        R 4      h\        V P                  4      # )z.No CRT component 'q' available for public keys)r=   r>   r4   r$   r6   s   &r.   r   ÚRsaKey.q…   rB   r1   c                ón   € V P                  4       '       g   \        R 4      h\        V P                  4      # )z/No CRT component 'dp' available for public keys)r=   r>   r4   r#   r6   s   &r.   ÚdpÚ	RsaKey.dp‹   ó+   € à×Ñ×!Ò!Ü Ð!RÓSÐSÜ�4—8‘8‹}Ðr1   c                ón   € V P                  4       '       g   \        R 4      h\        V P                  4      # )z/No CRT component 'dq' available for public keys)r=   r>   r4   r%   r6   s   &r.   ÚdqÚ	RsaKey.dq‘   rH   r1   c                óÞ   € V P                  4       '       g   \        R 4      hV P                  f+   V P                  P	                  V P
                  4      V n        \        V P                  4      # )z1No CRT component 'invq' available for public keys)r=   r>   r&   r$   Úinverser"   r4   r6   s   &r.   ÚinvqÚRsaKey.invq—   sM   € à×Ñ×!Ò!Ü Ð!TÓUÐUØ�:‰:ÒØŸ™Ÿ™¨¯©Ó1ˆDŒJÜ�4—:‘:‹Ðr1   c                ó   € V P                   # r3   )r   r6   s   &r.   ÚinvpÚRsaKey.invpŸ   s   € à�v‰vˆr1   c                ón   € V P                  4       '       g   \        R 4      h\        V P                  4      # )z.No CRT component 'u' available for public keys)r=   r>   r4   Ú_ur6   s   &r.   r   ÚRsaKey.u£   rB   r1   c                ó6   € V P                   P                  4       # )zSize of the RSA modulus in bits©r5   Úsize_in_bitsr6   s   &r.   rX   ÚRsaKey.size_in_bits©   s   € à�w‰w×#Ñ#Ó%Ð%r1   c                ó`   € V P                   P                  4       ^,
          ^,          ^,           # )z9The minimal amount of bytes that can hold the RSA modulusrW   r6   s   &r.   Úsize_in_bytesÚRsaKey.size_in_bytes­   s$   € à—‘×$Ñ$Ó&¨Õ*¨qÕ0°1Õ4Ð4r1   c                ó´   € ^ Tu;8:  d   V P                   8  g   M \        R4      h\        \        \	        V4      V P
                  V P                   4      4      # )é    zPlaintext too large)r5   r   r4   Úpowr   r:   )r'   Ú	plaintexts   &&r.   Ú_encryptÚRsaKey._encrypt±   s@   € Ø�IÖ' §¡Ö'ÜÐ2Ó3Ð3Ü”3”w˜yÓ)¨4¯7©7°D·G±GÓ<Ó=Ð=r1   c                óÖ  € ^ Tu;8:  d   V P                   8  g   M \        R4      hV P                  4       '       g   \        R4      h\        P
                  ! ^V P                   R7      p\	        V4      \        W P                  V P                   4      ,          V P                   ,          p\        W0P                  V P                  4      p\        W0P                  V P                  4      pWT,
          V P                  ,          V P                  ,          pW`P                  ,          V,           p\        P                  ! VP                  V P                   4      VV P                   4      pV# )r^   zCiphertext too largezThis is not a private key)Úmin_inclusiveÚmax_exclusive)r5   r   r=   Ú	TypeErrorr   Úrandom_ranger_   r:   r#   r"   r%   r$   rT   Ú_mult_modulo_bytesrM   )	r'   Ú
ciphertextÚrÚcpÚm1Úm2ÚhÚmpÚresults	   &&       r.   Ú_decrypt_to_bytesÚRsaKey._decrypt_to_bytes¶   sý   € Ø�JÖ( §¡Ö(ÜÐ3Ó4Ð4Ø×Ñ×!Ò!ÜÐ7Ó8Ð8ô
 × Ò ¨qÀÇÁÔHˆä�ZÓ ¤3 q¯'©'°4·7±7Ó#;Õ;¸d¿g¹gÕEˆä�—X‘X˜tŸw™wÓ'ˆÜ�—X‘X˜tŸw™wÓ'ˆØ�g˜Ÿ™Õ  D§G¡GÕ+ˆØ—‘�[˜2Õˆô ×+Ò+Ø—I‘I˜dŸg™gÓ&ØØ—G‘Góˆð ˆr1   c                ó6   € \        V P                  V4      4      # )zLegacy private method)r
   rq   ©r'   ri   s   &&r.   Ú_decryptÚRsaKey._decryptÏ   s   € ô ˜T×3Ñ3°JÓ?Ó@Ð@r1   c                ó   € \        V R4      # )z"Whether this is an RSA private keyr!   )Úhasattrr6   s   &r.   r=   ÚRsaKey.has_privateÔ   s   € ô �t˜TÓ"Ð"r1   c                ó   € R # ©T© r6   s   &r.   Úcan_encryptÚRsaKey.can_encryptÙ   ó   € Ùr1   c                ó   € R # r{   r|   r6   s   &r.   Úcan_signÚRsaKey.can_signÜ   r   r1   c                óD   € \        V P                  V P                  R7      # )zFA matching RSA public key.

Returns:
    a new :class:`RsaKey` object
r   )r   r5   r:   r6   s   &r.   Ú
public_keyÚRsaKey.public_keyß   s   € ô ˜Ÿ™ 4§7¡7Ô+Ð+r1   c                ó  € V P                  4       VP                  4       8w  d   R # V P                  VP                  8w  g   V P                  VP                  8w  d   R # V P                  4       '       g   R# V P                  VP                  8H  # )FT)r=   r   r   r   ©r'   Úothers   &&r.   Ú__eq__ÚRsaKey.__eq__ç   sf   € Ø×ÑÓ ×!2Ñ!2Ó!4Ô4ÙØ�6‰6�U—W‘WÔ §¡¨%¯'©'Ô 1ÙØ×Ñ×!Ò!ÙØ—‘˜%Ÿ'™'Ñ!Ð"r1   c                ó   € W8X  * # r3   r|   r‡   s   &&r.   Ú__ne__ÚRsaKey.__ne__ð   s   € ØÒ"Ð"r1   c                ó   € ^ RI Hp Vh)r^   )ÚPicklingError)Úpickler�   )r'   r�   s   & r.   Ú__getstate__ÚRsaKey.__getstate__ó   s   € å(ØÐr1   c                óJ  € V P                  4       '       d[   R \        V P                  4      \        V P                  4      \        V P                  4      \        V P
                  4      3,          pMRpR\        V P                  4      \        V P                  4      V3,          # )z, d=%d, p=%d, q=%d, u=%dÚ zRsaKey(n=%d, e=%d%s))r=   r4   r!   r"   r$   rT   r5   r:   )r'   Úextras   & r.   Ú__repr__ÚRsaKey.__repr__ø   st   € Ø×Ñ×ÒØ.´#°d·g±g³,ÄÀDÇGÁGÃÜ25°d·g±g³,ÄÀDÇGÁGÃð2Nõ N‰Eð ˆEØ%¬¨T¯W©W«´s¸4¿7¹7³|ÀUÐ(KÕKÐKr1   c                ó`   € V P                  4       '       d   R pMRpRV\        V 4      3,          # )ÚPrivateÚPublicz%s RSA key at 0x%X)r=   Úid)r'   Úkey_types   & r.   Ú__str__ÚRsaKey.__str__   s/   € Ø×Ñ×ÒØ ‰HàˆHØ# x´°D³Ð&:Õ:Ð:r1   Nc                ó:  € Ve   \        V4      pVf   \        P                  pVR8X  dò   V P                  V P                  3 Uu. uF  qwP                  4       NK  	  upw  r‰\        V^ ,          4      ^€,          '       d
   RV,           p\        V	^ ,          4      ^€,          '       d
   RV	,           p	RW‰.p
RP                  V
 Uu. uF*  p\        P                  ! R\        V4      4      V,           NK,  	  up4      pR\        P                  ! V4      RR ,           # V P                  4       '       Edb   \        ^ V P                  V P                   V P"                  V P$                  V P&                  V P"                  V P$                  ^,
          ,          V P"                  V P&                  ^,
          ,          \)        V P&                  4      P+                  V P$                  4      .	4      P-                  4       pV^8X  d   RpVR	8X  d   V'       d   \/        R
4      hM³^ RIHp VR8X  d)   Vf%   RpVP5                  V\6        R\9        4       R7      pM~RpV'       g   V'       d   \/        R4      hRpVP5                  V\6        W$V\9        4       R7      pRpM:Rp\;        \6        \        V P                  V P                   .4      \9        4       4      pVR	8X  d   V# VR8X  d$   ^ RIHp VP-                  WÞW%4      p\        V4      # \/        RV,          4      hu upi u upi )aè
  Export this RSA key.

Keyword Args:
  format (string):
    The desired output format:

    - ``'PEM'``. (default) Text output, according to `RFC1421`_/`RFC1423`_.
    - ``'DER'``. Binary output.
    - ``'OpenSSH'``. Text output, according to the OpenSSH specification.
      Only suitable for public keys (not private keys).

    Note that PEM contains a DER structure.

  passphrase (bytes or string):
    (*Private keys only*) The passphrase to protect the
    private key.

  pkcs (integer):
    (*Private keys only*) The standard to use for
    serializing the key: PKCS#1 or PKCS#8.

    With ``pkcs=1`` (*default*), the private key is encoded with a
    simple `PKCS#1`_ structure (``RSAPrivateKey``). The key cannot be
    securely encrypted.

    With ``pkcs=8``, the private key is encoded with a `PKCS#8`_ structure
    (``PrivateKeyInfo``). PKCS#8 offers the best ways to securely
    encrypt the key.

    .. note::
        This parameter is ignored for a public key.
        For DER and PEM, the output is always an
        ASN.1 DER ``SubjectPublicKeyInfo`` structure.

  protection (string):
    (*For private keys only*)
    The encryption scheme to use for protecting the private key
    using the passphrase.

    You can only specify a value if ``pkcs=8``.
    For all possible protection schemes,
    refer to :ref:`the encryption parameters of PKCS#8<enc_params>`.
    The recommended value is
    ``'PBKDF2WithHMAC-SHA512AndAES256-CBC'``.

    If ``None`` (default), the behavior depends on :attr:`format`:

    - if ``format='PEM'``, the obsolete PEM encryption scheme is used.
      It is based on MD5 for key derivation, and 3DES for encryption.

    - if ``format='DER'``, the ``'PBKDF2WithHMAC-SHA1AndDES-EDE3-CBC'``
      scheme is used.

  prot_params (dict):
    (*For private keys only*)

    The parameters to use to derive the encryption key
    from the passphrase. ``'protection'`` must be also specified.
    For all possible values,
    refer to :ref:`the encryption parameters of PKCS#8<enc_params>`.
    The recommendation is to use ``{'iteration_count':21000}`` for PBKDF2,
    and ``{'iteration_count':131072}`` for scrypt.

  randfunc (callable):
    A function that provides random bytes. Only used for PEM encoding.
    The default is :func:`Crypto.Random.get_random_bytes`.

Returns:
  bytes: the encoded key

Raises:
  ValueError:when the format is unknown or when you try to encrypt a private
    key with *DER* format and PKCS#1.

.. warning::
    If you don't provide a pass phrase, the private key will be
    exported in the clear!

.. _RFC1421:    http://www.ietf.org/rfc/rfc1421.txt
.. _RFC1423:    http://www.ietf.org/rfc/rfc1423.txt
.. _`PKCS#1`:   http://www.ietf.org/rfc/rfc3447.txt
.. _`PKCS#8`:   http://www.ietf.org/rfc/rfc5208.txt
NÚOpenSSHó    s   ssh-rsar1   ú>Ió   ssh-rsa zRSA PRIVATE KEYÚDERz&PKCS#1 private key cannot be encrypted©ÚPKCS8ÚPEMzPRIVATE KEY)Ú
key_paramszENCRYPTED PRIVATE KEYz"'protection' parameter must be setz"PBKDF2WithHMAC-SHA1AndDES-EDE3-CBC)Úprot_paramsr¨   z
PUBLIC KEY©r§   z3Unknown key format '%s'. Cannot export the RSA key.éÿÿÿÿ)r   r   Úget_random_bytesr:   r5   Úto_bytesr   ÚjoinÚstructÚpackÚlenÚbinasciiÚ
b2a_base64r=   r   r   r   r   r   r   r   rM   Úencoder   Ú	Crypto.IOr¦   ÚwrapÚoidr	   r   r§   )r'   ÚformatÚ
passphraseÚpkcsÚ
protectionÚrandfuncr©   ÚxÚe_bytesÚn_bytesÚkeypartsÚkpÚ	keystringÚ
binary_keyrœ   r¦   r§   Úpem_strs   &&&&&&&           r.   Ú
export_keyÚRsaKey.export_key  s§  € ðl Ò!Ü  Ó,ˆJàÒÜ×.Ñ.ˆHà�YÔØ7;·w±wÀÇÁÑ6HÓIÑ6H°§
¡
¦Ñ6HÑIÑˆGÜ�G˜A•JÓ $×&Ô&Ø! GÕ+�Ü�G˜A•JÓ $×&Ô&Ø! GÕ+�Ø" GÐ5ˆHØŸ™ÉHÓ!UÉHÀb¤&§+¢+¨d´C¸³GÓ"<¸r×"AÐ"AÉHÑ!UÓVˆIØ¤×!4Ò!4°YÓ!?ÀÀÐ!DÕDÐDð ×Ñ×ÓÜ$ aØ&*§f¡fØ&*§f¡fØ&*§f¡fØ&*§f¡fØ&*§f¡fØ&*§f¡f°·±°qµÕ&9Ø&*§f¡f°·±°qµÕ&9Ü&-¨d¯f©f£o×&=Ñ&=¸d¿f¹fÓ&Eð	&(ó 	)÷ *0©«ð ð �qŒyØ,�Ø˜U”?§zÜ$Ð%MÓNÐNøå+à˜U”? zÒ'9Ø,�HØ!&§¡¨J¼¸TÜ7>³yð ",ó "B‘Jð  7�Hß%ß&Ü",Ð-QÓ"RÐRØ%I˜
Ø!&§¡¨J¼Ø,6Ø8CÜ7>³yð ",ó "B�Jð "&‘Jà#ˆHÜ8¼Ü9DÀdÇfÁfØFJÇfÁfðFNó :Oä9@»ó;ˆJð �UŒ?ØÐØ�UŒ?Ý%à—j‘j °zÓLˆGÜ˜7Ó#Ð#äÐNÐQWÕWÓXÐXùòy  Jùò "Vs   ÁLÃ0Lc                ó&   € V P                   ! V/ VB # ©ú:meta private:)rÅ   )r'   Úargsr(   s   &*,r.   Ú	exportKeyÚRsaKey.exportKey£  s   € à�Š Ð/¨Ñ/Ð/r1   c                ó"   € V P                  4       # rÈ   )r„   r6   s   &r.   Ú	publickeyÚRsaKey.publickey§  s   € à�‰Ó Ð r1   c                ó   € \        R4      h©rÉ   z,Use module Crypto.Signature.pkcs1_15 instead©ÚNotImplementedError)r'   ÚMÚKs   &&&r.   ÚsignÚRsaKey.sign¬  ó   € ä!Ð"PÓQÐQr1   c                ó   € \        R4      hrÑ   rÒ   )r'   rÔ   Ú	signatures   &&&r.   ÚverifyÚRsaKey.verify°  rØ   r1   c                ó   € \        R4      h©rÉ   z+Use module Crypto.Cipher.PKCS1_OAEP insteadrÒ   )r'   r`   rÕ   s   &&&r.   ÚencryptÚRsaKey.encrypt´  ó   € ä!Ð"OÓPÐPr1   c                ó   € \        R4      hrÞ   rÒ   rt   s   &&r.   ÚdecryptÚRsaKey.decrypt¸  rá   r1   c                ó   € \         hrÈ   rÒ   ©r'   rÔ   ÚBs   &&&r.   ÚblindÚRsaKey.blind¼  ó   € ä!Ð!r1   c                ó   € \         hrÈ   rÒ   ræ   s   &&&r.   ÚunblindÚRsaKey.unblindÀ  rê   r1   c                ó   € \         hrÈ   rÒ   r6   s   &r.   ÚsizeÚRsaKey.sizeÄ  rê   r1   )r#   r%   r&   )r§   Né   NNN)+Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r/   Úpropertyr   r   r   r   r   rF   rJ   rN   rQ   r   rX   r[   ra   rq   ru   r=   r}   r�   r„   r‰   rŒ   r‘   r–   r�   rÅ   rË   rÎ   rÖ   rÛ   rß   rã   rè   rì   rï   Ú__static_attributes__Ú__classdictcell__)Ú__classdict__s   @r.   r   r   4   s]  ø‡ € ñò:ð> ñó ðð ñó ðð ñó ðð
 ñó ðð
 ñó ðð
 ñó ðð
 ñó ðð
 ñó ðð ñó ðð ñó ðò
&ò5ò>ò
ò2Aò
#ò
òò,ò#ò#òò
Lò;ôYYòx0ò!ò
RòRòQòQò"ò"÷"ð "r1   c           	     óp  aaaaa€ V R8  d   \        R4      hS^,          ^ 8X  g   S^8  d   \        R4      hVf   \        P                  p\        ^4      ;r4\        S4      oVP	                  4       V 8w  Ed   V^V ^,          ,          8  dþ   V ^,          pW,
          p\        ^4      ^V,          ^,
          ,          P                  4       ;ooWV8w  d/   \        ^4      ^V,          ^,
          ,          P                  4       oVV3R lp\        VVVR7      o\        ^4      V ^,          ^d,
          ,          oVVVV3R lp\        VVVR7      p	SV	,          pS^,
          P                  V	^,
          4      p
SP                  V
4      pEK(  SX	8”  d   V	Suop	SP                  V	4      p\        VSVSW›R7      # )aæ  Create a new RSA key pair.

The algorithm closely follows NIST `FIPS 186-4`_ in its
sections B.3.1 and B.3.3. The modulus is the product of
two non-strong probable primes.
Each prime passes a suitable number of Miller-Rabin tests
with random bases and a single Lucas test.

Args:
  bits (integer):
    Key length, or size (in bits) of the RSA modulus.
    It must be at least 1024, but **2048 is recommended.**
    The FIPS standard only defines 1024, 2048 and 3072.
Keyword Args:
  randfunc (callable):
    Function that returns random bytes.
    The default is :func:`Crypto.Random.get_random_bytes`.
  e (integer):
    Public RSA exponent. It must be an odd positive integer.
    It is typically a small number with very few ones in its
    binary representation.
    The FIPS standard requires the public exponent to be
    at least 65537 (the default).

Returns: an RSA key object (:class:`RsaKey`, with private key).

.. _FIPS 186-4: http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf
i   z"RSA modulus length must be >= 1024zBRSA public exponent must be a positive, odd integer larger than 2.c                 óT   <€ V S8„  ;'       d    V ^,
          P                  S4      ^8H  # ©rñ   )Úgcd)Ú	candidater   Úmin_ps   &€€r.   Úfilter_pÚgenerate.<locals>.filter_pý  s*   ø€ Ø˜uÑ$×DÐD¨)°a­-×)<Ñ)<¸QÓ)?À1Ñ)DÐDr1   )Ú
exact_bitsr¼   Úprime_filterc                 óŽ   <€ V S8„  ;'       d9    V ^,
          P                  S4      ^8H  ;'       d    \        V S,
          4      S8„  # rý   )rþ   Úabs)rÿ   r   Úmin_distanceÚmin_qr   s   &€€€€r.   Úfilter_qÚgenerate.<locals>.filter_q  sL   ø€ Ø Ñ%÷ 6ð 6Ø •]×'Ñ'¨Ó*¨aÑ/÷6ð 6ä˜	 A�Ó&¨Ñ5ð7r1   ©r   r   r   r   r   r   )
r   r   r¬   r   rX   Úsqrtr   ÚlcmrM   r   )Úbitsr¼   r   r   r   Úsize_qÚsize_pr  r	  r   r  r   r  r   r  r   s   &&f         @@@@r.   r   r   É  s…  ü€ ð< ˆd„{ÜÐ=Ó>Ð>Øˆ1…u�„z�Q˜”UÜÐ]Ó^Ð^àÒÜ×*Ñ*ˆä�A‹JÐ€AÜ�‹
€Aà
�.‰.Ó
˜dÕ
" q¨A°$¸!µ)Õ,<Ô'=ð ˜•ˆØ•ˆä  ›¨¨F­
°Q­Õ7×=Ñ=Ó?Ð?ˆ�ØÔÜ˜Q“Z A¨¥J°¥NÕ3×9Ñ9Ó;ˆEö	Eô $¨vØ-5Ø19ô;ˆô ˜q“z d¨a¥i°#¥oÕ6ˆ÷	7ð 	7ô
 $¨vØ-5Ø19ô;ˆð ��EˆØ�1�u�k‰k˜!˜a�%Ó ˆØ�I‰I�c‹N‹àˆ1„uØ�!ˆˆˆ1à	�	‰	�!‹€Aä�A˜˜a 1¨Ô/Ð/r1   c           	     óN  €  ! R R\         4      pV! 4       p\        R
V 4       F  w  rE\        W4\        V4      4       K  	  VP                  pVP
                  p\        VR4      '       g   \        WgR7      pEMgVP                  p	\        VR4      '       d   VP                  p
VP                  pMñW—,          ^,
          pTpV^,          ^ 8X  d   V^,          pK  Rp\        ^4      pV'       gˆ   V^d8  d�   \        V4      pVV8  dd   \        VVV4      pV^8w  dE   VV^,
          8w  d7   \        V^V4      ^8X  d%   \        V4      P                  V^,           4      p
RpMV^,          pKj  V^,          pK�  V'       g   \        R	4      hVX
,          ^ 8X  g   Q hWj,          p\        VR4      '       d   VP                  pMV
P                  V4      p\        WgWšVVR
7      pV'       Ed½   V^8:  g   Wv8¼  d   \        R4      h\        V4      P                  V4      ^8w  d   \        R4      hV^,          '       g   \        R4      hVP!                  4       '       EdJ   X	^8:  g   W–8¼  d   \        R4      h\        V4      P                  V	4      ^8w  d   \        R4      hX
X,          V8w  d   \        R4      h\#        V
4      \$        8X  d   \        R4      h\#        V4      \$        8X  d   \        R4      hV
^,
          V^,
          ,          pVV
^,
          P                  V^,
          4      ,          pWy,          \'        V4      ,          ^8w  d   \        R4      h\        VR4      '       d:   X^8:  g   VV8¼  d   \        R4      hV
V,          V,          ^8w  d   \        R4      hV# )a½  Construct an RSA key from a tuple of valid RSA components.

The modulus **n** must be the product of two primes.
The public exponent **e** must be odd and larger than 1.

In case of a private key, the following equations must apply:

.. math::

    \begin{align}
    p*q &= n \\
    e*d &\equiv 1 ( \text{mod lcm} [p-1, q-1]) \\
    p*u &\equiv 1 ( \text{mod } q)
    \end{align}

Args:
    rsa_components (tuple):
        A tuple of integers, with at least 2 and no
        more than 6 items. The items come in the following order:

        1. RSA modulus *n*.
        2. Public exponent *e*.
        3. Private exponent *d*.
           Only required if the key is private.
        4. First factor of *n* (*p*).
           Optional, but the other factor *q* must also be present.
        5. Second factor of *n* (*q*). Optional.
        6. CRT coefficient *u*, that is :math:`p^{-1} \text{mod }q`. Optional.

Keyword Args:
    consistency_check (boolean):
        If ``True``, the library will verify that the provided components
        fulfil the main RSA properties.

Raises:
    ValueError: when the key being imported fails the most basic RSA validity checks.

Returns: An RSA key object (:class:`RsaKey`).
c                   ó   € ] tR tRtRtR# )Úconstruct.<locals>.InputCompsiD  r|   N)rò   ró   rô   rõ   rø   r|   r1   r.   Ú
InputCompsr  D  s   † Ûr1   r  r   r   r   r   FTz2Unable to compute factors p and q from exponent d.r  zInvalid RSA public exponentz-RSA public exponent is not coprime to moduluszRSA modulus is not oddzInvalid RSA private exponentz.RSA private exponent is not coprime to modulusz RSA factors do not match moduluszRSA factor p is compositezRSA factor q is compositezInvalid RSA conditionzInvalid RSA component uzInvalid RSA component u with p)ÚobjectÚzipr    r   r   r   rx   r   r   r   r   r_   rþ   r   r   rM   r=   r   r   r4   )Úrsa_componentsÚconsistency_checkr  Úinput_compsÚcompr-   r   r   Úkeyr   r   r   ÚktotÚtÚspottedÚaÚkÚcandr   Úphir  s   &&                   r.   Ú	constructr#    s  € ôR”Vô ñ “,€KÜÐ;¸^ÖL‰ˆÜ�¤7¨5£>Ö2ñ Mð 	�‰€AØ�‰€AÜ�; ×$Ò$Ü�qÔŠà�M‰MˆÜ�; ×$Ò$Ø—‘ˆAØ—‘‰Að
 •5˜1•9ˆDð ˆAØ�a•%˜1”*Ø�a•’ð ˆGÜ˜“
ˆAß ! c¤'Ü˜A“J�à˜$”hÜ˜q ! Q›<�Dà˜q”y T¨a°!­e¤_¼¸TÀ1Àa»ÈAÔ9Mô $ A›JŸN™N¨4°!­8Ó4˜Ø"&˜ØØ˜•F’Aà�Q•’ßÜ Ð!UÓVÐVà˜•U˜q”LÐ!�LØ•ˆAä�; ×$Ò$Ø—‘‰Aà—	‘	˜!“ˆAô �q ¨1°Ô2ˆ÷ Ðð �Œ6�Q”VÜÐ:Ó;Ð;Ü�1‹:�>‰>˜!Ó Ô!ÜÐLÓMÐMð �1�uŒuÜÐ5Ó6Ð6à�?‰?×Óà�AŒv˜œÜ Ð!?Ó@Ð@Ü�q‹z�~‰~˜aÓ  AÔ%Ü Ð!QÓRÐRà�1�u˜ŒzÜ Ð!CÓDÐDÜ" 1Ó%¬Ô2Ü Ð!<Ó=Ð=Ü" 1Ó%¬Ô2Ü Ð!<Ó=Ð=à�q•5˜Q �UÕ#ˆCØ˜!˜a�%Ÿ™ Q¨¥UÓ+Õ+ˆCØ•œ˜C›Õ  QÔ&Ü Ð!8Ó9Ð9Ü�s˜C× Ò à˜”6˜Q !œVÜ$Ð%>Ó?Ð?Ø˜•E˜A•I !Ô#Ü$Ð%EÓFÐFà€Jr1   c                 óì   € \        4       P                  V ^	RR7      pV^ ,          ^ 8w  d   \        R4      h\        VR,          \	        V^,          4      P                  V^,          4      .,           4      # )é	   T©Únr_elementsÚonly_ints_expectedz(No PKCS#1 encoding of an RSA private key:rñ   é   N)r   Údecoder   r#  r   rM   ©Úencodedr(   Úders   &* r.   Ú_import_pkcs1_privater.  «  sb   € ô ‹-×
Ñ
˜w°AÈ$Ð
Ó
O€CØ
ˆ1…v�„{ÜÐCÓDÐDÜ�S˜•X¤¨¨Q­£×!8Ñ!8¸¸Q½Ó!@Ð AÕAÓBÐBr1   c                 óP   € \        4       P                  V ^RR7      p\        V4      # )é   Tr&  )r   r*  r#  r+  s   &* r.   Ú_import_pkcs1_publicr1  ¿  s'   € ô
 ‹-×
Ñ
˜w°AÈ$Ð
Ó
O€CÜ�S‹>Ðr1   c                 ón   € \         R 3p\        V 4      w  r4pW29  g   Ve   \        R4      h\        V4      # )ú1.2.840.113549.1.1.10zNo RSA subjectPublicKeyInfo)r·   r   r   r1  )r,  r(   ÚoidsÚalgoidÚencoded_keyÚparamss   &*    r.   Ú_import_subjectPublicKeyInfor8  È  s>   € äÐ(Ð)€Dä"AÀ'Ó"JÑ€F˜ØÔ˜VÒ/ÜÐ6Ó7Ð7Ü Ó,Ð,r1   c                 ó.   € \        V 4      p\        V4      # r3   )r   r8  )r,  r(   Úsp_infos   &* r.   Ú_import_x509_certr;  Ò  s   € ä.¨wÓ7€GÜ'¨Ó0Ð0r1   c                 ó˜   € ^ RI Hp \        R3pVP                  W4      pV^ ,          V9  d   \	        R4      h\        V^,          V4      # )r^   r¥   r3  zNo PKCS#8 encoded RSA key)rµ   r¦   r·   Úunwrapr   Ú_import_keyDER)r,  r¹   r¦   r4  r   s   &&   r.   Ú_import_pkcs8r?  Ø  sG   € ÝäÐ(Ð)€Dà�‰�WÓ)€AØˆ…t�4ÔÜÐ4Ó5Ð5Ü˜!˜A�$ 
Ó+Ð+r1   c                ó–   € \         \        \        \        \        3pV F  p V! W4      u # 	  \        R4      h  \
         d     K)  i ; i)z@Import an RSA key (public or private half), encoded in DER form.úRSA key format is not supported)r.  r1  r8  r;  r?  r   )Ú
extern_keyr¹   Ú	decodingsÚdecodings   &&  r.   r>  r>  ã  sX   € ô 'Ü%Ü-Ü"Üð	 €Ió ˆð	Ù˜JÓ3Ò3ñ ô Ð6Ó
7Ð7øô ô 	Úð	ús   ¢9¹AÁAc                 ó^  € ^RI HpHpHpHp V! W4      w  rgVR8w  d   \        R4      hV! V4      w  r‡V! V4      w  r—V! V4      w  r§V! V4      w  r·V! V4      w  rÇV! V4      w  r×V! V4      w  rïV! V4       W‰W­WË3 Uu. uF  p\        P                  ! V4      NK  	  pp\        V4      # u upi )rñ   )Úimport_openssh_private_genericÚ
read_bytesÚread_stringÚcheck_paddingzssh-rsazThis SSH key is not RSA)	Ú_opensshrF  rG  rH  rI  r   r   Ú
from_bytesr#  )ÚdataÚpasswordrF  rG  rH  rI  Ússh_nameÚ	decryptedr   r   r   Úiqmpr   r   r   Úpaddedr½   Úbuilds   &&                r.   Ú_import_openssh_private_rsarS  õ  sÆ   € ÷Có Cñ 9¸ÓHÑ€Hà�9ÔÜÐ2Ó3Ð3á˜iÓ(�L€AÙ˜iÓ(�L€AÙ˜iÓ(�L€AÙ  Ó+�O€DÙ˜iÓ(�L€AÙ˜iÓ(�L€Aá˜IÓ&�I€AÙ�&Ôà-.°1¸Ñ,AÓBÑ,A qŒW×Ò Ö"Ñ,A€EÐBÜ�UÓÐùò Cs   Á>B*c                ó¨  € ^ RI Hp \        V 4      p Ve   \        V4      pV P                  R4      '       d-   \	        V 4      pVP                  W14      w  rEp\        WA4      pV# V P                  R4      '       d4   VP                  \	        V 4      V4      w  r…pV'       d   Rp\        W�4      # V P                  R4      '       dÓ   \        P                  ! V P                  R4      ^,          4      p	. p
\        V	4      ^8”  dO   \        P                  ! RV	R,          4      ^ ,          pV
P                  V	^^V,            4       V	^V,           R p	K^  \        P                   ! V
^,          4      p\        P                   ! V
^,          4      p\#        WÜ.4      # \        V 4      ^ 8”  d#   \%        V ^ ,          4      ^08X  d   \        W4      # \'        R	4      h)
ay  Import an RSA key (public or private).

Args:
  extern_key (string or byte string):
    The RSA key to import.

    The following formats are supported for an RSA **public key**:

    - X.509 certificate (binary or PEM format)
    - X.509 ``subjectPublicKeyInfo`` DER SEQUENCE (binary or PEM
      encoding)
    - `PKCS#1`_ ``RSAPublicKey`` DER SEQUENCE (binary or PEM encoding)
    - An OpenSSH line (e.g. the content of ``~/.ssh/id_ecdsa``, ASCII)

    The following formats are supported for an RSA **private key**:

    - PKCS#1 ``RSAPrivateKey`` DER SEQUENCE (binary or PEM encoding)
    - `PKCS#8`_ ``PrivateKeyInfo`` or ``EncryptedPrivateKeyInfo``
      DER SEQUENCE (binary or PEM encoding)
    - OpenSSH (text format, introduced in `OpenSSH 6.5`_)

    For details about the PEM encoding, see `RFC1421`_/`RFC1423`_.

  passphrase (string or byte string):
    For private keys only, the pass phrase that encrypts the key.

Returns: An RSA key object (:class:`RsaKey`).

Raises:
  ValueError/IndexError/TypeError:
    When the given key cannot be parsed (possibly because the pass
    phrase is wrong).

.. _RFC1421: http://www.ietf.org/rfc/rfc1421.txt
.. _RFC1423: http://www.ietf.org/rfc/rfc1423.txt
.. _`PKCS#1`: http://www.ietf.org/rfc/rfc3447.txt
.. _`PKCS#8`: http://www.ietf.org/rfc/rfc5208.txt
.. _`OpenSSH 6.5`: https://flak.tedunangst.com/post/new-openssh-key-format-and-bcrypt-pbkdf
rª   Ns   -----BEGIN OPENSSH PRIVATE KEYs   -----r£   ó    r¢   :Né   NrA  )rµ   r§   r   Ú
startswithr   r*  rS  r>  r²   Ú
a2b_base64Úsplitr±   r¯   ÚunpackÚappendr   rK  r#  r   r   )rB  r¹   r§   Útext_encodedÚopenssh_encodedÚmarkerÚenc_flagrp   r-  rÂ   rÀ   Úlengthr   r   s   &&            r.   Ú
import_keyra    sˆ  € õR ä˜Ó$€JØÒÜ˜ZÓ(ˆ
à×ÑÐ>×?Ò?Ü˜ZÓ(ˆØ,/¯J©J°|Ó,PÑ)ˆ Ü,¨_ÓIˆØˆà×Ñ˜X×&Ò&à"%§*¡*¬U°:Ó->À
Ó"KÑˆ�hßØˆJÜ˜cÓ.Ð.à×Ñ˜[×)Ò)ä×'Ò'¨
×(8Ñ(8¸Ó(>¸qÕ(AÓBˆ	ØˆÜ�)‹n˜qÔ Ü—]’] 4¨°2­Ó7¸Õ:ˆFØ�O‰O˜I a¨¨F­
Ð3Ô4Ø! ! f¥* +Ð.ŠIÜ×Ò˜x¨�{Ó+ˆÜ×Ò˜x¨�{Ó+ˆÜ˜!˜Ó Ð ä
ˆ:ƒ˜Ôœt J¨q¥MÓ2°dÔ:ä˜jÓ5Ð5ä
Ð6Ó
7Ð7r1   z1.2.840.113549.1.1.1)r   r#  ra  r   r·   )Ni  r{   r3   )&Ú__all__r²   r¯   ÚCryptor   ÚCrypto.Util.py3compatr   r   r   ÚCrypto.Util.asn1r   r	   ÚCrypto.Util.numberr
   ÚCrypto.Math.Numbersr   ÚCrypto.Math.Primalityr   r   r   ÚCrypto.PublicKeyr   r   r   r  r   r   r#  r.  r1  r8  r;  r?  r>  rS  ra  Ú	importKeyr·   r|   r1   r.   Ú<module>rk     s•   ðò@€ó Û å ß 6Ñ 6ß 1Ý ,å '÷Gñ G÷@ñ @ô
R"ˆVô R"ôjO0ôdMò`Cò(ò-ò1ò,ò8ò$ô0L8ð` €	ð ‚r1   