Repository URL to install this package:
Version:
4.0.114 ▾
|
ó ۍEYc @` sÌ d d l m Z m Z m Z d d l m Z d d l m Z m Z d d l m Z e j Z e j d Z e j Z e j Z e j Z d Z d Z d Z d Z d Z d Z d S( i ( t absolute_importt divisiont print_function( t exceptions( t ffit lib( t ensurei c C` sv t j d t } t j d t } t j | | } t | d k d d t j t j | t t j | t f S( su Returns a randomly generated public key and secret key. :rtype: (bytes(public_key), bytes(secret_key)) s unsigned char[]i s Unexpected library errort raising( R t newt crypto_sign_PUBLICKEYBYTESt crypto_sign_SECRETKEYBYTESR t crypto_sign_keypairR t exct RuntimeErrort buffer( t pkt skt rc( ( sN /home/tvault/.virtenv/lib/python2.7/site-packages/nacl/bindings/crypto_sign.pyR s c C` s t | t k r$ t j d n t j d t } t j d t } t j | | | } t | d k d d t j t j | t t j | t f S( s Computes and returns the public key and secret key using the seed ``seed``. :param seed: bytes :rtype: (bytes(public_key), bytes(secret_key)) s Invalid seeds unsigned char[]i s Unexpected library errorR ( t lent crypto_sign_SEEDBYTESR t ValueErrorR R R R R t crypto_sign_seed_keypairR R R ( t seedR R R ( ( sN /home/tvault/.virtenv/lib/python2.7/site-packages/nacl/bindings/crypto_sign.pyR 3 s c C` s} t j d t | t } t j d } t j | | | t | | } t | d k d d t j t j | | d S( s© Signs the message ``message`` using the secret key ``sk`` and returns the signed message. :param message: bytes :param sk: bytes :rtype: bytes s unsigned char[]s unsigned long long *i s Unexpected library errorR ( R R R t crypto_sign_BYTESR t crypto_signR R R R ( t messageR t signedt signed_lenR ( ( sN /home/tvault/.virtenv/lib/python2.7/site-packages/nacl/bindings/crypto_sign.pyR K s ! c C` su t j d t | } t j d } t j | | | t | | d k r` t j d n t j | | d S( sÄ Verifies the signature of the signed message ``signed`` using the public key ``pk`` and returns the unsigned message. :param signed: bytes :param pk: bytes :rtype: bytes s unsigned char[]s unsigned long long *i s Signature was forged or corrupt( R R R R t crypto_sign_openR t BadSignatureErrorR ( R R R t message_len( ( sN /home/tvault/.virtenv/lib/python2.7/site-packages/nacl/bindings/crypto_sign.pyR _ s !c C` s{ t | t k r$ t j d n t } t j d | } t j | | } t | d k d d t j t j | | S( s Converts a public Ed25519 key (encoded as bytes ``public_key_bytes``) to a public Curve25519 key as bytes. Raises a ValueError if ``public_key_bytes`` is not of length ``crypto_sign_PUBLICKEYBYTES`` :param public_key_bytes: bytes :rtype: bytes s Invalid curve public keys unsigned char[]i s Unexpected library errorR ( R R R R t crypto_sign_curve25519_BYTESR R R t$ crypto_sign_ed25519_pk_to_curve25519R R R ( t public_key_bytest curve_public_key_lent curve_public_keyR ( ( sN /home/tvault/.virtenv/lib/python2.7/site-packages/nacl/bindings/crypto_sign.pyR r s c C` s{ t | t k r$ t j d n t } t j d | } t j | | } t | d k d d t j t j | | S( s Converts a secret Ed25519 key (encoded as bytes ``secret_key_bytes``) to a secret Curve25519 key as bytes. Raises a ValueError if ``secret_key_bytes``is not of length ``crypto_sign_SECRETKEYBYTES`` :param public_key_bytes: bytes :rtype: bytes s Invalid curve public keys unsigned char[]i s Unexpected library errorR ( R R R R R R R R t$ crypto_sign_ed25519_sk_to_curve25519R R R ( t secret_key_bytest curve_secret_key_lent curve_secret_keyR ( ( sN /home/tvault/.virtenv/lib/python2.7/site-packages/nacl/bindings/crypto_sign.pyR$ s N( t __future__R R R t naclR R t nacl._sodiumR R t nacl.exceptionsR t crypto_sign_bytesR t crypto_sign_secretkeybytesR t crypto_sign_publickeybytesR R t crypto_box_secretkeybytesR R R R R R R$ ( ( ( sN /home/tvault/.virtenv/lib/python2.7/site-packages/nacl/bindings/crypto_sign.pyt <module> s