+
    ^eòjÈ;  ã                   ó¸   € ^ RI Ht ^ RIHt ^ RIHt ^ RIHt ^ RIH	t	 ^ RI
Ht RR.t ! R	 R]4      t ! R
 R]4      t ! R R]4      t ! R R]4      tRR ltR# )é    )ÚDerSequence)Úlong_to_bytes)ÚInteger)ÚHMAC)ÚEccKey)ÚDsaKeyÚDssSigSchemeÚnewc                   óH   a € ] tR t^-t o RtR tR tR tR tR t	R t
RtV tR	# )
r	   z_A (EC)DSA signature object.
Do not instantiate directly.
Use :func:`Crypto.Signature.DSS.new`.
c                ó´   € Wn         W n        W0n        V P                  P                  4       V n        V P                  ^,
          ^,          ^,           V n        R# )zˆCreate a new Digital Signature Standard (DSS) object.

Do not instantiate this object directly,
use `Crypto.Signature.DSS.new` instead.
N)Ú_keyÚ	_encodingÚ_orderÚsize_in_bitsÚ_order_bitsÚ_order_bytes)ÚselfÚkeyÚencodingÚorders   &&&&Ú‹/opt/data/installs/351f81cc06284494/environments/aa258815729c481f8402f54f4c368f83/venv/lib/python3.14/site-packages/Crypto/Signature/DSS.pyÚ__init__ÚDssSigScheme.__init__3   sE   € ð Œ	Ø!ŒØŒàŸ;™;×3Ñ3Ó5ˆÔØ!×-Ñ-°Õ1°aÕ7¸!Õ;ˆÖó    c                ó6   € V P                   P                  4       # )zJReturn ``True`` if this signature object can be used
for signing messages.)r   Úhas_private)r   s   &r   Úcan_signÚDssSigScheme.can_signA   s   € ð �y‰y×$Ñ$Ó&Ð&r   c                ó   € \        R 4      h©zTo be provided by subclasses©ÚNotImplementedError©r   Úmsg_hashs   &&r   Ú_compute_nonceÚDssSigScheme._compute_nonceG   ó   € Ü!Ð"@ÓAÐAr   c                ó   € \        R 4      hr    r!   r#   s   &&r   Ú_valid_hashÚDssSigScheme._valid_hashJ   r'   r   c           	     ó$  € V P                   P                  4       '       g   \        R4      hV P                  V4      '       g   \	        R4      hV P                  V4      p\        P                  ! VP                  4       RV P                   4      pV P                   P                  W24      pV P                  R8X  d7   RP                  V Uu. uF  p\        WPP                  4      NK  	  up4      pV# \        V4      P                  4       pV# u upi )aË  Compute the DSA/ECDSA signature of a message.

Args:
  msg_hash (hash object):
    The hash that was carried out over the message.
    The object belongs to the :mod:`Crypto.Hash` package.
    Under mode ``'fips-186-3'``, the hash must be a FIPS
    approved secure hash (SHA-2 or SHA-3).

:return: The signature as ``bytes``
:raise ValueError: if the hash algorithm is incompatible to the (EC)DSA key
:raise TypeError: if the (EC)DSA key has no private half
zPrivate key is needed to signúHash is not sufficiently strongNÚbinaryr   )r   r   Ú	TypeErrorr)   Ú
ValueErrorr%   r   Ú
from_bytesÚdigestr   Ú_signr   Újoinr   r   Úencode)r   r$   ÚnonceÚzÚsig_pairÚxÚoutputs   &&     r   ÚsignÚDssSigScheme.signM   só   € ð �y‰y×$Ñ$×&Ò&ÜÐ;Ó<Ð<à×Ñ ×)Ò)ÜÐ>Ó?Ð?ð ×#Ñ# HÓ-ˆô ×Ò˜xŸ™Ó0Ð1C°$×2CÑ2CÐDÓEˆØ—9‘9—?‘? 1Ó,ˆð �>‰>˜XÔ%Ø—X‘XÙ(0ó2Ù(0 1ô  -¨Q×0AÑ0AÖBÙ(0ñ2ó 3ˆFð ˆô ! Ó*×1Ñ1Ó3ˆFàˆùò2s   ÃDc                ó¼  € V P                  V4      '       g   \        R4      hV P                  R8X  dq   \        V4      ^V P                  ,          8w  d   \        R4      hVRV P                   W P                  R 3 Uu. uF  p\
        P                  ! V4      NK  	  upw  rEMp \        4       P                  VRR7      p\        T4      ^8w  g   TP                  4       '       g   \        R4      h\        T^ ,          4      \        T^,          4      rT^ Tu;8  d   V P                  8  d   M M^ Tu;8  d   V P                  8  g   M \        R	4      h\
        P                  ! VP                  4       RV P                   4      pV P                  P                  WtV34      pV'       g   \        R
