I'm merging two PDFs with digital signatures using PDFBox. However, the result is a pdf with the signatures in the document, but when opened in Acrobat Reader it shows that there aren't valid signatures as shown:
How can I keep the signatures?
Signatures are used to authenticate that the PDF file is an original unmodified file.
When you merge files, you've modified them, so they are no longer originals, and hence the signature is invalid, as it should be.
You should remove the signatures to prevent the warning, and leave the merged PDF unsigned.
For an overview of changes allowed to a signed document see this answer.