commit 0c4e12a71fb55b87cd1d3ac6d238614dc4c6c98c
Author: Jan Pašek <pasekj@students.zcu.cz>
Date:   Mon Apr 26 06:37:27 2021 +0000

    Updated swagger.yaml

diff --git a/src/swagger.yaml b/src/swagger.yaml
index c361efb..0b626a2 100644
--- a/src/swagger.yaml
+++ b/src/swagger.yaml
@@ -1,10 +1,11 @@
+---
 openapi: 3.0.0
 info:
   title: X.509 certificate management
   description: API for certificate management created for YOSO company
-  version: 1.1.0
+  version: 1.2.0
 servers:
-- url: https://virtserver.swaggerhub.com/janpasek97/X509_management/1.1.0
+- url: https://virtserver.swaggerhub.com/janpasek97/X509_management/1.2.0
   description: X509 management API
 tags:
 - name: certificates
@@ -26,6 +27,24 @@ paths:
         explode: true
         schema:
           $ref: '#/components/schemas/Filtering'
+      - name: page
+        in: query
+        description: Page of the certificates to be displayed
+        required: false
+        style: form
+        explode: true
+        schema:
+          type: integer
+          example: 1
+      - name: per_page
+        in: query
+        description: Number of certificates returned in one page
+        required: false
+        style: form
+        explode: true
+        schema:
+          type: integer
+          example: 10
       responses:
         "200":
           description: returning results matching filtering criteria
@@ -347,14 +366,45 @@ paths:
             application/json:
               schema:
                 $ref: '#/components/schemas/ErrorResponse'
+  /api/certificates/{id}/identity:
+    post:
+      tags:
+      - certificates
+      summary: Create a PCKS12 identity
+      description: Create a PCKS12 identity based on the selected certificate. The identity includes the whole chain of trust and uses a specified name and password
+      operationId: createIdentityById
+      parameters:
+      - name: id
+        in: path
+        description: ID of a certificate whose private key is to be queried
+        required: true
+        style: simple
+        explode: false
+        schema:
+          $ref: '#/components/schemas/IdParameter'
+      requestBody:
+        description: Certificate data to be created
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/IdentityRequest'
+      responses:
+        "201":
+          description: identity created
+          content:
+            application/x-pkcs12:
+              schema:
+                type: string
+                format: binary
+        "400":
+          description: invalid input, object invalid
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ErrorResponse'
 components:
   schemas:
-    CAUsage:
-      required:
-      - CA
-      - SSL
-      - authentication
-      - digitalSignature
+    CertificateUsage:
       properties:
         CA:
           type: boolean
@@ -401,13 +451,15 @@ components:
           format: date
           example: 2021-07-01
         usage:
-          $ref: '#/components/schemas/CAUsage'
+          $ref: '#/components/schemas/CertificateUsage'
         issuer:
           $ref: '#/components/schemas/IssuerListItem'
     Filtering:
       properties:
-        CA:
-          type: boolean
+        type:
+          $ref: '#/components/schemas/CertificateType'
+        usage:
+          $ref: '#/components/schemas/CertificateUsage'
         issuedby:
           type: integer
           example: 517
@@ -447,6 +499,7 @@ components:
       required:
       - notAfter
       - notBefore
+      - status
       - subject
       - usage
       properties:
@@ -461,11 +514,17 @@ components:
           format: date
           example: 2021-07-01
         usage:
-          $ref: '#/components/schemas/CAUsage'
+          $ref: '#/components/schemas/CertificateUsage'
         CA:
           type: integer
           description: ID of the new item
           example: 547
+        status:
+          type: string
+          enum:
+          - valid
+          - expired
+          - revoked
     CertificateRequest:
       required:
       - subject
@@ -490,6 +549,11 @@ components:
           type: integer
           description: ID of the new item
           example: 547
+        key:
+          $ref: '#/components/schemas/PrivateKey'
+        extensions:
+          type: string
+          example: subjectAltName=IP:192.168.7.1
     SuccessResponse:
       required:
       - data
@@ -546,7 +610,7 @@ components:
         data:
           type: string
           description: Single PEM file or concatenation of multiple PEM formatted certificates
-          example: '-----BEGIN CERTIFICATE-----MIICLDCCAdKgAwIBAgIBADAKBggqhkjOPQQDAjB9MQswCQYDVQQGEwJCRTEPMA0GA1UEChMGR251VExTMSUwIwYDVQQ...etc-----END CERTIFICATE-----'
+          example: '-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----'
     IdParameter:
       required:
       - id
@@ -574,3 +638,27 @@ components:
           - cessationOfOperation
           - certificateHold
           - removeFromCRL
+    CertificateType:
+      properties:
+        RootCA:
+          type: boolean
+        IntermediateCA:
+          type: boolean
+        EndCertificate:
+          type: boolean
+    PrivateKey:
+      properties:
+        password:
+          type: string
+          example: passphrase
+        key_pem:
+          type: string
+          example: '-----BEGIN PRIVATE_KEY-----...-----END PRIVATE_KEY-----'
+    IdentityRequest:
+      properties:
+        name:
+          type: string
+          example: Jane Doe
+        password:
+          type: string
+          example: passphrase
