Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
contego / home / tvault / .virtenv / lib / python2.7 / site-packages / nacl / public.pyc
Size: Mime:
ó
ۍEYc@`sÅddlmZmZmZddlZddlmZddlmZddl	m
Z
mZmZdej
eefd„ƒYZdej
eefd	„ƒYZd
ej
eefd„ƒYZdS(i(tabsolute_importtdivisiontprint_functionN(tencoding(t
exceptions(tEncryptedMessagetStringFixertrandomt	PublicKeycB`sMeZdZejjZejd„Z	d„Z
d„Zd„Zd„Z
RS(s=
    The public key counterpart to an Curve25519 :class:`nacl.public.PrivateKey`
    for encrypting messages.

    :param public_key: [:class:`bytes`] Encoded Curve25519 public key
    :param encoder: A class that is able to decode the `public_key`

    :cvar SIZE: The size that the public key is required to be
    cC`sp|j|ƒ|_t|jtƒs6tjdƒ‚nt|jƒ|jkrltjdj	|jƒƒ‚ndS(Ns'PublicKey must be created from 32 bytess-The public key must be exactly {0} bytes long(
tdecodet_public_keyt
isinstancetbytestexct	TypeErrortlentSIZEt
ValueErrortformat(tselft
public_keytencoder((s@/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/public.pyt__init__$scC`s|jS(N(R
(R((s@/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/public.pyt	__bytes__/scC`stt|ƒƒS(N(thashR(R((s@/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/public.pyt__hash__2scC`s5t||jƒstStjjt|ƒt|ƒƒS(N(Rt	__class__tFalsetnacltbindingst
sodium_memcmpR(Rtother((s@/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/public.pyt__eq__5scC`s||kS(N((RR((s@/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/public.pyt__ne__:s(t__name__t
__module__t__doc__RRtcrypto_box_PUBLICKEYBYTESRRt
RawEncoderRRRR R!(((s@/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/public.pyRs				t
PrivateKeycB`s\eZdZejjZejd„Z	d„Z
d„Zd„Zd„Z
ed„ƒZRS(s
    Private key for decrypting messages using the Curve25519 algorithm.

    .. warning:: This **must** be protected and remain secret. Anyone who
        knows the value of your :class:`~nacl.public.PrivateKey` can decrypt
        any message encrypted by the corresponding
        :class:`~nacl.public.PublicKey`

    :param private_key: The private key used to decrypt messages
    :param encoder: The encoder class used to decode the given keys

    :cvar SIZE: The size that the private key is required to be
    cC`sŒ|j|ƒ}t|tƒs0tjdƒ‚nt|ƒ|jkr^tjd|jƒ‚ntj	j
|ƒ}||_t|ƒ|_
dS(Ns.PrivateKey must be created from a 32 byte seeds,The secret key must be exactly %d bytes long(R	RRR
RRRRRRtcrypto_scalarmult_baset_private_keyRR(Rtprivate_keyRtraw_public_key((s@/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/public.pyROs	cC`s|jS(N(R)(R((s@/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/public.pyR`scC`stt|ƒƒS(N(RR(R((s@/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/public.pyRcscC`s5t||jƒstStjjt|ƒt|ƒƒS(N(RRRRRRR(RR((s@/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/public.pyR fscC`s||kS(N((RR((s@/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/public.pyR!kscC`s|ttjƒdtjƒS(s~
        Generates a random :class:`~nacl.public.PrivateKey` object

        :rtype: :class:`~nacl.public.PrivateKey`
        R(RR'RRR&(tcls((s@/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/public.pytgeneratens(R"R#R$RRtcrypto_box_SECRETKEYBYTESRRR&RRRR R!tclassmethodR-(((s@/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/public.pyR'>s
				tBoxcB`sneZdZejjZd„Zd„Ze	e
jd„ƒZde
jd„Zde
jd„Zd„ZRS(s/
    The Box class boxes and unboxes messages between a pair of keys

    The ciphertexts generated by :class:`~nacl.public.Box` 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 private_key: :class:`~nacl.public.PrivateKey` used to encrypt and
        decrypt messages
    :param public_key: :class:`~nacl.public.PublicKey` used to encrypt and
        decrypt messages

    :cvar NONCE_SIZE: The size that the nonce is required to be.
    cC`s„|rw|rwt|tƒs,t|tƒr>tjdƒ‚ntjj|jdt	j
ƒ|jdt	j
ƒƒ|_n	d|_dS(Ns5Box must be created from a PrivateKey and a PublicKeyR(
RR'RR
RRRtcrypto_box_beforenmtencodeRR&t_shared_keytNone(RR*R((s@/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/public.pyRŽs	cC`s|jS(N(R3(R((s@/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/public.pyR›scC`s%|ddƒ}|j|ƒ|_|S(N(R4R	R3(R,tencodedRtbox((s@/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/public.pyR	žscC`s¥|dkrt|jƒ}nt|ƒ|jkrLtjd|jƒ‚ntjj|||j	ƒ}|j
|ƒ}|j
|ƒ}tj|||j
||ƒƒS(s¯
        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.

        :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(
R4Rt
NONCE_SIZERR
RRRtcrypto_box_afternmR3R2Rt_from_parts(Rt	plaintexttnonceRt
ciphertextt
encoded_noncetencoded_ciphertext((s@/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/public.pytencrypt¨s		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	R4R7RR
RRRtcrypto_box_open_afternmR3(RR<R;RR:((s@/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/public.pytdecryptÍs

		cC`s|jS(s§
        Returns the Curve25519 shared secret, that can then be used as a key in
        other symmetric ciphers.

        .. warning:: It is **VITALLY** important that you use a nonce with your
            symmetric cipher. If you fail to do this, you compromise the
            privacy of the messages encrypted. Ensure that the key length of
            your cipher is 32 bytes.
        :rtype: [:class:`bytes`]
        (R3(R((s@/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/public.pyt
shared_keyísN(R"R#R$RRtcrypto_box_NONCEBYTESR7RRR/RR&R	R4R?RARB(((s@/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/public.pyR0xs	
		% (t
__future__RRRt
nacl.bindingsRRRR
t
nacl.utilsRRRt	EncodabletobjectRR'R0(((s@/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/public.pyt<module>s':