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 / bindings / crypto_box.pyc
Size: Mime:
ó
ۍEYc@`sàddlmZmZmZddlmZddlmZm	Z	ddl
mZddgZe	j
ƒZe	jƒZe	jƒZe	jƒZe	jƒZe	jƒZd„Zd„Zd	„Zd
„Zd„Zd„Zd
S(i(tabsolute_importtdivisiontprint_function(t
exceptions(tffitlib(tensuretcrypto_box_keypairt
crypto_boxcC`svtjdtƒ}tjdtƒ}tj||ƒ}t|dkddtjƒtj	|tƒtj	|tƒfS(sq
    Returns a randomly generated public and secret key.

    :rtype: (bytes(public_key), bytes(secret_key))
    sunsigned char[]isUnexpected library errortraising(
Rtnewtcrypto_box_PUBLICKEYBYTEStcrypto_box_SECRETKEYBYTESRRRtexctRuntimeErrortbuffer(tpktsktrc((sM/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/bindings/crypto_box.pyR!s
cC`sìt|ƒtkr$tjdƒ‚nt|ƒtkrHtjdƒ‚nt|ƒtkrltjdƒ‚ndt|}tjdt|ƒƒ}t	j
||t|ƒ|||ƒ}t|dkddtjƒtj
|t|ƒƒtS(	sð
    Encrypts and returns a message ``message`` using the secret key ``sk``,
    public key ``pk``, and the nonce ``nonce``.

    :param message: bytes
    :param nonce: bytes
    :param pk: bytes
    :param sk: bytes
    :rtype: bytes
    sInvalid nonce sizesInvalid public keysInvalid secret keytsunsigned char[]isUnexpected library errorR	(tlentcrypto_box_NONCEBYTESR
t
ValueErrorRRtcrypto_box_ZEROBYTESRR
RRRRRtcrypto_box_BOXZEROBYTES(tmessagetnonceRRtpaddedt
ciphertextR((sM/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/bindings/crypto_box.pyR5s$
cC`sìt|ƒtkr$tjdƒ‚nt|ƒtkrHtjdƒ‚nt|ƒtkrltjdƒ‚ndt|}tjdt|ƒƒ}t	j
||t|ƒ|||ƒ}t|dkddtjƒtj
|t|ƒƒtS(	s
    Decrypts and returns an encrypted message ``ciphertext``, using the secret
    key ``sk``, public key ``pk``, and the nonce ``nonce``.

    :param ciphertext: bytes
    :param nonce: bytes
    :param pk: bytes
    :param sk: bytes
    :rtype: bytes
    sInvalid nonce sizesInvalid public keysInvalid secret keyRsunsigned char[]is/An error occurred trying to decrypt the messageR	(RRR
RRRRRR
Rtcrypto_box_openRtCryptoErrorRR(RRRRRt	plaintexttres((sM/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/bindings/crypto_box.pyRTs$
cC`sœt|ƒtkr$tjdƒ‚nt|ƒtkrHtjdƒ‚ntjdtƒ}tj	|||ƒ}t
|dkddtjƒtj|tƒS(s
    Computes and returns the shared key for the public key ``pk`` and the
    secret key ``sk``. This can be used to speed up operations where the same
    set of keys is going to be used multiple times.

    :param pk: bytes
    :param sk: bytes
    :rtype: bytes
    sInvalid public keysInvalid secret keysunsigned char[]isUnexpected library errorR	(
RRR
RRRR
tcrypto_box_BEFORENMBYTESRtcrypto_box_beforenmRRR(RRtkR((sM/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/bindings/crypto_box.pyR"rs

cC`sÅt|ƒtkr$tjdƒ‚nt|ƒtkrHtjdƒ‚ndt|}tjdt|ƒƒ}tj	||t|ƒ||ƒ}t
|dkddtjƒtj|t|ƒƒt
S(sÇ
    Encrypts and returns the message ``message`` using the shared key ``k`` and
    the nonce ``nonce``.

    :param message: bytes
    :param nonce: bytes
    :param k: bytes
    :rtype: bytes
    s
Invalid noncesInvalid shared keyRsunsigned char[]isUnexpected library errorR	(RRR
RR!RRR
Rtcrypto_box_afternmRRRR(RRR#RRR((sM/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/bindings/crypto_box.pyR$Œs
!
cC`sÅt|ƒtkr$tjdƒ‚nt|ƒtkrHtjdƒ‚ndt|}tjdt|ƒƒ}tj	||t|ƒ||ƒ}t
|dkddtjƒtj|t|ƒƒt
S(sØ
    Decrypts and returns the encrypted message ``ciphertext``, using the shared
    key ``k`` and the nonce ``nonce``.

    :param ciphertext: bytes
    :param nonce: bytes
    :param k: bytes
    :rtype: bytes
    s
Invalid noncesInvalid shared keyRsunsigned char[]is/An error occurred trying to decrypt the messageR	(RRR
RR!RRR
Rtcrypto_box_open_afternmRRRR(RRR#RRR ((sM/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/bindings/crypto_box.pyR%§s

N(t
__future__RRRtnaclRR
tnacl._sodiumRRtnacl.exceptionsRt__all__tcrypto_box_secretkeybytesRtcrypto_box_publickeybytesRtcrypto_box_noncebytesRtcrypto_box_zerobytesRtcrypto_box_boxzerobytesRtcrypto_box_beforenmbytesR!RRRR"R$R%(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/bindings/crypto_box.pyt<module>s