I get a certificate from some time stamping authority. I want know, if it is possible to sign the pdf document with just the certificate. All methods which I see is to sign with the certificate and private key in Java. If it is possible what class java can I use?
It is not possible.
Digital signature in a public key infraestructure: The message is signed with private key and verified with public (the public key is included into the certificate)
But if you got a certificate from a certificate authority (CA), then you probably have the private key. A certificate is issued by the CA using a CSR (Certificate Signing Request) created by you and signed with your private key. See Certificate enrollment process
Look for a .key
file
TSA vs CA
A TSA issues "time stamps", not certificates. A CA issues certificates. Some of them can be used by a TSA to issue timestamp. To sign a PDF you need a private key and a certificate. To timestamp a PDF you need to request a timestamp to a TSA