Projekt

Obecné

Profil

Stáhnout (2.94 KB) Statistiky
| Větev: | Tag: | Revize:
1
from src.utils.file_anchor import FileAnchor
2

    
3
INMEMORY_DATABASE_FILE = ":memory:"
4
TEST_DATABASE_FILE = INMEMORY_DATABASE_FILE
5
DB_DIR = "db"
6
DATABASE_FILE = f"{DB_DIR}/database_sqlite.db"
7
DATABASE_FILE_LOCATION = FileAnchor("aswi2021jmsd", DATABASE_FILE)
8
DATETIME_FORMAT = "%d.%m.%Y %H:%M:%S"
9

    
10
LOG_DIR = "logs"
11
LOG_FILENAME = "application.log"
12
LOG_FILE = f"{LOG_DIR}/{LOG_FILENAME}"
13
LOG_FILE_LOCATION = FileAnchor("aswi2021jmsd", LOG_FILE)
14
LOG_FORMAT = "%(levelname)-8s %(asctime)s - %(message)s"
15
LOG_NAME = "app_logger"
16

    
17
REV_REASON_UNSPECIFIED = "unspecified"
18

    
19
# Types of certificates
20
ROOT_CA_ID = 1
21
INTERMEDIATE_CA_ID = 2
22
CERTIFICATE_ID = 3
23

    
24
# Usage types of certificates
25
CA_ID = 1
26
SSL_ID = 2
27
SIGNATURE_ID = 3
28
AUTHENTICATION_ID = 4
29
DICT_USAGES = {CA_ID: False, SSL_ID: False, SIGNATURE_ID: False, AUTHENTICATION_ID: False}
30

    
31
# DB names of tables
32
TAB_CERTIFICATES = "Certificates"
33
TAB_PRIVATE_KEYS = "PrivateKeys"
34
TAB_CERTIFICATE_USAGES = "CertificateUsages"
35
TAB_CERTIFICATE_TYPES = "CertificateTypes"
36
TAB_USAGE_TYPES = "UsageTypes"
37

    
38
# DB column names
39
COL_ID = "id"
40
COL_PK = "private_key"
41

    
42
# DB column names of Certificates table
43
COL_VALID_FROM = "valid_from"
44
COL_VALID_TO = "valid_to"
45
COL_PEM_DATA = "pem_data"
46
COL_COMMON_NAME = "common_name"
47
COL_COUNTRY_CODE = "country_code"
48
COL_LOCALITY = "locality"
49
COL_PROVINCE = "province"
50
COL_ORGANIZATION = "organization"
51
COL_ORGANIZATIONAL_UNIT = "organizational_unit"
52
COL_EMAIL_ADDRESS = "email_address"
53
COL_REVOCATION_DATE = "revocation_date"
54
COL_REVOCATION_REASON = "revocation_reason"
55
COL_DELETION_DATE = "deletion_date"
56
COL_TYPE_ID = "certificate_type_id"
57
COL_PARENT_ID = "parent_certificate_id"
58
COL_PRIVATE_KEY_ID = "private_key_id"
59

    
60
# DB column names of PrivateKeys table
61
COL_PRIVATE_KEY = "private_key"
62
COL_PASSWORD = "password"
63

    
64
# DB column names of PrivateKey table
65
COL_CERTIFICATE_ID = "certificate_id"
66
COL_USAGE_TYPE_ID = "usage_type_id"
67

    
68
# configuration default
69
DEFAULT_CONNECTION_STRING = "db/database_sqlite.db"
70
DEFAULT_SERVER_BASE_URL = "http://localhost"
71
DEFAULT_LOG_LEVEL = "DEBUG"
72

    
73
# available certificate states and revocation reasons
74
CERTIFICATE_STATES = {"valid", "revoked"}
75
CERTIFICATE_REVOCATION_REASONS = {"unspecified", "keyCompromise",
76
                                  "CACompromise", "affiliationChanged",
77
                                  "superseded", "cessationOfOperation",
78
                                  "certificateHold", "removeFromCRL"}
79
CERTIFICATE_REVOCATION_REASON_HOLD = "certificateHold"
80

    
81
CERTIFICATE_VALID = "valid"
82
CERTIFICATE_REVOKED = "revoked"
83
CERTIFICATE_EXPIRED = "expired"
84

    
85

    
86
# Insert values into the template using % (index_file, serial_file)
87
CRL_CONFIG = """[ ca ]
88
default_ca = crl_ca
89

    
90
[ crl_ext ]
91
authorityKeyIdentifier=keyid:always
92

    
93
[ crl_ca ]
94
database = %s
95
serial = %s
96
default_md = sha1
97
policy = crl_policy
98
default_crl_days = 30
99

    
100
[ crl_policy ]
101
commonName = supplied
102
stateOrProvinceName = optional
103
countryName = optional
104
emailAddress = optional
105
organizationName = optional
106
organizationalUnitName = optional
107

    
108
"""
(2-2/3)