commit 5b57121efc959abe46a429728294b9083b75edaf
Author: Captain_Trojan <sejakm@students.zcu.cz>
Date:   Wed Apr 7 00:19:27 2021 +0200

    Re #8476 - Refactored the application; swagger is not used for code generation anymore, REST API is being implemented from scratch. Migration only, fixing tests.

diff --git a/app.py b/app.py
index 95f6c2a..92b1c07 100644
--- a/app.py
+++ b/app.py
@@ -1,5 +1,6 @@
 from flask import Flask
 import os
+from src.controllers.certificates_controller import CertController
 
 app = Flask(__name__)
 
@@ -9,6 +10,16 @@ def index():
     return 'Welcome to the X.509 management application homepage!'
 
 
+@app.route('/api/certificates', methods=["POST"])
+def create_certificate():
+    return CertController.create_certificate()
+
+
+@app.route('/api/certificates', methods=["GET"])
+def get_cert_list():
+    return CertController.get_certificate_list()
+
+
 if __name__ == '__main__':
     host = "0.0.0.0"
     port = 5000
@@ -20,5 +31,4 @@ if __name__ == '__main__':
     if "FLASK_PORT" in os.environ:
         host = os.environ["FLASK_PORT"]
 
-    app.run(host=host, port=port)
-
+    app.run(host=host, port=port)
\ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
index f77c13c..7a57414 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,6 +1,2 @@
 Flask==1.1.2
-pytest~=6.2.3
-
-connexion~=2.7.0
-connexion[swagger-ui]
-six~=1.15.0
\ No newline at end of file
+pytest~=6.2.3
\ No newline at end of file
diff --git a/src/controllers/__init__.py b/src/controllers/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/src/controllers/certificates_controller.py b/src/controllers/certificates_controller.py
new file mode 100644
index 0000000..6081f30
--- /dev/null
+++ b/src/controllers/certificates_controller.py
@@ -0,0 +1,277 @@
+from datetime import datetime
+from itertools import chain
+from flask import request
+from src.dao.private_key_repository import PrivateKeyRepository
+from src.model.subject import Subject
+from src.services.certificate_service import CertificateService
+from src.dao.certificate_repository import CertificateRepository  # TODO not the Controller's responsibility. 1
+from src.services.cryptography import CryptographyService  # TODO not the Controller's responsibility. 2
+from sqlite3 import Connection  # TODO not the Controller's responsibility. 3
+from src.constants import DICT_USAGES, CA_ID, \
+    DATABASE_FILE_LOCATION, SSL_ID, SIGNATURE_ID, AUTHENTICATION_ID, \
+    DATETIME_FORMAT, ROOT_CA_ID, INTERMEDIATE_CA_ID, CERTIFICATE_ID  # TODO DATABASE_FILE - not the Controller's
+#  responsibility. 4
+from src.services.key_service import KeyService
+
+# _ = Connection("../" + DATABASE_FILE)                                 # TODO not the Controller's responsibility. 5
+# cursor = _.cursor()                                                   # TODO responsibility of the
+                                                                        #  CertificateRepository. It makes no sense to
+                                                                        #  supply a different cursor than precisely
+                                                                        #  the one corresponding to the connection.
+                                                                        #  The cursor can always be generated from the
+                                                                        #  connection instance.
+FILTERING = "filtering"
+ISSUER = "issuer"
+US = "usage"
+NOT_AFTER = "notAfter"
+NOT_BEFORE = "notBefore"
+COMMON_NAME = "CN"
+ID = "id"
+E_NO_ISSUER_FOUND = {"success": False,
+                           "data": "No certificate authority with such unique ID exists."}
+E_NO_CERTIFICATES_FOUND = {"success": False, "data": "No certificates found."}
+E_NOT_JSON_FORMAT = {"success": False, "data": "The request must be JSON-formatted."}
+E_CORRUPTED_DATABASE = {"success": False, "data": "Internal server error (corrupted database)."}
+E_GENERAL_ERROR = {"success": False, "data": "Internal server error (unknown origin)."}
+E_MISSING_PARAMETERS = {"success": False, "data": "Invalid request, missing parameters."}
+E_WRONG_PARAMETERS = {"success": False, "data": "Invalid request, wrong parameters."}
+USAGE = "usage"
+SUBJECT = "subject"
+VALIDITY_DAYS = "validityDays"
+CA = "CA"
+
+__ = CryptographyService()  # TODO not the Controller's responsibility. 6
+CERTIFICATE_SERVICE = CertificateService(__, CertificateRepository(None, None))
+# TODO open for discussion. Expected:
+#  CS = CertificateService.get_instance()
+#  or something like that.
+
+KEY_SERVICE = KeyService(__, PrivateKeyRepository(None, None))  # TODO as above
+
+
+class CertController:
+
+    @staticmethod
+    def setup():
+        """
+        SQLite3 thread issue hack.
+        :return:
+        """
+        _ = Connection(DATABASE_FILE_LOCATION.shortest_relative_path())
+        CERTIFICATE_SERVICE.certificate_repository.connection = _
+        CERTIFICATE_SERVICE.certificate_repository.cursor = _.cursor()
+        KEY_SERVICE.private_key_repository.connection = _
+        KEY_SERVICE.private_key_repository.cursor = _.cursor()
+
+    @staticmethod
+    def create_certificate():  # noqa: E501
+        """create new certificate
+
+        Create a new certificate based on given information # noqa: E501
+
+        :param body: Certificate data to be created
+        :type body: dict | bytes
+
+        :rtype: CreatedResponse
+        """
+        CertController.setup()  # TODO remove after issue fixed
+
+        key_map = {'CA': CA_ID, 'SSL': SSL_ID, 'digitalSignature': SIGNATURE_ID, 'authentication': AUTHENTICATION_ID}
+        required_keys = {SUBJECT, USAGE, VALIDITY_DAYS}
+
+        if request.is_json:
+            body = request.get_json()
+            if not all(k in body for k in required_keys):
+                return E_MISSING_PARAMETERS, 400
+
+            if not isinstance(body[VALIDITY_DAYS], int):
+                return E_WRONG_PARAMETERS, 400
+
+            subject = Subject.from_dict(body[SUBJECT])
+
+            if subject is None:
+                return E_WRONG_PARAMETERS, 400
+
+            usages_dict = DICT_USAGES.copy()
+
+            if not isinstance(body[USAGE], dict):
+                return E_WRONG_PARAMETERS, 400
+
+            for k, v in body[USAGE].items():
+                if k not in key_map:
+                    return E_WRONG_PARAMETERS, 400
+                usages_dict[key_map[k]] = v
+
+            key = KEY_SERVICE.create_new_key()  # TODO pass key
+
+            if CA not in body:
+                cert = CERTIFICATE_SERVICE.create_root_ca(
+                    key,
+                    subject,
+                    usages=usages_dict,
+                    days=body[VALIDITY_DAYS]
+                )
+            else:
+                issuer = CERTIFICATE_SERVICE.get_certificate(body[CA])
+
+                if issuer is None:
+                    return E_NO_ISSUER_FOUND, 400
+
+                issuer_key = KEY_SERVICE.get_key(issuer.private_key_id)
+
+                if issuer_key is None:
+                    return E_CORRUPTED_DATABASE, 500
+
+                f = CERTIFICATE_SERVICE.create_ca if CA_ID in usages_dict and usages_dict[CA_ID] else \
+                    CERTIFICATE_SERVICE.create_end_cert
+
+                cert = f(
+                    key,
+                    subject,
+                    issuer,
+                    issuer_key,
+                    usages=usages_dict,
+                    days=body[VALIDITY_DAYS]
+                )
+
+            if cert is not None:
+                return {"success": True,
+                        "data": cert.certificate_id}, 201
+            else:
+                return {"success": False,
+                        "data": "Internal error: The certificate could not have been created."}, 400
+        else:
+            return E_NOT_JSON_FORMAT, 400
+
+    @staticmethod
+    def get_certificate_by_id(id):  # noqa: E501
+        """get certificate by ID
+
+        Get certificate in PEM format by ID # noqa: E501
+
+        :param id: ID of a certificate to be queried
+        :type id: dict | bytes
+
+        :rtype: PemResponse
+        """
+        CertController.setup()  # TODO remove after issue fixed
+
+        if connexion.request.is_json:
+            id = IdParameter.from_dict(connexion.request.get_json())  # noqa: E501
+        return 'do some magic!'
+
+    @staticmethod
+    def get_certificate_details_by_id(id):  # noqa: E501
+        """get certificate&#x27;s details by ID
+
+        Get certificate details by ID # noqa: E501
+
+        :param id: ID of a certificate whose details are to be queried
+        :type id: dict | bytes
+
+        :rtype: CertificateResponse
+        """
+        CertController.setup()  # TODO remove after issue fixed
+
+        if connexion.request.is_json:
+            id = IdParameter.from_dict(connexion.request.get_json())  # noqa: E501
+        return 'do some magic!'
+
+    @staticmethod
+    def get_certificate_list():  # noqa: E501
+        """get list of certificates
+
+        Lists certificates based on provided filtering options # noqa: E501
+
+        :param filtering: Filter certificate type to be queried
+        :type filtering: dict | bytes
+
+        :rtype: CertificateListResponse
+        """
+        CertController.setup()  # TODO remove after issue fixed
+
+        key_map = {CA_ID: 'CA', SSL_ID: 'SSL', SIGNATURE_ID: 'digitalSignature', AUTHENTICATION_ID: 'authentication'}
+
+        targets = {ROOT_CA_ID, INTERMEDIATE_CA_ID, CERTIFICATE_ID}
+        if request.is_json:
+            data = request.get_json()
+            if FILTERING in data:
+                if isinstance(data[FILTERING], dict):
+                    if CA in data[FILTERING]:
+                        if isinstance(data[FILTERING][CA], bool):
+                            if data[FILTERING][CA]:
+                                targets.remove(CERTIFICATE_ID)
+                            else:
+                                targets.remove(ROOT_CA_ID)
+                                targets.remove(INTERMEDIATE_CA_ID)
+                        else:
+                            return E_WRONG_PARAMETERS, 400
+                else:
+                    return E_WRONG_PARAMETERS, 400
+
+        if len(targets) == 3:
+            certs = CERTIFICATE_SERVICE.get_certificates()
+        else:
+            certs = list(chain(CERTIFICATE_SERVICE.get_certificates(target) for target in targets))
+
+        if certs is None:
+            return E_GENERAL_ERROR, 500
+        elif len(certs) == 0:
+            return E_NO_CERTIFICATES_FOUND, 204
+        else:
+            ret = []
+            for c in certs:
+                c_issuer = CERTIFICATE_SERVICE.get_certificate(c.parent_id)
+                if c_issuer is None:
+                    return E_CORRUPTED_DATABASE, 500
+
+                ret.append(
+                    {
+                        ID: c.certificate_id,
+                        COMMON_NAME: c.common_name,
+                        NOT_BEFORE: datetime.strptime(c.valid_from, DATETIME_FORMAT).date(),
+                        NOT_AFTER: datetime.strptime(c.valid_to, DATETIME_FORMAT).date(),
+                        USAGE: {key_map[k]: v for k, v in c.usages.items()},
+                        ISSUER: {
+                            ID: c_issuer.certificate_id,
+                            COMMON_NAME: c_issuer.common_name
+                        }
+                    }
+                )
+            return {"success": True, "data": ret}
+
+
+
+    @staticmethod
+    def get_certificate_root_by_id(id):  # noqa: E501
+        """get certificate&#x27;s root of trust chain by ID
+
+        Get certificate&#x27;s root of trust chain in PEM format by ID # noqa: E501
+
+        :param id: ID of a child certificate whose root is to be queried
+        :type id: dict | bytes
+
+        :rtype: PemResponse
+        """
+        CertController.setup()  # TODO remove after issue fixed
+
+        if connexion.request.is_json:
+            id = IdParameter.from_dict(connexion.request.get_json())  # noqa: E501
+        return 'do some magic!'
+
+    @staticmethod
+    def get_certificate_trust_chain_by_id(id):  # noqa: E501
+        """get certificate&#x27;s trust chain by ID
+
+        Get certificate trust chain in PEM format by ID # noqa: E501
+
+        :param id: ID of a child certificate whose chain is to be queried
+        :type id: dict | bytes
+
+        :rtype: PemResponse
+        """
+        CertController.setup()  # TODO remove after issue fixed
+
+        if connexion.request.is_json:
+            id = IdParameter.from_dict(connexion.request.get_json())  # noqa: E501
+        return 'do some magic!'
diff --git a/src/model/subject.py b/src/model/subject.py
index 9e90077..e8bca57 100644
--- a/src/model/subject.py
+++ b/src/model/subject.py
@@ -1,4 +1,6 @@
 class Subject:
+    ATTR_MAP = {"C": "common_name", "ST": "state", "L": "locality", "CN": "common_name", "O": "organization",
+                "OU": "organization_unit", "emailAddress": "email_address"}
 
     def __init__(self, common_name=None, country=None, locality=None, state=None, organization=None,
                  organization_unit=None, email_address=None):
@@ -9,3 +11,17 @@ class Subject:
         self.organization = organization
         self.organization_unit = organization_unit
         self.email_address = email_address
+
+    @staticmethod
+    def from_dict(d):
+        if not isinstance(d, dict):
+            return None
+
+        s = Subject()
+        for k, v in Subject.ATTR_MAP.items():
+            if k in d:
+                if not isinstance(d[k], str):
+                    return None
+                s.__setattr__(v, d[k])
+
+        return s
diff --git a/src/swagger.yaml b/src/swagger.yaml
new file mode 100644
index 0000000..37e5740
--- /dev/null
+++ b/src/swagger.yaml
@@ -0,0 +1,511 @@
+openapi: 3.0.0
+info:
+  title: X.509 certificate management
+  description: API for certificate management created for YOSO company
+  version: 1.0.1
+servers:
+- url: https://virtserver.swaggerhub.com/janpasek97/X509_management/1.0.1
+  description: X509 management API
+tags:
+- name: certificates
+  description: API for creating and querying certificates
+paths:
+  /api/certificates/{id}:
+    get:
+      tags:
+      - certificates
+      summary: get certificate by ID
+      description: Get certificate in PEM format by ID
+      operationId: get_certificate_by_id
+      parameters:
+      - name: id
+        in: path
+        description: ID of a certificate to be queried
+        required: true
+        style: simple
+        explode: false
+        schema:
+          $ref: '#/components/schemas/IdParameter'
+      responses:
+        "200":
+          description: returning the certificate
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/PemResponse'
+        "204":
+          description: the certificate was not found
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ErrorResponse'
+        "400":
+          description: bad request
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ErrorResponse'
+      x-openapi-router-controller: swagger_server.controllers.certificates_controller
+  /api/certificates/{id}/chain:
+    get:
+      tags:
+      - certificates
+      summary: get certificate's trust chain by ID
+      description: Get certificate trust chain in PEM format by ID
+      operationId: get_certificate_trust_chain_by_id
+      parameters:
+      - name: id
+        in: path
+        description: ID of a child certificate whose chain is to be queried
+        required: true
+        style: simple
+        explode: false
+        schema:
+          $ref: '#/components/schemas/IdParameter'
+      responses:
+        "200":
+          description: returning the trust chain
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/PemResponse'
+        "204":
+          description: the certificate was not found
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ErrorResponse'
+        "400":
+          description: bad request
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ErrorResponse'
+      x-openapi-router-controller: swagger_server.controllers.certificates_controller
+  /api/certificates/{id}/root:
+    get:
+      tags:
+      - certificates
+      summary: get certificate's root of trust chain by ID
+      description: Get certificate's root of trust chain in PEM format by ID
+      operationId: get_certificate_root_by_id
+      parameters:
+      - name: id
+        in: path
+        description: ID of a child certificate whose root is to be queried
+        required: true
+        style: simple
+        explode: false
+        schema:
+          $ref: '#/components/schemas/IdParameter'
+      responses:
+        "200":
+          description: returning the root of trust chain
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/PemResponse'
+        "204":
+          description: the certificate was not found
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ErrorResponse'
+        "400":
+          description: bad request
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ErrorResponse'
+      x-openapi-router-controller: swagger_server.controllers.certificates_controller
+  /api/certificates/{id}/details:
+    get:
+      tags:
+      - certificates
+      summary: get certificate's details by ID
+      description: Get certificate details by ID
+      operationId: get_certificate_details_by_id
+      parameters:
+      - name: id
+        in: path
+        description: ID of a certificate whose details are to be queried
+        required: true
+        style: simple
+        explode: false
+        schema:
+          $ref: '#/components/schemas/IdParameter'
+      responses:
+        "200":
+          description: returning the certificate details
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/CertificateResponse'
+        "204":
+          description: the certificate was not found
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ErrorResponse'
+        "400":
+          description: bad request
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ErrorResponse'
+      x-openapi-router-controller: swagger_server.controllers.certificates_controller
+  /api/certificates:
+    get:
+      tags:
+      - certificates
+      summary: get list of certificates
+      description: Lists certificates based on provided filtering options
+      operationId: get_certificate_list
+      parameters:
+      - name: filtering
+        in: query
+        description: Filter certificate type to be queried
+        required: false
+        style: form
+        explode: true
+        schema:
+          $ref: '#/components/schemas/Filtering'
+      responses:
+        "200":
+          description: returning results matching filtering criteria
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/CertificateListResponse'
+        "204":
+          description: no certificates found
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ErrorResponse'
+        "400":
+          description: bad request
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ErrorResponse'
+      x-openapi-router-controller: swagger_server.controllers.certificates_controller
+    post:
+      tags:
+      - certificates
+      summary: create new certificate
+      description: Create a new certificate based on given information
+      operationId: create_certificate
+      requestBody:
+        description: Certificate data to be created
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CertificateRequest'
+      responses:
+        "201":
+          description: item created
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/CreatedResponse'
+        "400":
+          description: "invalid input, object invalid"
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ErrorResponse'
+        "409":
+          description: an existing item already exists
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ErrorResponse'
+      x-openapi-router-controller: swagger_server.controllers.certificates_controller
+components:
+  schemas:
+    CAUsage:
+      required:
+      - CA
+      - SSL
+      - authentication
+      - digitalSignature
+      properties:
+        CA:
+          type: boolean
+        authentication:
+          type: boolean
+        digitalSignature:
+          type: boolean
+        SSL:
+          type: boolean
+      example:
+        digitalSignature: true
+        SSL: true
+        CA: true
+        authentication: true
+    IssuerListItem:
+      required:
+      - CN
+      - id
+      properties:
+        id:
+          type: integer
+          example: 547
+        CN:
+          type: string
+          example: Root CA s.r.o.
+      example:
+        id: 547
+        CN: Root CA s.r.o.
+    CertificateListResponse:
+      properties:
+        success:
+          type: boolean
+          example: true
+        data:
+          type: array
+          items:
+            $ref: '#/components/schemas/CertificateListItem'
+      example:
+        data:
+        - notAfter: 2021-07-01T00:00:00.000+00:00
+          usage:
+            digitalSignature: true
+            SSL: true
+            CA: true
+            authentication: true
+          id: 547
+          CN: Root CA s.r.o.
+          notBefore: 2021-03-31T00:00:00.000+00:00
+          issuer:
+            id: 547
+            CN: Root CA s.r.o.
+        - notAfter: 2021-07-01T00:00:00.000+00:00
+          usage:
+            digitalSignature: true
+            SSL: true
+            CA: true
+            authentication: true
+          id: 547
+          CN: Root CA s.r.o.
+          notBefore: 2021-03-31T00:00:00.000+00:00
+          issuer:
+            id: 547
+            CN: Root CA s.r.o.
+        success: true
+    CertificateListItem:
+      properties:
+        id:
+          type: integer
+          example: 547
+        CN:
+          type: string
+          example: Root CA s.r.o.
+        notBefore:
+          type: string
+          format: date
+          example: 2021-03-31
+        notAfter:
+          type: string
+          format: date
+          example: 2021-07-01
+        usage:
+          $ref: '#/components/schemas/CAUsage'
+        issuer:
+          $ref: '#/components/schemas/IssuerListItem'
+      example:
+        notAfter: 2021-07-01T00:00:00.000+00:00
+        usage:
+          digitalSignature: true
+          SSL: true
+          CA: true
+          authentication: true
+        id: 547
+        CN: Root CA s.r.o.
+        notBefore: 2021-03-31T00:00:00.000+00:00
+        issuer:
+          id: 547
+          CN: Root CA s.r.o.
+    Filtering:
+      properties:
+        CA:
+          type: boolean
+    Subject:
+      required:
+      - CN
+      properties:
+        C:
+          type: string
+          description: Country code
+          example: CZ
+        ST:
+          type: string
+          description: State/Province
+          example: Pilsen Region
+        L:
+          type: string
+          description: Locality
+          example: Pilsen
+        CN:
+          type: string
+          description: Common name
+          example: Root CA s.r.o.
+        O:
+          type: string
+          description: Organization
+          example: Root CA s.r.o.
+        OU:
+          type: string
+          description: Organization Unit
+          example: IT department
+        emailAddress:
+          type: string
+          description: Email Address
+          example: root@ca.com
+      example:
+        ST: Pilsen Region
+        emailAddress: root@ca.com
+        C: CZ
+        OU: IT department
+        CN: Root CA s.r.o.
+        L: Pilsen
+        O: Root CA s.r.o.
+    Certificate:
+      required:
+      - notAfter
+      - notBefore
+      - subject
+      - usage
+      properties:
+        subject:
+          $ref: '#/components/schemas/Subject'
+        notBefore:
+          type: string
+          format: date
+          example: 2021-03-31
+        notAfter:
+          type: string
+          format: date
+          example: 2021-07-01
+        usage:
+          $ref: '#/components/schemas/CAUsage'
+        CA:
+          type: integer
+          description: ID of the new item
+          example: 547
+      example:
+        notAfter: 2021-07-01T00:00:00.000+00:00
+        subject:
+          ST: Pilsen Region
+          emailAddress: root@ca.com
+          C: CZ
+          OU: IT department
+          CN: Root CA s.r.o.
+          L: Pilsen
+          O: Root CA s.r.o.
+        usage:
+          digitalSignature: true
+          SSL: true
+          CA: true
+          authentication: true
+        notBefore: 2021-03-31T00:00:00.000+00:00
+        CA: 547
+    CertificateRequest:
+      required:
+      - subject
+      - usage
+      - validityDays
+      properties:
+        subject:
+          $ref: '#/components/schemas/Subject'
+        validityDays:
+          type: integer
+          example: 30
+        usage:
+          $ref: '#/components/schemas/CAUsage'
+        CA:
+          type: integer
+          description: ID of the new item
+          example: 547
+    CreatedResponse:
+      required:
+      - data
+      - success
+      properties:
+        success:
+          type: boolean
+          example: true
+        data:
+          type: integer
+          example: 457
+      description: Item was created
+      example:
+        data: 457
+        success: true
+    ErrorResponse:
+      required:
+      - data
+      - success
+      properties:
+        success:
+          type: boolean
+          example: false
+        data:
+          type: string
+          example: An error occured
+    CertificateResponse:
+      required:
+      - data
+      - success
+      properties:
+        success:
+          type: boolean
+          example: true
+        data:
+          $ref: '#/components/schemas/Certificate'
+      example:
+        data:
+          notAfter: 2021-07-01T00:00:00.000+00:00
+          subject:
+            ST: Pilsen Region
+            emailAddress: root@ca.com
+            C: CZ
+            OU: IT department
+            CN: Root CA s.r.o.
+            L: Pilsen
+            O: Root CA s.r.o.
+          usage:
+            digitalSignature: true
+            SSL: true
+            CA: true
+            authentication: true
+          notBefore: 2021-03-31T00:00:00.000+00:00
+          CA: 547
+        success: true
+    PemResponse:
+      required:
+      - data
+      - success
+      properties:
+        success:
+          type: boolean
+          example: true
+        data:
+          type: string
+          description: Single PEM file or concatenation of multiple PEM formatted
+            certificates
+          example: '-----BEGIN CERTIFICATE-----MIICLDCCAdKgAwIBAgIBADAKBggqhkjOPQQDAjB9MQswCQYDVQQGEwJCRTEPMA0GA1UEChMGR251VExTMSUwIwYDVQQ...etc-----END
+            CERTIFICATE-----'
+      example:
+        data: '-----BEGIN CERTIFICATE-----MIICLDCCAdKgAwIBAgIBADAKBggqhkjOPQQDAjB9MQswCQYDVQQGEwJCRTEPMA0GA1UEChMGR251VExTMSUwIwYDVQQ...etc-----END
+          CERTIFICATE-----'
+        success: true
+    IdParameter:
+      required:
+      - id
+      properties:
+        id:
+          type: integer
+          example: 444
+
diff --git a/src/utils/util.py b/src/utils/util.py
new file mode 100644
index 0000000..edb2251
--- /dev/null
+++ b/src/utils/util.py
@@ -0,0 +1,141 @@
+import datetime
+
+import six
+import typing
+
+
+def _deserialize(data, klass):
+    """Deserializes dict, list, str into an object.
+
+    :param data: dict, list or str.
+    :param klass: class literal, or string of class name.
+
+    :return: object.
+    """
+    if data is None:
+        return None
+
+    if klass in six.integer_types or klass in (float, str, bool):
+        return _deserialize_primitive(data, klass)
+    elif klass == object:
+        return _deserialize_object(data)
+    elif klass == datetime.date:
+        return deserialize_date(data)
+    elif klass == datetime.datetime:
+        return deserialize_datetime(data)
+    elif hasattr(klass, '__origin__'):
+        if klass.__origin__ == list:
+            return _deserialize_list(data, klass.__args__[0])
+        if klass.__origin__ == dict:
+            return _deserialize_dict(data, klass.__args__[1])
+    else:
+        return deserialize_model(data, klass)
+
+
+def _deserialize_primitive(data, klass):
+    """Deserializes to primitive type.
+
+    :param data: data to deserialize.
+    :param klass: class literal.
+
+    :return: int, long, float, str, bool.
+    :rtype: int | long | float | str | bool
+    """
+    try:
+        value = klass(data)
+    except UnicodeEncodeError:
+        value = six.u(data)
+    except TypeError:
+        value = data
+    return value
+
+
+def _deserialize_object(value):
+    """Return a original value.
+
+    :return: object.
+    """
+    return value
+
+
+def deserialize_date(string):
+    """Deserializes string to date.
+
+    :param string: str.
+    :type string: str
+    :return: date.
+    :rtype: date
+    """
+    try:
+        from dateutil.parser import parse
+        return parse(string).date()
+    except ImportError:
+        return string
+
+
+def deserialize_datetime(string):
+    """Deserializes string to datetime.
+
+    The string should be in iso8601 datetime format.
+
+    :param string: str.
+    :type string: str
+    :return: datetime.
+    :rtype: datetime
+    """
+    try:
+        from dateutil.parser import parse
+        return parse(string)
+    except ImportError:
+        return string
+
+
+def deserialize_model(data, klass):
+    """Deserializes list or dict to model.
+
+    :param data: dict, list.
+    :type data: dict | list
+    :param klass: class literal.
+    :return: model object.
+    """
+    instance = klass()
+
+    if not instance.swagger_types:
+        return data
+
+    for attr, attr_type in six.iteritems(instance.swagger_types):
+        if data is not None \
+                and instance.attribute_map[attr] in data \
+                and isinstance(data, (list, dict)):
+            value = data[instance.attribute_map[attr]]
+            setattr(instance, attr, _deserialize(value, attr_type))
+
+    return instance
+
+
+def _deserialize_list(data, boxed_type):
+    """Deserializes a list and its elements.
+
+    :param data: list to deserialize.
+    :type data: list
+    :param boxed_type: class literal.
+
+    :return: deserialized list.
+    :rtype: list
+    """
+    return [_deserialize(sub_data, boxed_type)
+            for sub_data in data]
+
+
+def _deserialize_dict(data, boxed_type):
+    """Deserializes a dict and its elements.
+
+    :param data: dict to deserialize.
+    :type data: dict
+    :param boxed_type: class literal.
+
+    :return: deserialized dict.
+    :rtype: dict
+    """
+    return {k: _deserialize(v, boxed_type)
+            for k, v in six.iteritems(data)}
diff --git a/swagger_server/__init__.py b/swagger_server/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/swagger_server/__main__.py b/swagger_server/__main__.py
deleted file mode 100644
index a1835af..0000000
--- a/swagger_server/__main__.py
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/env python3
-import logging
-
-import connexion
-
-from swagger_server import encoder
-
-
-app = connexion.App(__name__, specification_dir='./swagger/', debug=False)
-PORT = 8080
-
-
-def setup(a):
-    a.app.json_encoder = encoder.JSONEncoder
-    a.add_api('swagger.yaml', arguments={'title': 'X.509 certificate management'}, base_path="/", pythonic_params=True)
-    # a.run(port=PORT)
-
-
-if __name__ == '__main__':
-    setup(app)
-    app.run(PORT)
diff --git a/swagger_server/controllers/__init__.py b/swagger_server/controllers/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/swagger_server/controllers/authorization_controller.py b/swagger_server/controllers/authorization_controller.py
deleted file mode 100644
index 2f7b0bb..0000000
--- a/swagger_server/controllers/authorization_controller.py
+++ /dev/null
@@ -1,6 +0,0 @@
-from typing import List
-"""
-controller generated to handled auth operation described at:
-https://connexion.readthedocs.io/en/latest/security.html
-"""
-
diff --git a/swagger_server/controllers/certificates_controller.py b/swagger_server/controllers/certificates_controller.py
deleted file mode 100644
index 744d271..0000000
--- a/swagger_server/controllers/certificates_controller.py
+++ /dev/null
@@ -1,244 +0,0 @@
-from datetime import datetime
-
-import connexion
-import six
-
-from src.dao.private_key_repository import PrivateKeyRepository
-from src.model.subject import Subject
-from src.services.certificate_service import CertificateService
-from src.dao.certificate_repository import CertificateRepository    # TODO not the Controller's responsibility. 1
-from src.services.cryptography import CryptographyService           # TODO not the Controller's responsibility. 2
-from sqlite3 import Connection                                      # TODO not the Controller's responsibility. 3
-from src.constants import DICT_USAGES, CA_ID, \
-    DATABASE_FILE_LOCATION, SSL_ID, SIGNATURE_ID, AUTHENTICATION_ID, \
-    DATETIME_FORMAT  # TODO DATABASE_FILE - not the Controller's
-                                                                    #  responsibility. 4
-from src.services.key_service import KeyService
-from swagger_server.models import CertificateRequest, CertificateListItem, CAUsage, IssuerListItem
-
-from swagger_server.models.certificate import Certificate  # noqa: E501
-from swagger_server.models.certificate_list_response import CertificateListResponse  # noqa: E501
-from swagger_server.models.certificate_response import CertificateResponse  # noqa: E501
-from swagger_server.models.created_response import CreatedResponse  # noqa: E501
-from swagger_server.models.error_response import ErrorResponse  # noqa: E501
-from swagger_server.models.filtering import Filtering  # noqa: E501
-from swagger_server.models.id_parameter import IdParameter  # noqa: E501
-from swagger_server.models.pem_response import PemResponse  # noqa: E501
-from swagger_server import util
-
-
-# _ = Connection("../" + DATABASE_FILE)                                 # TODO not the Controller's responsibility. 5
-# cursor = _.cursor()                                                   # TODO responsibility of the
-                                                                        #  CertificateRepository. It makes no sense to
-                                                                        #  supply a different cursor than precisely
-                                                                        #  the one corresponding to the connection.
-                                                                        #  The cursor can always be generated from the
-                                                                        #  connection instance.
-GENERAL_ERROR = "An error occured during processing of the request."
-CORRUPTED_DATABASE = "Internal server error (corrupted database)."
-
-__ = CryptographyService()                                              # TODO not the Controller's responsibility. 6
-CERTIFICATE_SERVICE = CertificateService(__, CertificateRepository(None, None))
-                                                                        # TODO open for discussion. Expected:
-                                                                        #  CS = CertificateService.get_instance()
-                                                                        #  or something like that.
-
-KEY_SERVICE = KeyService(__, PrivateKeyRepository(None, None))          # TODO as above
-
-
-
-def setup():
-    """
-    SQLite3 thread issue hack.
-    :return:
-    """
-    _ = Connection(DATABASE_FILE_LOCATION.shortest_relative_path())
-    CERTIFICATE_SERVICE.certificate_repository.connection = _
-    CERTIFICATE_SERVICE.certificate_repository.cursor = _.cursor()
-    KEY_SERVICE.private_key_repository.connection = _
-    KEY_SERVICE.private_key_repository.cursor = _.cursor()
-
-
-def create_certificate(body=None):  # noqa: E501
-    """create new certificate
-
-    Create a new certificate based on given information # noqa: E501
-
-    :param body: Certificate data to be created
-    :type body: dict | bytes
-
-    :rtype: CreatedResponse
-    """
-    setup()                                                             # TODO remove after issue fixed
-
-    if connexion.request.is_json:
-        body = CertificateRequest.from_dict(connexion.request.get_json())  # noqa: E501
-        # if body.subject is None or body.usage is None or body.validity_days is None:
-        #     return 400
-
-        key = KEY_SERVICE.create_new_key()                              # TODO pass key
-        subject = Subject(
-            common_name=body.subject.cn,
-            country=body.subject.c,
-            locality=body.subject.l,
-            state=body.subject.st,
-            organization=body.subject.o,
-            organization_unit=body.subject.ou,
-            email_address=body.subject.email_address
-        )
-        usages_dict = DICT_USAGES.copy()
-
-        if body.ca is None:
-            cert = CERTIFICATE_SERVICE.create_root_ca(
-                key,
-                subject,
-                usages=usages_dict,
-                days=body.validity_days
-            )
-        else:
-            issuer = CERTIFICATE_SERVICE.get_certificate(body.ca)
-
-            if issuer is None:
-                return ErrorResponse(
-                    success=False,
-                    data="No certificate authority with such unique ID exists."
-                ), 400
-
-            issuer_key = KEY_SERVICE.get_key(issuer.private_key_id)
-
-            if issuer_key is None:
-                return ErrorResponse(
-                    success=False,
-                    data=CORRUPTED_DATABASE
-                ), 400
-
-            f = CERTIFICATE_SERVICE.create_ca if CA_ID in usages_dict and usages_dict[CA_ID] else \
-                CERTIFICATE_SERVICE.create_end_cert
-
-            cert = f(
-                key,
-                subject,
-                issuer,
-                issuer_key,
-                usages=usages_dict,
-                days=body.validity_days
-            )
-
-        if cert is not None:
-            return CreatedResponse(
-                success=True,
-                data=cert.certificate_id
-            ), 201
-        else:
-            return ErrorResponse(
-                success=False,
-                data="The certificate could not have been created."
-            ), 400
-    else:
-        return ErrorResponse(success=False, data="The request must be JSON-formatted."), 400
-
-
-def get_certificate_by_id(id):  # noqa: E501
-    """get certificate by ID
-
-    Get certificate in PEM format by ID # noqa: E501
-
-    :param id: ID of a certificate to be queried
-    :type id: dict | bytes
-
-    :rtype: PemResponse
-    """
-    if connexion.request.is_json:
-        id = IdParameter.from_dict(connexion.request.get_json())  # noqa: E501
-    return 'do some magic!'
-
-
-def get_certificate_details_by_id(id):  # noqa: E501
-    """get certificate&#x27;s details by ID
-
-    Get certificate details by ID # noqa: E501
-
-    :param id: ID of a certificate whose details are to be queried
-    :type id: dict | bytes
-
-    :rtype: CertificateResponse
-    """
-    if connexion.request.is_json:
-        id = IdParameter.from_dict(connexion.request.get_json())  # noqa: E501
-    return 'do some magic!'
-
-
-def get_certificate_list(filtering=None):  # noqa: E501
-    """get list of certificates
-
-    Lists certificates based on provided filtering options # noqa: E501
-
-    :param filtering: Filter certificate type to be queried
-    :type filtering: dict | bytes
-
-    :rtype: CertificateListResponse
-    """
-    setup()                                                             # TODO remove after issue fixed
-
-    key_map = {CA_ID: 'ca', SSL_ID: 'ssl', SIGNATURE_ID: 'digital_signature', AUTHENTICATION_ID: 'authentication'}
-
-    if len(connexion.request.data) == 0:
-        certs = CERTIFICATE_SERVICE.get_certificates()
-        if certs is None:
-            return ErrorResponse(success=False, data=GENERAL_ERROR), 500
-        elif len(certs) == 0:
-            return ErrorResponse(success=False, data="No certificates found."), 204
-        else:
-            ret = []
-            for c in certs:
-                c_issuer = CERTIFICATE_SERVICE.get_certificate(c.parent_id)
-                if c_issuer is None:
-                    return ErrorResponse(success=False, data=CORRUPTED_DATABASE)
-
-                ret.append(
-                    CertificateListItem(
-                        id=c.certificate_id,
-                        cn=c.common_name,
-                        not_before=datetime.strptime(c.valid_from, DATETIME_FORMAT).date(),
-                        not_after=datetime.strptime(c.valid_to, DATETIME_FORMAT).date(),
-                        usage=CAUsage(**{key_map[k]: v for k, v in c.usages.items()}),
-                        issuer=IssuerListItem(
-                            id=c_issuer.certificate_id,
-                            cn=c_issuer.common_name
-                        )
-                    )
-                )
-            return CertificateListResponse(success=True, data=ret)
-    else:
-        # TODO fix filtering issue (somehow)
-        return ErrorResponse(success=False, data="The request must be JSON-formatted."), 400
-
-
-def get_certificate_root_by_id(id):  # noqa: E501
-    """get certificate&#x27;s root of trust chain by ID
-
-    Get certificate&#x27;s root of trust chain in PEM format by ID # noqa: E501
-
-    :param id: ID of a child certificate whose root is to be queried
-    :type id: dict | bytes
-
-    :rtype: PemResponse
-    """
-    if connexion.request.is_json:
-        id = IdParameter.from_dict(connexion.request.get_json())  # noqa: E501
-    return 'do some magic!'
-
-
-def get_certificate_trust_chain_by_id(id):  # noqa: E501
-    """get certificate&#x27;s trust chain by ID
-
-    Get certificate trust chain in PEM format by ID # noqa: E501
-
-    :param id: ID of a child certificate whose chain is to be queried
-    :type id: dict | bytes
-
-    :rtype: PemResponse
-    """
-    if connexion.request.is_json:
-        id = IdParameter.from_dict(connexion.request.get_json())  # noqa: E501
-    return 'do some magic!'
diff --git a/swagger_server/encoder.py b/swagger_server/encoder.py
deleted file mode 100644
index 61ba472..0000000
--- a/swagger_server/encoder.py
+++ /dev/null
@@ -1,20 +0,0 @@
-from connexion.apps.flask_app import FlaskJSONEncoder
-import six
-
-from swagger_server.models.base_model_ import Model
-
-
-class JSONEncoder(FlaskJSONEncoder):
-    include_nulls = False
-
-    def default(self, o):
-        if isinstance(o, Model):
-            dikt = {}
-            for attr, _ in six.iteritems(o.swagger_types):
-                value = getattr(o, attr)
-                if value is None and not self.include_nulls:
-                    continue
-                attr = o.attribute_map[attr]
-                dikt[attr] = value
-            return dikt
-        return FlaskJSONEncoder.default(self, o)
diff --git a/swagger_server/models/__init__.py b/swagger_server/models/__init__.py
deleted file mode 100644
index d087416..0000000
--- a/swagger_server/models/__init__.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# coding: utf-8
-
-# flake8: noqa
-from __future__ import absolute_import
-# import models into model package
-from swagger_server.models.ca_usage import CAUsage
-from swagger_server.models.certificate import Certificate
-from swagger_server.models.certificate_list_item import CertificateListItem
-from swagger_server.models.certificate_list_response import CertificateListResponse
-from swagger_server.models.certificate_request import CertificateRequest
-from swagger_server.models.certificate_response import CertificateResponse
-from swagger_server.models.created_response import CreatedResponse
-from swagger_server.models.error_response import ErrorResponse
-from swagger_server.models.filtering import Filtering
-from swagger_server.models.id_parameter import IdParameter
-from swagger_server.models.issuer_list_item import IssuerListItem
-from swagger_server.models.pem_response import PemResponse
-from swagger_server.models.subject import Subject
diff --git a/swagger_server/models/base_model_.py b/swagger_server/models/base_model_.py
deleted file mode 100644
index 97999c3..0000000
--- a/swagger_server/models/base_model_.py
+++ /dev/null
@@ -1,69 +0,0 @@
-import pprint
-
-import six
-import typing
-
-from swagger_server import util
-
-T = typing.TypeVar('T')
-
-
-class Model(object):
-    # swaggerTypes: The key is attribute name and the
-    # value is attribute type.
-    swagger_types = {}
-
-    # attributeMap: The key is attribute name and the
-    # value is json key in definition.
-    attribute_map = {}
-
-    @classmethod
-    def from_dict(cls: typing.Type[T], dikt) -> T:
-        """Returns the dict as a model"""
-        return util.deserialize_model(dikt, cls)
-
-    def to_dict(self):
-        """Returns the model properties as a dict
-
-        :rtype: dict
-        """
-        result = {}
-
-        for attr, _ in six.iteritems(self.swagger_types):
-            value = getattr(self, attr)
-            if isinstance(value, list):
-                result[attr] = list(map(
-                    lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
-                    value
-                ))
-            elif hasattr(value, "to_dict"):
-                result[attr] = value.to_dict()
-            elif isinstance(value, dict):
-                result[attr] = dict(map(
-                    lambda item: (item[0], item[1].to_dict())
-                    if hasattr(item[1], "to_dict") else item,
-                    value.items()
-                ))
-            else:
-                result[attr] = value
-
-        return result
-
-    def to_str(self):
-        """Returns the string representation of the model
-
-        :rtype: str
-        """
-        return pprint.pformat(self.to_dict())
-
-    def __repr__(self):
-        """For `print` and `pprint`"""
-        return self.to_str()
-
-    def __eq__(self, other):
-        """Returns true if both objects are equal"""
-        return self.__dict__ == other.__dict__
-
-    def __ne__(self, other):
-        """Returns true if both objects are not equal"""
-        return not self == other
diff --git a/swagger_server/models/ca_usage.py b/swagger_server/models/ca_usage.py
deleted file mode 100644
index 33acd33..0000000
--- a/swagger_server/models/ca_usage.py
+++ /dev/null
@@ -1,148 +0,0 @@
-# coding: utf-8
-
-from __future__ import absolute_import
-from datetime import date, datetime  # noqa: F401
-
-from typing import List, Dict  # noqa: F401
-
-from swagger_server.models.base_model_ import Model
-from swagger_server import util
-
-
-class CAUsage(Model):
-    """NOTE: This class is auto generated by the swagger code generator program.
-
-    Do not edit the class manually.
-    """
-    def __init__(self, ca: bool=None, authentication: bool=None, digital_signature: bool=None, ssl: bool=None):  # noqa: E501
-        """CAUsage - a model defined in Swagger
-
-        :param ca: The ca of this CAUsage.  # noqa: E501
-        :type ca: bool
-        :param authentication: The authentication of this CAUsage.  # noqa: E501
-        :type authentication: bool
-        :param digital_signature: The digital_signature of this CAUsage.  # noqa: E501
-        :type digital_signature: bool
-        :param ssl: The ssl of this CAUsage.  # noqa: E501
-        :type ssl: bool
-        """
-        self.swagger_types = {
-            'ca': bool,
-            'authentication': bool,
-            'digital_signature': bool,
-            'ssl': bool
-        }
-
-        self.attribute_map = {
-            'ca': 'CA',
-            'authentication': 'authentication',
-            'digital_signature': 'digitalSignature',
-            'ssl': 'SSL'
-        }
-        self._ca = ca
-        self._authentication = authentication
-        self._digital_signature = digital_signature
-        self._ssl = ssl
-
-    @classmethod
-    def from_dict(cls, dikt) -> 'CAUsage':
-        """Returns the dict as a model
-
-        :param dikt: A dict.
-        :type: dict
-        :return: The CAUsage of this CAUsage.  # noqa: E501
-        :rtype: CAUsage
-        """
-        return util.deserialize_model(dikt, cls)
-
-    @property
-    def ca(self) -> bool:
-        """Gets the ca of this CAUsage.
-
-
-        :return: The ca of this CAUsage.
-        :rtype: bool
-        """
-        return self._ca
-
-    @ca.setter
-    def ca(self, ca: bool):
-        """Sets the ca of this CAUsage.
-
-
-        :param ca: The ca of this CAUsage.
-        :type ca: bool
-        """
-        if ca is None:
-            raise ValueError("Invalid value for `ca`, must not be `None`")  # noqa: E501
-
-        self._ca = ca
-
-    @property
-    def authentication(self) -> bool:
-        """Gets the authentication of this CAUsage.
-
-
-        :return: The authentication of this CAUsage.
-        :rtype: bool
-        """
-        return self._authentication
-
-    @authentication.setter
-    def authentication(self, authentication: bool):
-        """Sets the authentication of this CAUsage.
-
-
-        :param authentication: The authentication of this CAUsage.
-        :type authentication: bool
-        """
-        if authentication is None:
-            raise ValueError("Invalid value for `authentication`, must not be `None`")  # noqa: E501
-
-        self._authentication = authentication
-
-    @property
-    def digital_signature(self) -> bool:
-        """Gets the digital_signature of this CAUsage.
-
-
-        :return: The digital_signature of this CAUsage.
-        :rtype: bool
-        """
-        return self._digital_signature
-
-    @digital_signature.setter
-    def digital_signature(self, digital_signature: bool):
-        """Sets the digital_signature of this CAUsage.
-
-
-        :param digital_signature: The digital_signature of this CAUsage.
-        :type digital_signature: bool
-        """
-        if digital_signature is None:
-            raise ValueError("Invalid value for `digital_signature`, must not be `None`")  # noqa: E501
-
-        self._digital_signature = digital_signature
-
-    @property
-    def ssl(self) -> bool:
-        """Gets the ssl of this CAUsage.
-
-
-        :return: The ssl of this CAUsage.
-        :rtype: bool
-        """
-        return self._ssl
-
-    @ssl.setter
-    def ssl(self, ssl: bool):
-        """Sets the ssl of this CAUsage.
-
-
-        :param ssl: The ssl of this CAUsage.
-        :type ssl: bool
-        """
-        if ssl is None:
-            raise ValueError("Invalid value for `ssl`, must not be `None`")  # noqa: E501
-
-        self._ssl = ssl
diff --git a/swagger_server/models/certificate.py b/swagger_server/models/certificate.py
deleted file mode 100644
index 4202d46..0000000
--- a/swagger_server/models/certificate.py
+++ /dev/null
@@ -1,178 +0,0 @@
-# coding: utf-8
-
-from __future__ import absolute_import
-from datetime import date, datetime  # noqa: F401
-
-from typing import List, Dict  # noqa: F401
-
-from swagger_server.models.base_model_ import Model
-from swagger_server.models.ca_usage import CAUsage  # noqa: F401,E501
-from swagger_server.models.subject import Subject  # noqa: F401,E501
-from swagger_server import util
-
-
-class Certificate(Model):
-    """NOTE: This class is auto generated by the swagger code generator program.
-
-    Do not edit the class manually.
-    """
-    def __init__(self, subject: Subject=None, not_before: date=None, not_after: date=None, usage: CAUsage=None, ca: int=None):  # noqa: E501
-        """Certificate - a model defined in Swagger
-
-        :param subject: The subject of this Certificate.  # noqa: E501
-        :type subject: Subject
-        :param not_before: The not_before of this Certificate.  # noqa: E501
-        :type not_before: date
-        :param not_after: The not_after of this Certificate.  # noqa: E501
-        :type not_after: date
-        :param usage: The usage of this Certificate.  # noqa: E501
-        :type usage: CAUsage
-        :param ca: The ca of this Certificate.  # noqa: E501
-        :type ca: int
-        """
-        self.swagger_types = {
-            'subject': Subject,
-            'not_before': date,
-            'not_after': date,
-            'usage': CAUsage,
-            'ca': int
-        }
-
-        self.attribute_map = {
-            'subject': 'subject',
-            'not_before': 'notBefore',
-            'not_after': 'notAfter',
-            'usage': 'usage',
-            'ca': 'CA'
-        }
-        self._subject = subject
-        self._not_before = not_before
-        self._not_after = not_after
-        self._usage = usage
-        self._ca = ca
-
-    @classmethod
-    def from_dict(cls, dikt) -> 'Certificate':
-        """Returns the dict as a model
-
-        :param dikt: A dict.
-        :type: dict
-        :return: The Certificate of this Certificate.  # noqa: E501
-        :rtype: Certificate
-        """
-        return util.deserialize_model(dikt, cls)
-
-    @property
-    def subject(self) -> Subject:
-        """Gets the subject of this Certificate.
-
-
-        :return: The subject of this Certificate.
-        :rtype: Subject
-        """
-        return self._subject
-
-    @subject.setter
-    def subject(self, subject: Subject):
-        """Sets the subject of this Certificate.
-
-
-        :param subject: The subject of this Certificate.
-        :type subject: Subject
-        """
-        if subject is None:
-            raise ValueError("Invalid value for `subject`, must not be `None`")  # noqa: E501
-
-        self._subject = subject
-
-    @property
-    def not_before(self) -> date:
-        """Gets the not_before of this Certificate.
-
-
-        :return: The not_before of this Certificate.
-        :rtype: date
-        """
-        return self._not_before
-
-    @not_before.setter
-    def not_before(self, not_before: date):
-        """Sets the not_before of this Certificate.
-
-
-        :param not_before: The not_before of this Certificate.
-        :type not_before: date
-        """
-        if not_before is None:
-            raise ValueError("Invalid value for `not_before`, must not be `None`")  # noqa: E501
-
-        self._not_before = not_before
-
-    @property
-    def not_after(self) -> date:
-        """Gets the not_after of this Certificate.
-
-
-        :return: The not_after of this Certificate.
-        :rtype: date
-        """
-        return self._not_after
-
-    @not_after.setter
-    def not_after(self, not_after: date):
-        """Sets the not_after of this Certificate.
-
-
-        :param not_after: The not_after of this Certificate.
-        :type not_after: date
-        """
-        if not_after is None:
-            raise ValueError("Invalid value for `not_after`, must not be `None`")  # noqa: E501
-
-        self._not_after = not_after
-
-    @property
-    def usage(self) -> CAUsage:
-        """Gets the usage of this Certificate.
-
-
-        :return: The usage of this Certificate.
-        :rtype: CAUsage
-        """
-        return self._usage
-
-    @usage.setter
-    def usage(self, usage: CAUsage):
-        """Sets the usage of this Certificate.
-
-
-        :param usage: The usage of this Certificate.
-        :type usage: CAUsage
-        """
-        if usage is None:
-            raise ValueError("Invalid value for `usage`, must not be `None`")  # noqa: E501
-
-        self._usage = usage
-
-    @property
-    def ca(self) -> int:
-        """Gets the ca of this Certificate.
-
-        ID of the new item  # noqa: E501
-
-        :return: The ca of this Certificate.
-        :rtype: int
-        """
-        return self._ca
-
-    @ca.setter
-    def ca(self, ca: int):
-        """Sets the ca of this Certificate.
-
-        ID of the new item  # noqa: E501
-
-        :param ca: The ca of this Certificate.
-        :type ca: int
-        """
-
-        self._ca = ca
diff --git a/swagger_server/models/certificate_list_item.py b/swagger_server/models/certificate_list_item.py
deleted file mode 100644
index 6809f33..0000000
--- a/swagger_server/models/certificate_list_item.py
+++ /dev/null
@@ -1,194 +0,0 @@
-# coding: utf-8
-
-from __future__ import absolute_import
-from datetime import date, datetime  # noqa: F401
-
-from typing import List, Dict  # noqa: F401
-
-from swagger_server.models.base_model_ import Model
-from swagger_server.models.ca_usage import CAUsage  # noqa: F401,E501
-from swagger_server.models.issuer_list_item import IssuerListItem  # noqa: F401,E501
-from swagger_server import util
-
-
-class CertificateListItem(Model):
-    """NOTE: This class is auto generated by the swagger code generator program.
-
-    Do not edit the class manually.
-    """
-    def __init__(self, id: int=None, cn: str=None, not_before: date=None, not_after: date=None, usage: CAUsage=None, issuer: IssuerListItem=None):  # noqa: E501
-        """CertificateListItem - a model defined in Swagger
-
-        :param id: The id of this CertificateListItem.  # noqa: E501
-        :type id: int
-        :param cn: The cn of this CertificateListItem.  # noqa: E501
-        :type cn: str
-        :param not_before: The not_before of this CertificateListItem.  # noqa: E501
-        :type not_before: date
-        :param not_after: The not_after of this CertificateListItem.  # noqa: E501
-        :type not_after: date
-        :param usage: The usage of this CertificateListItem.  # noqa: E501
-        :type usage: CAUsage
-        :param issuer: The issuer of this CertificateListItem.  # noqa: E501
-        :type issuer: IssuerListItem
-        """
-        self.swagger_types = {
-            'id': int,
-            'cn': str,
-            'not_before': date,
-            'not_after': date,
-            'usage': CAUsage,
-            'issuer': IssuerListItem
-        }
-
-        self.attribute_map = {
-            'id': 'id',
-            'cn': 'CN',
-            'not_before': 'notBefore',
-            'not_after': 'notAfter',
-            'usage': 'usage',
-            'issuer': 'issuer'
-        }
-        self._id = id
-        self._cn = cn
-        self._not_before = not_before
-        self._not_after = not_after
-        self._usage = usage
-        self._issuer = issuer
-
-    @classmethod
-    def from_dict(cls, dikt) -> 'CertificateListItem':
-        """Returns the dict as a model
-
-        :param dikt: A dict.
-        :type: dict
-        :return: The CertificateListItem of this CertificateListItem.  # noqa: E501
-        :rtype: CertificateListItem
-        """
-        return util.deserialize_model(dikt, cls)
-
-    @property
-    def id(self) -> int:
-        """Gets the id of this CertificateListItem.
-
-
-        :return: The id of this CertificateListItem.
-        :rtype: int
-        """
-        return self._id
-
-    @id.setter
-    def id(self, id: int):
-        """Sets the id of this CertificateListItem.
-
-
-        :param id: The id of this CertificateListItem.
-        :type id: int
-        """
-
-        self._id = id
-
-    @property
-    def cn(self) -> str:
-        """Gets the cn of this CertificateListItem.
-
-
-        :return: The cn of this CertificateListItem.
-        :rtype: str
-        """
-        return self._cn
-
-    @cn.setter
-    def cn(self, cn: str):
-        """Sets the cn of this CertificateListItem.
-
-
-        :param cn: The cn of this CertificateListItem.
-        :type cn: str
-        """
-
-        self._cn = cn
-
-    @property
-    def not_before(self) -> date:
-        """Gets the not_before of this CertificateListItem.
-
-
-        :return: The not_before of this CertificateListItem.
-        :rtype: date
-        """
-        return self._not_before
-
-    @not_before.setter
-    def not_before(self, not_before: date):
-        """Sets the not_before of this CertificateListItem.
-
-
-        :param not_before: The not_before of this CertificateListItem.
-        :type not_before: date
-        """
-
-        self._not_before = not_before
-
-    @property
-    def not_after(self) -> date:
-        """Gets the not_after of this CertificateListItem.
-
-
-        :return: The not_after of this CertificateListItem.
-        :rtype: date
-        """
-        return self._not_after
-
-    @not_after.setter
-    def not_after(self, not_after: date):
-        """Sets the not_after of this CertificateListItem.
-
-
-        :param not_after: The not_after of this CertificateListItem.
-        :type not_after: date
-        """
-
-        self._not_after = not_after
-
-    @property
-    def usage(self) -> CAUsage:
-        """Gets the usage of this CertificateListItem.
-
-
-        :return: The usage of this CertificateListItem.
-        :rtype: CAUsage
-        """
-        return self._usage
-
-    @usage.setter
-    def usage(self, usage: CAUsage):
-        """Sets the usage of this CertificateListItem.
-
-
-        :param usage: The usage of this CertificateListItem.
-        :type usage: CAUsage
-        """
-
-        self._usage = usage
-
-    @property
-    def issuer(self) -> IssuerListItem:
-        """Gets the issuer of this CertificateListItem.
-
-
-        :return: The issuer of this CertificateListItem.
-        :rtype: IssuerListItem
-        """
-        return self._issuer
-
-    @issuer.setter
-    def issuer(self, issuer: IssuerListItem):
-        """Sets the issuer of this CertificateListItem.
-
-
-        :param issuer: The issuer of this CertificateListItem.
-        :type issuer: IssuerListItem
-        """
-
-        self._issuer = issuer
diff --git a/swagger_server/models/certificate_list_response.py b/swagger_server/models/certificate_list_response.py
deleted file mode 100644
index cc0ac63..0000000
--- a/swagger_server/models/certificate_list_response.py
+++ /dev/null
@@ -1,89 +0,0 @@
-# coding: utf-8
-
-from __future__ import absolute_import
-from datetime import date, datetime  # noqa: F401
-
-from typing import List, Dict  # noqa: F401
-
-from swagger_server.models.base_model_ import Model
-from swagger_server.models.certificate_list_item import CertificateListItem  # noqa: F401,E501
-from swagger_server import util
-
-
-class CertificateListResponse(Model):
-    """NOTE: This class is auto generated by the swagger code generator program.
-
-    Do not edit the class manually.
-    """
-    def __init__(self, success: bool=None, data: List[CertificateListItem]=None):  # noqa: E501
-        """CertificateListResponse - a model defined in Swagger
-
-        :param success: The success of this CertificateListResponse.  # noqa: E501
-        :type success: bool
-        :param data: The data of this CertificateListResponse.  # noqa: E501
-        :type data: List[CertificateListItem]
-        """
-        self.swagger_types = {
-            'success': bool,
-            'data': List[CertificateListItem]
-        }
-
-        self.attribute_map = {
-            'success': 'success',
-            'data': 'data'
-        }
-        self._success = success
-        self._data = data
-
-    @classmethod
-    def from_dict(cls, dikt) -> 'CertificateListResponse':
-        """Returns the dict as a model
-
-        :param dikt: A dict.
-        :type: dict
-        :return: The CertificateListResponse of this CertificateListResponse.  # noqa: E501
-        :rtype: CertificateListResponse
-        """
-        return util.deserialize_model(dikt, cls)
-
-    @property
-    def success(self) -> bool:
-        """Gets the success of this CertificateListResponse.
-
-
-        :return: The success of this CertificateListResponse.
-        :rtype: bool
-        """
-        return self._success
-
-    @success.setter
-    def success(self, success: bool):
-        """Sets the success of this CertificateListResponse.
-
-
-        :param success: The success of this CertificateListResponse.
-        :type success: bool
-        """
-
-        self._success = success
-
-    @property
-    def data(self) -> List[CertificateListItem]:
-        """Gets the data of this CertificateListResponse.
-
-
-        :return: The data of this CertificateListResponse.
-        :rtype: List[CertificateListItem]
-        """
-        return self._data
-
-    @data.setter
-    def data(self, data: List[CertificateListItem]):
-        """Sets the data of this CertificateListResponse.
-
-
-        :param data: The data of this CertificateListResponse.
-        :type data: List[CertificateListItem]
-        """
-
-        self._data = data
diff --git a/swagger_server/models/certificate_request.py b/swagger_server/models/certificate_request.py
deleted file mode 100644
index 698826e..0000000
--- a/swagger_server/models/certificate_request.py
+++ /dev/null
@@ -1,150 +0,0 @@
-# coding: utf-8
-
-from __future__ import absolute_import
-from datetime import date, datetime  # noqa: F401
-
-from typing import List, Dict  # noqa: F401
-
-from swagger_server.models.base_model_ import Model
-from swagger_server.models.ca_usage import CAUsage  # noqa: F401,E501
-from swagger_server.models.subject import Subject  # noqa: F401,E501
-from swagger_server import util
-
-
-class CertificateRequest(Model):
-    """NOTE: This class is auto generated by the swagger code generator program.
-
-    Do not edit the class manually.
-    """
-    def __init__(self, subject: Subject=None, validity_days: int=None, usage: CAUsage=None, ca: int=None):  # noqa: E501
-        """CertificateRequest - a model defined in Swagger
-
-        :param subject: The subject of this CertificateRequest.  # noqa: E501
-        :type subject: Subject
-        :param validity_days: The validity_days of this CertificateRequest.  # noqa: E501
-        :type validity_days: int
-        :param usage: The usage of this CertificateRequest.  # noqa: E501
-        :type usage: CAUsage
-        :param ca: The ca of this CertificateRequest.  # noqa: E501
-        :type ca: int
-        """
-        self.swagger_types = {
-            'subject': Subject,
-            'validity_days': int,
-            'usage': CAUsage,
-            'ca': int
-        }
-
-        self.attribute_map = {
-            'subject': 'subject',
-            'validity_days': 'validityDays',
-            'usage': 'usage',
-            'ca': 'CA'
-        }
-        self._subject = subject
-        self._validity_days = validity_days
-        self._usage = usage
-        self._ca = ca
-
-    @classmethod
-    def from_dict(cls, dikt) -> 'CertificateRequest':
-        """Returns the dict as a model
-
-        :param dikt: A dict.
-        :type: dict
-        :return: The CertificateRequest of this CertificateRequest.  # noqa: E501
-        :rtype: CertificateRequest
-        """
-        return util.deserialize_model(dikt, cls)
-
-    @property
-    def subject(self) -> Subject:
-        """Gets the subject of this CertificateRequest.
-
-
-        :return: The subject of this CertificateRequest.
-        :rtype: Subject
-        """
-        return self._subject
-
-    @subject.setter
-    def subject(self, subject: Subject):
-        """Sets the subject of this CertificateRequest.
-
-
-        :param subject: The subject of this CertificateRequest.
-        :type subject: Subject
-        """
-        if subject is None:
-            raise ValueError("Invalid value for `subject`, must not be `None`")  # noqa: E501
-
-        self._subject = subject
-
-    @property
-    def validity_days(self) -> int:
-        """Gets the validity_days of this CertificateRequest.
-
-
-        :return: The validity_days of this CertificateRequest.
-        :rtype: int
-        """
-        return self._validity_days
-
-    @validity_days.setter
-    def validity_days(self, validity_days: int):
-        """Sets the validity_days of this CertificateRequest.
-
-
-        :param validity_days: The validity_days of this CertificateRequest.
-        :type validity_days: int
-        """
-        if validity_days is None:
-            raise ValueError("Invalid value for `validity_days`, must not be `None`")  # noqa: E501
-
-        self._validity_days = validity_days
-
-    @property
-    def usage(self) -> CAUsage:
-        """Gets the usage of this CertificateRequest.
-
-
-        :return: The usage of this CertificateRequest.
-        :rtype: CAUsage
-        """
-        return self._usage
-
-    @usage.setter
-    def usage(self, usage: CAUsage):
-        """Sets the usage of this CertificateRequest.
-
-
-        :param usage: The usage of this CertificateRequest.
-        :type usage: CAUsage
-        """
-        if usage is None:
-            raise ValueError("Invalid value for `usage`, must not be `None`")  # noqa: E501
-
-        self._usage = usage
-
-    @property
-    def ca(self) -> int:
-        """Gets the ca of this CertificateRequest.
-
-        ID of the new item  # noqa: E501
-
-        :return: The ca of this CertificateRequest.
-        :rtype: int
-        """
-        return self._ca
-
-    @ca.setter
-    def ca(self, ca: int):
-        """Sets the ca of this CertificateRequest.
-
-        ID of the new item  # noqa: E501
-
-        :param ca: The ca of this CertificateRequest.
-        :type ca: int
-        """
-
-        self._ca = ca
diff --git a/swagger_server/models/certificate_response.py b/swagger_server/models/certificate_response.py
deleted file mode 100644
index f3bd63f..0000000
--- a/swagger_server/models/certificate_response.py
+++ /dev/null
@@ -1,93 +0,0 @@
-# coding: utf-8
-
-from __future__ import absolute_import
-from datetime import date, datetime  # noqa: F401
-
-from typing import List, Dict  # noqa: F401
-
-from swagger_server.models.base_model_ import Model
-from swagger_server.models.certificate import Certificate  # noqa: F401,E501
-from swagger_server import util
-
-
-class CertificateResponse(Model):
-    """NOTE: This class is auto generated by the swagger code generator program.
-
-    Do not edit the class manually.
-    """
-    def __init__(self, success: bool=None, data: Certificate=None):  # noqa: E501
-        """CertificateResponse - a model defined in Swagger
-
-        :param success: The success of this CertificateResponse.  # noqa: E501
-        :type success: bool
-        :param data: The data of this CertificateResponse.  # noqa: E501
-        :type data: Certificate
-        """
-        self.swagger_types = {
-            'success': bool,
-            'data': Certificate
-        }
-
-        self.attribute_map = {
-            'success': 'success',
-            'data': 'data'
-        }
-        self._success = success
-        self._data = data
-
-    @classmethod
-    def from_dict(cls, dikt) -> 'CertificateResponse':
-        """Returns the dict as a model
-
-        :param dikt: A dict.
-        :type: dict
-        :return: The CertificateResponse of this CertificateResponse.  # noqa: E501
-        :rtype: CertificateResponse
-        """
-        return util.deserialize_model(dikt, cls)
-
-    @property
-    def success(self) -> bool:
-        """Gets the success of this CertificateResponse.
-
-
-        :return: The success of this CertificateResponse.
-        :rtype: bool
-        """
-        return self._success
-
-    @success.setter
-    def success(self, success: bool):
-        """Sets the success of this CertificateResponse.
-
-
-        :param success: The success of this CertificateResponse.
-        :type success: bool
-        """
-        if success is None:
-            raise ValueError("Invalid value for `success`, must not be `None`")  # noqa: E501
-
-        self._success = success
-
-    @property
-    def data(self) -> Certificate:
-        """Gets the data of this CertificateResponse.
-
-
-        :return: The data of this CertificateResponse.
-        :rtype: Certificate
-        """
-        return self._data
-
-    @data.setter
-    def data(self, data: Certificate):
-        """Sets the data of this CertificateResponse.
-
-
-        :param data: The data of this CertificateResponse.
-        :type data: Certificate
-        """
-        if data is None:
-            raise ValueError("Invalid value for `data`, must not be `None`")  # noqa: E501
-
-        self._data = data
diff --git a/swagger_server/models/created_response.py b/swagger_server/models/created_response.py
deleted file mode 100644
index 9f079a7..0000000
--- a/swagger_server/models/created_response.py
+++ /dev/null
@@ -1,92 +0,0 @@
-# coding: utf-8
-
-from __future__ import absolute_import
-from datetime import date, datetime  # noqa: F401
-
-from typing import List, Dict  # noqa: F401
-
-from swagger_server.models.base_model_ import Model
-from swagger_server import util
-
-
-class CreatedResponse(Model):
-    """NOTE: This class is auto generated by the swagger code generator program.
-
-    Do not edit the class manually.
-    """
-    def __init__(self, success: bool=None, data: int=None):  # noqa: E501
-        """CreatedResponse - a model defined in Swagger
-
-        :param success: The success of this CreatedResponse.  # noqa: E501
-        :type success: bool
-        :param data: The data of this CreatedResponse.  # noqa: E501
-        :type data: int
-        """
-        self.swagger_types = {
-            'success': bool,
-            'data': int
-        }
-
-        self.attribute_map = {
-            'success': 'success',
-            'data': 'data'
-        }
-        self._success = success
-        self._data = data
-
-    @classmethod
-    def from_dict(cls, dikt) -> 'CreatedResponse':
-        """Returns the dict as a model
-
-        :param dikt: A dict.
-        :type: dict
-        :return: The CreatedResponse of this CreatedResponse.  # noqa: E501
-        :rtype: CreatedResponse
-        """
-        return util.deserialize_model(dikt, cls)
-
-    @property
-    def success(self) -> bool:
-        """Gets the success of this CreatedResponse.
-
-
-        :return: The success of this CreatedResponse.
-        :rtype: bool
-        """
-        return self._success
-
-    @success.setter
-    def success(self, success: bool):
-        """Sets the success of this CreatedResponse.
-
-
-        :param success: The success of this CreatedResponse.
-        :type success: bool
-        """
-        if success is None:
-            raise ValueError("Invalid value for `success`, must not be `None`")  # noqa: E501
-
-        self._success = success
-
-    @property
-    def data(self) -> int:
-        """Gets the data of this CreatedResponse.
-
-
-        :return: The data of this CreatedResponse.
-        :rtype: int
-        """
-        return self._data
-
-    @data.setter
-    def data(self, data: int):
-        """Sets the data of this CreatedResponse.
-
-
-        :param data: The data of this CreatedResponse.
-        :type data: int
-        """
-        if data is None:
-            raise ValueError("Invalid value for `data`, must not be `None`")  # noqa: E501
-
-        self._data = data
diff --git a/swagger_server/models/error_response.py b/swagger_server/models/error_response.py
deleted file mode 100644
index 6d6bb9b..0000000
--- a/swagger_server/models/error_response.py
+++ /dev/null
@@ -1,92 +0,0 @@
-# coding: utf-8
-
-from __future__ import absolute_import
-from datetime import date, datetime  # noqa: F401
-
-from typing import List, Dict  # noqa: F401
-
-from swagger_server.models.base_model_ import Model
-from swagger_server import util
-
-
-class ErrorResponse(Model):
-    """NOTE: This class is auto generated by the swagger code generator program.
-
-    Do not edit the class manually.
-    """
-    def __init__(self, success: bool=None, data: str=None):  # noqa: E501
-        """ErrorResponse - a model defined in Swagger
-
-        :param success: The success of this ErrorResponse.  # noqa: E501
-        :type success: bool
-        :param data: The data of this ErrorResponse.  # noqa: E501
-        :type data: str
-        """
-        self.swagger_types = {
-            'success': bool,
-            'data': str
-        }
-
-        self.attribute_map = {
-            'success': 'success',
-            'data': 'data'
-        }
-        self._success = success
-        self._data = data
-
-    @classmethod
-    def from_dict(cls, dikt) -> 'ErrorResponse':
-        """Returns the dict as a model
-
-        :param dikt: A dict.
-        :type: dict
-        :return: The ErrorResponse of this ErrorResponse.  # noqa: E501
-        :rtype: ErrorResponse
-        """
-        return util.deserialize_model(dikt, cls)
-
-    @property
-    def success(self) -> bool:
-        """Gets the success of this ErrorResponse.
-
-
-        :return: The success of this ErrorResponse.
-        :rtype: bool
-        """
-        return self._success
-
-    @success.setter
-    def success(self, success: bool):
-        """Sets the success of this ErrorResponse.
-
-
-        :param success: The success of this ErrorResponse.
-        :type success: bool
-        """
-        if success is None:
-            raise ValueError("Invalid value for `success`, must not be `None`")  # noqa: E501
-
-        self._success = success
-
-    @property
-    def data(self) -> str:
-        """Gets the data of this ErrorResponse.
-
-
-        :return: The data of this ErrorResponse.
-        :rtype: str
-        """
-        return self._data
-
-    @data.setter
-    def data(self, data: str):
-        """Sets the data of this ErrorResponse.
-
-
-        :param data: The data of this ErrorResponse.
-        :type data: str
-        """
-        if data is None:
-            raise ValueError("Invalid value for `data`, must not be `None`")  # noqa: E501
-
-        self._data = data
diff --git a/swagger_server/models/filtering.py b/swagger_server/models/filtering.py
deleted file mode 100644
index 6e718a0..0000000
--- a/swagger_server/models/filtering.py
+++ /dev/null
@@ -1,62 +0,0 @@
-# coding: utf-8
-
-from __future__ import absolute_import
-from datetime import date, datetime  # noqa: F401
-
-from typing import List, Dict  # noqa: F401
-
-from swagger_server.models.base_model_ import Model
-from swagger_server import util
-
-
-class Filtering(Model):
-    """NOTE: This class is auto generated by the swagger code generator program.
-
-    Do not edit the class manually.
-    """
-    def __init__(self, ca: bool=None):  # noqa: E501
-        """Filtering - a model defined in Swagger
-
-        :param ca: The ca of this Filtering.  # noqa: E501
-        :type ca: bool
-        """
-        self.swagger_types = {
-            'ca': bool
-        }
-
-        self.attribute_map = {
-            'ca': 'CA'
-        }
-        self._ca = ca
-
-    @classmethod
-    def from_dict(cls, dikt) -> 'Filtering':
-        """Returns the dict as a model
-
-        :param dikt: A dict.
-        :type: dict
-        :return: The Filtering of this Filtering.  # noqa: E501
-        :rtype: Filtering
-        """
-        return util.deserialize_model(dikt, cls)
-
-    @property
-    def ca(self) -> bool:
-        """Gets the ca of this Filtering.
-
-
-        :return: The ca of this Filtering.
-        :rtype: bool
-        """
-        return self._ca
-
-    @ca.setter
-    def ca(self, ca: bool):
-        """Sets the ca of this Filtering.
-
-
-        :param ca: The ca of this Filtering.
-        :type ca: bool
-        """
-
-        self._ca = ca
diff --git a/swagger_server/models/id_parameter.py b/swagger_server/models/id_parameter.py
deleted file mode 100644
index 8f94801..0000000
--- a/swagger_server/models/id_parameter.py
+++ /dev/null
@@ -1,64 +0,0 @@
-# coding: utf-8
-
-from __future__ import absolute_import
-from datetime import date, datetime  # noqa: F401
-
-from typing import List, Dict  # noqa: F401
-
-from swagger_server.models.base_model_ import Model
-from swagger_server import util
-
-
-class IdParameter(Model):
-    """NOTE: This class is auto generated by the swagger code generator program.
-
-    Do not edit the class manually.
-    """
-    def __init__(self, id: int=None):  # noqa: E501
-        """IdParameter - a model defined in Swagger
-
-        :param id: The id of this IdParameter.  # noqa: E501
-        :type id: int
-        """
-        self.swagger_types = {
-            'id': int
-        }
-
-        self.attribute_map = {
-            'id': 'id'
-        }
-        self._id = id
-
-    @classmethod
-    def from_dict(cls, dikt) -> 'IdParameter':
-        """Returns the dict as a model
-
-        :param dikt: A dict.
-        :type: dict
-        :return: The IdParameter of this IdParameter.  # noqa: E501
-        :rtype: IdParameter
-        """
-        return util.deserialize_model(dikt, cls)
-
-    @property
-    def id(self) -> int:
-        """Gets the id of this IdParameter.
-
-
-        :return: The id of this IdParameter.
-        :rtype: int
-        """
-        return self._id
-
-    @id.setter
-    def id(self, id: int):
-        """Sets the id of this IdParameter.
-
-
-        :param id: The id of this IdParameter.
-        :type id: int
-        """
-        if id is None:
-            raise ValueError("Invalid value for `id`, must not be `None`")  # noqa: E501
-
-        self._id = id
diff --git a/swagger_server/models/issuer_list_item.py b/swagger_server/models/issuer_list_item.py
deleted file mode 100644
index 8eed087..0000000
--- a/swagger_server/models/issuer_list_item.py
+++ /dev/null
@@ -1,92 +0,0 @@
-# coding: utf-8
-
-from __future__ import absolute_import
-from datetime import date, datetime  # noqa: F401
-
-from typing import List, Dict  # noqa: F401
-
-from swagger_server.models.base_model_ import Model
-from swagger_server import util
-
-
-class IssuerListItem(Model):
-    """NOTE: This class is auto generated by the swagger code generator program.
-
-    Do not edit the class manually.
-    """
-    def __init__(self, id: int=None, cn: str=None):  # noqa: E501
-        """IssuerListItem - a model defined in Swagger
-
-        :param id: The id of this IssuerListItem.  # noqa: E501
-        :type id: int
-        :param cn: The cn of this IssuerListItem.  # noqa: E501
-        :type cn: str
-        """
-        self.swagger_types = {
-            'id': int,
-            'cn': str
-        }
-
-        self.attribute_map = {
-            'id': 'id',
-            'cn': 'CN'
-        }
-        self._id = id
-        self._cn = cn
-
-    @classmethod
-    def from_dict(cls, dikt) -> 'IssuerListItem':
-        """Returns the dict as a model
-
-        :param dikt: A dict.
-        :type: dict
-        :return: The IssuerListItem of this IssuerListItem.  # noqa: E501
-        :rtype: IssuerListItem
-        """
-        return util.deserialize_model(dikt, cls)
-
-    @property
-    def id(self) -> int:
-        """Gets the id of this IssuerListItem.
-
-
-        :return: The id of this IssuerListItem.
-        :rtype: int
-        """
-        return self._id
-
-    @id.setter
-    def id(self, id: int):
-        """Sets the id of this IssuerListItem.
-
-
-        :param id: The id of this IssuerListItem.
-        :type id: int
-        """
-        if id is None:
-            raise ValueError("Invalid value for `id`, must not be `None`")  # noqa: E501
-
-        self._id = id
-
-    @property
-    def cn(self) -> str:
-        """Gets the cn of this IssuerListItem.
-
-
-        :return: The cn of this IssuerListItem.
-        :rtype: str
-        """
-        return self._cn
-
-    @cn.setter
-    def cn(self, cn: str):
-        """Sets the cn of this IssuerListItem.
-
-
-        :param cn: The cn of this IssuerListItem.
-        :type cn: str
-        """
-        if cn is None:
-            raise ValueError("Invalid value for `cn`, must not be `None`")  # noqa: E501
-
-        self._cn = cn
diff --git a/swagger_server/models/pem_response.py b/swagger_server/models/pem_response.py
deleted file mode 100644
index f9ed80b..0000000
--- a/swagger_server/models/pem_response.py
+++ /dev/null
@@ -1,94 +0,0 @@
-# coding: utf-8
-
-from __future__ import absolute_import
-from datetime import date, datetime  # noqa: F401
-
-from typing import List, Dict  # noqa: F401
-
-from swagger_server.models.base_model_ import Model
-from swagger_server import util
-
-
-class PemResponse(Model):
-    """NOTE: This class is auto generated by the swagger code generator program.
-
-    Do not edit the class manually.
-    """
-    def __init__(self, success: bool=None, data: str=None):  # noqa: E501
-        """PemResponse - a model defined in Swagger
-
-        :param success: The success of this PemResponse.  # noqa: E501
-        :type success: bool
-        :param data: The data of this PemResponse.  # noqa: E501
-        :type data: str
-        """
-        self.swagger_types = {
-            'success': bool,
-            'data': str
-        }
-
-        self.attribute_map = {
-            'success': 'success',
-            'data': 'data'
-        }
-        self._success = success
-        self._data = data
-
-    @classmethod
-    def from_dict(cls, dikt) -> 'PemResponse':
-        """Returns the dict as a model
-
-        :param dikt: A dict.
-        :type: dict
-        :return: The PemResponse of this PemResponse.  # noqa: E501
-        :rtype: PemResponse
-        """
-        return util.deserialize_model(dikt, cls)
-
-    @property
-    def success(self) -> bool:
-        """Gets the success of this PemResponse.
-
-
-        :return: The success of this PemResponse.
-        :rtype: bool
-        """
-        return self._success
-
-    @success.setter
-    def success(self, success: bool):
-        """Sets the success of this PemResponse.
-
-
-        :param success: The success of this PemResponse.
-        :type success: bool
-        """
-        if success is None:
-            raise ValueError("Invalid value for `success`, must not be `None`")  # noqa: E501
-
-        self._success = success
-
-    @property
-    def data(self) -> str:
-        """Gets the data of this PemResponse.
-
-        Single PEM file or concatenation of multiple PEM formatted certificates  # noqa: E501
-
-        :return: The data of this PemResponse.
-        :rtype: str
-        """
-        return self._data
-
-    @data.setter
-    def data(self, data: str):
-        """Sets the data of this PemResponse.
-
-        Single PEM file or concatenation of multiple PEM formatted certificates  # noqa: E501
-
-        :param data: The data of this PemResponse.
-        :type data: str
-        """
-        if data is None:
-            raise ValueError("Invalid value for `data`, must not be `None`")  # noqa: E501
-
-        self._data = data
diff --git a/swagger_server/models/subject.py b/swagger_server/models/subject.py
deleted file mode 100644
index 2866baa..0000000
--- a/swagger_server/models/subject.py
+++ /dev/null
@@ -1,234 +0,0 @@
-# coding: utf-8
-
-from __future__ import absolute_import
-from datetime import date, datetime  # noqa: F401
-
-from typing import List, Dict  # noqa: F401
-
-from swagger_server.models.base_model_ import Model
-from swagger_server import util
-
-
-class Subject(Model):
-    """NOTE: This class is auto generated by the swagger code generator program.
-
-    Do not edit the class manually.
-    """
-    def __init__(self, c: str=None, st: str=None, l: str=None, cn: str=None, o: str=None, ou: str=None, email_address: str=None):  # noqa: E501
-        """Subject - a model defined in Swagger
-
-        :param c: The c of this Subject.  # noqa: E501
-        :type c: str
-        :param st: The st of this Subject.  # noqa: E501
-        :type st: str
-        :param l: The l of this Subject.  # noqa: E501
-        :type l: str
-        :param cn: The cn of this Subject.  # noqa: E501
-        :type cn: str
-        :param o: The o of this Subject.  # noqa: E501
-        :type o: str
-        :param ou: The ou of this Subject.  # noqa: E501
-        :type ou: str
-        :param email_address: The email_address of this Subject.  # noqa: E501
-        :type email_address: str
-        """
-        self.swagger_types = {
-            'c': str,
-            'st': str,
-            'l': str,
-            'cn': str,
-            'o': str,
-            'ou': str,
-            'email_address': str
-        }
-
-        self.attribute_map = {
-            'c': 'C',
-            'st': 'ST',
-            'l': 'L',
-            'cn': 'CN',
-            'o': 'O',
-            'ou': 'OU',
-            'email_address': 'emailAddress'
-        }
-        self._c = c
-        self._st = st
-        self._l = l
-        self._cn = cn
-        self._o = o
-        self._ou = ou
-        self._email_address = email_address
-
-    @classmethod
-    def from_dict(cls, dikt) -> 'Subject':
-        """Returns the dict as a model
-
-        :param dikt: A dict.
-        :type: dict
-        :return: The Subject of this Subject.  # noqa: E501
-        :rtype: Subject
-        """
-        return util.deserialize_model(dikt, cls)
-
-    @property
-    def c(self) -> str:
-        """Gets the c of this Subject.
-
-        Country code  # noqa: E501
-
-        :return: The c of this Subject.
-        :rtype: str
-        """
-        return self._c
-
-    @c.setter
-    def c(self, c: str):
-        """Sets the c of this Subject.
-
-        Country code  # noqa: E501
-
-        :param c: The c of this Subject.
-        :type c: str
-        """
-
-        self._c = c
-
-    @property
-    def st(self) -> str:
-        """Gets the st of this Subject.
-
-        State/Province  # noqa: E501
-
-        :return: The st of this Subject.
-        :rtype: str
-        """
-        return self._st
-
-    @st.setter
-    def st(self, st: str):
-        """Sets the st of this Subject.
-
-        State/Province  # noqa: E501
-
-        :param st: The st of this Subject.
-        :type st: str
-        """
-
-        self._st = st
-
-    @property
-    def l(self) -> str:
-        """Gets the l of this Subject.
-
-        Locality  # noqa: E501
-
-        :return: The l of this Subject.
-        :rtype: str
-        """
-        return self._l
-
-    @l.setter
-    def l(self, l: str):
-        """Sets the l of this Subject.
-
-        Locality  # noqa: E501
-
-        :param l: The l of this Subject.
-        :type l: str
-        """
-
-        self._l = l
-
-    @property
-    def cn(self) -> str:
-        """Gets the cn of this Subject.
-
-        Common name  # noqa: E501
-
-        :return: The cn of this Subject.
-        :rtype: str
-        """
-        return self._cn
-
-    @cn.setter
-    def cn(self, cn: str):
-        """Sets the cn of this Subject.
-
-        Common name  # noqa: E501
-
-        :param cn: The cn of this Subject.
-        :type cn: str
-        """
-        if cn is None:
-            raise ValueError("Invalid value for `cn`, must not be `None`")  # noqa: E501
-
-        self._cn = cn
-
-    @property
-    def o(self) -> str:
-        """Gets the o of this Subject.
-
-        Organization  # noqa: E501
-
-        :return: The o of this Subject.
-        :rtype: str
-        """
-        return self._o
-
-    @o.setter
-    def o(self, o: str):
-        """Sets the o of this Subject.
-
-        Organization  # noqa: E501
-
-        :param o: The o of this Subject.
-        :type o: str
-        """
-
-        self._o = o
-
-    @property
-    def ou(self) -> str:
-        """Gets the ou of this Subject.
-
-        Organization Unit  # noqa: E501
-
-        :return: The ou of this Subject.
-        :rtype: str
-        """
-        return self._ou
-
-    @ou.setter
-    def ou(self, ou: str):
-        """Sets the ou of this Subject.
-
-        Organization Unit  # noqa: E501
-
-        :param ou: The ou of this Subject.
-        :type ou: str
-        """
-
-        self._ou = ou
-
-    @property
-    def email_address(self) -> str:
-        """Gets the email_address of this Subject.
-
-        Email Address  # noqa: E501
-
-        :return: The email_address of this Subject.
-        :rtype: str
-        """
-        return self._email_address
-
-    @email_address.setter
-    def email_address(self, email_address: str):
-        """Sets the email_address of this Subject.
-
-        Email Address  # noqa: E501
-
-        :param email_address: The email_address of this Subject.
-        :type email_address: str
-        """
-
-        self._email_address = email_address
diff --git a/swagger_server/swagger/swagger.yaml b/swagger_server/swagger/swagger.yaml
deleted file mode 100644
index 37e5740..0000000
--- a/swagger_server/swagger/swagger.yaml
+++ /dev/null
@@ -1,511 +0,0 @@
-openapi: 3.0.0
-info:
-  title: X.509 certificate management
-  description: API for certificate management created for YOSO company
-  version: 1.0.1
-servers:
-- url: https://virtserver.swaggerhub.com/janpasek97/X509_management/1.0.1
-  description: X509 management API
-tags:
-- name: certificates
-  description: API for creating and querying certificates
-paths:
-  /api/certificates/{id}:
-    get:
-      tags:
-      - certificates
-      summary: get certificate by ID
-      description: Get certificate in PEM format by ID
-      operationId: get_certificate_by_id
-      parameters:
-      - name: id
-        in: path
-        description: ID of a certificate to be queried
-        required: true
-        style: simple
-        explode: false
-        schema:
-          $ref: '#/components/schemas/IdParameter'
-      responses:
-        "200":
-          description: returning the certificate
-          content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/PemResponse'
-        "204":
-          description: the certificate was not found
-          content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/ErrorResponse'
-        "400":
-          description: bad request
-          content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/ErrorResponse'
-      x-openapi-router-controller: swagger_server.controllers.certificates_controller
-  /api/certificates/{id}/chain:
-    get:
-      tags:
-      - certificates
-      summary: get certificate's trust chain by ID
-      description: Get certificate trust chain in PEM format by ID
-      operationId: get_certificate_trust_chain_by_id
-      parameters:
-      - name: id
-        in: path
-        description: ID of a child certificate whose chain is to be queried
-        required: true
-        style: simple
-        explode: false
-        schema:
-          $ref: '#/components/schemas/IdParameter'
-      responses:
-        "200":
-          description: returning the trust chain
-          content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/PemResponse'
-        "204":
-          description: the certificate was not found
-          content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/ErrorResponse'
-        "400":
-          description: bad request
-          content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/ErrorResponse'
-      x-openapi-router-controller: swagger_server.controllers.certificates_controller
-  /api/certificates/{id}/root:
-    get:
-      tags:
-      - certificates
-      summary: get certificate's root of trust chain by ID
-      description: Get certificate's root of trust chain in PEM format by ID
-      operationId: get_certificate_root_by_id
-      parameters:
-      - name: id
-        in: path
-        description: ID of a child certificate whose root is to be queried
-        required: true
-        style: simple
-        explode: false
-        schema:
-          $ref: '#/components/schemas/IdParameter'
-      responses:
-        "200":
-          description: returning the root of trust chain
-          content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/PemResponse'
-        "204":
-          description: the certificate was not found
-          content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/ErrorResponse'
-        "400":
-          description: bad request
-          content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/ErrorResponse'
-      x-openapi-router-controller: swagger_server.controllers.certificates_controller
-  /api/certificates/{id}/details:
-    get:
-      tags:
-      - certificates
-      summary: get certificate's details by ID
-      description: Get certificate details by ID
-      operationId: get_certificate_details_by_id
-      parameters:
-      - name: id
-        in: path
-        description: ID of a certificate whose details are to be queried
-        required: true
-        style: simple
-        explode: false
-        schema:
-          $ref: '#/components/schemas/IdParameter'
-      responses:
-        "200":
-          description: returning the certificate details
-          content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/CertificateResponse'
-        "204":
-          description: the certificate was not found
-          content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/ErrorResponse'
-        "400":
-          description: bad request
-          content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/ErrorResponse'
-      x-openapi-router-controller: swagger_server.controllers.certificates_controller
-  /api/certificates:
-    get:
-      tags:
-      - certificates
-      summary: get list of certificates
-      description: Lists certificates based on provided filtering options
-      operationId: get_certificate_list
-      parameters:
-      - name: filtering
-        in: query
-        description: Filter certificate type to be queried
-        required: false
-        style: form
-        explode: true
-        schema:
-          $ref: '#/components/schemas/Filtering'
-      responses:
-        "200":
-          description: returning results matching filtering criteria
-          content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/CertificateListResponse'
-        "204":
-          description: no certificates found
-          content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/ErrorResponse'
-        "400":
-          description: bad request
-          content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/ErrorResponse'
-      x-openapi-router-controller: swagger_server.controllers.certificates_controller
-    post:
-      tags:
-      - certificates
-      summary: create new certificate
-      description: Create a new certificate based on given information
-      operationId: create_certificate
-      requestBody:
-        description: Certificate data to be created
-        content:
-          application/json:
-            schema:
-              $ref: '#/components/schemas/CertificateRequest'
-      responses:
-        "201":
-          description: item created
-          content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/CreatedResponse'
-        "400":
-          description: "invalid input, object invalid"
-          content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/ErrorResponse'
-        "409":
-          description: an existing item already exists
-          content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/ErrorResponse'
-      x-openapi-router-controller: swagger_server.controllers.certificates_controller
-components:
-  schemas:
-    CAUsage:
-      required:
-      - CA
-      - SSL
-      - authentication
-      - digitalSignature
-      properties:
-        CA:
-          type: boolean
-        authentication:
-          type: boolean
-        digitalSignature:
-          type: boolean
-        SSL:
-          type: boolean
-      example:
-        digitalSignature: true
-        SSL: true
-        CA: true
-        authentication: true
-    IssuerListItem:
-      required:
-      - CN
-      - id
-      properties:
-        id:
-          type: integer
-          example: 547
-        CN:
-          type: string
-          example: Root CA s.r.o.
-      example:
-        id: 547
-        CN: Root CA s.r.o.
-    CertificateListResponse:
-      properties:
-        success:
-          type: boolean
-          example: true
-        data:
-          type: array
-          items:
-            $ref: '#/components/schemas/CertificateListItem'
-      example:
-        data:
-        - notAfter: 2021-07-01T00:00:00.000+00:00
-          usage:
-            digitalSignature: true
-            SSL: true
-            CA: true
-            authentication: true
-          id: 547
-          CN: Root CA s.r.o.
-          notBefore: 2021-03-31T00:00:00.000+00:00
-          issuer:
-            id: 547
-            CN: Root CA s.r.o.
-        - notAfter: 2021-07-01T00:00:00.000+00:00
-          usage:
-            digitalSignature: true
-            SSL: true
-            CA: true
-            authentication: true
-          id: 547
-          CN: Root CA s.r.o.
-          notBefore: 2021-03-31T00:00:00.000+00:00
-          issuer:
-            id: 547
-            CN: Root CA s.r.o.
-        success: true
-    CertificateListItem:
-      properties:
-        id:
-          type: integer
-          example: 547
-        CN:
-          type: string
-          example: Root CA s.r.o.
-        notBefore:
-          type: string
-          format: date
-          example: 2021-03-31
-        notAfter:
-          type: string
-          format: date
-          example: 2021-07-01
-        usage:
-          $ref: '#/components/schemas/CAUsage'
-        issuer:
-          $ref: '#/components/schemas/IssuerListItem'
-      example:
-        notAfter: 2021-07-01T00:00:00.000+00:00
-        usage:
-          digitalSignature: true
-          SSL: true
-          CA: true
-          authentication: true
-        id: 547
-        CN: Root CA s.r.o.
-        notBefore: 2021-03-31T00:00:00.000+00:00
-        issuer:
-          id: 547
-          CN: Root CA s.r.o.
-    Filtering:
-      properties:
-        CA:
-          type: boolean
-    Subject:
-      required:
-      - CN
-      properties:
-        C:
-          type: string
-          description: Country code
-          example: CZ
-        ST:
-          type: string
-          description: State/Province
-          example: Pilsen Region
-        L:
-          type: string
-          description: Locality
-          example: Pilsen
-        CN:
-          type: string
-          description: Common name
-          example: Root CA s.r.o.
-        O:
-          type: string
-          description: Organization
-          example: Root CA s.r.o.
-        OU:
-          type: string
-          description: Organization Unit
-          example: IT department
-        emailAddress:
-          type: string
-          description: Email Address
-          example: root@ca.com
-      example:
-        ST: Pilsen Region
-        emailAddress: root@ca.com
-        C: CZ
-        OU: IT department
-        CN: Root CA s.r.o.
-        L: Pilsen
-        O: Root CA s.r.o.
-    Certificate:
-      required:
-      - notAfter
-      - notBefore
-      - subject
-      - usage
-      properties:
-        subject:
-          $ref: '#/components/schemas/Subject'
-        notBefore:
-          type: string
-          format: date
-          example: 2021-03-31
-        notAfter:
-          type: string
-          format: date
-          example: 2021-07-01
-        usage:
-          $ref: '#/components/schemas/CAUsage'
-        CA:
-          type: integer
-          description: ID of the new item
-          example: 547
-      example:
-        notAfter: 2021-07-01T00:00:00.000+00:00
-        subject:
-          ST: Pilsen Region
-          emailAddress: root@ca.com
-          C: CZ
-          OU: IT department
-          CN: Root CA s.r.o.
-          L: Pilsen
-          O: Root CA s.r.o.
-        usage:
-          digitalSignature: true
-          SSL: true
-          CA: true
-          authentication: true
-        notBefore: 2021-03-31T00:00:00.000+00:00
-        CA: 547
-    CertificateRequest:
-      required:
-      - subject
-      - usage
-      - validityDays
-      properties:
-        subject:
-          $ref: '#/components/schemas/Subject'
-        validityDays:
-          type: integer
-          example: 30
-        usage:
-          $ref: '#/components/schemas/CAUsage'
-        CA:
-          type: integer
-          description: ID of the new item
-          example: 547
-    CreatedResponse:
-      required:
-      - data
-      - success
-      properties:
-        success:
-          type: boolean
-          example: true
-        data:
-          type: integer
-          example: 457
-      description: Item was created
-      example:
-        data: 457
-        success: true
-    ErrorResponse:
-      required:
-      - data
-      - success
-      properties:
-        success:
-          type: boolean
-          example: false
-        data:
-          type: string
-          example: An error occured
-    CertificateResponse:
-      required:
-      - data
-      - success
-      properties:
-        success:
-          type: boolean
-          example: true
-        data:
-          $ref: '#/components/schemas/Certificate'
-      example:
-        data:
-          notAfter: 2021-07-01T00:00:00.000+00:00
-          subject:
-            ST: Pilsen Region
-            emailAddress: root@ca.com
-            C: CZ
-            OU: IT department
-            CN: Root CA s.r.o.
-            L: Pilsen
-            O: Root CA s.r.o.
-          usage:
-            digitalSignature: true
-            SSL: true
-            CA: true
-            authentication: true
-          notBefore: 2021-03-31T00:00:00.000+00:00
-          CA: 547
-        success: true
-    PemResponse:
-      required:
-      - data
-      - success
-      properties:
-        success:
-          type: boolean
-          example: true
-        data:
-          type: string
-          description: Single PEM file or concatenation of multiple PEM formatted
-            certificates
-          example: '-----BEGIN CERTIFICATE-----MIICLDCCAdKgAwIBAgIBADAKBggqhkjOPQQDAjB9MQswCQYDVQQGEwJCRTEPMA0GA1UEChMGR251VExTMSUwIwYDVQQ...etc-----END
-            CERTIFICATE-----'
-      example:
-        data: '-----BEGIN CERTIFICATE-----MIICLDCCAdKgAwIBAgIBADAKBggqhkjOPQQDAjB9MQswCQYDVQQGEwJCRTEPMA0GA1UEChMGR251VExTMSUwIwYDVQQ...etc-----END
-          CERTIFICATE-----'
-        success: true
-    IdParameter:
-      required:
-      - id
-      properties:
-        id:
-          type: integer
-          example: 444
-
diff --git a/swagger_server/util.py b/swagger_server/util.py
deleted file mode 100644
index edb2251..0000000
--- a/swagger_server/util.py
+++ /dev/null
@@ -1,141 +0,0 @@
-import datetime
-
-import six
-import typing
-
-
-def _deserialize(data, klass):
-    """Deserializes dict, list, str into an object.
-
-    :param data: dict, list or str.
-    :param klass: class literal, or string of class name.
-
-    :return: object.
-    """
-    if data is None:
-        return None
-
-    if klass in six.integer_types or klass in (float, str, bool):
-        return _deserialize_primitive(data, klass)
-    elif klass == object:
-        return _deserialize_object(data)
-    elif klass == datetime.date:
-        return deserialize_date(data)
-    elif klass == datetime.datetime:
-        return deserialize_datetime(data)
-    elif hasattr(klass, '__origin__'):
-        if klass.__origin__ == list:
-            return _deserialize_list(data, klass.__args__[0])
-        if klass.__origin__ == dict:
-            return _deserialize_dict(data, klass.__args__[1])
-    else:
-        return deserialize_model(data, klass)
-
-
-def _deserialize_primitive(data, klass):
-    """Deserializes to primitive type.
-
-    :param data: data to deserialize.
-    :param klass: class literal.
-
-    :return: int, long, float, str, bool.
-    :rtype: int | long | float | str | bool
-    """
-    try:
-        value = klass(data)
-    except UnicodeEncodeError:
-        value = six.u(data)
-    except TypeError:
-        value = data
-    return value
-
-
-def _deserialize_object(value):
-    """Return a original value.
-
-    :return: object.
-    """
-    return value
-
-
-def deserialize_date(string):
-    """Deserializes string to date.
-
-    :param string: str.
-    :type string: str
-    :return: date.
-    :rtype: date
-    """
-    try:
-        from dateutil.parser import parse
-        return parse(string).date()
-    except ImportError:
-        return string
-
-
-def deserialize_datetime(string):
-    """Deserializes string to datetime.
-
-    The string should be in iso8601 datetime format.
-
-    :param string: str.
-    :type string: str
-    :return: datetime.
-    :rtype: datetime
-    """
-    try:
-        from dateutil.parser import parse
-        return parse(string)
-    except ImportError:
-        return string
-
-
-def deserialize_model(data, klass):
-    """Deserializes list or dict to model.
-
-    :param data: dict, list.
-    :type data: dict | list
-    :param klass: class literal.
-    :return: model object.
-    """
-    instance = klass()
-
-    if not instance.swagger_types:
-        return data
-
-    for attr, attr_type in six.iteritems(instance.swagger_types):
-        if data is not None \
-                and instance.attribute_map[attr] in data \
-                and isinstance(data, (list, dict)):
-            value = data[instance.attribute_map[attr]]
-            setattr(instance, attr, _deserialize(value, attr_type))
-
-    return instance
-
-
-def _deserialize_list(data, boxed_type):
-    """Deserializes a list and its elements.
-
-    :param data: list to deserialize.
-    :type data: list
-    :param boxed_type: class literal.
-
-    :return: deserialized list.
-    :rtype: list
-    """
-    return [_deserialize(sub_data, boxed_type)
-            for sub_data in data]
-
-
-def _deserialize_dict(data, boxed_type):
-    """Deserializes a dict and its elements.
-
-    :param data: dict to deserialize.
-    :type data: dict
-    :param boxed_type: class literal.
-
-    :return: deserialized dict.
-    :rtype: dict
-    """
-    return {k: _deserialize(v, boxed_type)
-            for k, v in six.iteritems(data)}
diff --git a/tests/unit_tests/rest_api/certificates.py b/tests/unit_tests/rest_api/certificates.py
index 3564292..1565934 100644
--- a/tests/unit_tests/rest_api/certificates.py
+++ b/tests/unit_tests/rest_api/certificates.py
@@ -2,7 +2,8 @@ def test_import(server):
     assert 1 + 2 + 3 + 4 != -1 / 12
 
     ret = server.get("/")
