mssun / passforios

Pass for iOS - an iOS client compatible with Pass command line application.
https://mssun.github.io/passforios
MIT License
1.5k stars 102 forks source link

Invalid session key size error #536

Open santuari opened 2 years ago

santuari commented 2 years ago

I migrated my key from RSA to ECDSA. I am trying to setup passforios to use two keys (iPhone and yubikey), but I got an error in the passforios app: "Invalid session key size" while trying to decrypt and the new password created are not decryptable by both iPhone and Yubikey.

I used RSA keys with sub-keys on the yubikey and one RSA key without subkeys on iPhone: everything works.

Now I use ECDSA sub-keys both on the yubikey and iPhone:

# Yubikey keys
pub   nistp384/MasterId 2022-01-08 [C]
uid         [ultimate] myName <myEmail>
sub   nistp384/SubId1 2022-01-08 [S] [expires: 2024-02-27]
sub   nistp384/SubId2 2022-01-08 [E] [expires: 2024-02-27]
sub   nistp384/SubId3 2022-01-08 [A] [expires: 2024-02-27]

# iPhone keys
pub   nistp384/iPhoneMatserId 2022-01-08 [SC] [expires: 2024-02-27]
uid         [ultimate] myName <myEmail>
sub   nistp384/iPhoneSubId1 2022-01-08 [E] [expires: 2024-02-27]

The pass .gpg-id contains MasterId and iPhoneMatserId.

If I use only the iPhone PGP as a configuration for passforios as follows:

gpg -a --export  iPhoneMatserId > public.asc
gpg -a --export-secrect-keys  iPhoneMatserId > private.asc

on iPhone I am able to create new password and decrypt the stored passwords. Clearly, with the yubikey I am not able to decrypt the password created on iPhone, because "yubikey" public key is missing (i.e., MasterId).

I tired to add the public PGP key of the MasterId but I got always the error "Invalid session key size error". Those are the way I created the public PGP key to be used on passforios:

# master keys
gpg -a --export  MasterId iPhoneMatserId > public.asc
# only sub-keys 
gpg -a --export  SubId2! iPhoneSubId1! > public.asc
# only sub-keys without !
gpg -a --export  SubId2 iPhoneSubId1 > public.asc

What I am doing wrong?

santuari commented 2 years ago

Any idea on what I am doing wrong?