Closed cgraefe closed 7 years ago
You can see where the default key flags are set here: https://github.com/singpolyma/openpgp-php/blob/master/lib/openpgp_crypt_rsa.php#L157
As of recent commits the defaults are S and C.
If you want to add E, you will need to pass sign_key_userid
an OpenPGP_SignaturePacket
in addition to the key and userid packets. Set up as you see for the defaults, but add whatever settings you want (for example, also or on 0x04
to say the key can be used to encrypt communications -- see more flags in RFC4880 section 5.2.3.21)
In my current use case, I would like to use openpgp-php for key generation and decryption. The public key will be published and documents encrypted (somewhere else) using gpg should be read and decrypted. I generated a key pair using the keygen.php script from the examples folder and exported the public key, which I then imported into my gpg keyring using
gpg --import gpg_pubkey
When trying to use the key for encryption, gpg will skip it as an "unusable public key". I suppose this is because it is flagged for usage "C", only:
Is there a way to generate and export a public key for encryption? Or would I need a subkey for this? Any hints on this or maybe an additional/extended example script would be very much appreciated.