-
Notifications
You must be signed in to change notification settings - Fork 0
/
armor.h
54 lines (49 loc) · 1.81 KB
/
armor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/**
* @file armor.h
* @brief Routines to (de)armor OpenPGP packet streams.
*
* Copyright 2002-2004, 2011 Jonathan McDowell <[email protected]>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef __ARMOR_H__
#define __ARMOR_H__
#include "keystructs.h"
/**
* @brief Takes a list of OpenPGP packets and armors it.
* @param putchar_func The function to output the next armor character.
* @param ctx The context pointer for putchar_func.
* @param packets The list of packets to output.
*
* This function ASCII armors a list of OpenPGP packets and outputs it
* using putchar_func.
*/
int armor_openpgp_stream(size_t (*putchar_func)(void *ctx, size_t count,
void *c),
void *ctx,
struct openpgp_packet_list *packets);
/**
* @brief Reads & decodes an ACSII armored OpenPGP msg.
* @param getchar_func The function to get the next character from the stream.
* @param ctx The context pointer for getchar_func.
* @param packets The list of packets.
*
* This function uses getchar_func to read characters from an ASCII
* armored OpenPGP stream and outputs the data as a linked list of
* packets.
*/
int dearmor_openpgp_stream(size_t (*getchar_func)(void *ctx, size_t count,
void *c),
void *ctx,
struct openpgp_packet_list **packets);
#endif /* __ARMOR_H__ */