diff --git a/README.md b/README.md index 2616bca0..0b66e330 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,7 @@ The following applies to Ubuntu Bionic. Other distros may have different package * Run Onionr normally: `$ ./onionr.sh start` * Run Onionr in background as daemon: `$ ./start-daemon.sh` * Open Onionr web interface `$ ./onionr.sh openhome` +* Gracefully stop Onionr from CLI `$ ./onionr.sh stop` # Help out diff --git a/onionr/onionrcrypto/encryption/__init__.py b/onionr/onionrcrypto/encryption/__init__.py index 0bcdde6b..caf9c0c0 100644 --- a/onionr/onionrcrypto/encryption/__init__.py +++ b/onionr/onionrcrypto/encryption/__init__.py @@ -27,6 +27,8 @@ def pub_key_encrypt(data, pubkey, encodedData=False): def pub_key_decrypt(data, pubkey='', privkey='', encodedData=False): '''pubkey decrypt (Curve25519, taken from Ed25519 pubkey)''' + if pubkey != '': + pubkey = unpaddedbase32.repad(bytesconverter.str_to_bytes(pubkey)) decrypted = False if encodedData: encoding = nacl.encoding.Base64Encoder diff --git a/onionr/onionrcrypto/signing/__init__.py b/onionr/onionrcrypto/signing/__init__.py index a46aacc2..a62f5ba9 100644 --- a/onionr/onionrcrypto/signing/__init__.py +++ b/onionr/onionrcrypto/signing/__init__.py @@ -1,8 +1,13 @@ import base64, binascii + +import unpaddedbase32 import nacl.encoding, nacl.signing, nacl.exceptions + +from onionrutils import bytesconverter import logger def ed_sign(data, key, encodeResult=False): '''Ed25519 sign data''' + key = unpaddedbase32.repad(bytesconverter.str_to_bytes(key)) try: data = data.encode() except AttributeError: @@ -17,6 +22,7 @@ def ed_sign(data, key, encodeResult=False): def ed_verify(data, key, sig, encodedData=True): '''Verify signed data (combined in nacl) to an ed25519 key''' + key = unpaddedbase32.repad(bytesconverter.str_to_bytes(key)) try: key = nacl.signing.VerifyKey(key=key, encoder=nacl.encoding.Base32Encoder) except nacl.exceptions.ValueError: