- # Function to validate keystore.jks/truststore.jks can be opened with generated pass-phrase.
- def can_open_keystore_and_truststore_with_pass(self):
- can_open_keystore = self.can_open_jks_file_with_pass_file(self.keystorePassPath, self.keystoreJksPath)
- can_open_truststore = self.can_open_jks_file_with_pass_file(self.truststorePassPath, self.truststoreJksPath)
+ # Function to validate keystore/truststore can be opened with generated pass-phrase.
+ def can_open_keystore_and_truststore_with_pass(self, container_name):
+ if container_name != NETCONF_PNP_SIM_CONTAINER_NAME:
+ return self.can_open_keystore_and_truststore_pem_files()
+ else:
+ return self.can_open_keystore_and_truststore_p12_files()
+
+ # Function to validate keystore.pem/truststore.pem exist and are not empty.
+ def can_open_keystore_and_truststore_pem_files(self):
+ try:
+ private_key = self.file_exist_and_not_empty(self.keyPem)
+ keystore_pem = self.file_exist_and_not_empty(self.keystorePemPath)
+ truststore_pem = self.file_exist_and_not_empty(self.truststorePemPath)
+ return private_key and keystore_pem and truststore_pem
+ except Exception as e:
+ print("UnExpected Error in validating keystore.pem/truststore.pem: {0}".format(e))
+ return False
+
+ # Function to validate keystore.p12/truststore.p12 can be opened with generated pass-phrase.
+ def can_open_keystore_and_truststore_p12_files(self):
+ can_open_keystore = self.can_open_p12_file_with_pass_file(self.keystorePassPath, self.keystoreP12Path)
+ can_open_truststore = self.can_open_p12_file_with_pass_file(self.truststorePassPath, self.truststoreP12Path)