-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathx509.yaml
73 lines (69 loc) · 2.34 KB
/
x509.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
name: okms-cli x509 test suite
description: Test the OKMS x509 subcommand
testcases:
- name: Create Keys
steps:
- name: Create an RSA 2048 key pair
type: okms-cmd
args: keys new --type rsa --size 2048 test-rsa-1 --usage sign,verify
assertions:
- result.code ShouldEqual 0
vars:
rsaKeyId:
from: result.systemoutjson.id
- name: Create an ECDSA P-256 key pair
type: okms-cmd
args: keys new --type ec --curve P-256 test-ecdsa-1 --usage sign,verify
assertions:
- result.code ShouldEqual 0
vars:
ecKeyId:
from: result.systemoutjson.id
- name: Create CA
steps:
- name: Create self-signed CA
type: okms-cmd
args: x509 create ca {{ .Create-Keys.rsaKeyId }} --cn Test-CA-RSA > out/ca.pem
assertions:
- result.code ShouldEqual 0
- name: Create certificate
steps:
- name: Create self-signed certificate
type: okms-cmd
args: x509 create cert {{ .Create-Keys.ecKeyId }} --cn Test-cert-ECDSA --server-auth
assertions:
- result.code ShouldEqual 0
- name: Create and sign CSR
steps:
- name: Create CSR
type: okms-cmd
args: x509 create csr {{ .Create-Keys.ecKeyId }} --cn Test-cert-ECDSA > out/csr.pem
assertions:
- result.code ShouldEqual 0
- name: Sign CSR without CA Key Id
type: okms-cmd
args: x509 sign out/csr.pem out/ca.pem --client-auth
assertions:
- result.code ShouldEqual 0
- name: Sign CSR with CA Key Id
type: okms-cmd
args: x509 sign out/csr.pem out/ca.pem {{ .Create-Keys.rsaKeyId }} --client-auth
assertions:
- result.code ShouldEqual 0
- name: Sign CSR with wrong CA Key Id
type: okms-cmd
args: x509 sign out/csr.pem out/ca.pem {{ .Create-Keys.ecKeyId }} --client-auth
assertions:
- result.code ShouldEqual 1
- name: Delete the keys
steps:
- name: Force delete the {{ .value.kind }} key
type: okms-cmd
range:
- keyId: "{{ .Create-Keys.rsaKeyId }}"
kind: RSA
- keyId: "{{ .Create-Keys.ecKeyId }}"
kind: ECDSA
args: keys delete {{ .value.keyId }} --force
assertions:
- result.code ShouldEqual 0