summaryrefslogtreecommitdiff
path: root/pkcs11/gkm/gkm-sexp.h
blob: 0e44d80284f527a1f9c9548eb751ace21a48de5c (plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
 * gnome-keyring
 *
 * Copyright (C) 2008 Stefan Walter
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, see
 * <http://www.gnu.org/licenses/>.
 */

#ifndef GKM_SEXP_H_
#define GKM_SEXP_H_

#include <gcrypt.h>

#include <glib-object.h>

#include "gkm-types.h"

GkmSexp*       gkm_sexp_new           (gcry_sexp_t sexp);

GkmSexp*       gkm_sexp_ref           (GkmSexp *sexp);

void           gkm_sexp_unref         (gpointer sexp);

gcry_sexp_t    gkm_sexp_get           (GkmSexp *sexp);

#define        GKM_BOXED_SEXP         (gkm_sexp_boxed_type ())

GType          gkm_sexp_boxed_type    (void);


gboolean       gkm_sexp_parse_key                (gcry_sexp_t sexp,
                                                  int *algorithm,
                                                  gboolean *is_private,
                                                  gcry_sexp_t *numbers);

gboolean       gkm_sexp_key_to_public            (gcry_sexp_t sexp,
                                                  gcry_sexp_t *pub);

gboolean       gkm_sexp_extract_mpi              (gcry_sexp_t sexp,
                                                  gcry_mpi_t *mpi,
                                                  ...) G_GNUC_NULL_TERMINATED;

gboolean       gkm_sexp_extract_string           (gcry_sexp_t sexp,
                                                  gchar **buf,
                                                  ...) G_GNUC_NULL_TERMINATED;

gboolean       gkm_sexp_extract_buffer           (gcry_sexp_t sexp,
                                                  gchar **buf,
                                                  gsize *bufsize,
                                                  ...) G_GNUC_NULL_TERMINATED;

gcry_sexp_t    gkm_sexp_get_childv               (gcry_sexp_t sexp,
                                                  va_list va);

void           gkm_sexp_dump                     (gcry_sexp_t sexp);

#endif /* GKM_SEXP_H_ */