passforios icon indicating copy to clipboard operation
passforios copied to clipboard

PGP key import fails when using "export-secret-subkeys" on v0.6.0

Open a-feld opened this issue 4 years ago • 25 comments

On version 0.6.0 of pass, PGP key init appears to have stopped working. When trying to import keys I get an error message dialog along the lines of "cannot import the key". The key is a 3072 bit RSA key.

Downgrading to pass 0.5.1 seems to solve the issue.

a-feld avatar Jul 15 '19 23:07 a-feld

Looking into the issue further it appears that gopenpgp doesn't like my armored private key. The public key loads successfully but the private key does not. I'm still debugging.

a-feld avatar Jul 16 '19 01:07 a-feld

This issue is related to https://github.com/golang/go/issues/13605 The GPG key in use is a subkey and the primary private key is not exported. This results in a gnu-dummy S2K in the armored key and causes an error when attempting to parse the private key.

The key is generated through the command:

gpg  --export-secret-subkeys -a $KEY_ID 

There doesn't appear to be anything to do on the passforios side of things.

a-feld avatar Jul 16 '19 01:07 a-feld

Yeah. It would be a good idea to add a caveat to the wiki that it's not possible to use subkeys for this task right now. I just use a dedicated key everywhere.

Edit: Pinging @yishilin14

savyajha avatar Jul 16 '19 04:07 savyajha

This is wired... Golang still does not merge the fix for FOUR years.

I'll leave this issue open for now, since some people upgrade to the latest version and found out that subkey is not supported.

mssun avatar Jul 16 '19 04:07 mssun

Do we have to add ObjectivePGP back as a backup plan?

Edit: I mean using ObjectivePGP as an alternative in case gopengpg fails to encrypt/decrypt, for the sake of compatibility. This is not the ultimate solution though.

yishilin14 avatar Jul 16 '19 04:07 yishilin14

I seriously hope we don't shift back to ObjectivePGP in any form. Being able to use ed25519 keys makes me feel safer.

savyajha avatar Jul 16 '19 05:07 savyajha

Don’t worry. We don’t have plan to switch back.

I’m thinking about how to fix this, cause we have received some feedbacks on the subkey issue.

mssun avatar Jul 16 '19 05:07 mssun

Hi all, I added a hot fix to this issue (0862c1388e1b42ecf6b3c4db91c3e824aac319ba). If Gopenpgp fails to import the key and throws an error, Pass uses ObjectivePGP to import the key.

Some examples:

  1. RSA2048 public key: imported by Gopenpgp
  2. RSA2048 private key: imported by Gopenpgp
  3. RSA2048 private key (subkey): imported by ObjectivePGP
  4. ED25519 public key: imported by Gopenpgp
  5. ED25519 private key: imported by Gopenpgp
  6. ED25519 private key (subkey): Pass will CRASH without showing any error message, as in the previous App Store version. This is because ObjectivePGP cannot handle this key algorithm. Previously, users have to reinstall the app in order to get rid of the endless crash. Now, Pass will remove the key from the keychain and users do not have to reinstall. However, the user experience is still awful because there is no error message about the crash and the key pasted is gone without any notification.

If you guys are interested to try this specific version we roll out to all TestFlight testers, please drop an email to [email protected]. Thank in advance for your patience and help.

yishilin14 avatar Jul 17 '19 04:07 yishilin14

I was suddenly affected by this issue after Pass automatically updated to the latest AppStore version (0.6.0) and my previously loaded RSA4096 keys with subkeys stopped working. Subkey support is essential as it's really required for safe use of PGP/GPG and much more essential than compatibility with ECDSA/ed25519 keys. My suggestion for a near term until a viable solution is reached that doesn't break core functionality: revert back to the ObjectivePGP version for the AppStore version and keep the version using gopenpgp in TestFlight until this issue is resolved.

jmpolom avatar Jul 20 '19 17:07 jmpolom

My suggestion for a near term until a viable solution is reached that doesn't break core functionality: revert back to the ObjectivePGP version for the AppStore version and keep the version using gopenpgp in TestFlight until this issue is resolved.

@jmpolom Thanks for you comment. But we will not revert back to the ObjectivePGP version.

Please see my previous comment for the solution. We will submit a new version to AppStore by Monday.

yishilin14 avatar Jul 20 '19 18:07 yishilin14

@yishilin14 that looked like a reasonable solution. ObjectivePGP will be retained to import subkeys that can't be imported with gopenpgp. This will prevent core functionality from being lost for RSA subkeys.

jmpolom avatar Jul 20 '19 19:07 jmpolom

Hi @yishilin14 , the subkey issues appear to have been fixed in Keybase's fork of go crypto.

