MCPcopy
hub / github.com/pyca/cryptography / encrypt

Method encrypt

src/cryptography/fernet.py:52–53  ·  view source on GitHub ↗
(self, data: bytes)

Source from the content-addressed store, hash-verified

50 return base64.urlsafe_b64encode(os.urandom(32))
51
52 def encrypt(self, data: bytes) -> bytes:
53 return self.encrypt_at_time(data, int(time.time()))
54
55 def encrypt_at_time(self, data: bytes, current_time: int) -> bytes:
56 iv = os.urandom(16)

Callers 15

test_invalid_typesMethod · 0.95
test_roundtripsMethod · 0.95
test_decryptMethod · 0.95
test_aes_gcm_aead_apiFunction · 0.45
test_aes_ccm_aead_apiFunction · 0.45
test_chacha20poly1305Function · 0.45
test_roundtripMethod · 0.45
test_wrong_key_x25519Method · 0.45
test_wrong_key_p256Method · 0.45

Calls 1

encrypt_at_timeMethod · 0.95

Tested by 15

test_invalid_typesMethod · 0.76
test_roundtripsMethod · 0.76
test_decryptMethod · 0.76
test_aes_gcm_aead_apiFunction · 0.36
test_aes_ccm_aead_apiFunction · 0.36
test_chacha20poly1305Function · 0.36
test_roundtripMethod · 0.36
test_wrong_key_x25519Method · 0.36
test_wrong_key_p256Method · 0.36