aboutsummaryrefslogtreecommitdiffstats
path: root/tests/aaf/certservice/libraries/P12ArtifactsValidator.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/aaf/certservice/libraries/P12ArtifactsValidator.py')
-rw-r--r--tests/aaf/certservice/libraries/P12ArtifactsValidator.py37
1 files changed, 0 insertions, 37 deletions
diff --git a/tests/aaf/certservice/libraries/P12ArtifactsValidator.py b/tests/aaf/certservice/libraries/P12ArtifactsValidator.py
deleted file mode 100644
index b0701718..00000000
--- a/tests/aaf/certservice/libraries/P12ArtifactsValidator.py
+++ /dev/null
@@ -1,37 +0,0 @@
-from OpenSSL import crypto
-from EnvsReader import EnvsReader
-from ArtifactParser import ArtifactParser
-
-class P12ArtifactsValidator:
-
- def __init__(self, mount_path):
- self.parser = ArtifactParser(mount_path, "p12")
-
- def get_and_compare_data_p12(self, path_to_env):
- data = self.get_data(path_to_env)
- return data, self.parser.contains_expected_data(data)
-
- def can_open_keystore_and_truststore_with_pass(self):
- can_open_keystore = self.can_open_store_file_with_pass_file(self.parser.keystorePassPath, self.parser.keystorePath)
- can_open_truststore = self.can_open_store_file_with_pass_file(self.parser.truststorePassPath, self.parser.truststorePath)
-
- return can_open_keystore & can_open_truststore
-
- def can_open_store_file_with_pass_file(self, pass_file_path, store_file_path):
- try:
- self.get_certificate(pass_file_path, store_file_path)
- return True
- except:
- return False
-
- def get_data(self, path_to_env):
- envs = self.parser.get_envs_as_dict(EnvsReader().read_env_list_from_file(path_to_env))
- certificate = self.get_certificate(self.parser.keystorePassPath, self.parser.keystorePath)
- data = self.parser.get_owner_data_from_certificate(certificate)
- data['SANS'] = self.parser.get_sans(certificate)
- return type('', (object,), {"expectedData": envs, "actualData": data})
-
- def get_certificate(self, pass_file_path, store_file_path):
- password = open(pass_file_path, 'rb').read()
- crypto.load_pkcs12(open(store_file_path, 'rb').read(), password)
- return crypto.load_pkcs12(open(store_file_path, 'rb').read(), password).get_certificate()