-    assert ret.status_code == 404
+    assert ret.status_code == 200
+    assert str(ret.data, encoding='utf-8') == "Welcome to the X.509 management application homepage!"
 
 
 def test_root_ca(server):
@@ -53,10 +54,10 @@ def test_invalid_params_1(server):
 
     d = ret.json
 
-    assert "status" in d
-    assert d["status"] == 400
-    assert "detail" in d
-    assert d["detail"] == "'usage' is a required property"
+    assert "data" in d
+    assert d["data"] == "Invalid request, missing parameters."
+    assert "success" in d
+    assert not d["success"]
 
 
 def test_invalid_params_2(server):
@@ -83,10 +84,10 @@ def test_invalid_params_2(server):
 
     d = ret.json
 
-    assert "status" in d
-    assert d["status"] == 400
-    assert "detail" in d
-    assert d["detail"] == "'tak mesic treba plus minus' is not of type 'integer' - 'validityDays'"
+    assert "data" in d
+    assert d["data"] == "Invalid request, wrong parameters."
+    assert "success" in d
+    assert not d["success"]
 
 
 def test_invalid_params_3(server):
@@ -113,10 +114,10 @@ def test_invalid_params_3(server):
 
     d = ret.json
 
-    assert "status" in d
-    assert d["status"] == 400
-    assert "detail" in d
-    assert d["detail"] == "['Bosna', 'Herzegovina'] is not of type 'string' - 'subject.ST'"
+    assert "data" in d
+    assert d["data"] == "Invalid request, wrong parameters."
+    assert "success" in d
+    assert not d["success"]
 
 
 def test_root_inter_ca(server):
diff --git a/tests/unit_tests/rest_api/conftest.py b/tests/unit_tests/rest_api/conftest.py
index e7c9227..dc168d4 100644
--- a/tests/unit_tests/rest_api/conftest.py
+++ b/tests/unit_tests/rest_api/conftest.py
@@ -1,12 +1,11 @@
 import pytest
-from swagger_server.__main__ import app as flask_app, setup
+from app import app as flask_app
 from src.db.setup_database import setup_database
 
 
 @pytest.fixture(scope="session")
 def server():
     setup_database()
-    setup(flask_app)
-    flask_app.app.testing = True
-    with flask_app.app.test_client() as s:
+    flask_app.testing = True
+    with flask_app.test_client() as s:
         yield s
