-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcertificate-management.yaml
486 lines (479 loc) · 18.6 KB
/
certificate-management.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
openapi: "3.0.0"
info:
description: "This is the Certificate API for UC4."
version: "0.15.1"
title: "UC4"
servers:
- url: https://uc4.cs.upb.de/api/experimental/certificate-management
- url: https://uc4.cs.upb.de/api/develop/certificate-management
- url: https://uc4.cs.upb.de/api/production/certificate-management
tags:
- name: "Version Management"
description: "Everything about the Version"
externalDocs:
description: "Find out more"
url: "https://github.com/upb-uc4"
- name: "Certificate Management"
description: "Everything about certificates"
externalDocs:
description: "Find out more"
url: "https://github.com/upb-uc4"
paths:
/version:
get:
tags:
- "Version Management"
summary: "Get version"
description: "Returns the version of the current service"
operationId: "getVersion"
responses:
"200":
description: "OK"
content:
application/json:
schema:
$ref: '#/components/schemas/JsonServiceVersion'
/version/hyperledger:
get:
tags:
- "Version Management"
summary: "Get Hyperledger version"
description: "Returns the version of the current hyperledger backend"
operationId: "getVersionHyperledger"
responses:
"200":
description: "OK"
content:
application/json:
schema:
$ref: '#/components/schemas/JsonHyperledgerVersion'
/certificates/{username}:
post:
tags:
- "Certificate Management"
summary: "Send info to start the certificate creation process"
description: "Send the CSR, and optionally the encrypted private key, to start the certificate creation process. One can only invoke this process for themselves."
operationId: "createCertificate"
security:
- uc4_token_login: []
- uc4_token_login_header: []
parameters:
- name: "username"
in: "path"
description: "Username of the user for which to create a certificate"
required: true
schema:
type: 'string'
requestBody:
description: "CSR object that is the base for Certificate Creation"
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PostMessageCSR'
examples:
PostMessageCsrExample:
$ref: '#/components/examples/PostMessageCsrExample'
responses:
"201":
description: "Created"
content:
application/json:
schema:
$ref: '#/components/schemas/JsonCertificate'
headers:
Location:
schema:
type: string
description: "URI of the newly created Certificate"
"400":
description: |
Bad Request
types: MalformedLoginToken, Deserialization, MultipleAuthorizationError, JsonValidation
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/GenericError'
- $ref: '#/components/schemas/DetailedError'
"401":
description: |
Unauthorized
types: JwtAuthorization, LoginTokenExpired
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
"403":
description: |
Forbidden
types: OwnerMismatch
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
"409":
description: |
Conflict
types: AlreadyEnrolled
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
"413":
description: |
Payload Too Large
types: EntityTooLarge
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
"422":
description: |
Unprocessable Entity
types: Validation, LoginTokenSignatureInvalid
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/GenericError'
- $ref: '#/components/schemas/DetailedError'
/certificates/{username}/certificate:
get:
tags:
- "Certificate Management"
summary: "Get a specified certificate"
description: "Fetch the certificate of the user with the specified username"
operationId: "getCertificate"
security:
- uc4_token_login: []
- uc4_token_login_header: []
parameters:
- name: "username"
in: "path"
description: "Username of the user whose certificate is fetched"
required: true
schema:
type: 'string'
responses:
"200":
description: "OK"
content:
application/json:
schema:
$ref: '#/components/schemas/JsonCertificate'
"400":
description: |
Bad Request
types: MalformedLoginToken, MultipleAuthorizationError
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
"401":
description: |
Unauthorized
types: JwtAuthorization, LoginTokenExpired
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
"404":
description: |
Not Found
types: KeyNotFound
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
"422":
description: |
Unprocessable Entity
types: LoginTokenSignatureInvalid
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
/certificates/{username}/privateKey:
get:
tags:
- "Certificate Management"
summary: "Fetch the encrypted private key"
description: "Fetch the encrypted private key of the user with the username specified in path and authorization. One can only fetch their own encrypted private key."
operationId: "getPrivateKey"
security:
- uc4_token_login: []
- uc4_token_login_header: []
parameters:
- name: "username"
in: "path"
description: "Username of the user whose private key is fetched"
required: true
schema:
type: 'string'
responses:
"200":
description: "OK"
content:
application/json:
schema:
$ref: '#/components/schemas/EncryptedPrivateKey'
"400":
description: |
Bad Request
types: MalformedLoginToken, MultipleAuthorizationError
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
"401":
description: |
Unauthorized
types: JwtAuthorization, LoginTokenExpired
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
"403":
description: |
Forbidden
types: OwnerMismatch
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
"404":
description: |
NotFound
types: NotEnrolled
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
/certificates/enrollmentId:
get:
tags:
- "Certificate Management"
summary: "Get the enrollmentIds specified by the query parameter"
description: "Fetch the enrollmentIds of the users with the specified usernames"
operationId: "getEnrollmentIDs"
security:
- uc4_token_login: []
- uc4_token_login_header: []
parameters:
- name: "usernames"
in: "query"
description: "Comma separated list of usernames, of which the enrollmentIds are fetched"
required: true
schema:
type: 'string'
responses:
"200":
description: "OK"
content:
application/json:
schema:
$ref: '#/components/schemas/JsonUsernameEnrollmentId'
examples:
ExampleJsonUsernameEnrollmentId:
$ref: '#/components/examples/ExampleJsonUsernameEnrollmentId'
"400":
description: |
Bad Request
types: MalformedLoginToken, MultipleAuthorizationError
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
"401":
description: |
Unauthorized
types: JwtAuthorization, LoginTokenExpired
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
"404":
description: |
Not Found
types: KeyNotFound
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
"422":
description: |
Unprocessable Entity
types: LoginTokenSignatureInvalid
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
/certificates/username:
get:
tags:
- "Certificate Management"
summary: "Get the usernames specified by the query parameter"
description: "Fetch the usernames of the users with the specified enrollmentIds"
operationId: "getUsernames"
security:
- uc4_token_login: []
- uc4_token_login_header: []
parameters:
- name: "enrollmentIds"
in: "query"
description: "Comma separated list of enrollmentIds, of which the usernames are fetched"
required: true
schema:
type: 'string'
responses:
"200":
description: "OK"
content:
application/json:
schema:
$ref: '#/components/schemas/JsonUsernameEnrollmentId'
examples:
ExampleJsonUsernameEnrollmentId:
$ref: '#/components/examples/ExampleJsonUsernameEnrollmentId'
"400":
description: |
Bad Request
types: MalformedLoginToken, MultipleAuthorizationError
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
"401":
description: |
Unauthorized
types: JwtAuthorization, LoginTokenExpired
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
"404":
description: |
Not Found
types: KeyNotFound
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
"422":
description: |
Unprocessable Entity
types: LoginTokenSignatureInvalid
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
components:
securitySchemes:
uc4_token_login:
type: apiKey
in: cookie
name: login
uc4_token_login_header:
type: http
scheme: bearer
schemas:
EncryptedPrivateKey:
type: "object"
properties:
key:
type: string
description: "The encrypted private key."
iv:
type: string
description: "The IV for key encryption/decryption."
salt:
type: string
description: "The salt used to derive the key from the password."
PostMessageCSR:
type: "object"
properties:
certificateSigningRequest:
type: string
description: "In PEM format, x509 certificate signing request, as specified in PKCS#10. Common-name must be the enrollmentId."
encryptedPrivateKey:
allOf:
- $ref: "#/components/schemas/EncryptedPrivateKey"
JsonCertificate:
type: "object"
properties:
certificate:
type: string
description: "In PEM format, x509 certificate, as specified in PKCS#10."
JsonEnrollmentId:
type: "object"
properties:
id:
type: string
JsonUsername:
type: "object"
properties:
username:
type: string
JsonUsernameEnrollmentId:
type: "object"
properties:
username:
type: string
enrollmentId:
type: string
JsonServiceVersion:
type: object
properties:
serviceVersion:
type: string
JsonHyperledgerVersion:
type: object
properties:
hlfApiVersion:
type: string
chaincodeVersion:
type: string
GenericError:
allOf:
- $ref: 'https://raw.githubusercontent.com/upb-uc4/api/develop/errors.yaml#/components/schemas/GenericError'
- type: object
DetailedError:
allOf:
- $ref: 'https://raw.githubusercontent.com/upb-uc4/api/develop/errors.yaml#/components/schemas/DetailedError'
- type: object
examples:
ExampleJsonUsernameEnrollmentId:
summary: "An Example for an JsonUsernameEnrollmentId object"
value:
- username: "student"
enrollmentId: "0424974c68530290458c8d58674e2637f65abc127057957d7b3acbd24c208f93"
- username: "student2"
enrollmentId: "008747125d802de1500be52313d865b1126d0ac0eb3a1de80f90bc8436680336"
PostMessageCsrExample:
summary : "PostMessageCsr Example"
value:
certificateSigningRequest: |
-----BEGIN CERTIFICATE REQUEST-----
MIIChDCCAW4CAQAwETEPMA0GA1UEAxMGdGVzdGlkMIIBIjANBgkqhkiG9w0BAQEF
AAOCAQ8AMIIBCgKCAQEAsipACqx6inXxSTeiC1sl8PdJXDGQh2MHs7X519XXhMcp
Aa3XV/9qqt+lYXglGmGb3uHbZ+IGeAkE9Lid6J//Au9ulBnKhKd1Uyy5EqFNLcLm
6Q4s7kEYWC23xu9GD6EHWJLNn29ywJg801Pl4tLS2LJ45fbfd4QwwTZdrWj1ufNd
3FVm6XyItw8MI0bfkglsYGqJ3bO7zX41E/23r8iE668smXRGpBfwhtpl1P2AWyBZ
yXXiKo9aYgDAe2LIz6fO8PZSzWOJLatHDZ1BHlF7k0ZPlABmGekELYyeaola2xS7
UgO41M8BWJpNmWG9fIiJchFRQCk9gpFFf+zr9I0TzwIDAQABoDAwLgYJKoZIhvcN
AQkOMSEwHzAdBgNVHQ4EFgQUDq+poSooyuAmOc51K6wd4xUtBtYwCwYJKoZIhvcN
AQELA4IBAQCPrQ6iF7kbqjT+XijpsK4kMHtCN+2GUsO+/X/GCGN/K74440ZLPEH0
qQO20o3fc1GDI6ShZ5G//8+m2CItg7WxeFDXc/b6W2c5HqAh6rUvPMIym+9JHaZJ
aHHNt4N6wWYnZVhvR6Sy+DeDwdog0hQh+FFoDO9bPJF46leN+MdsgTZ8Mwe8liJp
CTovF8w/FIt197UYT5S/qJ5/zfg5b+KXulQ0zf5LeWng7LvQeywgWdrvsVVmKLM0
zOUy2PvH59mXlOg78NnoDWWU2Rt1UaVlbOAxOiCuC84j2wIgLEErVS4eYXwHOT+c
de5esScxXO7Eikl9DwUe3lkqfA1FCjls
-----END CERTIFICATE REQUEST-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u17hg1TGpQdVVOPC1YN8="
externalDocs:
description: "Find out more about Swagger"
url: "http://swagger.io"