Projekt

Obecné

Profil

Stáhnout (13.9 KB) Statistiky
| Větev: | Tag: | Revize:
1
openapi: 3.0.0
2
info:
3
  title: X.509 certificate management
4
  description: API for certificate management created for YOSO company
5
  version: 1.0.1
6
servers:
7
- url: https://virtserver.swaggerhub.com/janpasek97/X509_management/1.0.1
8
  description: X509 management API
9
tags:
10
- name: certificates
11
  description: API for creating and querying certificates
12
paths:
13
  /api/certificates/{id}:
14
    get:
15
      tags:
16
      - certificates
17
      summary: get certificate by ID
18
      description: Get certificate in PEM format by ID
19
      operationId: get_certificate_by_id
20
      parameters:
21
      - name: id
22
        in: path
23
        description: ID of a certificate to be queried
24
        required: true
25
        style: simple
26
        explode: false
27
        schema:
28
          $ref: '#/components/schemas/IdParameter'
29
      responses:
30
        "200":
31
          description: returning the certificate
32
          content:
33
            application/json:
34
              schema:
35
                $ref: '#/components/schemas/PemResponse'
36
        "204":
37
          description: the certificate was not found
38
          content:
39
            application/json:
40
              schema:
41
                $ref: '#/components/schemas/ErrorResponse'
42
        "400":
43
          description: bad request
44
          content:
45
            application/json:
46
              schema:
47
                $ref: '#/components/schemas/ErrorResponse'
48
      x-openapi-router-controller: swagger_server.controllers.certificates_controller
49
  /api/certificates/{id}/chain:
50
    get:
51
      tags:
52
      - certificates
53
      summary: get certificate's trust chain by ID
54
      description: Get certificate trust chain in PEM format by ID
55
      operationId: get_certificate_trust_chain_by_id
56
      parameters:
57
      - name: id
58
        in: path
59
        description: ID of a child certificate whose chain is to be queried
60
        required: true
61
        style: simple
62
        explode: false
63
        schema:
64
          $ref: '#/components/schemas/IdParameter'
65
      responses:
66
        "200":
67
          description: returning the trust chain
68
          content:
69
            application/json:
70
              schema:
71
                $ref: '#/components/schemas/PemResponse'
72
        "204":
73
          description: the certificate was not found
74
          content:
75
            application/json:
76
              schema:
77
                $ref: '#/components/schemas/ErrorResponse'
78
        "400":
79
          description: bad request
80
          content:
81
            application/json:
82
              schema:
83
                $ref: '#/components/schemas/ErrorResponse'
84
      x-openapi-router-controller: swagger_server.controllers.certificates_controller
85
  /api/certificates/{id}/root:
86
    get:
87
      tags:
88
      - certificates
89
      summary: get certificate's root of trust chain by ID
90
      description: Get certificate's root of trust chain in PEM format by ID
91
      operationId: get_certificate_root_by_id
92
      parameters:
93
      - name: id
94
        in: path
95
        description: ID of a child certificate whose root is to be queried
96
        required: true
97
        style: simple
98
        explode: false
99
        schema:
100
          $ref: '#/components/schemas/IdParameter'
101
      responses:
102
        "200":
103
          description: returning the root of trust chain
104
          content:
105
            application/json:
106
              schema:
107
                $ref: '#/components/schemas/PemResponse'
108
        "204":
109
          description: the certificate was not found
110
          content:
111
            application/json:
112
              schema:
113
                $ref: '#/components/schemas/ErrorResponse'
114
        "400":
115
          description: bad request
116
          content:
117
            application/json:
118
              schema:
119
                $ref: '#/components/schemas/ErrorResponse'
120
      x-openapi-router-controller: swagger_server.controllers.certificates_controller
121
  /api/certificates/{id}/details:
122
    get:
123
      tags:
124
      - certificates
125
      summary: get certificate's details by ID
126
      description: Get certificate details by ID
127
      operationId: get_certificate_details_by_id
128
      parameters:
129
      - name: id
130
        in: path
131
        description: ID of a certificate whose details are to be queried
132
        required: true
133
        style: simple
134
        explode: false
135
        schema:
136
          $ref: '#/components/schemas/IdParameter'
137
      responses:
138
        "200":
139
          description: returning the certificate details
140
          content:
141
            application/json:
142
              schema:
143
                $ref: '#/components/schemas/CertificateResponse'
144
        "204":
145
          description: the certificate was not found
146
          content:
147
            application/json:
148
              schema:
149
                $ref: '#/components/schemas/ErrorResponse'
150
        "400":
151
          description: bad request
152
          content:
153
            application/json:
154
              schema:
155
                $ref: '#/components/schemas/ErrorResponse'
156
      x-openapi-router-controller: swagger_server.controllers.certificates_controller
157
  /api/certificates:
