Example #1
0
 def test_identifier_ec(self):
     bytes = TestCertificates.PKCS8_ec.read()
     container = PrivateReader.by_bytes(bytes)
     container.parse()
     should = "7D:83:F3:D5:9F:B1:CC:36:2B:50:E7:FD:7A:45:A1:60:63:48:FB:58:B7:AA:31:7A:A1:C4:B5:D4:C1:59:82:CE"
     ident = container.public_key_hash()
     self.assertEqual(ident, should)
Example #2
0
 def test_identifier_rsa(self):
     bytes = TestCertificates.PKCS8_rsa_ca.read()
     container = PrivateReader.by_bytes(bytes)
     container.parse()
     should = "FA:CC:60:F4:20:6B:25:C7:A4:AD:1D:FE:37:C4:76:09:73:07:BE:35:E9:50:2B:28:1A:10:6A:30:2C:09:D4:A9"
     ident = str(container.public_key_hash())
     self.assertEqual(ident, should)
Example #3
0
    def test_is_private_key_not(self):
        bytes = TestCertificates.X509_ec.read()
        x509 = X509Reader.by_bytes(bytes)
        x509.parse()

        bytes = TestCertificates.PKCS1_rsa_ca.read()
        key = PrivateReader.by_bytes(bytes)
        key.parse()
        self.assertFalse(x509.is_cert_of(key))
Example #4
0
 def test_to_private_key(self):
     bytes = TestCertificates.PKCS8_ec.read()
     x509 = PrivateReader.by_bytes(bytes)
     x509.parse()
     public = strongMan.apps.certificates.models.certificates.PrivateKey.by_reader(
         x509)
     self.assertIsNotNone(public)
     self.assertIsNotNone(public.algorithm)
     self.assertIsNotNone(public.der_container)
Example #5
0
 def test_to_private_key(self):
     bytes = TestCertificates.PKCS1_ec.read()
     priv = PrivateReader.by_bytes(bytes)
     priv.parse()
     privatekey = strongMan.apps.certificates.models.certificates.PrivateKey.by_reader(
         priv)
     self.assertIsNotNone(privatekey)
     self.assertIsNotNone(privatekey.algorithm)
     self.assertIsNotNone(privatekey.der_container)
Example #6
0
 def test_dump_rsa(self):
     bytes = TestCertificates.PKCS1_rsa_ca.read()
     container = PrivateReader.by_bytes(bytes)
     container.parse()
     self.assertIsNotNone(container.der_dump())
Example #7
0
 def test_algorithm_ec(self):
     bytes = TestCertificates.PKCS1_ec.read()
     container = PrivateReader.by_bytes(bytes)
     container.parse()
     self.assertEqual(container.algorithm(), "ec")
Example #8
0
 def test_decryption(self):
     bytes = TestCertificates.PKCS8_rsa_ca_encrypted.read()
     container = PrivateReader.by_bytes(bytes, password=b"strongman")
     container.parse()
     self.assertEqual(container.algorithm(), "rsa")
Example #9
0
 def test_algorithm_rsa(self):
     bytes = TestCertificates.PKCS8_rsa_ca.read()
     container = PrivateReader.by_bytes(bytes)
     container.parse()
     self.assertEqual(container.algorithm(), "rsa")
Example #10
0
 def test_parse(self):
     bytes = TestCertificates.PKCS8_rsa_ca.read()
     container = PrivateReader.by_bytes(bytes)
     container.parse()
     self.assertIsNotNone(container.asn1)
Example #11
0
 def test_dsa(self):
     bytes = TestCertificates.PKCS1_dsa.read()
     x509 = PrivateReader.by_bytes(bytes)
     with self.assertRaises(Exception):
         x509.parse()