bugfix
This commit is contained in:
parent
d9fd408dd6
commit
55f53e34ae
@ -57,11 +57,14 @@ class RSA:
|
|||||||
)
|
)
|
||||||
return key
|
return key
|
||||||
|
|
||||||
|
def publickeyFromText(self,text):
|
||||||
|
public_key_bytes = bytes(text,encoding='utf8')
|
||||||
|
return serialization.load_pem_public_key(data=public_key_bytes,backend=default_backend())
|
||||||
|
|
||||||
def read_publickey(self,fname):
|
def read_publickey(self,fname):
|
||||||
with open(fname,'r') as f:
|
with open(fname,'r') as f:
|
||||||
public_key_pem_export = f.read()
|
text = f.read()
|
||||||
public_key_pem_export = bytes(public_key_pem_export,encoding='utf8') if not isinstance(public_key_pem_export, bytes) else public_key_pem_export
|
return self.publickeyFromText(text)
|
||||||
return serialization.load_pem_public_key(data=public_key_pem_export,backend=default_backend())
|
|
||||||
|
|
||||||
def create_privatekey(self):
|
def create_privatekey(self):
|
||||||
return rsa.generate_private_key(
|
return rsa.generate_private_key(
|
||||||
|
Loading…
Reference in New Issue
Block a user