1 |
4a40b0d2
|
Stanislav Král
|
from src.dao.certificate_repository import CertificateRepository
|
2 |
|
|
from src.dao.private_key_repository import PrivateKeyRepository
|
3 |
|
|
from src.model.certificate import Certificate
|
4 |
|
|
from src.model.subject import Subject
|
5 |
|
|
from src.services.cryptography import CryptographyService
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
class CertificateService:
|
9 |
|
|
|
10 |
|
|
def __init__(self, cryptography_service: CryptographyService, certificate_repository: CertificateRepository):
|
11 |
|
|
self.cryptography_service = cryptography_service
|
12 |
|
|
self.certificate_repository = certificate_repository
|
13 |
|
|
|
14 |
|
|
# TODO key passphrase is not present in class diagram
|
15 |
|
|
def create_root_ca(self, key: PrivateKeyRepository, subject: Subject, extensions: str, config: str,
|
16 |
|
|
key_passphrase: str):
|
17 |
|
|
cert_pem = self.cryptography_service.create_sscrt(subject, key, key_pass=key_passphrase, extensions=extensions,
|
18 |
|
|
config=config)
|
19 |
|
|
|
20 |
|
|
certificate = Certificate(-1, subject.common_name, subject)
|