Hello Alexander,
the PGP key looks good. As you have already tried it with GnuPG, it
seems to be a valid key. I thought you might throw the exported key into
pgpdump, but since you do not really want to export a key, this is
unnecessary. As I have explained, you cannot export only the subkey,
thus I am afraid the test with GnuPG will not help.
Everything else you said sounds reasonable, so I don't see why there
should be an exception. In fact, if you have a look at the source code
of AddMethod(PGPPublicKey), you see that the exception you described
occurrs only if IsEncryptionKey is false:
public void AddMethod(
PgpPublicKey key)
{
if (!key.IsEncryptionKey)
{
throw new ArgumentException("passed in key not an
encryption key!");
}
methods.Add(new PubMethod(key));
}
So does your method PublicKeyFromString return a PgpPublicKey object
with IsEncryptionKey set to false? I have tried your code on my machine
with one of my keys that seemed similar to yours (primary DSA, subkey
ElGamal) and it worked for me. The key had IsEncryptionKey set to true.
Best,
Christoph