I have an issue with the usage of a subkeys in the method EncryptAndSign. This method uses the master key for encryption, even if there is a subkey for encryption. Have a look at the comment on IsEncryptionKey in the BouncyCastle Library: "Note: with version 4 keys KeyFlags subpackets should also be considered when present for determining the preferred use of the key."
Your method Encrypt() already uses the right logic, but EncryptAndSign() uses the method GetFirstPublicKey() which does't care about the logic with KeyFlags of subkeys.
I'll make a pull request with a possible solution. Perhaps you can check it out.
Hi
I have an issue with the usage of a subkeys in the method EncryptAndSign. This method uses the master key for encryption, even if there is a subkey for encryption. Have a look at the comment on IsEncryptionKey in the BouncyCastle Library: "Note: with version 4 keys KeyFlags subpackets should also be considered when present for determining the preferred use of the key." Your method Encrypt() already uses the right logic, but EncryptAndSign() uses the method GetFirstPublicKey() which does't care about the logic with KeyFlags of subkeys.
I'll make a pull request with a possible solution. Perhaps you can check it out.
Thanks Claudio