I have PEM format file, How can verify the signature in Java, as I followed http://download.oracle.com/javase/tutorial/security/apisign/versig.html but found that Java doesnt support PEM
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can read a certificate in a PEM file using BouncyCastle‘s
PEMReader. If the content is an X.509 certificate, you should get an instance ofX509Certificateand verify it as you want from there.EDIT: Here is what the code should look like (not tried):
(Of course, as with any I/O operations, you’ll need to close the reader perhaps with try/finally.)
Note that
checkValidityandverifydon’t return anything: instead, they throw exceptions if when they fail.