i am working on a project where it requires key management(Creation of Secret, Public and subkeys) and use them to perform cryptographic operations.
I have tried a POC on PGP Subkey creation with Bouncy Castle and try to perform cryptographic operations with it.
Following are the observations –
- Subkeys can be created only at the beginning with Secret Key. It cannot be created later and associated with Secret Key (while in gpg it can be added later).
- Documents encrypted with subkeys cannot be decrypted with Secret Key. (results in an Exception)
- Bouncy Castle treats subkeys as PGP MESSAGE (while Secret Key - PGP PRIVATE KEY BLOCK and Public Key - PGP PUBLIC KEY BLOCK)
- Specific Bouncy Castle APIs for Subkeys are not available.
Please help me understand how subkeys can be used in cryptographic operations with Bouncy Castle. It will be more helpful if anyone provide me code for the same.