Add OpenSSL 1.1 support to CryptMessage plugin by using radfish's pyelliptic version
This commit is contained in:
parent
be742c78e7
commit
fbafd23177
11 changed files with 2169 additions and 4 deletions
|
@ -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:
|
||||
|
|
|
@ -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])]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue