diff options
| author | Nicolas Clapies <nclapies@entrouvert.com> | 2005-12-06 12:54:30 +0000 |
|---|---|---|
| committer | Nicolas Clapies <nclapies@entrouvert.com> | 2005-12-06 12:54:30 +0000 |
| commit | e09892edad3db0b8aaf7700b631a008691e7364b (patch) | |
| tree | f17a7624d995d9af946c9ebd2023db88f3515315 | |
| parent | 0f0c06606df6f1bf16f11c10674b9405d549fedf (diff) | |
Only KeyValue in KeyInfo. Added KeyValue and RsaKeyValue element.
| -rw-r--r-- | lasso/xml/ds_key_info.c | 3 | ||||
| -rw-r--r-- | lasso/xml/ds_key_info.h | 3 | ||||
| -rw-r--r-- | lasso/xml/ds_key_value.c | 96 | ||||
| -rw-r--r-- | lasso/xml/ds_key_value.h | 70 | ||||
| -rw-r--r-- | lasso/xml/ds_rsa_key_value.c | 98 | ||||
| -rw-r--r-- | lasso/xml/ds_rsa_key_value.h | 70 |
6 files changed, 336 insertions, 4 deletions
diff --git a/lasso/xml/ds_key_info.c b/lasso/xml/ds_key_info.c index 377b9fa3..695f2b9d 100644 --- a/lasso/xml/ds_key_info.c +++ b/lasso/xml/ds_key_info.c @@ -33,8 +33,7 @@ /*****************************************************************************/ static struct XmlSnippet schema_snippets[] = { - { "KeyName", SNIPPET_CONTENT, G_STRUCT_OFFSET(LassoDsKeyInfo, KeyName) }, - { "KeyValue", SNIPPET_CONTENT, G_STRUCT_OFFSET(LassoDsKeyInfo, KeyValue) }, + { "KeyValue", SNIPPET_NODE, G_STRUCT_OFFSET(LassoDsKeyInfo, KeyValue) }, { NULL, 0, 0} }; diff --git a/lasso/xml/ds_key_info.h b/lasso/xml/ds_key_info.h index 4a00cd59..1bafd759 100644 --- a/lasso/xml/ds_key_info.h +++ b/lasso/xml/ds_key_info.h @@ -52,8 +52,7 @@ typedef struct _LassoDsKeyInfoClass LassoDsKeyInfoClass; struct _LassoDsKeyInfo { LassoNode parent; - char *KeyName; - char *KeyValue; + LassoDsKeyValue *KeyValue; }; struct _LassoDsKeyInfoClass { diff --git a/lasso/xml/ds_key_value.c b/lasso/xml/ds_key_value.c new file mode 100644 index 00000000..4fee49e9 --- /dev/null +++ b/lasso/xml/ds_key_value.c @@ -0,0 +1,96 @@ +/* $Id$ + * + * Lasso - A free implementation of the Samlerty Alliance specifications. + * + * Copyright (C) 2004, 2005 Entr'ouvert + * http://lasso.entrouvert.org + * + * Authors: See AUTHORS file in top-level directory. + * + * 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 + */ + +#include <lasso/xml/ds_key_value.h> + +/* + * + */ + +/*****************************************************************************/ +/* private methods */ +/*****************************************************************************/ + +static struct XmlSnippet schema_snippets[] = { + { "RSAKeyValue", SNIPPET_NODE, G_STRUCT_OFFSET(LassoDsKeyValue, RSAKeyValue) }, + { NULL, 0, 0} +}; + +/*****************************************************************************/ +/* instance and class init functions */ +/*****************************************************************************/ + +static void +instance_init(LassoDsKeyValue *node) +{ + node->RSAKeyValue = NULL; +} + +static void +class_init(LassoDsKeyValueClass *klass) +{ + LassoNodeClass *nclass = LASSO_NODE_CLASS(klass); + + nclass->node_data = g_new0(LassoNodeClassData, 1); + lasso_node_class_set_nodename(nclass, "KeyValue"); + lasso_node_class_set_ns(nclass, LASSO_DS_HREF, LASSO_DS_PREFIX); + lasso_node_class_add_snippets(nclass, schema_snippets); +} + +GType +lasso_ds_key_value_get_type() +{ + static GType this_type = 0; + + if (!this_type) { + static const GTypeInfo this_info = { + sizeof (LassoDsKeyValueClass), + NULL, + NULL, + (GClassInitFunc) class_init, + NULL, + NULL, + sizeof(LassoDsKeyValue), + 0, + (GInstanceInitFunc) instance_init, + }; + + this_type = g_type_register_static(LASSO_TYPE_NODE, + "LassoDsKeyValue", &this_info, 0); + } + return this_type; +} + +/** + * lasso_ds_key_value_new: + * + * Creates a new #LassoDsKeyValue object. + * + * Return value: a newly created #LassoDsKeyValue object + **/ +LassoDsKeyValue* +lasso_ds_key_value_new() +{ + return g_object_new(LASSO_TYPE_DS_KEY_VALUE, NULL); +} diff --git a/lasso/xml/ds_key_value.h b/lasso/xml/ds_key_value.h new file mode 100644 index 00000000..7def8bc6 --- /dev/null +++ b/lasso/xml/ds_key_value.h @@ -0,0 +1,70 @@ +/* $Id + * + * Lasso - A free implementation of the Liberty Alliance specifications. + * + * Copyright (C) 2004, 2005 Entr'ouvert + * http://lasso.entrouvert.org + * + * Authors: See AUTHORS file in top-level directory. + * + * 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_DS_KEY_VALUE_H__ +#define __LASSO_DS_KEY_VALUE_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include <lasso/xml/xml.h> +#include <lasso/xml/ds_rsa_key_value.h> + +#define LASSO_TYPE_DS_KEY_VALUE (lasso_ds_key_value_get_type()) +#define LASSO_DS_KEY_VALUE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_DS_KEY_VALUE, \ + LassoDsKeyValue)) +#define LASSO_DS_KEY_VALUE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_DS_KEY_VALUE, \ + LassoDsKeyValueClass)) +#define LASSO_IS_DS_KEY_VALUE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_DS_KEY_VALUE)) +#define LASSO_IS_DS_KEY_VALUE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_DS_KEY_VALUE)) +#define LASSO_DS_KEY_VALUE_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_DS_KEY_VALUE, \ + LassoDsKeyValueClass)) + +typedef struct _LassoDsKeyValue LassoDsKeyValue; +typedef struct _LassoDsKeyValueClass LassoDsKeyValueClass; + +struct _LassoDsKeyValue { + LassoNode parent; + + LassoDsRsaKeyValue *RSAKeyValue; +}; + +struct _LassoDsKeyValueClass { + LassoNodeClass parent; +}; + +LASSO_EXPORT GType lasso_ds_key_value_get_type(void); +LASSO_EXPORT LassoDsKeyValue* lasso_ds_key_value_new(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LASSO_DS_KEY_VALUE_H__ */ diff --git a/lasso/xml/ds_rsa_key_value.c b/lasso/xml/ds_rsa_key_value.c new file mode 100644 index 00000000..cdc01d1b --- /dev/null +++ b/lasso/xml/ds_rsa_key_value.c @@ -0,0 +1,98 @@ +/* $Id$ + * + * Lasso - A free implementation of the Samlerty Alliance specifications. + * + * Copyright (C) 2004, 2005 Entr'ouvert + * http://lasso.entrouvert.org + * + * Authors: See AUTHORS file in top-level directory. + * + * 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 + */ + +#include <lasso/xml/ds_rsa_key_value.h> + +/* + * + */ + +/*****************************************************************************/ +/* private methods */ +/*****************************************************************************/ + +static struct XmlSnippet schema_snippets[] = { + { "Modulus", SNIPPET_CONTENT, G_STRUCT_OFFSET(LassoDsRsaKeyValue, Modulus) }, + { "Exponent", SNIPPET_CONTENT, G_STRUCT_OFFSET(LassoDsRsaKeyValue, Exponent) }, + { NULL, 0, 0} +}; + +/*****************************************************************************/ +/* instance and class init functions */ +/*****************************************************************************/ + +static void +instance_init(LassoDsRsaKeyValue *node) +{ + node->Modulus = NULL; + node->Exponent = NULL; +} + +static void +class_init(LassoDsRsaKeyValueClass *klass) +{ + LassoNodeClass *nclass = LASSO_NODE_CLASS(klass); + + nclass->node_data = g_new0(LassoNodeClassData, 1); + lasso_node_class_set_nodename(nclass, "RsaKeyValue"); + lasso_node_class_set_ns(nclass, LASSO_DS_HREF, LASSO_DS_PREFIX); + lasso_node_class_add_snippets(nclass, schema_snippets); +} + +GType +lasso_ds_rsa_key_value_get_type() +{ + static GType this_type = 0; + + if (!this_type) { + static const GTypeInfo this_info = { + sizeof (LassoDsRsaKeyValueClass), + NULL, + NULL, + (GClassInitFunc) class_init, + NULL, + NULL, + sizeof(LassoDsRsaKeyValue), + 0, + (GInstanceInitFunc) instance_init, + }; + + this_type = g_type_register_static(LASSO_TYPE_NODE, + "LassoDsRsaKeyValue", &this_info, 0); + } + return this_type; +} + +/** + * lasso_ds_rsa_key_value_new: + * + * Creates a new #LassoDsRsaKeyValue object. + * + * Return value: a newly created #LassoDsRsaKeyValue object + **/ +LassoDsRsaKeyValue* +lasso_ds_rsa_key_value_new() +{ + return g_object_new(LASSO_TYPE_DS_RSA_KEY_VALUE, NULL); +} diff --git a/lasso/xml/ds_rsa_key_value.h b/lasso/xml/ds_rsa_key_value.h new file mode 100644 index 00000000..e0430563 --- /dev/null +++ b/lasso/xml/ds_rsa_key_value.h @@ -0,0 +1,70 @@ +/* $Id + * + * Lasso - A free implementation of the Liberty Alliance specifications. + * + * Copyright (C) 2004, 2005 Entr'ouvert + * http://lasso.entrouvert.org + * + * Authors: See AUTHORS file in top-level directory. + * + * 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_DS_RSA_KEY_VALUE_H__ +#define __LASSO_DS_RSA_KEY_VALUE_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include <lasso/xml/xml.h> + +#define LASSO_TYPE_DS_RSA_KEY_VALUE (lasso_ds_rsa_key_value_get_type()) +#define LASSO_DS_RSA_KEY_VALUE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_DS_RSA_KEY_VALUE, \ + LassoDsRsaKeyValue)) +#define LASSO_DS_RSA_KEY_VALUE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_DS_RSA_KEY_VALUE, \ + LassoDsRsaKeyValueClass)) +#define LASSO_IS_DS_RSA_KEY_VALUE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_DS_RSA_KEY_VALUE)) +#define LASSO_IS_DS_RSA_KEY_VALUE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_DS_RSA_KEY_VALUE)) +#define LASSO_DS_RSA_KEY_VALUE_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_DS_RSA_KEY_VALUE, \ + LassoDsRsaKeyValueClass)) + +typedef struct _LassoDsRsaKeyValue LassoDsRsaKeyValue; +typedef struct _LassoDsRsaKeyValueClass LassoDsRsaKeyValueClass; + +struct _LassoDsRsaKeyValue { + LassoNode parent; + + char *Modulus; + char *Exponent; +}; + +struct _LassoDsRsaKeyValueClass { + LassoNodeClass parent; +}; + +LASSO_EXPORT GType lasso_ds_rsa_key_value_get_type(void); +LASSO_EXPORT LassoDsRsaKeyValue* lasso_ds_rsa_key_value_new(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LASSO_DS_RSA_KEY_VALUE_H__ */ |
