I have 2 files : a PKCS#7 signature and a file, which has been signed by this signature. My question is how can I verify this signature properly? Which data exactly should I use and extract from the PKCS7 in order to do that? I've heard that the order of the actions looks like this:
- Check whether a certificate out of date or not
- Check whether CA is out out of date or not
- Check whether this public key is still valid
- And perhaps extract the hash value from the attribute in PKCS7 file and check for equality to a hash file, which has been signed
Am I correct? And how can I do it using Bouncy Castle? I've come across with this
CMSSignedData data = new CMSSignedData(bytesArray)
But how can I check validality using only one method, if there is? This looks like overcomplicated - I should take every certificate, check it's expire date, writing custom method that does it.. And somehow check that the public key is still valid.. Is it possible to do it easier?