BitPunch McEliece  v0.0.4
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
asn1.h
Go to the documentation of this file.
1 /*
2  This file is part of BitPunch
3  Copyright (C) 2015 Frantisek Uhrecky <frantisek.uhrecky[what here]gmail.com>
4 
5  This program is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef ASN1_H
19 #define ASN1_H
20 
21 #include <bitpunch/config.h>
22 
23 #ifdef BPU_CONF_ASN1
25 
26 #include <stdint.h>
27 #include <libtasn1.h>
28 
29 #define BPU_STR_ASN1_MECS_PRI_KEY "asn1/MecsPriKey.asn"
30 #define BPU_STR_ASN1_MECS_PUB_KEY "asn1/MecsPubKey.asn"
31 #define BPU_STR_ASN1_MECS_PRI_KEY_NAME "BPU_ASN1.MecsPriKey"
32 #define BPU_STR_ASN1_MECS_PUB_KEY_NAME "BPU_ASN1.MecsPubKey"
33 
35 #define BPU_STR_ASN1_OID_MECS_BASIC_GOPPA "1.3.6.1.4.1.8301.3.1.3.4.1"
36 #define BPU_STR_ASN1_OID_MECS_CCA2_POINTCHEVAL_GOPPA "1.3.6.1.4.1.8301.3.1.3.4.2.2"
38 
46 int BPU_asn1EncodePriKey(char **buffer, int *size, const BPU_T_Mecs_Ctx *ctx);
48 
49 int BPU_asn1DecodePriKey(BPU_T_Mecs_Ctx **ctx, const char *buffer, const int size);
50 
51 int BPU_asn1EncodePubKey(char **buffer, int *size, const BPU_T_Mecs_Ctx *ctx);
52 
53 int BPU_asn1DecodePubKey(BPU_T_Mecs_Ctx **ctx, const char *buffer, const int size);
54 
55 int BPU_asn1ReadValue(char **buffer, int *len, const int max_len, const char *name, const asn1_node node);
56 
58 
59 int BPU_asn1MallocBuffer(char **buffer, int *len, const int max_len, const asn1_node node, const char *name);
60 
61 int BPU_asn1LoadFileToBuffer(char **buffer, long *size, const char *file_name);
62 
63 int BPU_asn1LoadKeyPair(BPU_T_Mecs_Ctx **ctx, const char *pri_key_file, const char *pub_key_file);
64 
65 int BPU_asn1LoadPriKey(BPU_T_Mecs_Ctx **ctx, const char *pri_key_file);
66 
67 int BPU_asn1LoadPubKey(BPU_T_Mecs_Ctx **ctx, const char *pub_key_file);
68 
69 int BPU_asn1SaveKeyPair(const BPU_T_Mecs_Ctx *ctx, const char *pri_key_file, const char *pub_key_file);
70 
71 int BPU_asn1SavePriKey(const BPU_T_Mecs_Ctx *ctx, const char *pri_key_file);
72 
73 int BPU_asn1SavePubKey(const BPU_T_Mecs_Ctx *ctx, const char *pub_key_file);
74 
75 int BPU_asn1WriteBufferToFile(const char *buffer, const long size, const char *file_name);
76 
77 #endif // BPU_CONF_ASN1
78 #endif // ASN1_H
int BPU_asn1LoadKeyPair(BPU_T_Mecs_Ctx **ctx, const char *pri_key_file, const char *pub_key_file)
Definition: asn1.c:519
int BPU_asn1SavePriKey(const BPU_T_Mecs_Ctx *ctx, const char *pri_key_file)
Definition: asn1.c:569
int BPU_asn1SavePubKey(const BPU_T_Mecs_Ctx *ctx, const char *pub_key_file)
Definition: asn1.c:587
int BPU_asn1ReadValue(char **buffer, int *len, const int max_len, const char *name, const asn1_node node)
Definition: asn1.c:411
BPU_T_EN_Mecs_Types BPU_asn1GetMecsTypeFromOid(asn1_node node)
Definition: asn1.c:429
enum _BPU_T_EN_Mecs_Types BPU_T_EN_Mecs_Types
Possible types of MECS.
int BPU_asn1EncodePubKey(char **buffer, int *size, const BPU_T_Mecs_Ctx *ctx)
Definition: asn1.c:237
int BPU_asn1DecodePriKey(BPU_T_Mecs_Ctx **ctx, const char *buffer, const int size)
Definition: asn1.c:134
int BPU_asn1LoadFileToBuffer(char **buffer, long *size, const char *file_name)
Definition: asn1.c:480
int BPU_asn1LoadPubKey(BPU_T_Mecs_Ctx **ctx, const char *pub_key_file)
Definition: asn1.c:544
int BPU_asn1DecodePubKey(BPU_T_Mecs_Ctx **ctx, const char *buffer, const int size)
Definition: asn1.c:325
int BPU_asn1EncodePriKey(char **buffer, int *size, const BPU_T_Mecs_Ctx *ctx)
BPU_asn1EncodePriKey dsadsad.
Definition: asn1.c:26
int BPU_asn1WriteBufferToFile(const char *buffer, const long size, const char *file_name)
Definition: asn1.c:605
int BPU_asn1MallocBuffer(char **buffer, int *len, const int max_len, const asn1_node node, const char *name)
Definition: asn1.c:455
int BPU_asn1SaveKeyPair(const BPU_T_Mecs_Ctx *ctx, const char *pri_key_file, const char *pub_key_file)
Definition: asn1.c:561
int BPU_asn1LoadPriKey(BPU_T_Mecs_Ctx **ctx, const char *pri_key_file)
Definition: asn1.c:527