do == 1 => Encrypt; do == 0 => Decrypt
(self, key, iv, do, ciphername='aes-256-cbc')
| 22 | print ctx2.ciphering(ciphertext) |
| 23 | """ |
| 24 | def __init__(self, key, iv, do, ciphername='aes-256-cbc'): |
| 25 | """ |
| 26 | do == 1 => Encrypt; do == 0 => Decrypt |
| 27 | """ |
| 28 | self.cipher = OpenSSL.get_cipher(ciphername) |
| 29 | self.ctx = OpenSSL.EVP_CIPHER_CTX_new() |
| 30 | if do == 1 or do == 0: |
| 31 | k = OpenSSL.malloc(key, len(key)) |
| 32 | IV = OpenSSL.malloc(iv, len(iv)) |
| 33 | OpenSSL.EVP_CipherInit_ex( |
| 34 | self.ctx, self.cipher.get_pointer(), 0, k, IV, do) |
| 35 | else: |
| 36 | raise Exception("RTFM ...") |
| 37 | |
| 38 | @staticmethod |
| 39 | def get_all_cipher(): |
nothing calls this directly
no test coverage detected