@bettyvschmartz
I was able to reproduce issues on Linux and have released onlykey-agent v1.1.11 to address issues. It appears with Linux there are 2 distinct issues:
Issue #1) Init of derivation keys work first time but not second time even if the directory is deleted
The first time you use the agent like this it works:
$ rm -rf /home/osboxes/.gnupg/onlykey && onlykey-gpg init ‘bob smith bob@protonmail.com’
If you try to create the same identify a second time (run exact same command) it works, however if you try to create a different identity like this:
$ rm -rf /home/osboxes/.gnupg/onlykey && onlykey-gpg init ‘alice smith alice@protonmail.com’
It fails, its as if GPG is remembering the identity directory even though its removed. If you use a different directory like this it works:
rm -rf /home/osboxes/.gnupg/onlykey && onlykey-gpg init ‘alice smith alice@protonmail.com’ --homedir /home/osboxes/.gnupg/onlykey/testalice
This seems to be because rm in Linux does not really delete the file if its held open by a process, running this command shows the deleted file:
$ `sudo lsof -F sn0 | tr -d '\000' | grep deleted | sed 's/^[a-z]*\([0-9]*\)n/\1 /' | sort -n`
After a reboot the file will be actually deleted and the agent can create a different identify in the same location. Still looking into other options here and why this behavior happens.
Issue #2) When using stored keys with imported public keys (-i option) on Mac and some Linux versions this works but I found in some cases it was unable to resolve path to run-agent.sh, and so failed. This is now fixed in version 1.1.11 of onlykey-agent. The fix was to create the environment variable AGENTHOMEDIR that contains whatever --homedir is passed to the onlykey-gpg command.
There are also improvements for better GPG support in in the new v2.1.1 firmware if you have a chance to test that out. Here are some one liners to test with the test key provided above:
Stored Key Test
$ rm -rf /home/osboxes/.gnupg/onlykey && onlykey-gpg init “Bob Smith <bob@protonmail.com>” -sk 102 -dk 101 -i /home/osboxes/testpub.asc --homedir /home/osboxes/.gnupg/onlykey/2 && echo “secret message” | gpg2 --encrypt -r “Bob Smith <bob@protonmail.com>” --homedir /home/osboxes/.gnupg/onlykey/2 | gpg2 --decrypt --homedir /home/osboxes/.gnupg/onlykey/2 && echo “Hello World” | gpg2 --sign --homedir /home/osboxes/.gnupg/onlykey/2 | gpg2 --verify --homedir /home/osboxes/.gnupg/onlykey/2
2021-06-03 15:59:02,533 WARNING This GPG tool is still in EXPERIMENTAL mode, so please note that the API and features may change without backwards compatibility! [init.py:128]
2021-06-03 15:59:02,551 WARNING NOTE: in order to re-generate the exact same GPG key later, run this command with “–time=0” commandline flag (to set the timestamp of the GPG key manually). [init.py:39]
gpg: inserting ownertrust of 6
gpg: checking the trustdb
gpg: marginals needed: 3 completes needed: 1 trust model: pgp
gpg: depth: 0 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 1u
sec ed25519 2021-03-23 [SC]
04C64623EA51A3B79658DBF7FFADEA1DA23333FD
uid [ultimate] Bob Smith <bob@protonmail.com>
ssb cv25519 2021-03-23 [E]
gpg: encrypted with 256-bit ECDH key, ID 4B433249E7DE1630, created 2021-03-23
“Bob Smith <bob@protonmail.com>”
secret message
gpg: using “Bob Smith <bob@protonmail.com>” as default secret key for signing
gpg: Signature made Thu 03 Jun 2021 03:59:05 PM EDT
gpg: using EDDSA key 04C64623EA51A3B79658DBF7FFADEA1DA23333FD
gpg: issuer “bob@protonmail.com”
gpg: Good signature from “Bob Smith <bob@protonmail.com>” [ultimate]
Derived Key Testrm -rf /home/osboxes/.gnupg/onlykey && onlykey-gpg init “Bob Smith <bob@protonmail.com>” --homedir /home/osboxes/.gnupg/onlykey/3 && echo “secret message” | gpg2 --encrypt -r “Bob Smith <bob@protonmail.com>” --homedir /home/osboxes/.gnupg/onlykey/3 | gpg2 --decrypt --homedir /home/osboxes/.gnupg/onlykey/3 && echo “Hello World” | gpg2 --sign --homedir /home/osboxes/.gnupg/onlykey/3 | gpg2 --verify --homedir /home/osboxes/.gnupg/onlykey/3
2021-06-03 16:17:27,197 WARNING This GPG tool is still in EXPERIMENTAL mode, so please note that the API and features may change without backwards compatibility! [init.py:128]
2021-06-03 16:17:27,211 WARNING NOTE: in order to re-generate the exact same GPG key later, run this command with “–time=0” commandline flag (to set the timestamp of the GPG key manually). [init.py:39]
Enter the 3 digit challenge code on OnlyKey to authorize <gpg://Bob Smith <bob@protonmail.com>|ed25519>
1 6 6
Enter the 3 digit challenge code on OnlyKey to authorize <gpg://Bob Smith <bob@protonmail.com>|ed25519>
3 6 2
gpg: inserting ownertrust of 6
gpg: checking the trustdb
gpg: marginals needed: 3 completes needed: 1 trust model: pgp
gpg: depth: 0 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 1u
sec ed25519 1970-01-01 [SC]
00D7E7648313E75CBCACEE1E4E33E1555C9C727D
uid [ultimate] Bob Smith <bob@protonmail.com>
ssb cv25519 1970-01-01 [E]
gpg: WARNING: cipher algorithm AES256 not found in recipient preferences
gpg: encrypted with 256-bit ECDH key, ID B6A4B0937CCC61C7, created 1970-01-01
“Bob Smith <bob@protonmail.com>”
secret message
gpg: using “Bob Smith <bob@protonmail.com>” as default secret key for signing
gpg: Signature made Thu 03 Jun 2021 04:17:35 PM EDT
gpg: using EDDSA key 00D7E7648313E75CBCACEE1E4E33E1555C9C727D
gpg: issuer “bob@protonmail.com”
gpg: Good signature from “Bob Smith <bob@protonmail.com>” [uncertain]
To test this upgrade to the latest firmware here - Release OnlyKey 2.1.1 Firmware · trustcrypto/OnlyKey-Firmware · GitHub
And upgrade to the latest agent with:
$ pip3 install onlykey-agent