swiftly.dencrypt

Encryption routines for Swiftly.

Requires PyCrypto 2.6.1 or greater. <https://www.dlitz.net/software/pycrypto/>

Copyright 2013 Gregory Holt

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

swiftly.dencrypt.AES256CBC = '\x00'

Constant that can be used a preamble for algorithm detection.

swiftly.dencrypt.aes_decrypt(key, stdin, chunk_size=65536)[source]

Generator that decrypts a content stream using AES 256 in CBC mode.

Parameters:
  • key – Any string to use as the decryption key.
  • stdin – Where to read the encrypted data from.
  • chunk_size – Largest amount to read at once.
swiftly.dencrypt.aes_encrypt(key, stdin, preamble=None, chunk_size=65536, content_length=None)[source]

Generator that encrypts a content stream using AES 256 in CBC mode.

Parameters:
  • key – Any string to use as the encryption key.
  • stdin – Where to read the contents from.
  • preamble – str to yield initially useful for providing a hint for future readers as to the algorithm in use.
  • chunk_size – Largest amount to read at once.
  • content_length – The number of bytes to read from stdin. None or < 0 indicates reading until EOF.

Previous topic

swiftly.concurrency

Next topic

swiftly.filelikeiter

This Page