|
|
|
@ -19,6 +19,10 @@ try:
@@ -19,6 +19,10 @@ try:
|
|
|
|
|
"\tpip uninstall pycrypto") |
|
|
|
|
else: |
|
|
|
|
from Crypto.Random import get_random_bytes |
|
|
|
|
except ImportError: |
|
|
|
|
try: |
|
|
|
|
from Cryptodome.Cipher import AES |
|
|
|
|
from Cryptodome.Random import get_random_bytes |
|
|
|
|
except ImportError: |
|
|
|
|
PBinCLIError("Unable import pycryptodome") |
|
|
|
|
|
|
|
|
@ -120,8 +124,15 @@ class Paste:
@@ -120,8 +124,15 @@ class Paste:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def __deriveKey(self, salt): |
|
|
|
|
try: |
|
|
|
|
from Crypto.Protocol.KDF import PBKDF2 |
|
|
|
|
from Crypto.Hash import HMAC, SHA256 |
|
|
|
|
except ModuleNotFoundError: |
|
|
|
|
try: |
|
|
|
|
from Cryptodome.Protocol.KDF import PBKDF2 |
|
|
|
|
from Cryptodome.Hash import HMAC, SHA256 |
|
|
|
|
except ImportError: |
|
|
|
|
PBinCLIError("Unable import pycryptodome") |
|
|
|
|
|
|
|
|
|
# Key derivation, using PBKDF2 and SHA256 HMAC |
|
|
|
|
return PBKDF2( |
|
|
|
|