Digital Certificate Verification using PHP

Hi to all,

I have a java applet, and a smartcard which have a digital certificate (public key & private key) in it. Using the java applet and the smartcard, i can digitally sign any local file in computer, obtain the digital signature and also i can extract the certification chain.

So, i want to upload the signature, the file itself and the certification chain to the apache-php server and there i want to verify these informations.
So my questions are:

1 - How can i upload the public key (loaded in smartcard) to the server? (Is there a particular folder for its reside?)
2 - How can i decode the signature using this (uploaded) public key?
3 - How can i obtain the message digest from the original file using hash algoritm?
4 - How can i verify the certification chain is correct and the sender’s certificate is right?

As you see, i know what to do but don’t know how to do using php…

Anyone can help on this issue, please…?

Thanks ahead,


There are a lot of questions here, and mostly they depend on your java applet.

What form will it output these things as? Where will it output them to?

I choice a local file using standart file input in a html form, then click the sign button and applet outputs digital signature and certificate chain as a string variable.

Yesterday, i searched and found some answers; i want to share here, maybe someone else may need in future:

This link give the answer to my first,second and the third question. For the fourth one, i saw java applet is a better solution than using the php but i have to work on it and not sure if/how it will work… If i can conclude that i will share with you…