Using these patches will allow passforios to fix the subkey problem without using ObjectivePGP. I've tested this with a subkey and it appears to import successfully now. This would also allow passforios to use ed25519 subkeys.

I've pushed that branch up here https://github.com/a-feld/passforios/commit/66ab4d56c2633dc01ab7efe7f06135bce06aab2d

What do you think?

a-feld avatar Jul 21 '19 00:07 a-feld

I too would very much like to see this patched ASAP as it has completely crippled my password management on mobile. Currently I’m working off sites remembering me but it’s going to rapidly become an issue if I can use a sub key.

On 21 Jul 2019, at 01:02, Allan Feldman [email protected] wrote:

Hi @yishilin14 , the subkey issues appear to have been fixed in Keybase's fork of go crypto.

Using these patches will allow passforios to fix the subkey problem without using ObjectivePGP. I've tested this with a subkey and it appears to import successfully now. This would also allow passforios to use ed25519 subkeys.

I've pushed that branch up here a-feld@66ab4d5

What do you think?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

tomtom5152 avatar Jul 21 '19 00:07 tomtom5152

@a-feld Thank you for pointing that out.

I am a bit concerned about using a patch. Does that mean that we have to somehow "fix" the version of go crypto libraries in order to make sure that the patch works?

Do you mind creating a pull request? We can move our related tech discussions there.

yishilin14 avatar Jul 21 '19 16:07 yishilin14

Is there an ETA for the new version in the app store? I've got the same problem as #290 and can't access my passwords anymore.

dfv-ms avatar Jul 24 '19 07:07 dfv-ms

As 0.7 is released in the AppStore I was so happy but now I can again add my key, but after I click on any password pass just crashes to my homescreen without a message. Someone else experiencing this? Should I open a new report? I also tried by removing the app and start from scratch just with the same effect.

nylocx avatar Jul 25 '19 19:07 nylocx

@nylocx, did previous builds work for you? Right now, we are using two libraries (gopengpg and objectivpgp) to cover more cases, though it is a workaround before we figure out how to fix it in gopenpgp.

mssun avatar Jul 25 '19 21:07 mssun

@mssun yes everything before 0.6 worked fine. I’m on an iPhone Xs with the latest IOS version and have enabled Pass in the settings as password store provider. 0.6 broke because my key has subkeys as I decrypt on my notebooks using a yubikey as a smart card device. It’s too bad that iOS doesn’t even provide something like a coredump on such a crash.

Sent with GitHawk

nylocx avatar Jul 26 '19 03:07 nylocx

@nylocx I didn't have a yubikey in my hand right now. Can you give me a concrete example so that I can test this case? Say, how to generatef the case with openssl?

mssun avatar Jul 26 '19 18:07 mssun

Hi, I tried to generate a key mostly similar to the one I use with gpg:

-----BEGIN PGP PRIVATE KEY BLOCK-----

lQPGBF07btUBCADViFIoxIpdoa6hpGLKd31cLb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AKCRB4EWSgosoi
sVu4CAC7CYGVMB0c+Jy600Jd3Jbi98dDeQVw18E7j9UoQn/s6k/+VXFb7/nDAV+B
SpkKexOiehM5sINMDxU436RzYOF4dAthxPG5PbN/E4MmTzTFS1U1+PvnxaxkRiUm
xowxMIG3/8u+TUrGZrWIjvocDJtwqXKivc4FFORiEiOgJ+KhpyxnjARmUttM5RER
La/f/lj1I7Cj87cJlZkq7Yz/Lj+p0Lb3F11RQqn7qAN6wnx3vEo3IW15GIvUA5S9
0bKhCZ/PKPMLF8mP1OT4PyDeFM77ZpsOchCOlJlKBHzgT3s/dlS9C8hkvfg9rHXc
lX2tdrz36iYVcLiyBnFhcx0c6NvG
=EFkY
-----END PGP PUBLIC KEY BLOCK-----

The passphrase is: pass

The only thing I couldn't do was transfering the subkeys to a smartcard so that just stubs of the subkeys are left, because I had no other smartcard device here. Maybe you can check with those keys.

nylocx avatar Jul 26 '19 21:07 nylocx

Thanks. BTW, how do you generate the key? Can you provide the commands?

mssun avatar Jul 26 '19 21:07 mssun

Sure its pretty standard: gpg --gen-key Then select RSA 2048 or 4096 and fill in the details after creation is finished you just edit the key in expert mode gpg --expert --edit-key <keyid> addkey add an RSA key (type 4) and another subkey with addkey as encryption key (type 6)