158
    get:
159
      tags:
160
      - certificates
161
      summary: get list of certificates
162
      description: Lists certificates based on provided filtering options
163
      operationId: get_certificate_list
164
      parameters:
165
      - name: filtering
166
        in: query
167
        description: Filter certificate type to be queried
168
        required: false
169
        style: form
170
        explode: true
171
        schema:
172
          $ref: '#/components/schemas/Filtering'
173
      responses:
174
        "200":
175
          description: returning results matching filtering criteria
176
          content:
177
            application/json:
178
              schema:
179
                $ref: '#/components/schemas/CertificateListResponse'
180
        "204":
181
          description: no certificates found
182
          content:
183
            application/json:
184
              schema:
185
                $ref: '#/components/schemas/ErrorResponse'
186
        "400":
187
          description: bad request
188
          content:
189
            application/json:
190
              schema:
191
                $ref: '#/components/schemas/ErrorResponse'
192
      x-openapi-router-controller: swagger_server.controllers.certificates_controller
193
    post:
194
      tags:
195
      - certificates
196
      summary: create new certificate
197
      description: Create a new certificate based on given information
198
      operationId: create_certificate
199
      requestBody:
200
        description: Certificate data to be created
201
        content:
202
          application/json:
203
            schema:
204
              $ref: '#/components/schemas/CertificateRequest'
205
      responses:
206
        "201":
207
          description: item created
208
          content:
209
            application/json:
210
              schema:
211
                $ref: '#/components/schemas/CreatedResponse'
212
        "400":
213
          description: "invalid input, object invalid"
214
          content:
215
            application/json:
216
              schema:
217
                $ref: '#/components/schemas/ErrorResponse'
218
        "409":
219
          description: an existing item already exists
220
          content:
221
            application/json:
222
              schema:
223
                $ref: '#/components/schemas/ErrorResponse'
224
      x-openapi-router-controller: swagger_server.controllers.certificates_controller
225
components:
226
  schemas:
227
    CAUsage:
228
      required:
229
      - CA
230
      - SSL
231
      - authentication
232
      - digitalSignature
233
      properties:
234
        CA:
235
          type: boolean
236
        authentication:
237
          type: boolean
238
        digitalSignature:
239
          type: boolean
240
        SSL:
241
          type: boolean
242
      example:
243
        digitalSignature: true
244
        SSL: true
245
        CA: true
246
        authentication: true
247
    IssuerListItem:
248
      required:
249
      - CN
250
      - id
251
      properties:
252
        id:
253
          type: integer
254
          example: 547
255
        CN:
256
          type: string
257
          example: Root CA s.r.o.
258
      example:
259
        id: 547
260
        CN: Root CA s.r.o.
261
    CertificateListResponse:
262
      properties:
263
        success:
264
          type: boolean
265
          example: true
266
        data:
267
          type: array
268
          items:
269
            $ref: '#/components/schemas/CertificateListItem'
270
      example:
271
        data:
272
        - notAfter: 2021-07-01T00:00:00.000+00:00
273
          usage:
274
            digitalSignature: true
275
            SSL: true
276
            CA: true
277
            authentication: true
278
          id: 547
279
          CN: Root CA s.r.o.
280
          notBefore: 2021-03-31T00:00:00.000+00:00
281
          issuer:
282
            id: 547
283
            CN: Root CA s.r.o.
284
        - notAfter: 2021-07-01T00:00:00.000+00:00
285
          usage:
286
            digitalSignature: true
287
            SSL: true
288
            CA: true
289
            authentication: true
290
          id: 547
291
          CN: Root CA s.r.o.
292
          notBefore: 2021-03-31T00:00:00.000+00:00
293
          issuer:
294
            id: 547
295
            CN: Root CA s.r.o.
296
        success: true
297
    CertificateListItem:
298
      properties:
299
        id:
300
          type: integer
301
          example: 547
302
        CN:
303
          type: string
304
          example: Root CA s.r.o.
305
        notBefore:
306
          type: string
307
          format: date
308
          example: 2021-03-31
309
        notAfter:
310
          type: string
311
          format: date
312
          example: 2021-07-01
313
        usage:
314
          $ref: '#/components/schemas/CAUsage'
315
        issuer:
316
          $ref: '#/components/schemas/IssuerListItem'
317
      example:
318
        notAfter: 2021-07-01T00:00:00.000+00:00
319
        usage:
320
          digitalSignature: true
321
          SSL: true
322
          CA: true
323
          authentication: true
324
        id: 547
325
        CN: Root CA s.r.o.
326
        notBefore: 2021-03-31T00:00:00.000+00:00
327
        issuer:
328
          id: 547
329
          CN: Root CA s.r.o.
330
    Filtering:
331
      properties:
332
        CA:
333
          type: boolean
334
    Subject:
335
      required:
