davsclaus opened a new pull request, #3382:
URL: https://github.com/apache/camel-kamelets/pull/3382

   Two new **Preview** action Kamelets on the Camel `pgp` data format 
(camel-crypto-pgp), for the OpenPGP step of file exchanges with partners (sftp, 
ftp, smb, object stores).
   
   ### `pgp-encrypt-action`
   Encrypts the body for the public key of a recipient, and can also sign it.
   
   | Option | |
   |---|---|
   | `publicKeyRing` (required) | the recipient's public key ring: `file:`, 
`classpath:` or `base64:` (the key ring itself as text) |
   | `keyUserId` (required) | the user id of the recipient's key, or a part of 
it (every key that matches is used) |
   | `armored` | ASCII armored output instead of binary (default `false`) |
   | `signingKeyRing`, `signingKeyUserId`, `signingPassphrase` (credential) | 
sign with your secret key; all three needed, else the Kamelet does not start |
   
   - **Input:** text, bytes, a stream or a file.
   - **Output:** the OpenPGP message as a stream, `Content-Type: 
application/pgp-encrypted`, the other headers kept.
   - Encrypts with AES-256 and signs with SHA-256 (the data format defaults are 
CAST5 and SHA-1), always with the integrity packet. gpg 2.5 decrypts the result 
and verifies the signature (checked locally).
   
   ### `pgp-decrypt-action`
   Decrypts with your secret key, and checks the signature against the senders 
you trust.
   
   | Option | |
   |---|---|
   | `secretKeyRing` (required) | your secret key ring: `file:`, `classpath:` 
or `base64:` |
   | `passphrase` (required, credential) | the passphrase of your secret key |
   | `verificationKeyRing` | the public keys of the senders you trust; when it 
is set, a message must be signed by one of them |
   | `signatureVerification` | `required` (default) or `optional` (unsigned 
messages pass too); only used with `verificationKeyRing` |
   
   - **Input:** an OpenPGP message, binary or armored: bytes, text, a stream or 
a file.
   - **Output:** the decrypted data as a stream, `Content-Type: 
application/octet-stream`, the other headers kept.
   - If `verificationKeyRing` is not set, signatures are not checked. Integrity 
protection is required.
   
   ### Security
   Before the marshal/unmarshal step, both Kamelets remove the 
`CamelPGPDataFormat*` headers. The data format reads the key ring file name, 
the key ring bytes, the user ids, the passphrases and the algorithms from these 
headers before it looks at its own options, so a message cannot choose a key or 
an algorithm. The headers are removed again after the step. Both Kamelets are 
added to the `KameletsRemoveHeadersTest` CSV.
   
   ### Known limitation (Camel)
   When the recipient key was made with GnuPG 2.4 or later, gpg 2.4 and later 
encrypt in the OCB (AEAD) format. The `requireIntegrityProtection` check of the 
data format rejects those messages as "not integrity protected", even though 
OCB is authenticated (`PGPEncryptedData.isAEAD()`). The `pgp-decrypt-action` 
description documents this and the workaround (remove OCB from the key 
preferences with `setpref`). A test pins the current behaviour, so when Camel 
fixes this the test fails and the description gets updated.
   
   ### Tests
   `CommonIT`, new package `pgp` (no container). It uses test-only RSA key 
pairs made with gpg (alice, bob), committed as armored files with a `Comment:` 
that marks them test-only. The test checks:
   - armored round trip, where `CamelPGPDataFormatKeyUserid`/`KeyFileName` 
headers that name bob are ignored and the `CamelPGPDataFormat*` headers are 
gone afterwards
   - binary message signed by bob, with the public key ring given as `base64:` 
text, and the signature checked
   - a message made by gpg, decrypted with and without its signature checked
   - failures: the wrong key; a signer who is not trusted; an unsigned message 
when a signature is required (it passes when `optional`); a message with one 
bit changed (`Message failed integrity check`); a message without integrity 
protection; the OCB message from gpg 2.5
   
   Local results: `./mvnw -o clean install -DskipITs` passes (catalog 
validation, `KameletsRemoveHeadersTest` 89/89). `CommonIT` 
(`-Denable.integration.tests -Dit.test=CommonIT`): 73 tests, 0 failures, 
including `pgp-action-test` with its 19 checks. gpg 2.5 also decrypted a 
message made by `pgp-encrypt-action` and verified its signature: AES256, 
SHA-256 signature, the `CamelFileName` stored as the literal file name.
   
   Fixes #3374.
   
   ### Upgrade note
   ```
   New Kamelets `pgp-encrypt-action` and `pgp-decrypt-action` (Preview): 
OpenPGP encryption and signing of a message body, and its decryption and 
signature check, with key rings given as `file:`, `classpath:` or `base64:` 
resources.
   ```
   
   _Claude Code on behalf of Claus Ibsen_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to