glance.common.crypt module¶
Routines for URL-safe encrypting/decrypting
- glance.common.crypt.urlsafe_decrypt(key, ciphertext)[source]¶
Decrypts URL-safe base64 encoded ciphertext. On Python 3, the result is decoded from UTF-8.
- Parameters:
key – AES secret key
ciphertext – The encrypted text to decrypt
- Returns:
Resulting plaintext
- glance.common.crypt.urlsafe_encrypt(key, plaintext, blocksize=16)[source]¶
Encrypts plaintext. Resulting ciphertext will contain URL-safe characters. If plaintext is Unicode, encode it to UTF-8 before encryption.
- Parameters:
key – AES secret key
plaintext – Input text to be encrypted
blocksize – Non-zero integer multiple of AES blocksize in bytes (16)
- Returns:
Resulting ciphertext