mirror of
https://github.com/markqvist/Reticulum.git
synced 2026-10-26 10:51:49 -04:00
Fixed invalid reference in exception description
This commit is contained in:
parent
99c428a9f5
commit
281c47f3e0
1 changed files with 4 additions and 4 deletions
|
|
@ -43,7 +43,7 @@ elif cp.PROVIDER == cp.PROVIDER_PYCA:
|
|||
class AES_128_CBC:
|
||||
@staticmethod
|
||||
def encrypt(plaintext, key, iv):
|
||||
if len(key) != 16: raise ValueError(f"Invalid key length {len(key)*8} for {self}")
|
||||
if len(key) != 16: raise ValueError(f"Invalid key length {len(key)*8} for AES_128_CBC")
|
||||
if cp.PROVIDER == cp.PROVIDER_INTERNAL:
|
||||
cipher = AES128(key)
|
||||
return cipher.encrypt(plaintext, iv)
|
||||
|
|
@ -60,7 +60,7 @@ class AES_128_CBC:
|
|||
|
||||
@staticmethod
|
||||
def decrypt(ciphertext, key, iv):
|
||||
if len(key) != 16: raise ValueError(f"Invalid key length {len(key)*8} for {self}")
|
||||
if len(key) != 16: raise ValueError(f"Invalid key length {len(key)*8} for AES_128_CBC")
|
||||
if cp.PROVIDER == cp.PROVIDER_INTERNAL:
|
||||
cipher = AES128(key)
|
||||
return cipher.decrypt(ciphertext, iv)
|
||||
|
|
@ -78,7 +78,7 @@ class AES_128_CBC:
|
|||
class AES_256_CBC:
|
||||
@staticmethod
|
||||
def encrypt(plaintext, key, iv):
|
||||
if len(key) != 32: raise ValueError(f"Invalid key length {len(key)*8} for {self}")
|
||||
if len(key) != 32: raise ValueError(f"Invalid key length {len(key)*8} for AES_256_CBC")
|
||||
if cp.PROVIDER == cp.PROVIDER_INTERNAL:
|
||||
cipher = AES256(key)
|
||||
return cipher.encrypt_cbc(plaintext, iv)
|
||||
|
|
@ -95,7 +95,7 @@ class AES_256_CBC:
|
|||
|
||||
@staticmethod
|
||||
def decrypt(ciphertext, key, iv):
|
||||
if len(key) != 32: raise ValueError(f"Invalid key length {len(key)*8} for {self}")
|
||||
if len(key) != 32: raise ValueError(f"Invalid key length {len(key)*8} for AES_256_CBC")
|
||||
if cp.PROVIDER == cp.PROVIDER_INTERNAL:
|
||||
cipher = AES256(key)
|
||||
return cipher.decrypt_cbc(ciphertext, iv)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue