Skip to content

Using subkey for encryption in EncryptAndSign #39

Description

@clayschaad

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions