1 /* ksba-io-support.h - Supporting functions for ksba reader and writer
2 * Copyright (C) 2017 Werner Koch
4 * This file is part of GnuPG.
6 * This file is free software; you can redistribute it and/or modify
7 * it under the terms of either
9 * - the GNU Lesser General Public License as published by the Free
10 * Software Foundation; either version 3 of the License, or (at
11 * your option) any later version.
15 * - the GNU General Public License as published by the Free
16 * Software Foundation; either version 2 of the License, or (at
17 * your option) any later version.
19 * or both in parallel, as here.
21 * This file is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, see <https://www.gnu.org/licenses/>.
30 #ifndef GNUPG_KSBA_IO_SUPPORT_H
31 #define GNUPG_KSBA_IO_SUPPORT_H
33 /* Flags used with gnupg_ksba_create_reader and
34 * gnupg_ksba_create_writer. */
35 #define GNUPG_KSBA_IO_PEM 1 /* X.509 PEM format. */
36 #define GNUPG_KSBA_IO_BASE64 2 /* Plain Base64 format. */
37 #define GNUPG_KSBA_IO_AUTODETECT 4 /* Try to autodetect the format. */
38 #define GNUPG_KSBA_IO_MULTIPEM 8 /* Allow more than one PEM chunk. */
42 typedef struct gnupg_ksba_io_s *gnupg_ksba_io_t;
46 gpg_error_t gnupg_ksba_create_reader (gnupg_ksba_io_t *ctx,
49 ksba_reader_t *r_reader);
51 int gnupg_ksba_reader_eof_seen (gnupg_ksba_io_t ctx);
52 void gnupg_ksba_destroy_reader (gnupg_ksba_io_t ctx);
54 gpg_error_t gnupg_ksba_create_writer (gnupg_ksba_io_t *ctx,
58 ksba_writer_t *r_writer);
60 gpg_error_t gnupg_ksba_finish_writer (gnupg_ksba_io_t ctx);
61 void gnupg_ksba_destroy_writer (gnupg_ksba_io_t ctx);
66 #endif /*GNUPG_KSBA_IO_SUPPORT_H*/