def get_named(cls, name):
     cert = None
     try:
         rows = Cert.row_template(name)
         cells = BaseSchema.get_rows(rows, Cert.store)
         args = {'name': name}
         for k, v in cells.items():
             if not v or v == "":
                 continue
             colf = ezpersist.base.Persist.key_parts(k)[1]
             if colf == OWNER_COLF:
                 args['owner'] = v
             elif colf == STATUS_COLF:
                 args['status'] = v
             elif colf == ADMIN_COLF:
                 args['admins'] = v
             elif colf == LEVEL_COLF:
                 args['level'] = v
             elif colf == VIS_COLF:
                 args['visibility'] = v
             elif colf == PKEY_COLF:
                 args['pk'] = ezbakeca.ca.load_privatekey(v)
             elif colf == CERT_COLF:
                 args['cert'] = ezbakeca.ca.load_cert(v)
         cert = Cert(**args)
     except (KeyError, ValueError):
         # didn't exist, create new
         cert = Cert(name)
         cert.save()
     return cert
예제 #2
0
 def get_named(cls, name):
     cert = None
     try:
         rows = Cert.row_template(name)
         cells = BaseSchema.get_rows(rows, Cert.store)
         args = {"name": name}
         for k, v in cells.items():
             if not v or v == "":
                 continue
             colf = ezpersist.base.Persist.key_parts(k)[1]
             if colf == OWNER_COLF:
                 args["owner"] = v
             elif colf == STATUS_COLF:
                 args["status"] = v
             elif colf == ADMIN_COLF:
                 args["admins"] = v
             elif colf == LEVEL_COLF:
                 args["level"] = v
             elif colf == VIS_COLF:
                 args["visibility"] = v
             elif colf == PKEY_COLF:
                 args["pk"] = ezbakeca.ca.load_privatekey(v)
             elif colf == CERT_COLF:
                 args["cert"] = ezbakeca.ca.load_cert(v)
         cert = Cert(**args)
     except (KeyError, ValueError):
         # didn't exist, create new
         cert = Cert(name)
         cert.save()
     return cert
예제 #3
0
 def get_named(cls, name):
     rows = cls.row_template(name, True, True, True)
     cells = BaseSchema.get_rows(rows, cls.store)
     for k, v in cells.items():
         if not v or v == "":
             continue
         colf = ezpersist.base.Persist.key_parts(k)[1]
         if colf == PKEY_COLF:
             pk = load_privatekey(cells[k])
         elif colf == CERT_COLF:
             cert = load_cert(cells[k])
         elif colf == SERIAL_COLF:
             serial = long(cells[k])
     ca = EzbakeCA(name, pk=pk, certificate=cert, serial=serial)
     return ca
 def get_named(cls, name):
     rows = cls.row_template(name, True, True, True)
     cells = BaseSchema.get_rows(rows, cls.store)
     for k, v in cells.items():
         if not v or v == "":
             continue
         colf = ezpersist.base.Persist.key_parts(k)[1]
         if colf == PKEY_COLF:
             pk = load_privatekey(cells[k])
         elif colf == CERT_COLF:
             cert = load_cert(cells[k])
         elif colf == SERIAL_COLF:
             serial = long(cells[k])
     ca = EzbakeCA(name, pk=pk, certificate=cert, serial=serial)
     return ca