4      hR# u upi   \        \        3 d    \        R4      hi ; i)a¬  Check if a certain (EC)DSA signature is authentic.

Args:
  msg_hash (hash object):
    The hash that was carried out over the message.
    This is an object belonging to the :mod:`Crypto.Hash` module.
    Under mode ``'fips-186-3'``, the hash must be a FIPS
    approved secure hash (SHA-2 or SHA-3).

  signature (``bytes``):
    The signature that needs to be validated.

:raise ValueError: if the signature is not authentic
r,   r-   z'The signature is not authentic (length)NT)Ústrictz$The signature is not authentic (DER)z,The signature is not authentic (DER content)z"The signature is not authentic (d)zThe signature is not authenticF)r)   r/   r   Úlenr   r   r0   r   ÚdecodeÚ
IndexErrorÚhasOnlyIntsr   r1   r   Ú_verify)	r   r$   Ú	signaturer8   Úr_primeÚs_primeÚder_seqr6   Úresults	   &&&      r   ÚverifyÚDssSigScheme.verifyz   s­  € ð  ×Ñ ×)Ò)ÜÐ>Ó?Ð?à�>‰>˜XÔ%Ü�9‹~ ! d×&7Ñ&7Õ"7Ô8Ü Ð!JÓKÐKà*3Ð4F°T×5FÑ5FÐ*GØ*3×4EÑ4EÐ4FÐ*Gñ*Ió Jñ*I Aô !(× 2Ò 2°1Ö 5ñ*Iñ JÑˆG�WðIÜ%›-×.Ñ.¨yÀÐ.ÓF�ô �7‹|˜qÔ ¨×(;Ñ(;×(=Ò(=Ü Ð!OÓPÐPÜ& w¨q¥zÓ2´G¸GÀA½JÓ4G�Wà�GÖ)˜dŸk™k×)°1°wÖ3LÀÇÁÖ3LÜÐAÓBÐBä×Ò˜xŸ™Ó0Ð1C°$×2CÑ2CÐDÓEˆØ—‘×"Ñ" 1°Ð&8Ó9ˆßÜÐ=Ó>Ð>áùò) Jøô ¤
Ð+ô IÜ Ð!GÓHÐHðIús   Á?F9Â%F> Æ>G)r   r   r   r   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r%   r)   r:   rH   Ú__static_attributes__Ú__classdictcell__)Ú__classdict__s   @r   r	   r	   -   s0   ø‡ € ñò
<ò'òBòBò+÷Z*ð *r   c                   óP   a a€ ] tR t^§t oV 3R ltR tR tR tR tR t	Rt
VtV ;t# )ÚDeterministicDsaSigSchemec                ó<   <€ \         \        V `  WV4       W@n        R # ©N)ÚsuperrS   r   Ú_private_key)r   r   r   r   Úprivate_keyÚ	__class__s   &&&&&€r   r   Ú"DeterministicDsaSigScheme.__init__ª   s   ø€ ÜÔ'¨Ñ7¸ÀuÔMØ'Ör   c                ó´   € \         P                  ! V4      pV P                  P                  4       p\	        V4      ^,          pWC8”  d   W$V,
          ,          pV# )zSee 2.3.2 in RFC6979)r   r0   r   r   r>   )r   ÚbstrrG   Úq_lenÚb_lens   &&   r   Ú	_bits2intÚ#DeterministicDsaSigScheme._bits2int®   sI   € ô ×#Ò# DÓ)ˆØ—‘×(Ñ(Ó*ˆÜ�D“	˜A•ˆØŒ=à �Õ&ˆFØˆr   c                óh   € ^ Tu;8  d   V P                   8  g   Q h Q h\        WP                  4      # )zSee 2.3.3 in RFC6979)r   r   r   )r   Ú	int_mod_qs   &&r   Ú_int2octetsÚ%DeterministicDsaSigScheme._int2octets¹   s2   € ð �9Ö*˜tŸ{™{Ô*Ð*Ñ*Ð*Ð*Ü˜Y×(9Ñ(9Ó:Ð:r   c                ó�   € V P                  V4      pW P                  8  d   TpMW P                  ,
          pV P                  V4      # )zSee 2.3.4 in RFC6979)r_   r   rc   )r   r\   Úz1Úz2s   &&  r   Ú_bits2octetsÚ&DeterministicDsaSigScheme._bits2octets¿   s>   € ð �^‰^˜DÓ!ˆØ—‘ÔØ‰Bà—k‘kÕ!ˆBØ×Ñ Ó#Ð#r   c                ó8  € VP                  4       pRVP                  ,          pRVP                  ,          pR FŠ  p\        P                  ! VW5,           V P	                  V P
                  4      ,           V P                  V4      ,           V4      P                  4       p\        P                  ! WCV4      P                  4       pKŒ  	  Rp^ Tu;8  d   V P                  8  g¹   M VR8w  dR   \        P                  ! WCR,           V4      P                  4       p\        P                  ! WCV4      P                  4       pRp\        V4      V P                  8  d0   \        P                  ! WCV4      P                  4       pWs,          pKI  V P                  V4      pKÑ  V# )z!Generate k in a deterministic wayó   ó    r   )rl   rk   éÿÿÿÿ)r1   Údigest_sizer   r
   rc   rW   rh   r   r>   r   r_   )r   ÚmhashÚh1Úmask_vÚnonce_kÚint_octr5   Úmask_ts   &&      r   r%   Ú(DeterministicDsaSigScheme._compute_nonceÉ   sR  € ð
 �\‰\‹^ˆà˜5×,Ñ,Õ,ˆà˜E×-Ñ-Õ-ˆã)ˆGä—h’h˜wØ%Õ/Ø#×/Ñ/°×0AÑ0AÓBõ Cà#×0Ñ0°Ó4õ 5à6;ó=÷ >D¹V»Xð ô
 —X’X˜g¨uÓ5×<Ñ<Ó>ŠFñ *ð ˆØ�uÖ*˜tŸ{™{Ö*à˜Œ{ÜŸ(š( 7°WÕ,<Ø#(ó*ß*0©&«(ð äŸš '°5Ó9×@Ñ@ÓB�ð ˆFô �f“+ × 1Ñ 1Ô1ÜŸš '°5Ó9×@Ñ@ÓB�ØÕ ’ð —N‘N 6Ó*ŠEØˆr   c                ó   € R # )T© r#   s   &&r   r)   Ú%DeterministicDsaSigScheme._valid_hashñ   s   € Ùr   )rW   )rJ   rK   rL   rM   r   r_   rc   rh   r%   r)   rO   rP   Ú__classcell__©rY   rQ   s   @@r   rS   rS   §   s)   ù‡ € õ(ò	ò;ò$ò&÷Pò r   rS   c                   óB   a a€ ] tR t^õt oRtV 3R ltR tR tRtVt	V ;t
# )ÚFipsDsaSigSchemec                óø   <€ \         \        V `  WV4       W@n        \	        VP
                  4      P                  4       pWPP                  3V P                  9  d    R WPP                  3,          p\        V4      hR# )z+L/N (%d, %d) is not compliant to FIPS 186-3N)
rV   r|   r   Ú	_randfuncr   Úpr   r   Ú_fips_186_3_L_Nr/   )r   r   r   r   ÚrandfuncÚLÚerrorrY   s   &&&&&  €r   r   ÚFipsDsaSigScheme.__init__  sm   ø€ ÜÔ Ñ.¨s¸eÔDØ!Œä�C—E‘E‹N×'Ñ'Ó)ˆØ×ÑÐ ¨×(<Ñ(<Ô<ØBØ×+Ñ+Ð,õ-ˆEä˜UÓ#Ð#ñ =r   c                ó\   € \         P                  ! ^V P                  V P                  R7      # ©é   )Úmin_inclusiveÚmax_exclusiver�   )r   Úrandom_ranger   r~   r#   s   &&r   r%   ÚFipsDsaSigScheme._compute_nonce  s%   € ä×#Ò#°!Ø26·+±+Ø-1¯^©^ô=ð 	=r   c                óf   € VP                   R8H  ;'       g    VP                   P                  R4      # )z*Verify that SHA-1, SHA-2 or SHA-3 are usedz1.3.14.3.2.26z2.16.840.1.101.3.4.2.)ÚoidÚ
startswithr#   s   &&r   r)   ÚFipsDsaSigScheme._valid_hash  s3   € à—‘ Ñ/÷ Að AØ—‘×'Ñ'Ð(?Ó@ð	Br   ©r~   ))i   é    )é   éà   )r’   é   )i   r”   )rJ   rK   rL   rM   r€   r   r%   r)   rO   rP   ry   rz   s   @@r   r|   r|   õ   s"   ù‡ € ð
€Oõ$ò=÷Bò Br   r|   c                   ó>   a a€ ] tR tRt oV 3R ltR tR tRtVtV ;t	# )ÚFipsEcDsaSigSchemei  c                ó<   <€ \         \        V `  WV4       W@n        R # rU   )rV   r–   r   r~   )r   r   r   r   r�   rY   s   &&&&&€r   r   ÚFipsEcDsaSigScheme.__init__  s   ø€ ÜÔ  $Ñ0°ÀÔFØ!Žr   c                ó„   € \         P                  ! ^V P                  P                  P                  V P
                  R7      # r†   )r   rŠ   r   Ú_curver   r~   r#   s   &&r   r%   Ú!FipsEcDsaSigScheme._compute_nonce  s1   € Ü×#Ò#°!Ø26·)±)×2BÑ2B×2HÑ2HØ-1¯^©^ô=ð 	=r   c                óÒ   € V P                   P                  P                  4       pRpRpRpRpW4,           V,           V,           p VP                  V9   pV#   \         d    Rp T# i ; i)zpVerify that the strength of the hash matches or exceeds
the strength of the EC. We fail if the hash is too weak.F)z2.16.840.1.101.3.4.2.4z2.16.840.1.101.3.4.2.7z2.16.840.1.101.3.4.2.5)z2.16.840.1.101.3.4.2.1z2.16.840.1.101.3.4.2.8z2.16.840.1.101.3.4.2.6)z2.16.840.1.101.3.4.2.2z2.16.840.1.101.3.4.2.9)z2.16.840.1.101.3.4.2.3z2.16.840.1.101.3.4.2.10)r   ÚpointQr   r�   ÚAttributeError)	r   r$   Úmodulus_bitsÚsha224Úsha256Úsha384Úsha512ÚshsrG   s	   &&       r   r)   ÚFipsEcDsaSigScheme._valid_hash"  sy   € ð —y‘y×'Ñ'×4Ñ4Ó6ˆð `ˆØ_ˆØEˆØFˆØ�o Õ&¨Õ/ˆð	Ø—\‘\ SÑ(ˆFð ˆøô ô 	Ø‰FØˆð	ús   ÁA ÁA&Á%A&r�   )
rJ   rK   rL   rM   r   r%   r)   rO   rP   ry   rz   s   @@r   r–   r–     s   ù‡ € õ"ò=÷
ò r   r–   Nc                óŠ  € VR9  d   \        RV,          4      h\        V \        4      '       dF   V P                  P                  pRpV P
                  P                  R4      '       g   \        R4      hMR\        V \        4      '       d   \        V P                  4      pRpM$\        R\        \        V 4      4      ,           4      hV P                  4       '       d   \        W4      pMRpVR8X  d   \        WWF4      # VR	8X  d/   \        V \        4      '       d   \        WWC4      # \!        WWC4      # \        R
V,          4      h)aó	  Create a signature object :class:`DssSigScheme` that
can perform (EC)DSA signature or verification.

.. note::
    Refer to `NIST SP 800 Part 1 Rev 4`_ (or newer release) for an
    overview of the recommended key lengths.

Args:
    key (:class:`Crypto.PublicKey.DSA` or :class:`Crypto.PublicKey.ECC`):
        The key to use for computing the signature (*private* keys only)
        or for verifying one.
        For DSA keys, let ``L`` and ``N`` be the bit lengths of the modulus ``p``
        and of ``q``: the pair ``(L,N)`` must appear in the following list,
        in compliance to section 4.2 of `FIPS 186-4`_:

        - (1024, 160) *legacy only; do not create new signatures with this*
        - (2048, 224) *deprecated; do not create new signatures with this*
        - (2048, 256)
        - (3072, 256)

        For ECC, only keys over P-224, P-256, P-384, and P-521 are accepted.

    mode (string):
        The parameter can take these values:

        - ``'fips-186-3'``. The signature generation is randomized and carried out
          according to `FIPS 186-3`_: the nonce ``k`` is taken from the RNG.
        - ``'deterministic-rfc6979'``. The signature generation is not
          randomized. See RFC6979_.

    encoding (string):
        How the signature is encoded. This value determines the output of
        :meth:`sign` and the input to :meth:`verify`.

        The following values are accepted:

        - ``'binary'`` (default), the signature is the raw concatenation
          of ``r`` and ``s``. It is defined in the IEEE P.1363 standard.
          For DSA, the size in bytes of the signature is ``N/4`` bytes
          (e.g. 64 for ``N=256``).
          For ECDSA, the signature is always twice the length of a point
          coordinate (e.g. 64 bytes for P-256).

        - ``'der'``, the signature is a ASN.1 DER SEQUENCE
          with two INTEGERs (``r`` and ``s``). It is defined in RFC3279_.
          The size of the signature is variable.

    randfunc (callable):
        A function that returns random ``bytes``, of a given length.
        If omitted, the internal RNG is used.
        Only applicable for the *'fips-186-3'* mode.

