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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* egg-asn1.h - ASN.1 helper routines
Copyright (C) 2007 Stefan Walter
The Gnome Keyring Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Gnome Keyring Library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Gnome Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Author: Stef Walter <stef@memberwebs.com>
*/
#ifndef EGG_ASN1_H_
#define EGG_ASN1_H_
#include <glib.h>
#include <libtasn1.h>
typedef void* (*EggAllocator) (void* p, gsize);
ASN1_TYPE egg_asn1_get_pk_asn1type (void);
ASN1_TYPE egg_asn1_get_pkix_asn1type (void);
ASN1_TYPE egg_asn1_decode (const gchar *type, const guchar *data,
gsize n_data);
guchar* egg_asn1_encode (ASN1_TYPE asn, const gchar* part,
gsize *len, EggAllocator alloc);
guchar* egg_asn1_read_value (ASN1_TYPE asn, const gchar *part,
gsize *len, EggAllocator alloc);
gboolean egg_asn1_write_value (ASN1_TYPE asn, const gchar *part,
const guchar* value, gsize len);
GQuark egg_asn1_read_oid (ASN1_TYPE asn, const gchar *part);
gboolean egg_asn1_write_oid (ASN1_TYPE asn, const gchar *part, GQuark val);
gboolean egg_asn1_read_boolean (ASN1_TYPE asn, const gchar *part, gboolean *val);
gboolean egg_asn1_read_uint (ASN1_TYPE asn, const gchar *part, guint *val);
gboolean egg_asn1_read_time (ASN1_TYPE asn, const gchar *part, time_t *val);
gboolean egg_asn1_read_date (ASN1_TYPE asn, const gchar *part, GDate *date);
const guchar* egg_asn1_read_content (ASN1_TYPE asn, const guchar *data, gsize n_data,
const gchar *part, gsize *n_content);
const guchar* egg_asn1_read_element (ASN1_TYPE asn, const guchar *data, gsize n_data,
const gchar *part, gsize *n_element);
gboolean egg_asn1_write_uint (ASN1_TYPE asn, const gchar *part, guint val);
gint egg_asn1_element_length (const guchar *data, gsize n_data);
const guchar* egg_asn1_element_content (const guchar *data, gsize n_data, gsize *n_content);
gchar* egg_asn1_read_dn (ASN1_TYPE asn, const gchar *part);
gchar* egg_asn1_read_dn_part (ASN1_TYPE asn, const gchar *part, const gchar *match);
glong egg_asn1_time_parse_utc (const gchar* value);
glong egg_asn1_time_parse_general (const gchar* value);
typedef void (*EggAsn1DnCallback) (guint index, GQuark oid, const guchar *value,
gsize n_value, gpointer user_data);
gboolean egg_asn1_dn_parse (ASN1_TYPE asn, const gchar *part,
EggAsn1DnCallback callback, gpointer user_data);
const gchar* egg_asn1_dn_oid_attr (GQuark oid);
const gchar* egg_asn1_dn_oid_desc (GQuark oid);
gchar* egg_asn1_dn_print_value (GQuark oid, const guchar *value, gsize n_value);
#endif /*EGG_ASN1_H_*/
|