Add OpenSSL 1.1 support to CryptMessage plugin by using radfish's pyelliptic version

This commit is contained in:
shortcutme 2019-08-02 16:13:54 +02:00
parent be742c78e7
commit fbafd23177
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE
11 changed files with 2169 additions and 4 deletions

View file

@ -7,7 +7,7 @@ ecc_cache = {}
def eciesEncrypt(data, pubkey, ephemcurve=None, ciphername='aes-256-cbc'):
import pyelliptic
from lib import pyelliptic
pubkey_openssl = toOpensslPublickey(base64.b64decode(pubkey))
curve, pubkey_x, pubkey_y, i = pyelliptic.ECC._decode_pubkey(pubkey_openssl)
if ephemcurve is None:
@ -34,7 +34,7 @@ def split(encrypted):
def getEcc(privatekey=None):
import pyelliptic
from lib import pyelliptic
global ecc_cache
if privatekey not in ecc_cache:
if privatekey:

View file

@ -60,7 +60,7 @@ class UiWebsocketPlugin(object):
# Encrypt a text using AES
# Return: Iv, AES key, Encrypted text
def actionAesEncrypt(self, to, text, key=None, iv=None):
import pyelliptic
from lib import pyelliptic
if key:
key = base64.b64decode(key)
@ -83,7 +83,7 @@ class UiWebsocketPlugin(object):
# Decrypt a text using AES
# Return: Decrypted text
def actionAesDecrypt(self, to, *args):
import pyelliptic
from lib import pyelliptic
if len(args) == 3: # Single decrypt
encrypted_texts = [(args[0], args[1])]