7
gSOAP XML Web services tools
8
Copyright (C) 2000-2005, Robert van Engelen, Genivia Inc., All Rights Reserved.
9
This part of the software is released under one of the following licenses:
10
GPL, the gSOAP public license, or Genivia's license for commercial use.
11
--------------------------------------------------------------------------------
14
The contents of this file are subject to the gSOAP Public License Version 1.3
15
(the "License"); you may not use this file except in compliance with the
16
License. You may obtain a copy of the License at
17
http://www.cs.fsu.edu/~engelen/soaplicense.html
18
Software distributed under the License is distributed on an "AS IS" basis,
19
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
20
for the specific language governing rights and limitations under the License.
22
The Initial Developer of the Original Code is Robert A. van Engelen.
23
Copyright (C) 2000-2005, Robert van Engelen, Genivia Inc., All Rights Reserved.
24
--------------------------------------------------------------------------------
27
This program is free software; you can redistribute it and/or modify it under
28
the terms of the GNU General Public License as published by the Free Software
29
Foundation; either version 2 of the License, or (at your option) any later
32
This program is distributed in the hope that it will be useful, but WITHOUT ANY
33
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
34
PARTICULAR PURPOSE. See the GNU General Public License for more details.
36
You should have received a copy of the GNU General Public License along with
37
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
38
Place, Suite 330, Boston, MA 02111-1307 USA
40
Author contact information:
41
engelen@genivia.com / engelen@acm.org
42
--------------------------------------------------------------------------------
43
A commercial use license is available from Genivia, Inc., contact@genivia.com
44
--------------------------------------------------------------------------------
50
/** plugin identification for plugin registry */
51
#define SOAP_WSSE_ID "SOAP-WSSE-1.1"
53
/** plugin identification for plugin registry */
54
extern const char soap_wsse_id[];
57
@struct soap_wsse_data
58
@brief wsseapi plugin data
60
The signature key (private) and verification key (public) are kept in the
61
plugin data, together with other info.
64
{ int sign_alg; /**< The digest or signature algorithm used */
65
const void *sign_key; /**< EVP_PKEY or key string for HMAC */
66
int sign_keylen; /**< HMAC key length */
67
int vrfy_alg; /**< The signature verify algorithm used */
68
const void *vrfy_key; /**< EVP_PKEY or key string for HMAC verify */
69
int vrfy_keylen; /**< HMAC key length */
70
struct soap_wsse_digest *digest; /**< List of ID-hash pairs */
71
int (*fprepareinit)(struct soap*);
72
int (*fpreparesend)(struct soap*, const char*, size_t);
73
int (*fpreparefinal)(struct soap*);
74
int (*fdisconnect)(struct soap*);
76
const void *(*security_token_handler)(struct soap *soap, int alg, int *keylen);
80
@struct soap_wsse_digest
81
@brief Digest dictionary: linked list of ID-hash pairs
83
The digest dictionary is populated by the soap_wsse_preparesend callback. The
84
callback intercepts XML elements with wsu:Id attributes and computes the digest
85
during the preprocessing of a message transmission. The 'level' field is used
86
to determine when the end of an element is reached by handling inner wsu:Id
87
attributed elements, so that the outer wsu:Id attributed element can be hashed.
89
struct soap_wsse_digest
90
{ struct soap_wsse_digest *next; /**< Next in list */
91
unsigned int level; /**< XML parser depth level */
92
struct soap_smd_data smd; /**< smdevp engine context */
93
unsigned char hash[SOAP_SMD_MAX_SIZE];/**< Digest hash value */
94
char id[1]; /**< String flows down the struct */
97
extern const char *wsse_PasswordTextURI;
98
extern const char *wsse_PasswordDigestURI;
99
extern const char *wsse_Base64BinaryURI;
100
extern const char *wsse_X509v3URI;
101
extern const char *wsse_X509v3SubjectKeyIdentifierURI;
103
extern const char *ds_sha1URI;
104
extern const char *ds_hmac_sha1URI;
105
extern const char *ds_dsa_sha1URI;
106
extern const char *ds_rsa_sha1URI;
108
extern const char *ds_URI;
109
extern const char *c14n_URI;
110
extern const char *wsu_URI;
112
struct _wsse__Security* soap_wsse_add_Security(struct soap *soap);
113
struct _wsse__Security* soap_wsse_add_Security_actor(struct soap *soap, const char *actor);
114
void soap_wsse_delete_Security(struct soap *soap);
115
struct _wsse__Security* soap_wsse_Security(struct soap *soap);
117
struct ds__SignatureType* soap_wsse_add_Signature(struct soap *soap);
118
void soap_wsse_delete_Signature(struct soap *soap);
119
struct ds__SignatureType* soap_wsse_Signature(struct soap *soap);
121
int soap_wsse_add_Timestamp(struct soap *soap, const char *id, time_t lifetime);
122
struct _wsu__Timestamp *soap_wsse_Timestamp(struct soap *soap);
123
int soap_wsse_verify_Timestamp(struct soap *soap);
125
int soap_wsse_add_UsernameTokenText(struct soap *soap, const char *id, const char *username, const char *password);
126
int soap_wsse_add_UsernameTokenDigest(struct soap *soap, const char *id, const char *username, const char *password);
127
struct _wsse__UsernameToken *soap_wsse_UsernameToken(struct soap *soap, const char *id);
128
const char* soap_wsse_get_Username(struct soap *soap);
129
int soap_wsse_verify_Password(struct soap *soap, const char *password);
131
int soap_wsse_add_BinarySecurityToken(struct soap *soap, const char *id, const char *valueType, const unsigned char *data, int size);
132
int soap_wsse_add_BinarySecurityTokenX509(struct soap *soap, const char *id, X509 *cert);
133
int soap_wsse_add_BinarySecurityTokenPEM(struct soap *soap, const char *id, const char *filename);
134
struct _wsse__BinarySecurityToken *soap_wsse_BinarySecurityToken(struct soap *soap, const char *id);
135
int soap_wsse_get_BinarySecurityToken(struct soap *soap, const char *id, char **valueType, unsigned char **data, int *size);
136
X509 *soap_wsse_get_BinarySecurityTokenX509(struct soap *soap, const char *id);
137
int soap_wsse_verify_X509(struct soap *soap, X509 *cert);
139
struct ds__SignedInfoType *soap_wsse_add_SignedInfo(struct soap *soap);
140
int soap_wsse_add_SignedInfo_Reference(struct soap *soap, const char *URI, const char *transform, const char *inclusiveNamespaces, const char *HA);
141
int soap_wsse_add_SignedInfo_SignatureMethod(struct soap *soap, const char *method, int canonical);
142
struct ds__SignedInfoType *soap_wsse_SignedInfo(struct soap *soap);
143
int soap_wsse_get_SignedInfo_SignatureMethod(struct soap *soap, int *alg);
145
int soap_wsse_add_SignatureValue(struct soap *soap, int alg, const void *key, int keylen);
146
int soap_wsse_verify_SignatureValue(struct soap *soap, int alg, const void *key, int keylen);
147
int soap_wsse_verify_SignedInfo(struct soap *soap);
148
int soap_wsse_verify_digest(struct soap *soap, int alg, int canonical, const char *id, unsigned char hash[SOAP_SMD_MAX_SIZE]);
150
struct ds__KeyInfoType *soap_wsse_add_KeyInfo(struct soap *soap);
151
struct ds__KeyInfoType *soap_wsse_KeyInfo(struct soap *soap);
153
int soap_wsse_add_KeyInfo_KeyName(struct soap *soap, const char *name);
154
const char *soap_wsse_get_KeyInfo_KeyName(struct soap *soap);
156
int soap_wsse_add_KeyInfo_SecurityTokenReferenceURI(struct soap *soap, const char *URI, const char *valueType);
157
int soap_wsse_add_KeyInfo_SecurityTokenReferenceX509(struct soap *soap, const char *URI);
158
const char *soap_wsse_get_KeyInfo_SecurityTokenReferenceURI(struct soap *soap);
159
const char *soap_wsse_get_KeyInfo_SecurityTokenReferenceValueType(struct soap *soap);
160
X509 *soap_wsse_get_KeyInfo_SecurityTokenReferenceX509(struct soap *soap);
162
int soap_wsse_add_KeyInfo_SecurityTokenReferenceKeyIdentifier(struct soap *soap, const char *id, const char *valueType, unsigned char *data, int size);
163
const char *soap_wsse_get_KeyInfo_SecurityTokenReferenceKeyIdentifierValueType(struct soap *soap);
164
const unsigned char *soap_wsse_get_KeyInfo_SecurityTokenReferenceKeyIdentifier(struct soap *soap, int *size);
166
int soap_wsse_add_KeyInfo_SecurityTokenReferenceEmbedded(struct soap *soap, const char *id, const char *valueType);
168
int soap_wsse_fault(struct soap *soap, enum wsse__FaultcodeEnum fault, const char *detail);
170
int soap_wsse(struct soap *soap, struct soap_plugin *p, void *arg);
172
int soap_wsse_sign(struct soap *soap, int alg, const void *key, int keylen);
173
int soap_wsse_sign_body(struct soap *soap, int alg, const void *key, int keylen);
174
int soap_wsse_verify_init(struct soap *soap);
175
int soap_wsse_verify_auto(struct soap *soap, int alg, const void *key, size_t keylen);
176
int soap_wsse_verify_done(struct soap *soap);
178
SOAP_FMAC1 void SOAP_FMAC2 soap_default_xsd__anyType(struct soap*, struct soap_dom_element *node);
179
SOAP_FMAC1 int SOAP_FMAC2 soap_out_xsd__anyType(struct soap *soap, const char *tag, int id, const struct soap_dom_element *node, const char *type);
180
SOAP_FMAC1 struct soap_dom_element * SOAP_FMAC2 soap_in_xsd__anyType(struct soap *soap, const char *tag, struct soap_dom_element *node, const char *type);