f



Encrypting a PDF using a key instead of password

How can a PDF be encrypted using a public key instead of a password?

Starting with:

 * myfile.pdf
 * my_keystore.pfx (created with openssl or Acrobat Reader)

I tried to encrypt it to myself as an experimental dry-run.  I first
extracted the public key:

$ openssl pkcs12 -in my_keystore.pfx -clcerts -nokeys -out my_pubkey.crt

Then JSignPDF was used to encrypt and sign the file:

$ java -jar JSignPdf.jar\
       myfile.pdf\
       --encryption             certificate\
       --encryption-certificate my_pubkey.crt\
       --img-path          	my_handwritten_sig.png\
       --keystore-file     	my_keystore.pfx\
       --keystore-password 	mypassword\
       --keystore-type     	PKCS12\
       --reason            	experiment\
       --render-mode       	GRAPHIC_AND_DESCRIPTION\
       --page                   1\
       -llx 75 -lly 175 -urx 450 -ury 225\
       --visible-signature

The error is:

  "the file my_pubkey.crt either doesn't contain a X509 certificate or
   the encryption is not supported for this certificate."

0
Fritz
5/18/2015 10:32:01 AM
comp.text.pdf 5600 articles. 0 followers. ramon (1518) is leader. Post Follow

0 Replies
770 Views

Similar Articles

[PageSpeed] 25

Reply: