Hi Alexander,
I reported the bug you referred to. Indeed, I observed the same
behaviour as you did when I imported the PGP keys with GnuPG, but it
only affects secret keys IIRC. Anyway, I have some code snippets that
may help you with your issue. However, I haven't had the time to search
for those, because I have been quite busy.
Maybe you can use the tool pgpdump to find out more about the original
and exported keys?
Also, I believe that the patch I had provided with the bug report has
some disadvantages that I found out about later. Maybe the KeyID changed
in the process of lifting the PGP version from 3 to 4 or something like
that. I will have a look at this and write another email when I have a
little more time (in 10 hours I hope).
Best,
Christoph
On 22.04.2013 20:48, Alexander Voronin wrote:
Could anyone comment this? I found unresolved bug
http://www.bouncycastle.org/jira/browse/BMA-98 could it lead to this
issue?
2013/4/18 Alexander Voronin <[email protected]
<mailto:[email protected]>>
Hi! Unfortunately wiki is down and I did not found anything
related in internet. I have following issue.
I have GnuPG signed public key that contains signed public key:
root@ubuntu:~# gpg --import < pkey.asc
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key 771E0A0E: public key "User (User) <[email protected]
<mailto:[email protected]>>" imported
gpg: Total number processed: 1
gpg: imported: 1
root@ubuntu:~#
root@ubuntu:~# gpg --encrypt -r User
gpg: 91A942AE: There is no assurance this key belongs to the named
user
pub 4096g/91A942AE 2010-10-29 User (User) <[email protected]
<mailto:[email protected]>>
Primary key fingerprint: BB08 D13A 1AEB 2F23 1767 D912 CCD0 17AF
771E 0A0E
Subkey fingerprint: E87A 27D3 A3D8 6489 70D8 2D19 2C65 0745
91A9 42AE
....
And so on. So key is correct and usable. To extract PgpPublicKey
object from key I'm using following method:
public static PgpPublicKey PublicKeyFromString(string keyString) {
using (Stream mStream = new MemoryStream(StringToBytes(keyString))) {
using (Stream inputStream = PgpUtilities.GetDecoderStream(mStream)) {
PgpPublicKeyRingBundle pgpPub = new
PgpPublicKeyRingBundle(inputStream);
foreach (PgpPublicKeyRing kRing in pgpPub.GetKeyRings()) {
foreach (PgpPublicKey pKey in kRing.GetPublicKeys()) {
if (pKey.IsEncryptionKey) {
return pKey;
}
}
}
}
}
// not found
throw new ArgumentException(SJ.Resources.ErrorPGPNoKeysInKeyRing);
}
The problem I see - kRing.GetPublicKeys() returns two elements -
one of them public key itself and second one is key sign. But
public key returned with attribute IsEncryptionKey set to false,
and sign returned with IsEncryptionKey set to true. I can't use
this PgpPublicKey object for encryption, and of course can't use
sign for this puprose. kRing.GetPublicKey() also returns public
key with IsEncryptionKey set to false.
When I got public key using this method it looks usable (untill
I'm trying to encrypt anything) and I can even save them in
armored format. But after this GnuPG import says:
root@ubuntu:~# gpg --import < pkey-extracted.asc
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key 771E0A0E: public key "User (User) <[email protected]
<mailto:[email protected]>>" imported
gpg: Total number processed: 1
gpg: imported: 1
root@ubuntu:~# gpg --encrypt -r User
gpg: Darkterror: skipped: unusable public key
gpg: [stdin]: encryption failed: unusable public key
root@ubuntu:~#
Is is bug or I missunderstood something? What is correct way to
extract signed public key form keyring?
Thanks in advance!
--
когда я опустился на самое дно, снизу мне постучали..
--
когда я опустился на самое дно, снизу мне постучали..