The goal of this article is to show some tests done on Electrum to sign messages, verify signatures, encrypt messages and decrypt them all within Electrum using a standard Bitcoin Wallet (on testnet in this case). So using Electrum as a tool for cryptography. Here below the tests and results i had using the command line on the testnet for encrypting and decrypting a simple string message.

Get a list of addresses and choose one for this test.

massmux@spartacus:~$ ./electrum-4.3.0-x86_64.AppImage --testnet listaddresses -w ~/.electrum/testnet/wallets/testnet1   --offline

Now take first address and ask for public keys. Infact we need the public key behind the address.

massmux@spartacus:~$ ./electrum-4.3.0-x86_64.AppImage --testnet getpubkeys -w ~/.electrum/testnet/wallets/testnet1 tb1qc84a329tvykedw9m8hmwqwkxjhurc04a9tpj3c  --offline

Now I can easily encrypt a message “mymessage” using the below syntax and the public key i just gathered.

massmux@spartacus:~$ ./electrum-4.3.0-x86_64.AppImage --testnet --offline encrypt 03a813c590a9298a91fe2393bd1692041aa2e5dd926ecc3399c05a7ac487927f4a mymessage

Let’s test the message decryption. The decryption needs to unlock the wallet, therefore the wallet password is asked by Electrum:

massmux@spartacus:~$ ./electrum-4.3.0-x86_64.AppImage --testnet --offline -w ~/.electrum/testnet/wallets/testnet1 decrypt 03a813c590a9298a91fe2393bd1692041aa2e5dd926ecc3399c05a7ac487927f4a QklFMQMn6ipkJxQgl/0fiksXpabViyuzAaiPft8bgINYbfKO7nkMEyy2VoMMLcUX48l1rr4fiklg4Qo/iFwM2B7RdwA/iFRzTdDFPXiAUenCtk0L0w==

As you can see, once again, Electrum shows a lot of advantages as a swiss knife for Bitcoin and anything around it. We used it to encrypt/decrypt messages in an easy way. All those operations are available also inside the GUI, without using the command line. But using the command line is more educative on my opinion. Enjoy