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

   [CAMEL-25992](https://issues.apache.org/jira/browse/CAMEL-25992)
   
   ## What
   
   The `sign`, `verify`, `hybridSign` and `hybridVerify` operations of 
camel-pqc now read a `java.io.File` or `java.nio.file.Path` body, and a file 
from a file consumer (a `GenericFile` body), as bytes from the file, the same 
way as a `byte[]` or `InputStream` body since CAMEL-23847. A binary file from 
the file consumer could not be signed before (`MalformedInputException`); now 
it can.
   
   ## Change
   
   - `PQCProducer`: one small resolver, `fileContent`, used by `sign`/`verify` 
(streamed in chunks) and by `hybridSign`/`hybridVerify` (read fully):
     - a `WrappedFile` gives its content (`WrappedFile.getBody()`). For the 
file consumer that is a `java.io.File` built from the current absolute path, so 
it is still the right file after a `preMove`; otherwise it is the content the 
consumer has already loaded (`byte[]` or `InputStream`), which then takes the 
existing branches;
     - a `java.io.File` is turned into its `Path`, which is streamed with 
`Files.newInputStream` (`sign`/`verify`) or read with `Files.readAllBytes` 
(hybrid operations).
     - `byte[]`, `InputStream` and `String` bodies, and all other body types, 
are handled as before.
   - `pqc-component.adoc`: the NOTE on body types now covers `File`, `Path` and 
`GenericFile` bodies, and the hybrid signature operations.
   - `camel-4x-upgrade-guide-4_24.adoc`: signatures created by earlier versions 
over such bodies may not verify and need to be created again.
   
   ## Tests
   
   `PQCFileBodySignatureTest` (8 tests) checks every case against an 
independent `java.security.Signature` (or `HybridSignature`) over the bytes of 
the file, which is binary content of every byte value:
   
   - `File` and `Path` bodies, signed and verified;
   - a binary file polled by the file consumer, signed and verified in one 
route;
   - a `GenericFile` whose content is already loaded as a `byte[]`;
   - `hybridSign` with a `Path` body and `hybridVerify` with a `File` body.
   
   All 8 fail without the change to `PQCProducer`. `mvn verify` of camel-pqc 
passes: 318 tests and 18 integration tests.
   
   The backports to camel-4.22.x and camel-4.18.x follow in separate PRs, and 
their upgrade-guide entries are added to `main` with them.
   
   _Claude Code on behalf of davsclaus_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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