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