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

Method decrypt

src/cryptography/fernet.py:84–90  ·  view source on GitHub ↗
(self, token: bytes | str, ttl: int | None = None)

Source from the content-addressed store, hash-verified

82 return base64.urlsafe_b64encode(basic_parts + hmac)
83
84 def decrypt(self, token: bytes | str, ttl: int | None = None) -> bytes:
85 timestamp, data = Fernet._get_unverified_token_data(token)
86 if ttl is None:
87 time_info = None
88 else:
89 time_info = (ttl, int(time.time()))
90 return self._decrypt_data(data, timestamp, time_info)
91
92 def decrypt_at_time(
93 self, token: bytes | str, ttl: int, current_time: int

Callers 15

test_verifyMethod · 0.95
test_invalidMethod · 0.95
test_non_base64_tokenMethod · 0.95
test_invalid_typesMethod · 0.95
test_roundtripsMethod · 0.95
test_encryptMethod · 0.95
decryptMethod · 0.45
test_aes_gcm_aead_apiFunction · 0.45
test_aes_ccm_aead_apiFunction · 0.45

Calls 2

_decrypt_dataMethod · 0.95

Tested by 15

test_verifyMethod · 0.76
test_invalidMethod · 0.76
test_non_base64_tokenMethod · 0.76
test_invalid_typesMethod · 0.76
test_roundtripsMethod · 0.76
test_encryptMethod · 0.76
test_aes_gcm_aead_apiFunction · 0.36
test_aes_ccm_aead_apiFunction · 0.36
test_chacha20poly1305Function · 0.36