1 /* der-encoder.h - Definitions for the Distinguished Encoding Rules Encoder
2 * Copyright (C) 2001, 2012 g10 Code GmbH
4 * This file is part of KSBA.
6 * KSBA 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 * KSBA is distributed in the hope that it will be useful, but WITHOUT
22 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
24 * License for more details.
26 * You should have received a copies of the GNU General Public License
27 * and the GNU Lesser General Public License along with this program;
28 * if not, see <http://www.gnu.org/licenses/>.
32 #define DER_ENCODER_H 1
34 #include "asn1-func.h"
37 typedef struct der_encoder_s *DerEncoder;
39 DerEncoder _ksba_der_encoder_new (void);
40 void _ksba_der_encoder_release (DerEncoder d);
42 gpg_error_t _ksba_der_encoder_set_module (DerEncoder d, ksba_asn_tree_t module);
43 gpg_error_t _ksba_der_encoder_set_writer (DerEncoder d, ksba_writer_t w);
46 gpg_error_t _ksba_der_write_integer (ksba_writer_t w,
47 const unsigned char *value);
48 gpg_error_t _ksba_der_write_algorithm_identifier (
49 ksba_writer_t w, const char *oid, const void *parm, size_t parmlen);
53 gpg_error_t _ksba_der_copy_tree (AsnNode dst,
54 AsnNode src, const unsigned char *srcimage);
58 gpg_error_t _ksba_der_store_time (AsnNode node, const ksba_isotime_t atime);
59 gpg_error_t _ksba_der_store_string (AsnNode node, const char *string);
60 gpg_error_t _ksba_der_store_integer (AsnNode node, const unsigned char *value);
61 gpg_error_t _ksba_der_store_oid (AsnNode node, const char *oid);
62 gpg_error_t _ksba_der_store_octet_string (AsnNode node,
63 const char *buf, size_t len);
64 gpg_error_t _ksba_der_store_sequence (AsnNode node,
65 const unsigned char *buf, size_t len);
66 gpg_error_t _ksba_der_store_null (AsnNode node);
69 gpg_error_t _ksba_der_encode_tree (AsnNode root,
70 unsigned char **r_image, size_t *r_imagelen);
74 #endif /*DER_ENCODER_H*/