Ejemplo n.º 1
0
 def create_client_for_cn(self):
   return self.create_client_for_cert(
     os.path.join(
       settings.CLIENT_CERT_DIR,
       subject_dn.subject_to_filename(settings.SUBJECT_WITH_CN_PERMISSIONS)
     )
   )
Ejemplo n.º 2
0
def create_certificate(subject, subject_dn_tuple, subject_info):
    cert_out_path = os.path.join(settings.CLIENT_CERT_DIR,
                                 subject_dn.subject_to_filename(subject))
    d1_x509v3_certificate_generator.generate(
        cert_out_path, settings.CA_CERT_PATH, settings.CA_KEY_PATH,
        settings.CA_KEY_PW, settings.CLIENT_CERT_PUBLIC_KEY_PATH, subject_info,
        settings.SUBJECT_ALT_NAME, subject_dn_tuple, 1)
    assert (os.path.exists(cert_out_path))
Ejemplo n.º 3
0
def create_certificate(subject, subject_dn_tuple, subject_info):
    cert_out_path = os.path.join(
        settings.CLIENT_CERT_DIR, subject_dn.subject_to_filename(subject)
    )
    d1_x509v3_certificate_generator.generate(
        cert_out_path,
        settings.CA_CERT_PATH,
        settings.CA_KEY_PATH,
        settings.CA_KEY_PW,
        settings.CLIENT_CERT_PUBLIC_KEY_PATH,
        subject_info,
        settings.SUBJECT_ALT_NAME,
        subject_dn_tuple,
        1,
    )
    assert os.path.exists(cert_out_path)
Ejemplo n.º 4
0
def get_certificate_path_for_subject(subject):
    """Get the path to the generated certificate for a given subject.
  """
    return os.path.join(settings.CLIENT_CERT_DIR,
                        subject_dn.subject_to_filename(subject))
Ejemplo n.º 5
0
 def create_client_for_subject(self, subject):
     return self.create_client_for_cert(
         certificate.get_certificate_path_for_subject(
             subject_dn.subject_to_filename(subject)))