sera/utils.py
def encrypt(msg, recipient_key, private_key='', encoding='utf-8'):
    """Encrypt a message with the given recipient public key"""

    private_key = private_key or getenv('SERA_CLIENT_PRIVATE_KEY')
    skey = PrivateKey(private_key, URLSafeBase64Encoder)
    rkey = PublicKey(recipient_key, URLSafeBase64Encoder)
    msg = bytes(msg, encoding)
    box = Box(skey, rkey)
    nonce = random(Box.NONCE_SIZE)
    return box.encrypt(msg, nonce)
Encrypt a message with the given recipient public key
Encrypt a message with the given recipient public key
Encrypt a message with the given recipient public key
def encrypt(msg, recipient_key, private_key='', encoding='utf-8'):
    private_key = private_key or getenv('SERA_CLIENT_PRIVATE_KEY')
    skey = PrivateKey(private_key, URLSafeBase64Encoder)
    rkey = PublicKey(recipient_key, URLSafeBase64Encoder)
    msg = bytes(msg, encoding)
    box = Box(skey, rkey)
    nonce = random(Box.NONCE_SIZE)
    return box.encrypt(msg, nonce)
def encrypt ( msg , recipient_key , private_key = '' , encoding = 'utf-8' ) : private_key = private_key or getenv ( 'SERA_CLIENT_PRIVATE_KEY' ) skey = PrivateKey ( private_key , URLSafeBase64Encoder ) rkey = PublicKey ( recipient_key , URLSafeBase64Encoder ) msg = bytes ( msg , encoding ) box = Box ( skey , rkey ) nonce = random ( Box . NONCE_SIZE ) return box . encrypt ( msg , nonce )
Encrypt a message with the given recipient public key
Encrypt a message with the given recipient public key
"""Encrypt a message with the given recipient public key"""
msg
recipient_key
private_key
encoding