Closed nikbra closed 2 years ago
So the GetUserIds
method comes from the Bouncy Castle repository and doesn't seem to have changed in 8 years.
I'm getting user IDs returned from the method using the most recent version of PgpCore so can't replicate this myself.
The most obvious answer is that you're using a key that's been created without a user but if that's not the case are you able to share a public key that's lets me replicate this and I'll take a look. I probably don't need the private key or password but they might make things easier if you're able to generate me a full set.
@mattosaurus , here is a link to a public pgp key from Swedish Handelsbanken. Should have a user : SHB/PGP-NYCKEL6
Here is a public link to the pgp key : handelsbanken_public_pgpkey_6_tcm72-152126.zip
Ah, this is to do with the changes made to the EncryptionKeys object to help it pick the correct key for each scenario (encrypting/signing/etc).
As part of this we changed how the PublicKey property was set. Previously it was just the first key in the keyring, now it's the first encryptable key in the keyring. In your case the encryption key doesn't have any user IDs but the master key does which would have been picked first previously (but wasn't always valid for encryption).
You can get the desired user ID from MasterKey.GetUserIds()
. To avoid confusion I'll probably flag the PublicKeys
and PublicKey
properties as obsolete and remove them in a future version.
@mattosaurus , thanks for the help. It works for us now. You can close this
Example :
PgpPublicKey GetUserIds();
Result in 0 user id's from version 5.6.0 and later.
Does work in version 5.5.0 but not in later versions.