Projekt

Obecné

Profil

« Předchozí | Další » 

Revize b3c80ccb

Přidáno uživatelem David Friesecký před téměř 4 roky(ů)

Re #8570 - Added logs

Zobrazit rozdíly:

src/services/key_service.py
3 3
from src.dao.private_key_repository import PrivateKeyRepository
4 4
from src.model.private_key import PrivateKey
5 5
from src.services.cryptography import CryptographyService
6
from src.utils.logger import Logger
6 7

  
7 8

  
8 9
class KeyService:
......
18 19
        :param passphrase: Passphrase to be used when encrypting the PK
19 20
        :return: An instance of the <PrivateKey> class representing the generated PK
20 21
        """
22

  
23
        Logger.debug("Function launched.")
24

  
21 25
        # generate a new private key
22 26
        private_key_pem = self.cryptography_service.create_private_key(passphrase)
23 27

  
......
38 42
        :param unique_id: ID of the PK to be found
39 43
        :return:An instance of the required PK or `None`
40 44
        """
45

  
46
        Logger.debug("Function launched.")
47

  
41 48
        return self.private_key_repository.read(unique_id)
42 49

  
43 50
    def get_keys(self, unique_ids=None):
......
47 54
        :param unique_ids: An array containing IDs of PKs to be fetched from the repository.
48 55
        :return: A list of instances of the PrivateKey class representing the PKs found
49 56
        """
57

  
58
        Logger.debug("Function launched.")
59

  
50 60
        if unique_ids is None:
51 61
            return self.private_key_repository.read_all()
52 62
        else:
......
60 70
        :param unique_id: ID of specific certificate to be deleted
61 71
        :return: `True` when the deletion was successful. `False` in other case
62 72
        """
73

  
74
        Logger.debug("Function launched.")
75

  
63 76
        return self.private_key_repository.delete(unique_id)
64 77

  
65 78
    def get_public_key(self, private_key: PrivateKey):
......
68 81
        :param private_key: private key from which a public key should be extracted
69 82
        :return: a string containing the extracted public key in PEM format
70 83
        """
84

  
85
        Logger.debug("Function launched.")
86

  
71 87
        return self.cryptography_service.extract_public_key_from_private_key(private_key.private_key,
72 88
                                                                             private_key.password)

Také k dispozici: Unified diff