Easy CA management
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

52 lines
1.2 KiB

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from peewee import *
import os
import json
from models.authority import Authority
from paths import *
class Certificate(Model):
"""
"""
signed_by = ForeignKeyField(
Authority,
related_name = 'signed_certificates',
)
cert_id = CharField(
index = True,
unique = True,
help_text = 'id shared with the sign request',
)
date_issued = DateTimeField(
help_text = 'certificate\'s issue date',
)
receiver = CharField(
help_text = 'hostname or list of user for this certificate',
)
serial_number = IntegerField(
help_text = 'certificate\'s progressive number',
)
validity_interval = CharField(
help_text = 'how long will the certificate be valid',
)
def __repr__(self):
return ( "%s %s" % ( str(self.__class__.__name__), str(self.cert_id) ) )
def __bool__(self):
return os.path.exists(self.path)
@property
def path(self):
return os.path.join(OUTPUT_PATH, self.cert_id + '-cert.pub')