summaryrefslogtreecommitdiffstats
path: root/lasso/xml/tools.h
blob: 79ae0cf61dbac1796147f0171fe0d647a5533925 (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
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
/* $Id$ 
 *
 * Lasso - A free implementation of the Liberty Alliance specifications.
 *
 * Copyright (C) 2004 Entr'ouvert
 * http://lasso.entrouvert.org
 * 
 * Authors: Nicolas Clapies <nclapies@entrouvert.com>
 *          Valery Febvre <vfebvre@easter-eggs.com>
 *
 * 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; either version 2 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 General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef __LASSO_TOOLS_H__
#define __LASSO_TOOLS_H__

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */ 

#include <glib-object.h>

#include <libxml/tree.h>
#include <xmlsec/crypto.h>

#include <lasso/export.h>
#include <lasso/xml/debug.h>

typedef enum {
  lassoSignatureMethodRsaSha1 = 1,
  lassoSignatureMethodDsaSha1
} lassoSignatureMethod;

typedef enum {
  lassoPemFileTypeUnknown = 0,
  lassoPemFileTypePubKey,
  lassoPemFileTypePrivateKey,
  lassoPemFileTypeCert
} lassoPemFileType;

LASSO_EXPORT xmlChar*          lasso_build_random_sequence                (guint8 size);

LASSO_EXPORT xmlChar*          lasso_build_unique_id                      (guint8 size);

LASSO_EXPORT xmlChar*          lasso_doc_get_node_content                 (xmlDocPtr      doc,
									   const xmlChar *name);

LASSO_EXPORT xmlChar*          lasso_g_ptr_array_index                    (GPtrArray *a,
									   guint      i);

LASSO_EXPORT gchar*            lasso_get_current_time                     (void);

LASSO_EXPORT GPtrArray*        lasso_query_get_value                      (const gchar   *query,
									   const xmlChar *param);

LASSO_EXPORT lassoPemFileType  lasso_get_pem_file_type                    (const gchar *pem_file);

LASSO_EXPORT xmlSecKeyPtr      lasso_get_public_key_from_pem_cert_file    (const gchar *pem_cert_file);

LASSO_EXPORT xmlSecKeysMngrPtr lasso_load_certs_from_pem_certs_chain_file (const gchar* pem_certs_chain_file);

LASSO_EXPORT GData*            lasso_query_to_dict                        (const gchar *query);

LASSO_EXPORT int               lasso_query_verify_signature               (const gchar   *query,
									   const xmlChar *sender_public_key_file,
									   const xmlChar *recipient_private_key_file);

LASSO_EXPORT xmlChar*          lasso_sha1                                 (xmlChar *str);

LASSO_EXPORT xmlChar*          lasso_str_escape                           (xmlChar *str);

LASSO_EXPORT xmlDocPtr         lasso_str_sign                             (xmlChar              *str,
									   lassoSignatureMethod  sign_method,
									   const char           *private_key_file);

LASSO_EXPORT xmlChar*          lasso_str_unescape                         (xmlChar *str);

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* __LASSO_TOOLS_H__ */