Exemplo n.º 1
0
 def test_verify_inconsistent_signature(self):
     manifest = cvmfs.Manifest(self.insane_manifest_broken_signature)
     cert = cvmfs.Certificate(open(self.certificate_file))
     is_valid = manifest.verify_signature(cert)
     self.assertFalse(is_valid)
Exemplo n.º 2
0
 def test_verify_signature(self):
     manifest = cvmfs.Manifest(self.sane_manifest)
     cert = cvmfs.Certificate(open(self.certificate_file))
     is_valid = manifest.verify_signature(cert)
     self.assertTrue(is_valid)
Exemplo n.º 3
0
 def test_verify_invalid_signature(self):
     manifest = cvmfs.Manifest(self.insane_manifest_tampered)
     cert = cvmfs.Certificate(open(self.certificate_file))
     is_valid = manifest.verify_signature(cert)
     self.assertFalse(is_valid)
Exemplo n.º 4
0
 def test_verify_tampered_message(self):
     with open(self.certificate_file) as cert_file:
         cert = cvmfs.Certificate(cert_file)
         self.assertFalse(cert.verify(self.signature, "I am Malory!"))
Exemplo n.º 5
0
 def test_certificate_fingerprint(self):
     with open(self.certificate_file) as cert_file:
         cert = cvmfs.Certificate(cert_file)
         self.assertEqual(self.fingerprint, cert.get_fingerprint())
Exemplo n.º 6
0
 def test_verify_message(self):
     with open(self.certificate_file) as cert_file:
         cert = cvmfs.Certificate(cert_file)
         self.assertTrue(cert.verify(self.signature, self.message_digest))
Exemplo n.º 7
0
 def test_get_openssl_x509(self):
     with open(self.certificate_file) as cert_file:
         cert = cvmfs.Certificate(cert_file)
         x509 = cert.get_openssl_certificate()
         self.assertTrue(isinstance(x509, X509))
Exemplo n.º 8
0
 def test_load(self):
     with open(self.certificate_file) as cert_file:
         cvmfs.Certificate(cert_file)
Exemplo n.º 9
0
 def test_doesnt_contain_certificate(self):
     with open(self.certificate_file) as cert:
         whitelist = cvmfs.Whitelist(
             self.insane_whitelist_signature_mismatch)
         certificate = cvmfs.Certificate(cert)
         self.assertFalse(whitelist.contains(certificate))
Exemplo n.º 10
0
 def test_contains_certificate(self):
     with open(self.certificate_file) as cert:
         whitelist = cvmfs.Whitelist(self.sane_whitelist)
         certificate = cvmfs.Certificate(cert)
         self.assertTrue(whitelist.contains(certificate))