cddl 0.8.9 → 0.12.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/bin/cddl +51 -15
  3. data/cddl.gemspec +10 -7
  4. data/data/cddl.abnf +30 -13
  5. data/lib/cbor-pp-play.rb +1 -0
  6. data/lib/cddl.rb +719 -71
  7. data/test/test-cddl.rb +53 -2
  8. data/test-data/7807.cddl +14 -0
  9. data/test-data/abignum.cddl +1 -0
  10. data/test-data/abnf1.cddl +3 -0
  11. data/test-data/abnf2.cddl +37 -0
  12. data/test-data/abnf3.cddl +32 -0
  13. data/test-data/b64c-sloppy.cddl +1 -0
  14. data/test-data/b64c.cddl +1 -0
  15. data/test-data/b64u-strict.cddl +12 -0
  16. data/test-data/b64u.cddl +1 -0
  17. data/test-data/base32.cddl +1 -0
  18. data/test-data/base32hex.cddl +1 -0
  19. data/test-data/bat.cddl +16 -0
  20. data/test-data/cat-re.cddl +4 -0
  21. data/test-data/catb64.cddl +8 -0
  22. data/test-data/complex-occ.cddl +11 -0
  23. data/test-data/coral.cddl +10 -0
  24. data/test-data/coral1.cddl +5 -0
  25. data/test-data/coral2.cddl +7 -0
  26. data/test-data/coral3.cddl +7 -0
  27. data/test-data/decimal-warn.cddl +1 -0
  28. data/test-data/decimal.cddl +1 -0
  29. data/test-data/decimal2.cddl +1 -0
  30. data/test-data/det1.cddl +12 -0
  31. data/test-data/dotplus1.cddl +3 -0
  32. data/test-data/dotplus2.cddl +3 -0
  33. data/test-data/dotplus3.cddl +3 -0
  34. data/test-data/dotplus4.cddl +3 -0
  35. data/test-data/enum.cddl +14 -0
  36. data/test-data/enum1.cddl +12 -0
  37. data/test-data/feat1.cddl +4 -0
  38. data/test-data/feature-controller.cddl +6 -0
  39. data/test-data/feature-detail.cddl +5 -0
  40. data/test-data/hex.cddl +1 -0
  41. data/test-data/hexlc.cddl +1 -0
  42. data/test-data/hexuc.cddl +1 -0
  43. data/test-data/homenet-de.cddl +12 -0
  44. data/test-data/homenet-fe.cddl +12 -0
  45. data/test-data/jim-cut-2.cddl +11 -0
  46. data/test-data/jim-cut.cddl +12 -0
  47. data/test-data/join.cddl +1 -0
  48. data/test-data/joini.cddl +1 -0
  49. data/test-data/joinx.cddl +1 -0
  50. data/test-data/json.cddl +1 -0
  51. data/test-data/json1.cddl +15 -0
  52. data/test-data/json2.cddl +1 -0
  53. data/test-data/jwt.cddl +15 -0
  54. data/test-data/lint1.cddl +9 -0
  55. data/test-data/mdl-ble.cddl +9 -0
  56. data/test-data/mdl-deve.cddl +54 -0
  57. data/test-data/mdl-dp.cddl +11 -0
  58. data/test-data/mdl-mso.cddl +20 -0
  59. data/test-data/mdl-request.cddl +26 -0
  60. data/test-data/mdl-response.cddl +66 -0
  61. data/test-data/mdl.cddl +11 -0
  62. data/test-data/mon-val.cddl +1 -0
  63. data/test-data/multipart-ct.cddl +2 -0
  64. data/test-data/non-empty.cddl +5 -0
  65. data/test-data/oid.cddl +8 -0
  66. data/test-data/oidbat.cddl +8 -0
  67. data/test-data/plus.cddl +3 -0
  68. data/test-data/prim.cddl +7 -0
  69. data/test-data/printf.cddl +2 -0
  70. data/test-data/printf0.cddl +1 -0
  71. data/test-data/printf1.cddl +2 -0
  72. data/test-data/printf2.cddl +2 -0
  73. data/test-data/printf3.cddl +2 -0
  74. data/test-data/sasl.cddl +24 -0
  75. data/test-data/sequence.cddl +1 -0
  76. data/test-data/sipos.cddl +8 -0
  77. data/test-data/star-edited.cddl +98 -0
  78. data/test-data/star.cddl +95 -0
  79. data/test-data/test-gen.cddl +3 -0
  80. data/test-data/time.cddl +11 -0
  81. data/test-data/valemb.cddl +16 -0
  82. data/test-data/yangid.cddl +1 -0
  83. data/test-data/yaron1.cddl +95 -0
  84. metadata +142 -13