336
      - CN
337
      properties:
338
        C:
339
          type: string
340
          description: Country code
341
          example: CZ
342
        ST:
343
          type: string
344
          description: State/Province
345
          example: Pilsen Region
346
        L:
347
          type: string
348
          description: Locality
349
          example: Pilsen
350
        CN:
351
          type: string
352
          description: Common name
353
          example: Root CA s.r.o.
354
        O:
355
          type: string
356
          description: Organization
357
          example: Root CA s.r.o.
358
        OU:
359
          type: string
360
          description: Organization Unit
361
          example: IT department
362
        emailAddress:
363
          type: string
364
          description: Email Address
365
          example: root@ca.com
366
      example:
367
        ST: Pilsen Region
368
        emailAddress: root@ca.com
369
        C: CZ
370
        OU: IT department
371
        CN: Root CA s.r.o.
372
        L: Pilsen
373
        O: Root CA s.r.o.
374
    Certificate:
375
      required:
376
      - notAfter
377
      - notBefore
378
      - subject
379
      - usage
380
      properties:
381
        subject:
382
          $ref: '#/components/schemas/Subject'
383
        notBefore:
384
          type: string
385
          format: date
386
          example: 2021-03-31
387
        notAfter:
388
          type: string
389
          format: date
390
          example: 2021-07-01
391
        usage:
392
          $ref: '#/components/schemas/CAUsage'
393
        CA:
394
          type: integer
395
          description: ID of the new item
396
          example: 547
397
      example:
398
        notAfter: 2021-07-01T00:00:00.000+00:00
399
        subject:
400
          ST: Pilsen Region
401
          emailAddress: root@ca.com
402
          C: CZ
403
          OU: IT department
404
          CN: Root CA s.r.o.
405
          L: Pilsen
406
          O: Root CA s.r.o.
407
        usage:
408
          digitalSignature: true
409
          SSL: true
410
          CA: true
411
          authentication: true
412
        notBefore: 2021-03-31T00:00:00.000+00:00
413
        CA: 547
414
    CertificateRequest:
415
      required:
416
      - subject
417
      - usage
418
      - validityDays
419
      properties:
420
        subject:
421
          $ref: '#/components/schemas/Subject'
422
        validityDays:
423
          type: integer
424
          example: 30
425
        usage:
426
          $ref: '#/components/schemas/CAUsage'
427
        CA:
428
          type: integer
429
          description: ID of the new item
430
          example: 547
431
    CreatedResponse:
432
      required:
433
      - data
434
      - success
435
      properties:
436
        success:
437
          type: boolean
438
          example: true
439
        data:
440
          type: integer
441
          example: 457
442
      description: Item was created
443
      example:
444
        data: 457
445
        success: true
446
    ErrorResponse:
447
      required:
448
      - data
449
      - success
450
      properties:
451
        success:
452
          type: boolean
453
          example: false
454
        data:
455
          type: string
456
          example: An error occured
457
    CertificateResponse:
458
      required:
459
      - data
460
      - success
461
      properties:
462
        success:
463
          type: boolean
464
          example: true
465
        data:
466
          $ref: '#/components/schemas/Certificate'
467
      example:
468
        data:
469
          notAfter: 2021-07-01T00:00:00.000+00:00
470
          subject:
471
            ST: Pilsen Region
472
            emailAddress: root@ca.com
473
            C: CZ
474
            OU: IT department
475
            CN: Root CA s.r.o.
476
            L: Pilsen
477
            O: Root CA s.r.o.
478
          usage:
479
            digitalSignature: true
480
            SSL: true
481
            CA: true
482
            authentication: true
483
          notBefore: 2021-03-31T00:00:00.000+00:00
484
          CA: 547
485
        success: true
486
    PemResponse:
487
      required:
488
      - data
489
      - success
490
      properties:
491
        success:
492
          type: boolean
493
          example: true
494
        data:
495
          type: string
496
          description: Single PEM file or concatenation of multiple PEM formatted
497
            certificates
498
          example: '-----BEGIN CERTIFICATE-----MIICLDCCAdKgAwIBAgIBADAKBggqhkjOPQQDAjB9MQswCQYDVQQGEwJCRTEPMA0GA1UEChMGR251VExTMSUwIwYDVQQ...etc-----END
499
            CERTIFICATE-----'
500
      example:
501
        data: '-----BEGIN CERTIFICATE-----MIICLDCCAdKgAwIBAgIBADAKBggqhkjOPQQDAjB9MQswCQYDVQQGEwJCRTEPMA0GA1UEChMGR251VExTMSUwIwYDVQQ...etc-----END
502
          CERTIFICATE-----'
503
        success: true
504
    IdParameter:
505
      required:
506
      - id
507
      properties:
508
        id:
509
          type: integer
510
          example: 444
511

    
    (1-1/1)