2 * CryptKitAsn1.cpp - ASN1 templates for FEE keys and signatures
5 #include "CryptKitAsn1.h"
6 #include <security_asn1/secasn1.h>
9 * Unlike RSA, DSA, and Diffie-Hellman, the integers in these
10 * objects are indeed signed.
12 #define SEC_ASN1_SIGNED (SEC_ASN1_SIGNED_INT | SEC_ASN1_INTEGER)
14 /* FEECurveParametersASN1 */
15 const SecAsn1Template FEECurveParametersASN1Template
[] = {
17 0, NULL
, sizeof(FEECurveParametersASN1
) },
18 { SEC_ASN1_INTEGER
, offsetof(FEECurveParametersASN1
,primeType
) },
19 { SEC_ASN1_INTEGER
, offsetof(FEECurveParametersASN1
,curveType
) },
20 { SEC_ASN1_SIGNED
, offsetof(FEECurveParametersASN1
,q
) },
21 { SEC_ASN1_SIGNED
, offsetof(FEECurveParametersASN1
,k
) },
22 { SEC_ASN1_SIGNED
, offsetof(FEECurveParametersASN1
,m
) },
23 { SEC_ASN1_SIGNED
, offsetof(FEECurveParametersASN1
,a
) },
24 { SEC_ASN1_SIGNED
, offsetof(FEECurveParametersASN1
,b_
) },
25 { SEC_ASN1_SIGNED
, offsetof(FEECurveParametersASN1
,c
) },
26 { SEC_ASN1_SIGNED
, offsetof(FEECurveParametersASN1
,x1Plus
) },
27 { SEC_ASN1_SIGNED
, offsetof(FEECurveParametersASN1
,x1Minus
) },
28 { SEC_ASN1_SIGNED
, offsetof(FEECurveParametersASN1
,cOrderPlus
) },
29 { SEC_ASN1_SIGNED
, offsetof(FEECurveParametersASN1
,cOrderMinus
) },
30 { SEC_ASN1_SIGNED
, offsetof(FEECurveParametersASN1
,x1OrderPlus
) },
31 { SEC_ASN1_SIGNED
, offsetof(FEECurveParametersASN1
,x1OrderMinus
) },
32 { SEC_ASN1_SIGNED
| SEC_ASN1_OPTIONAL
,
33 offsetof(FEECurveParametersASN1
,basePrime
) },
37 /* FEEElGamalSignatureASN1 */
38 const SecAsn1Template FEEElGamalSignatureASN1Template
[] = {
40 0, NULL
, sizeof(FEEElGamalSignatureASN1
) },
41 { SEC_ASN1_SIGNED
, offsetof(FEEElGamalSignatureASN1
,u
) },
42 { SEC_ASN1_SIGNED
, offsetof(FEEElGamalSignatureASN1
,pmX
) },
46 /* FEEECDSASignatureASN1 */
47 const SecAsn1Template FEEECDSASignatureASN1Template
[] = {
49 0, NULL
, sizeof(FEEECDSASignatureASN1
) },
50 { SEC_ASN1_SIGNED
, offsetof(FEEECDSASignatureASN1
,c
) },
51 { SEC_ASN1_SIGNED
, offsetof(FEEECDSASignatureASN1
,d
) },
55 /* FEEPublicKeyASN1 */
56 const SecAsn1Template FEEPublicKeyASN1Template
[] = {
58 0, NULL
, sizeof(FEEPublicKeyASN1
) },
59 { SEC_ASN1_SIGNED
, offsetof(FEEPublicKeyASN1
,version
) },
61 offsetof(FEEPublicKeyASN1
,curveParams
),
62 FEECurveParametersASN1Template
},
63 { SEC_ASN1_SIGNED
, offsetof(FEEPublicKeyASN1
,plusX
) },
64 { SEC_ASN1_SIGNED
, offsetof(FEEPublicKeyASN1
,minusX
) },
65 { SEC_ASN1_SIGNED
| SEC_ASN1_OPTIONAL
,
66 offsetof(FEEPublicKeyASN1
,plusY
) },
70 /* FEEPrivateKeyASN1 */
71 const SecAsn1Template FEEPrivateKeyASN1Template
[] = {
73 0, NULL
, sizeof(FEEPrivateKeyASN1
) },
74 { SEC_ASN1_SIGNED
, offsetof(FEEPrivateKeyASN1
,version
) },
76 offsetof(FEEPrivateKeyASN1
,curveParams
),
77 FEECurveParametersASN1Template
},
78 { SEC_ASN1_SIGNED
, offsetof(FEEPrivateKeyASN1
,privData
) },