I'm trying to copy my gpg key from one machine to another.
I do:
gpg --export ${ID} > public.key
gpg --export-secret-key ${ID} > private.key
Move files to new machine, and then:
gpg --import public.key
gpg: nyckel [ID]: public key [Name, e-mail] was imported
gpg: Total number of treated keys: 1
gpg: imported: 1 (RSA: 1)
gpg --allow-secret-key-import private.key
sec [?]/[ID] [Creation date] [Name, e-mail]
ssb [?]/[SUB-ID] [Creation date]
All looks good to me, but then:
$ gpg -d [file].gpg
gpg: encrypted with 4096-bit RSA-key, id [SUB-ID], created [Creation date]
[Name, e-mail]
gpg: decryption failed: secret key not accessible
So the error message says that the file has been encrypted with [SUB-ID], which the secret key import appears to say it has imported. (The [SUB-ID] in both messages is the same).
So I'm clearly doing something wrong, but I don't know what.