Interactive analysis of the election of the European Parliament in 2019 using Jupyter Notebooks, pandas and matplotlib.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
920 B

# provide crypto functions
from cryptography import x509
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.asymmetric import padding
from cryptography.hazmat.primitives import hashes
# constants
cert_file = 'certificate.crt'
ca_file = 'certchain.crt'
# functions
def get_public_key():
with open(cert_file, 'rb') as cf:
cert = x509.load_pem_x509_certificate(, default_backend())
return cert.public_key()
def verify_file_sig(file, sig_file):
public_key = get_public_key()
with open(file, 'rb') as data, open(sig_file, 'rb') as sig:
return True
except cryptography.exceptions.InvalidSignature as e:
return False