@@ -0,0 +1,66 @@
1
+ Response = {
2
+ "Version" : tstr,
3
+ ? "Documents" : Documents,
4
+ ? "Error" : int
5
+ }
6
+ Documents = {
7
+ + DocType => ResponseData
8
+ }
9
+ ; Version of the structure, currently 1.0
10
+ ; Returned documents, may be absent if Error is present
11
+ ; Error codes according to Table 8
12
+ ResponseData = {
13
+ "IssuerSigned" : IssuerSigned, ; Responded data elements signed by the issuer
14
+ "DeviceSigned" : DeviceSigned, ; Responded data elements signed by the mDL
15
+ "Errors" : Errors
16
+ }
17
+ IssuerSigned = {
18
+ "NameSpaces" : IssuerNameSpaces,
19
+ "IssuerAuth" : COSE_Sign1 ; The payload is the MobileSecurityObject, see 9.2.1.4
20
+ }
21
+ IssuerNameSpaces = {
22
+ + NameSpace => [ + IssuerSignedItem ]
23
+ }
24
+ IssuerSignedItem = [
25
+ uint,
26
+ bstr,
27
+ tstr,
28
+ any
29
+ ]
30
+ DeviceSigned = {
31
+ "NameSpaces" : DeviceNameSpaces, ; Currently only online token and URL are defined as DeviceSignedItems
32
+ "DeviceAuth" : DeviceAuth
33
+ }
34
+ DeviceNameSpaces = {
35
+ * NameSpace => DeviceSignedItems
36
+ }
37
+ DeviceSignedItems = {
38
+ + DataItemName => DataItemValue
39
+ }
40
+ DeviceAuth = {
41
+ "Signature" : COSE_Sign1, //
42
+ ; Use a nil value for the payload, the detached content is the DeviceAuthentication structure, see 9.2.2.4
43
+ "MAC" : COSE_Mac0
44
+ }
45
+ Errors = {
46
+ * NameSpace => [ + ErrorItem ]
47
+ }
48
+ ErrorItem = {
49
+ DataItemName => ErrorCode
50
+ }
51
+ DocType = tstr
52
+ NameSpace = tstr
53
+ DataItemName = tstr
54
+ DataItemValue = any
55
+ ErrorCode = int
56
+ ; See table 9
57
+ ; See 7.3.2
58
+ ; See 7.3.3
59
+ ; See Table 2
60
+ ; See Table 2
61
+ ; Error codes according to Table 9
62
+ ; Structures used for DeviceAuth signature or MAC generation, see 9.2.2.4
63
+ ; Structures used for MobileSecurityObject, see 9.2.1.4
64
+
65
+ COSE_Sign1 = "COSE_Sign1"
66
+ COSE_Mac0 = "COSE_Mac0"
@@ -0,0 +1,11 @@
1
+ driving_privileges = [
2
+ * driving_privilege
3
+ ]
4
+ driving_privilege = {
5
+ vehicle_category_code: tstr
6
+ ?issue_date: #6.0(tstr)
7
+ ?expiry_date: #6.0(tstr)
8
+ ?code: tstr
9
+ ?sign: tstr
10
+ ?value: int
11
+ }
@@ -0,0 +1 @@
1
+ decimal-monetary-value = text .regexp "-?[0-9]+(\\.[0-9]+)?"
@@ -0,0 +1,2 @@
1
+ multipart-core = [* multipart-part]
2
+ multipart-part = (type: uint .size 2, part: bytes / null)
@@ -0,0 +1,5 @@
1
+ distinguishedName = non-empty<{
2
+ ? country: text
3
+ }>
4
+
5
+ non-empty<M> = (M) .and ({ + any => any })
@@ -0,0 +1,8 @@
1
+ oid = bytes .abnfb ("oid" .cat cbor-tags-oid)
2
+
3
+ cbor-tags-oid = '
4
+ oid = 1*arc
5
+ roid = *arc
6
+ arc = [nlsb] %x00-7f
7
+ nlsb = %x81-ff *%x80-ff
8
+ '
@@ -0,0 +1,8 @@
1
+ oid = bytes .abnfb ("oid" .bat cbor-tags-oid)
2
+
3
+ cbor-tags-oid = '
4
+ oid = 1*arc
5
+ roid = *arc
6
+ arc = [nlsb] %x00-7f
7
+ nlsb = %x81-ff *%x80-ff
8
+ '
@@ -0,0 +1,3 @@
1
+ a = {
2
+ + any => any
3
+ }
@@ -0,0 +1,7 @@
1
+ start = [a, e, b, c, d]
2
+ a = false
3
+ e = undefined
4
+ b = float32
5
+ ; c = #7.32
6
+ c = #6.<12>(3)
7
+ d = #6.13(4)
@@ -0,0 +1,2 @@
1
+ a = text .printf (["%8d %06d", ~arr])
2
+ arr = [uint, uint]
@@ -0,0 +1 @@
1
+ my_label = text .printf (["0x%x: %a", 4711, 81.5])
@@ -0,0 +1,2 @@
1
+ my_alg_sha = hexlabel<4>
2
+ hexlabel<K> = text .printf (["0x%04x", K])
@@ -0,0 +1,2 @@
1
+ my_alg_sha = hexlabel<int>
2
+ hexlabel<K> = text .printf (["0x%04x", K])
@@ -0,0 +1,2 @@
1
+ any_alg = hexlabel<1..20>
2
+ hexlabel<K> = text .printf (["0x%04x", K])
@@ -0,0 +1,24 @@
1
+ message = text .abnfb ("message" .cat rfc4505)
2
+
3
+ rfc4505 = '
4
+ message = [ email / token ]
5
+ ;; to be prepared in accordance with Section 3
6
+
7
+ UTF1 = %x00-3F / %x41-7F ;; less "@" (U+0040)
8
+ UTF2 = %xC2-DF UTF0
9
+ UTF3 = %xE0 %xA0-BF UTF0 / %xE1-EC 2(UTF0) /
10
+ %xED %x80-9F UTF0 / %xEE-EF 2(UTF0)
11
+ UTF4 = %xF0 %x90-BF 2(UTF0) / %xF1-F3 3(UTF0) /
12
+ %xF4 %x80-8F 2(UTF0)
13
+ UTF0 = %x80-BF
14
+
15
+ TCHAR = UTF1 / UTF2 / UTF3 / UTF4
16
+ ;; any UTF-8 encoded Unicode character
17
+ ;; except "@" (U+0040)
18
+
19
+ email = "too@much.work"; for this example
20
+ ;email = addr-spec
21
+ ;; as defined in [IMAIL]
22
+
23
+ token = 1*255TCHAR
24
+ '
@@ -0,0 +1 @@
1
+ a = [tstr, tstr, tstr]
@@ -0,0 +1,8 @@
1
+ ; start = {*$$socket}
2
+ ; $$socket //= (4: bstr)
3
+ ; $ cddl works.cddl generate
4
+ ; {4: h'6F7267616E69736D'}
5
+ ; $ cat fails.cddl
6
+ start = {*$$socket}
7
+ $$socket //= (some,)
8
+ some = (4: bstr)
@@ -0,0 +1,98 @@
1
+ csr-template-schema = {
2
+ keyTypes: [ 1* $keyType ]
3
+ ? subject: distinguishedName
4
+ extensions: extensions
5
+ }
6
+
7
+ mandatory-wildcard = "**"
8
+ optional-wildcard = "*"
9
+ wildcard = mandatory-wildcard / optional-wildcard
10
+
11
+ ; non-empty = { + any => any }
12
+ non-empty<M> = (M) .and ({ + any => any })
13
+
14
+ ; regtext matches all text strings but "*" and "**"
15
+ regtext = text .regexp "([^\*].*)|([\*][^\*].*)|([\*][\*].+)"
16
+
17
+ regtext-or-wildcard = regtext / wildcard
18
+
19
+ distinguishedName = non-empty<{
20
+ ? country: regtext-or-wildcard
21
+ ? stateOrProvince: regtext-or-wildcard
22
+ ? locality: regtext-or-wildcard
23
+ ? organization: regtext-or-wildcard
24
+ ? organizationalUnit: regtext-or-wildcard
25
+ ? emailAddress: regtext-or-wildcard
26
+ ? commonName: regtext-or-wildcard
27
+ }>
28
+
29
+ $keyType /= rsaKeyType
30
+ $keyType /= ecdsaKeyType
31
+
32
+ rsaKeyType = {
33
+ PublicKeyType: "rsaEncryption" ; OID: 1.2.840.113549.1.1.1
34
+ PublicKeyLength: rsaKeySize
35
+ SignatureType: $rsaSignatureType
36
+ }
37
+
38
+ rsaKeySize = int .ge 2048
39
+
40
+ ; RSASSA-PKCS1-v1_5 with SHA-256
41
+ $rsaSignatureType /= "sha256WithRSAEncryption"
42
+ ; RSASSA-PCKS1-v1_5 with SHA-384
43
+ $rsaSignatureType /= "sha384WithRSAEncryption"
44
+ ; RSASSA-PCKS1-v1_5 with SHA-512
45
+ $rsaSignatureType /= "sha512WithRSAEncryption"
46
+ ; RSASSA-PSS with SHA-256, MGF-1 with SHA-256, and a 32 byte salt
47
+ $rsaSignatureType /= "sha256WithRSAandMGF1"
48
+ ; RSASSA-PSS with SHA-384, MGF-1 with SHA-384, and a 48 byte salt
49
+ $rsaSignatureType /= "sha384WithRSAandMGF1"
50
+ ; RSASSA-PSS with SHA-512, MGF-1 with SHA-512, and a 64 byte salt
51
+ $rsaSignatureType /= "sha512WithRSAandMGF1"
52
+
53
+ ecdsaKeyType = {
54
+ PublicKeyType: "id-ecPublicKey" ; OID: 1.2.840.10045.2.1
55
+ namedCurve: $ecdsaCurve
56
+ SignatureType: $ecdsaSignatureType
57
+ }
58
+
59
+ $ecdsaCurve /= "secp256r1" ; OID: 1.2.840.10045.3.1.7
60
+ $ecdsaCurve /= "secp384r1" ; OID: 1.3.132.0.34
61
+ $ecdsaCurve /= "secp521r1" ; OID: 1.3.132.0.3
62
+
63
+ $ecdsaSignatureType /= "ecdsa-with-SHA256" ; paired with secp256r1
64
+ $ecdsaSignatureType /= "ecdsa-with-SHA384" ; paired with secp384r1
65
+ $ecdsaSignatureType /= "ecdsa-with-SHA512" ; paired with secp521r1
66
+
67
+ subjectaltname = {
68
+ ? DNS: [ 1* regtext-or-wildcard ]
69
+ ? Email: [ 1* regtext ]
70
+ ? URI: [ 1* regtext ]
71
+ * $$subjectaltname-extension
72
+ }
73
+
74
+ extensions = {
75
+ ? keyUsage: [ 1* keyUsageType ]
76
+ ? extendedKeyUsage: [ 1* extendedKeyUsageType ]
77
+ subjectAltName: subjectaltname
78
+ }
79
+
80
+ keyUsageType /= "digitalSignature"
81
+ keyUsageType /= "nonRepudiation"
82
+ keyUsageType /= "keyEncipherment"
83
+ keyUsageType /= "dataEncipherment"
84
+ keyUsageType /= "keyAgreement"
85
+ keyUsageType /= "keyCertSign"
86
+ keyUsageType /= "cRLSign"
87
+ keyUsageType /= "encipherOnly"
88
+ keyUsageType /= "decipherOnly"
89
+
90
+ extendedKeyUsageType /= "serverAuth"
91
+ extendedKeyUsageType /= "clientAuth"
92
+ extendedKeyUsageType /= "codeSigning"
93
+ extendedKeyUsageType /= "emailProtection"
94
+ extendedKeyUsageType /= "timeStamping"
95
+ extendedKeyUsageType /= "OCSPSigning"
96
+ extendedKeyUsageType /= oid
97
+
98
+ oid = text .regexp "[0-9]+(\\.[0-9]+)*"
@@ -0,0 +1,95 @@
1
+ csr-template-schema = {
2
+ keyTypes: [ 1* $keyType ]
3
+ ? subject: distinguishedName
4
+ extensions: extensions
5
+ }
6
+
7
+ mandatory-wildcard = "**"
8
+ optional-wildcard = "*"
9
+ wildcard = mandatory-wildcard / optional-wildcard
10
+
11
+ ; regtext matches all text strings but "*" and "**"
12
+ regtext = text .regexp "([^\*].*)|([\*][^\*].*)|([\*][\*].+)"
13
+
14
+ regtext-or-wildcard = regtext / wildcard
15
+
16
+ distinguishedName = {
17
+ ? country: regtext-or-wildcard
18
+ ? stateOrProvince: regtext-or-wildcard
19
+ ? locality: regtext-or-wildcard
20
+ ? organization: regtext-or-wildcard
21
+ ? organizationalUnit: regtext-or-wildcard
22
+ ? emailAddress: regtext-or-wildcard
23
+ ? commonName: regtext-or-wildcard
24
+ }
25
+
26
+ $keyType /= rsaKeyType
27
+ $keyType /= ecdsaKeyType
28
+
29
+ rsaKeyType = {
30
+ PublicKeyType: "rsaEncryption" ; OID: 1.2.840.113549.1.1.1
31
+ PublicKeyLength: rsaKeySize
32
+ SignatureType: $rsaSignatureType
33
+ }
34
+
35
+ rsaKeySize = int .ge 2048
36
+
37
+ ; RSASSA-PKCS1-v1_5 with SHA-256
38
+ $rsaSignatureType /= "sha256WithRSAEncryption"
39
+ ; RSASSA-PCKS1-v1_5 with SHA-384
40
+ $rsaSignatureType /= "sha384WithRSAEncryption"
41
+ ; RSASSA-PCKS1-v1_5 with SHA-512
42
+ $rsaSignatureType /= "sha512WithRSAEncryption"
43
+ ; RSASSA-PSS with SHA-256, MGF-1 with SHA-256, and a 32 byte salt
44
+ $rsaSignatureType /= "sha256WithRSAandMGF1"
45
+ ; RSASSA-PSS with SHA-384, MGF-1 with SHA-384, and a 48 byte salt
46
+ $rsaSignatureType /= "sha384WithRSAandMGF1"
47
+ ; RSASSA-PSS with SHA-512, MGF-1 with SHA-512, and a 64 byte salt
48
+ $rsaSignatureType /= "sha512WithRSAandMGF1"
49
+
50
+ ecdsaKeyType = {
51
+ PublicKeyType: "id-ecPublicKey" ; OID: 1.2.840.10045.2.1
52
+ namedCurve: $ecdsaCurve
53
+ SignatureType: $ecdsaSignatureType
54
+ }
55
+
56
+ $ecdsaCurve /= "secp256r1" ; OID: 1.2.840.10045.3.1.7
57
+ $ecdsaCurve /= "secp384r1" ; OID: 1.3.132.0.34
58
+ $ecdsaCurve /= "secp521r1" ; OID: 1.3.132.0.3
59
+
60
+ $ecdsaSignatureType /= "ecdsa-with-SHA256" ; paired with secp256r1
61
+ $ecdsaSignatureType /= "ecdsa-with-SHA384" ; paired with secp384r1
62
+ $ecdsaSignatureType /= "ecdsa-with-SHA512" ; paired with secp521r1
63
+
64
+ subjectaltname = {
65
+ ? DNS: [ 1* regtext-or-wildcard ]
66
+ ? Email: [ 1* regtext ]
67
+ ? URI: [ 1* regtext ]
68
+ * $$subjectaltname-extension
69
+ }
70
+
71
+ extensions = {
72
+ ? keyUsage: [ 1* keyUsageType ]
73
+ ? extendedKeyUsage: [ 1* extendedKeyUsageType ]
74
+ subjectAltName: subjectaltname
75
+ }
76
+
77
+ keyUsageType /= "digitalSignature"
78
+ keyUsageType /= "nonRepudiation"
79
+ keyUsageType /= "keyEncipherment"
80
+ keyUsageType /= "dataEncipherment"
81
+ keyUsageType /= "keyAgreement"
82
+ keyUsageType /= "keyCertSign"
83
+ keyUsageType /= "cRLSign"
84
+ keyUsageType /= "encipherOnly"
85
+ keyUsageType /= "decipherOnly"
86
+
87
+ extendedKeyUsageType /= "serverAuth"
88
+ extendedKeyUsageType /= "clientAuth"
89
+ extendedKeyUsageType /= "codeSigning"
90
+ extendedKeyUsageType /= "emailProtection"
91
+ extendedKeyUsageType /= "timeStamping"
92
+ extendedKeyUsageType /= "OCSPSigning"
93
+ extendedKeyUsageType /= oid
94
+
95
+ oid = text .regexp "[0-9]+(\\.[0-9]+)*"
@@ -0,0 +1,3 @@
1
+ foo = arr<mapa<arr<int>, arr<text>>>
2
+ arr<X> = [* X]
3
+ mapa<X, Y> = {a: X, b: Y}
@@ -0,0 +1,11 @@
1
+ etime = #6.1001({
2
+ 1: int,
3
+ ? (
4
+ -3: uint .lt 1000 //
5
+ -6: uint .lt 1000000 //
6
+ -9: uint .lt 1000000000 //
7
+ -12: uint .lt 1000000000000 //
8
+ -15: uint .lt 1000000000000000 //
9
+ -18: uint .lt 1000000000000000000
10
+ )
11
+ })
@@ -0,0 +1,16 @@
1
+ cwt = [
2
+ bstr .cbor protected-map,
3
+ unprotected-map,
4
+ bstr .cbor payload-map,
5
+ bstr ; signature
6
+ ]
7
+
8
+ protected-map = {
9
+ &(alg: 1) => int,
10
+ ? &(typ: 16) => text,
11
+ * key => any
12
+ }
13
+
14
+ unprotected-map = ()
15
+ key = "key"
16
+ payload-map = { payload: "map"}
@@ -0,0 +1 @@
1
+ a = text .regexp "[a-z][a-z0-9]*(-[a-z0-9]+)*"
@@ -0,0 +1,95 @@
1
+ csr-template-schema = {
2
+ keyTypes: [ 1* $keyType ]
3
+ ? subject: distinguishedName
4
+ extensions: extensions
5
+ }
6
+
7
+ mandatory-wildcard = "**"
8
+ optional-wildcard = "*"
9
+ wildcard = mandatory-wildcard / optional-wildcard
10
+
11
+ ; regtext matches all text strings but "*" and "**"
12
+ regtext = text .regexp "([^\*].*)|([\*][^\*].*)|([\*][\*].+)"
13
+
14
+ regtext-or-wildcard = regtext / wildcard
15
+
16
+ distinguishedName = {
17
+ ? country: regtext-or-wildcard
18
+ ? stateOrProvince: regtext-or-wildcard
19
+ ? locality: regtext-or-wildcard
20
+ ? organization: regtext-or-wildcard
21
+ ? organizationalUnit: regtext-or-wildcard
22
+ ? emailAddress: regtext-or-wildcard
23
+ ? commonName: regtext-or-wildcard
24
+ }
25
+
26
+ $keyType /= rsaKeyType
27
+ $keyType /= ecdsaKeyType
28
+
29
+ rsaKeyType = {
30
+ PublicKeyType: "rsaEncryption" ; OID: 1.2.840.113549.1.1.1
31
+ PublicKeyLength: rsaKeySize
32
+ SignatureType: $rsaSignatureType
33
+ }
34
+
35
+ rsaKeySize = int .ge 2048
36
+
37
+ ; RSASSA-PKCS1-v1_5 with SHA-256
38
+ $rsaSignatureType /= "sha256WithRSAEncryption"
39
+ ; RSASSA-PCKS1-v1_5 with SHA-384
40
+ $rsaSignatureType /= "sha384WithRSAEncryption"
41
+ ; RSASSA-PCKS1-v1_5 with SHA-512
42
+ $rsaSignatureType /= "sha512WithRSAEncryption"
43
+ ; RSASSA-PSS with SHA-256, MGF-1 with SHA-256, and a 32 byte salt
44
+ $rsaSignatureType /= "sha256WithRSAandMGF1"
45
+ ; RSASSA-PSS with SHA-384, MGF-1 with SHA-384, and a 48 byte salt
46
+ $rsaSignatureType /= "sha384WithRSAandMGF1"
47
+ ; RSASSA-PSS with SHA-512, MGF-1 with SHA-512, and a 64 byte salt
48
+ $rsaSignatureType /= "sha512WithRSAandMGF1"
49
+
50
+ ecdsaKeyType = {
51
+ PublicKeyType: "id-ecPublicKey" ; OID: 1.2.840.10045.2.1
52
+ namedCurve: $ecdsaCurve
53
+ SignatureType: $ecdsaSignatureType
54
+ }
55
+
56
+ $ecdsaCurve /= "secp256r1" ; OID: 1.2.840.10045.3.1.7
57
+ $ecdsaCurve /= "secp384r1" ; OID: 1.3.132.0.34
58
+ $ecdsaCurve /= "secp521r1" ; OID: 1.3.132.0.3
59
+
60
+ $ecdsaSignatureType /= "ecdsa-with-SHA256" ; paired with secp256r1
61
+ $ecdsaSignatureType /= "ecdsa-with-SHA384" ; paired with secp384r1
62
+ $ecdsaSignatureType /= "ecdsa-with-SHA512" ; paired with secp521r1
63
+
64
+ subjectaltname = {
65
+ ? DNS: [ 1* regtext-or-wildcard ]
66
+ ? Email: [ 1* regtext ]
67
+ ? URI: [ 1* regtext ]
68
+ * $$subjectaltname-extension
69
+ }
70
+
71
+ extensions = {
72
+ ? keyUsage: [ 1* keyUsageType ]
73
+ ? extendedKeyUsage: [ 1* extendedKeyUsageType ]
74
+ subjectAltName: subjectaltname
75
+ }
76
+
77
+ keyUsageType /= "digitalSignature"
78
+ keyUsageType /= "nonRepudiation"
79
+ keyUsageType /= "keyEncipherment"
80
+ keyUsageType /= "dataEncipherment"
81
+ keyUsageType /= "keyAgreement"
82
+ keyUsageType /= "keyCertSign"
83
+ keyUsageType /= "cRLSign"
84
+ keyUsageType /= "encipherOnly"
85
+ keyUsageType /= "decipherOnly"
86
+
87
+ extendedKeyUsageType /= "serverAuth"
88
+ extendedKeyUsageType /= "clientAuth"
89
+ extendedKeyUsageType /= "codeSigning"
90
+ extendedKeyUsageType /= "emailProtection"
91
+ extendedKeyUsageType /= "timeStamping"
92
+ extendedKeyUsageType /= "OCSPSigning"
93
+ extendedKeyUsageType /= oid
94
+
95
+ oid = text .regexp "[0-9]+(\\.[0-9]+)*"