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