]> git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_cryptkit/lib/CryptKitAsn1.h
Security-57337.20.44.tar.gz
[apple/security.git] / OSX / libsecurity_cryptkit / lib / CryptKitAsn1.h
1 /*
2 * CryptKitAsn1.h - ASN1 templates for FEE objects
3 */
4
5 #ifndef _CRYPT_KIT_ASN1_H_
6 #define _CRYPT_KIT_ASN1_H_
7
8 #include "ckconfig.h"
9
10 #if CRYPTKIT_DER_ENABLE
11
12 #include <Security/cssmtype.h>
13 #include <Security/secasn1t.h>
14
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18
19 /*
20 -- FEE Curve parameters (defined in <security_cryptkit/feeTypes.h>)
21 FEEPrimeType ::= INTEGER { FPT_Mersenne(0), FPT_FEE(1), FPT_General(2) }
22 FEECurveType ::= INTEGER { FCT_Montgomery(0), FCT_Weierstrass(1),
23 FCT_General(2) }
24 */
25
26 /*
27 FEECurveParameters ::= SEQUENCE
28 {
29 primeType FEEPrimeType,
30 curveType FEECurveType,
31 q INTEGER, -- unsigned
32 k INTEGER, -- signed
33 m INTEGER,
34 a BigIntegerStr,
35 bb BigIntegerStr, -- can't use variable/field b
36 c BigIntegerStr,
37 x1Plus BigIntegerStr,
38 x1Minus BigIntegerStr,
39 cOrderPlus BigIntegerStr,
40 cOrderMinus BigIntegerStr,
41 x1OrderPlus BigIntegerStr,
42 x1OrderMinus BigIntegerStr,
43 basePrime BigIntegerStr OPTIONAL
44 -- iff FEEPrimeType == CT_GENERAL
45 }
46 */
47 typedef struct {
48 CSSM_DATA primeType;
49 CSSM_DATA curveType;
50 CSSM_DATA q;
51 CSSM_DATA k;
52 CSSM_DATA m;
53 CSSM_DATA a;
54 CSSM_DATA b_; // can't use variable/field b
55 CSSM_DATA c;
56 CSSM_DATA x1Plus;
57 CSSM_DATA x1Minus;
58 CSSM_DATA cOrderPlus;
59 CSSM_DATA cOrderMinus;
60 CSSM_DATA x1OrderPlus;
61 CSSM_DATA x1OrderMinus;
62 CSSM_DATA basePrime; // OPTIONAL
63 } FEECurveParametersASN1;
64
65 extern const SecAsn1Template FEECurveParametersASN1Template[];
66
67 /*
68 -- FEE ElGamal-style signature
69 FEEElGamalSignature ::= SEQUENCE {
70 u BigIntegerStr,
71 pmX BigIntegerStr
72 }
73 */
74 typedef struct {
75 CSSM_DATA u;
76 CSSM_DATA pmX;
77 } FEEElGamalSignatureASN1;
78
79 extern const SecAsn1Template FEEElGamalSignatureASN1Template[];
80
81 /*
82 -- FEE ECDSA-style signature
83 FEEECDSASignature ::= SEQUENCE {
84 c BigIntegerStr,
85 d BigIntegerStr
86 }
87 */
88 typedef struct {
89 CSSM_DATA c;
90 CSSM_DATA d;
91 } FEEECDSASignatureASN1;
92
93 extern const SecAsn1Template FEEECDSASignatureASN1Template[];
94
95 /*
96 FEEPublicKey ::= SEQUENCE
97 {
98 version INTEGER,
99 curveParams FEECurveParameters,
100 plusX BigIntegerStr,
101 minusX BigIntegerStr,
102 plusY BigIntegerStr OPTIONAL
103 -- iff FEECurveType == ct-weierstrass
104 }
105 */
106 typedef struct {
107 CSSM_DATA version;
108 FEECurveParametersASN1 curveParams;
109 CSSM_DATA plusX;
110 CSSM_DATA minusX;
111 CSSM_DATA plusY; // OPTIONAL
112 } FEEPublicKeyASN1;
113
114 extern const SecAsn1Template FEEPublicKeyASN1Template[];
115
116 /*
117 FEEPrivateKey ::= SEQUENCE
118 {
119 version INTEGER,
120 curveParams FEECurveParameters,
121 privData BigIntegerStr
122 }
123 */
124 typedef struct {
125 CSSM_DATA version;
126 FEECurveParametersASN1 curveParams;
127 CSSM_DATA privData;
128 } FEEPrivateKeyASN1;
129
130 extern const SecAsn1Template FEEPrivateKeyASN1Template[];
131
132 #ifdef __cplusplus
133 }
134 #endif
135
136 #endif /* CRYPTKIT_DER_ENABLE */
137
138 #endif /* _CRYPT_KIT_ASN1_H_ */