mirror of
https://github.com/markqvist/Reticulum.git
synced 2024-11-22 13:40:19 +00:00
Store GROUP destination symmetric key as bytes instead of base64
This commit is contained in:
parent
2b97c89566
commit
f880edbeb8
@ -5,9 +5,6 @@ import RNS
|
|||||||
from cryptography.fernet import Fernet
|
from cryptography.fernet import Fernet
|
||||||
from cryptography.hazmat.primitives import hashes
|
from cryptography.hazmat.primitives import hashes
|
||||||
from cryptography.hazmat.backends import default_backend
|
from cryptography.hazmat.backends import default_backend
|
||||||
from cryptography.hazmat.primitives import serialization
|
|
||||||
from cryptography.hazmat.primitives.asymmetric import rsa
|
|
||||||
from cryptography.hazmat.primitives.asymmetric import padding
|
|
||||||
|
|
||||||
class Callbacks:
|
class Callbacks:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -32,7 +29,6 @@ class Destination:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
KEYSIZE = RNS.Identity.KEYSIZE;
|
KEYSIZE = RNS.Identity.KEYSIZE;
|
||||||
PADDINGSIZE= RNS.Identity.PADDINGSIZE;
|
|
||||||
|
|
||||||
# Constants
|
# Constants
|
||||||
SINGLE = 0x00
|
SINGLE = 0x00
|
||||||
@ -245,8 +241,8 @@ class Destination:
|
|||||||
raise TypeError("A single destination holds keys through an Identity instance")
|
raise TypeError("A single destination holds keys through an Identity instance")
|
||||||
|
|
||||||
if self.type == Destination.GROUP:
|
if self.type == Destination.GROUP:
|
||||||
self.prv_bytes = Fernet.generate_key()
|
self.prv_bytes = base64.urlsafe_b64decode(Fernet.generate_key())
|
||||||
self.prv = Fernet(self.prv_bytes)
|
self.prv = Fernet(base64.urlsafe_b64encode(self.prv_bytes))
|
||||||
|
|
||||||
|
|
||||||
def get_private_key(self):
|
def get_private_key(self):
|
||||||
@ -278,7 +274,7 @@ class Destination:
|
|||||||
|
|
||||||
if self.type == Destination.GROUP:
|
if self.type == Destination.GROUP:
|
||||||
self.prv_bytes = key
|
self.prv_bytes = key
|
||||||
self.prv = Fernet(self.prv_bytes)
|
self.prv = Fernet(base64.urlsafe_b64encode(self.prv_bytes))
|
||||||
|
|
||||||
def load_public_key(self, key):
|
def load_public_key(self, key):
|
||||||
if self.type != Destination.SINGLE:
|
if self.type != Destination.SINGLE:
|
||||||
|
Loading…
Reference in New Issue
Block a user