.. _FIPS 186-3: http://csrc.nist.gov/publications/fips/fips186-3/fips_186-3.pdf
.. _FIPS 186-4: http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf
.. _NIST SP 800 Part 1 Rev 4: http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-57pt1r4.pdf
.. _RFC6979: http://tools.ietf.org/html/rfc6979
.. _RFC3279: https://tools.ietf.org/html/rfc3279#section-2.2.2
zUnknown encoding '%s'ÚdÚNISTz ECC key is not on a NIST P curver8   zUnsupported key type Nzdeterministic-rfc6979z
fips-186-3zUnknown DSS mode '%s')r-   Úder)r/   Ú
isinstancer   rš   r   ÚcurverŽ   r   r   ÚqÚstrÚtyper   ÚgetattrrS   r–   r|   )r   Úmoder   r�   r   Úprivate_key_attrrX   s   &&&&   r   r
   r
   6  s  € ðD Ð(Ô(ÜÐ0°8Õ;Ó<Ð<ä�#”v×ÒØ—
‘
× Ñ ˆØÐØ�y‰y×#Ñ# F×+Ò+ÜÐ?Ó@Ð@ð ,ä	�Cœ×	 Ò	 Ü˜Ÿ™“ˆØÑäÐ0´3´t¸C³y³>ÕAÓBÐBà
‡�×ÒÜ˜cÓ4‰àˆàÐ&Ô&Ü(¨¸ÓKÐKØ	�Ô	Ü�cœ6×"Ò"Ü% c°UÓEÐEä# C°5ÓCÐCäÐ0°4Õ7Ó8Ð8r   )r-   N)ÚCrypto.Util.asn1r   ÚCrypto.Util.numberr   ÚCrypto.Math.Numbersr   ÚCrypto.Hashr   ÚCrypto.PublicKey.ECCr   ÚCrypto.PublicKey.DSAr   Ú__all__Úobjectr	   rS   r|   r–   r
   rw   r   r   Ú<module>rº      sc   ðõD )Ý ,Ý 'å Ý 'Ý 'à˜5Ð
!€ôw�6ô wôtK ô Kô\B�|ô BôD˜ô ö>]9r   