def create_cert_if_not_exists(self, pem_file): if not os.path.isfile(pem_file): cert, key = generate_self_signed_cert("US", "None", "None", "None", "None", "*", 365, 0) with open(pem_file, 'wb') as _pem_file: _pem_file.write(cert) _pem_file.write(key)
def create_cert_if_not_exists(self, cap_name, pem_file): if not os.path.isfile(pem_file): logger.debug('Generating certificate and key: %s', pem_file) cert_dict = self.config['capabilities'][cap_name]['protocol_specific_data']['cert'] cert_cn = cert_dict['common_name'] cert_country = cert_dict['country'] cert_state = cert_dict['state'] cert_locality = cert_dict['locality'] cert_org = cert_dict['organization'] cert_org_unit = cert_dict['organizational_unit'] valid_days = int(cert_dict['valid_days']) serial_number = int(cert_dict['serial_number']) cert, key = common.generate_self_signed_cert(cert_country, cert_state, cert_org, cert_locality, cert_org_unit, cert_cn, valid_days, serial_number) with open(pem_file, 'wb') as _pem_file: _pem_file.write(cert) _pem_file.write(key)
def create_cert_if_not_exists(self, cap_name, pem_file): if not os.path.isfile(pem_file): logger.debug('Generating certificate and key: %s', pem_file) cert_dict = self.config['capabilities'][cap_name]['protocol_specific_data']['cert'] cert_cn = cert_dict['common_name'] cert_country = cert_dict['country'] cert_state = cert_dict['state'] cert_locality = cert_dict['locality'] cert_org = cert_dict['organization'] cert_org_unit = cert_dict['organizational_unit'] valid_days = int(cert_dict['valid_days']) serial_number = int(cert_dict['serial_number']) cert, key = common.generate_self_signed_cert(cert_country, cert_state, cert_org, cert_locality, cert_org_unit, cert_cn, valid_days, serial_number) with open(pem_file, 'wb') as _pem_file: _pem_file.write(cert) _pem_file.write(key)