Digitally sign latex pdf document with CA

There is an answer to this question on askubuntu: https://askubuntu.com/questions/147379/how-do-i-digitally-sign-a-pdf/608449#608449

gpg --clearsign --output=signed.pdf input.pdf

The user can check the signature with gpg --verify signed.pdf