You are correct that you must verify the certificate itself. And yes, you need the VeriSign root certificate (and any other intermediate certificates for the complete trust chain) that signed the verified certificate.
Current Symantec root certificates (VeriSign) can be found here in the zipfile .
Download and unzip the zip file and find all the certificates you want to trust and put them together (in pem format) in one certificate package file.
Now you need to do the actual check. Unfortunately, an OpenSSL call you need X509_verify_certificate . I looked at the source for both pyopenssl and M2Crypto, and do not make this call, so there is no direct Python code that you can call to verify the certificate with any of these packages.
However, since you are using pyopenssl, you obviously have the openssl library available. That way, you probably already have or can easily install the openssl command-line toolkit. If so, you can invoke the openssl verify through the pipe by doing something like this:
cert = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_ASN1, key)
The above channel executes the command
openssl verify -CAfile ca.bundle certificate.pem
Finally, if you are not familiar with openssl, a command to display certificates
openssl x509 -inform PEM -text -in certificate.pem
Hope this helps!
source share