/usr/lib/python3/dist-packages/nacl/__pycache__
NameSizeModeActions
encoding.cpython-310.pyc34580644editdlrm
exceptions.cpython-310.pyc24090644editdlrm
hash.cpython-310.pyc50440644editdlrm
hashlib.cpython-310.pyc46000644editdlrm
public.cpython-310.pyc132900644editdlrm
secret.cpython-310.pyc98220644editdlrm
signing.cpython-310.pyc78120644editdlrm
utils.cpython-310.pyc25940644editdlrm
__init__.cpython-310.pyc5670644editdlrm
Edit: /usr/lib/python3/dist-packages/nacl/__pycache__/signing.cpython-310.pyc (7812B)
o a @sddlmZddlZddlmZddlmZddlmZ m Z ddl m Z mZGdddeZGd d d eje ZGd d d eje ZdS) )OptionalN)encoding) exceptions) PrivateKey PublicKey) StringFixerrandomc @sdeZdZUdZeed<eed<ededededdfdd Zedefd d Z edefd d Z dS) SignedMessagezc A bytes subclass that holds a messaged that has been signed by a :class:`SigningKey`. _signature_message signaturemessagecombinedreturncCs||}||_||_|SN)r r )clsr r robjr./usr/lib/python3/dist-packages/nacl/signing.py _from_parts#szSignedMessage._from_partscC|jS)zL The signature contained within the :class:`SignedMessage`. )r selfrrrr ,zSignedMessage.signaturecCr)zJ The message contained within the :class:`SignedMessage`. )r rrrrr 3rzSignedMessage.messageN) __name__ __module__ __qualname____doc__bytes__annotations__ classmethodrpropertyr r rrrrr s$  r c @seZdZdZejfdedejfddZdefddZ de fd d Z d e de fd d Zd e de fddZdejfdedeedejdefddZdefddZdS) VerifyKeyz The public key counterpart to an Ed25519 SigningKey for producing digital signatures. :param key: [:class:`bytes`] Serialized Ed25519 public key :param encoder: A class that is able to decode the `key` keyencodercCsJ||}t|tstdt|tjjkr t dtjj||_ dS)Nz'VerifyKey must be created from 32 bytesz%The key must be exactly %s bytes long) decode isinstancerexc TypeErrorlennaclbindingscrypto_sign_PUBLICKEYBYTES ValueError_key)rr#r$rrr__init__Ds    zVerifyKey.__init__rcCrr)r.rrrr __bytes__TzVerifyKey.__bytes__cC tt|Srhashrrrrr__hash__W zVerifyKey.__hash__othercC&t||jsdStjt|t|SNFr& __class__r*r+ sodium_memcmprrr7rrr__eq__Z zVerifyKey.__eq__cC ||k Srrr=rrr__ne___ zVerifyKey.__ne__Nsmessager cCsp|dur+t|tstdtjjt|tjjkr#tdtjj|| |}n| |}tj ||j S)aS Verifies the signature of a signed message, returning the message if it has not been tampered with else raising :class:`~nacl.signing.BadSignatureError`. :param smessage: [:class:`bytes`] Either the original messaged or a signature and message concated together. :param signature: [:class:`bytes`] If an unsigned message is given for smessage then the detached signature must be provided. :param encoder: A class that is able to decode the secret message and signature. :rtype: :class:`bytes` Nz4Verification signature must be created from %d bytesz+The signature must be exactly %d bytes long) r&rr'r(r*r+crypto_sign_BYTESr)r-r%crypto_sign_openr.)rrCr r$rrrverifybs   zVerifyKey.verifycCstj|j}t|S)z Converts a :class:`~nacl.signing.VerifyKey` to a :class:`~nacl.public.PublicKey` :rtype: :class:`~nacl.public.PublicKey` )r*r+$crypto_sign_ed25519_pk_to_curve25519r._Curve25519_PublicKey)rraw_pkrrrto_curve25519_public_keysz"VerifyKey.to_curve25519_public_key)rrrrr RawEncoderrEncoderr/r0intr5objectboolr>rArrFrHrJrrrrr";s0   )r"c@seZdZdZejfdedejfddZdefddZ de fd d Z d e de fd d Zd e de fddZedddZejfdedejdefddZdefddZdS) SigningKeya Private key for producing digital signatures using the Ed25519 algorithm. Signing keys are produced from a 32-byte (256-bit) random seed value. This value can be passed into the :class:`~nacl.signing.SigningKey` as a :func:`bytes` whose length is 32. .. warning:: This **must** be protected and remain secret. Anyone who knows the value of your :class:`~nacl.signing.SigningKey` or it's seed can masquerade as you. :param seed: [:class:`bytes`] Random 32-byte value (i.e. private key) :param encoder: A class that is able to decode the seed :ivar: verify_key: [:class:`~nacl.signing.VerifyKey`] The verify (i.e. public) key that corresponds with this signing key. seedr$cCsj||}t|tstdt|tjjkr t dtjjtj |\}}||_ ||_ t ||_dS)Nz.SigningKey must be created from a 32 byte seedz&The seed must be exactly %d bytes long)r%r&rr'r(r)r*r+crypto_sign_SEEDBYTESr-crypto_sign_seed_keypair_seed _signing_keyr" verify_key)rrQr$ public_key secret_keyrrrr/s  zSigningKey.__init__rcCrr)rTrrrrr0r1zSigningKey.__bytes__cCr2rr3rrrrr5r6zSigningKey.__hash__r7cCr8r9r:r=rrrr>r?zSigningKey.__eq__cCr@rrr=rrrrArBzSigningKey.__ne__cCs|ttjjtjdS)z Generates a random :class:`~nacl.signing.SigningKey` object. :rtype: :class:`~nacl.signing.SigningKey` )r$)rr*r+rRrrK)rrrrgenerates zSigningKey.generater cCsTtj||j}tjj}||d|}|||d}||}t|||S)z Sign a message using this key. :param message: [:class:`bytes`] The data to be signed. :param encoder: A class that is used to encode the signed message. :rtype: :class:`~nacl.signing.SignedMessage` N)r*r+ crypto_signrUrDencoder r)rr r$ raw_signedrDr signedrrrsigns   zSigningKey.signcCs|j}tj|}t|S)z Converts a :class:`~nacl.signing.SigningKey` to a :class:`~nacl.public.PrivateKey` :rtype: :class:`~nacl.public.PrivateKey` )rUr*r+$crypto_sign_ed25519_sk_to_curve25519_Curve25519_PrivateKey)rsk raw_privaterrrto_curve25519_private_keys z$SigningKey.to_curve25519_private_keyN)rrP)rrrrrrKrrLr/r0rMr5rNrOr>rAr rYr r^r`rcrrrrrPs.   rP)typingr nacl.bindingsr*rrr' nacl.publicrr`rrH nacl.utilsrrrr Encodabler"rPrrrrs   ![