MCPcopy Index your code
hub / github.com/HelloZeroNet/ZeroNet / __init__

Method __init__

src/lib/pyelliptic/cipher.py:24–36  ·  view source on GitHub ↗

do == 1 => Encrypt; do == 0 => Decrypt

(self, key, iv, do, ciphername='aes-256-cbc')

Source from the content-addressed store, hash-verified

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():

Callers

nothing calls this directly

Calls 3

get_cipherMethod · 0.80
mallocMethod · 0.80
get_pointerMethod · 0.80

Tested by

no test coverage detected