And than use keytocard to move the subkeys to a smartcard (which I couldn't do for the demo).

A detailed explanation you can find here (thats what I used when I first got my yubikey in 2014 ;))

nylocx avatar Jul 26 '19 21:07 nylocx

I am getting Error "Cannot import they key." in 0.7 as well as 0.6.

gromakovsky avatar Jul 26 '19 23:07 gromakovsky

I have also encountered a similar issue. I have an ed25519 master key (certify only) and 3 rsa2048 subkeys (so they can fit on my smartcard). Here, we see that the master private key is unavailable, and the private subkeys are on the smartcard:

$ gpg --list-secret-keys
/home/joe/.gnupg/pubring.kbx
----------------------------
sec#  ed25519/0x62F9CC138DD71788 2020-04-29 [C]
      Key fingerprint = C219 B085 9693 A74A E328  B342 62F9 CC13 8DD7 1788
uid                   [ultimate] Joe Harrison <[email protected]>
ssb>  rsa2048/0x252B7C6B41E9E80B 2020-04-29 [S]
ssb>  rsa2048/0x44E2AEC68BB9AC88 2020-04-29 [E]
ssb>  rsa2048/0x58E3F701087D55BF 2020-04-29 [A]

Doing an export of the public and private keys with armor and importing into Pass via QR codes yields the error "cannot import the key" after clicking "save":

$ gpg --export -a [email protected] > public.asc
$ gpg --export-secret-keys -a [email protected] > private.asc
$ # transfer private.asc and public.asc to Pass app using QR codes

But if I set up a new keyring in a temporary directory and import the private subkeys (notice the lack of >) this all works:

$ gpg --list-secret-keys
/run/user/1000/tmp.dnOpSzeAoD/pubring.kbx
-----------------------------------------
sec#  ed25519 2020-04-29 [C]
      C219B0859693A74AE328B34262F9CC138DD71788
uid           [ unknown] Joe Harrison <[email protected]>
ssb   rsa2048 2020-04-29 [S]
ssb   rsa2048 2020-04-29 [E]
ssb   rsa2048 2020-04-29 [A]
$ gpg --export -a [email protected] > public.asc
$ gpg --export-secret-keys -a [email protected] > private.asc
$ # transfer private.asc and public.asc to Pass app using QR codes, all works ok

I think a workaround is to set up a new keyring in a temporary directory (e.g. cd $(mktemp -d); export GNUPGHOME=$PWD/.gnupg"), import your public keys, import the necessary private subkeys, and then delete all subkeys which are stored on the smartcard, export that modified key, and import it on the device.

This has one big drawback, though, I think: if any of those subkeys had the encryption capability (and were listed in .gpg-id, you won't be able to decrypt password entries generated on your phone with those keys.

sigwinch28 avatar Apr 29 '20 16:04 sigwinch28

I still experienced this bug as for today. Thanks to the hint by @sigwinch28, here's how I worked around it.


This is a note on putting my key-pairs to iPhone for the app pass to work. Notice that I DO NOT want my primary key to be transplanted, and I DO want a separate passphrase when it is used in iOS. I’m using gpg version 2.2.29.

(Caveat: My way isn’t optimal. It could be better to do all writings to a temporarily created file system that is safer.)

First, export the full secret-key to a file secret.asc.

$ gpg --export-secret-keys --armor [[key-id]] > secret.asc

Then temporarily move the current gpg root-dir to another place. Then import the freshly generated secret keys. We do this because the ios app pass does not seem to have taken care of this bug - you need to hack around like this for it to accept secret sub-keys.

$ mv ~/.gnupg ~/.gnupg_
$ gpg --import secret.asc

Then edit the password by the following. It will prompt you to reset the password. This is also why you should have exported the full private key above (including the primary key).

$ gpg --edit-key [[key-id]]
..(in-repl).. gpg> passwd
# Enter the original password, and set a new password.

Then remove the primary key. For the current version, go to ~/.gnupg/private-keys-v1 and manually remove the primary key! We do not want this to be stored in an iPhone.

Export keys to qr-codes by using qrencode. The arguments are set for the case where the output is too long.

$ gpg --export-secret-subkeys -a [[key-id]] | qrencode -S -v 40 -l L -o secret.png
$ gpg --export -a [[key-id]] | qrencode -S -v 40 -l L -o public.png

Use the ios app pass to read the qr-code into iphone. It is smart enough to expect multiple qr codes if the output is too long.

Finally, remove the temporary files with care.

$ rm -rf ~/.gnupg secret.asc secret.png public.png
$ mv ~/.gnupg_ ~/.gnupg

jcguu95 avatar Aug 16 '21 21:08 jcguu95