mirror of https://gitlab.com/bashrc2/epicyon
Check for beginning and end of public key
parent
32817b721a
commit
6c1b792a20
6
pgp.py
6
pgp.py
|
@ -344,7 +344,8 @@ def _getPGPPublicKeyFromActor(handle: str, actorJson=None) -> str:
|
||||||
if not isinstance(tag['value'], str):
|
if not isinstance(tag['value'], str):
|
||||||
continue
|
continue
|
||||||
if '--BEGIN PGP PUBLIC KEY BLOCK--' in tag['value']:
|
if '--BEGIN PGP PUBLIC KEY BLOCK--' in tag['value']:
|
||||||
return tag['value']
|
if '--END PGP PUBLIC KEY BLOCK--' in tag['value']:
|
||||||
|
return tag['value']
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
@ -378,7 +379,8 @@ def pgpDecrypt(content: str, fromHandle: str) -> str:
|
||||||
|
|
||||||
# if the public key is also included within the message then import it
|
# if the public key is also included within the message then import it
|
||||||
startBlock = '--BEGIN PGP PUBLIC KEY BLOCK--'
|
startBlock = '--BEGIN PGP PUBLIC KEY BLOCK--'
|
||||||
if startBlock in content:
|
endBlock = '--END PGP PUBLIC KEY BLOCK--'
|
||||||
|
if startBlock in content and endBlock in content:
|
||||||
pubKey = extractPGPPublicKey(content)
|
pubKey = extractPGPPublicKey(content)
|
||||||
else:
|
else:
|
||||||
pubKey = _getPGPPublicKeyFromActor(content, fromHandle)
|
pubKey = _getPGPPublicKeyFromActor(content, fromHandle)
|
||||||
|
|
Loading…
Reference in New Issue