[gnome-keyring/dbus-api] [pkcs11] Rename current public and private key to 'xsa'
- From: Stefan Walter <stefw src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-keyring/dbus-api] [pkcs11] Rename current public and private key to 'xsa'
- Date: Sat, 14 Nov 2009 14:26:25 +0000 (UTC)
commit ae5fdc13a1ae81999a2f51c91b9e955605394f29
Author: Stef Walter <stef memberwebs com>
Date: Thu Nov 12 07:08:01 2009 +0000
[pkcs11] Rename current public and private key to 'xsa'
Rename GckPublicKey to GckPublicXsaKey and GckPrivateKey to
GckPrivateXsaKey to accomodate coming DH public and private
keys.
pkcs11/gck/Makefile.am | 4 +-
pkcs11/gck/gck-certificate-key.c | 2 +-
pkcs11/gck/gck-certificate-key.h | 6 +-
pkcs11/gck/gck-module.c | 8 +-
pkcs11/gck/gck-private-key.h | 67 -----
.../{gck-private-key.c => gck-private-xsa-key.c} | 258 +++++++++-----------
pkcs11/gck/gck-private-xsa-key.h | 67 +++++
pkcs11/gck/gck-public-key.h | 59 -----
.../gck/{gck-public-key.c => gck-public-xsa-key.c} | 214 ++++++----------
pkcs11/gck/gck-public-xsa-key.h | 60 +++++
pkcs11/gck/gck-types.h | 4 +-
pkcs11/ssh-store/gck-ssh-private-key.c | 10 +-
pkcs11/ssh-store/gck-ssh-private-key.h | 4 +-
pkcs11/ssh-store/gck-ssh-public-key.c | 4 +-
pkcs11/ssh-store/gck-ssh-public-key.h | 4 +-
pkcs11/user-store/gck-user-private-key.c | 8 +-
pkcs11/user-store/gck-user-private-key.h | 4 +-
pkcs11/user-store/gck-user-public-key.c | 6 +-
pkcs11/user-store/gck-user-public-key.h | 4 +-
19 files changed, 353 insertions(+), 440 deletions(-)
---
diff --git a/pkcs11/gck/Makefile.am b/pkcs11/gck/Makefile.am
index 5694ee6..3427ada 100644
--- a/pkcs11/gck/Makefile.am
+++ b/pkcs11/gck/Makefile.am
@@ -34,8 +34,8 @@ libgck_la_SOURCES = \
gck-memory-store.c gck-memory-store.h \
gck-module.c gck-module.h gck-module-ep.h \
gck-object.c gck-object.h \
- gck-private-key.c gck-private-key.h \
- gck-public-key.c gck-public-key.h \
+ gck-private-xsa-key.c gck-private-xsa-key.h \
+ gck-public-xsa-key.c gck-public-xsa-key.h \
gck-secret.c gck-secret.h \
gck-serializable.c gck-serializable.h \
gck-session.c gck-session.h \
diff --git a/pkcs11/gck/gck-certificate-key.c b/pkcs11/gck/gck-certificate-key.c
index 4874e98..cd2cda6 100644
--- a/pkcs11/gck/gck-certificate-key.c
+++ b/pkcs11/gck/gck-certificate-key.c
@@ -39,7 +39,7 @@ struct _GckCertificateKeyPrivate {
GckCertificate *certificate;
};
-G_DEFINE_TYPE (GckCertificateKey, gck_certificate_key, GCK_TYPE_PUBLIC_KEY);
+G_DEFINE_TYPE (GckCertificateKey, gck_certificate_key, GCK_TYPE_PUBLIC_XSA_KEY);
/* -----------------------------------------------------------------------------
* OBJECT
diff --git a/pkcs11/gck/gck-certificate-key.h b/pkcs11/gck/gck-certificate-key.h
index 7bac89c..bfccc16 100644
--- a/pkcs11/gck/gck-certificate-key.h
+++ b/pkcs11/gck/gck-certificate-key.h
@@ -24,7 +24,7 @@
#include <glib-object.h>
-#include "gck-public-key.h"
+#include "gck-public-xsa-key.h"
#include "gck-types.h"
#define GCK_TYPE_CERTIFICATE_KEY (gck_certificate_key_get_type ())
@@ -38,12 +38,12 @@ typedef struct _GckCertificateKeyClass GckCertificateKeyClass;
typedef struct _GckCertificateKeyPrivate GckCertificateKeyPrivate;
struct _GckCertificateKey {
- GckPublicKey parent;
+ GckPublicXsaKey parent;
GckCertificateKeyPrivate *pv;
};
struct _GckCertificateKeyClass {
- GckPublicKeyClass parent_class;
+ GckPublicXsaKeyClass parent_class;
};
GType gck_certificate_key_get_type (void);
diff --git a/pkcs11/gck/gck-module.c b/pkcs11/gck/gck-module.c
index d27a0a0..e23b8ce 100644
--- a/pkcs11/gck/gck-module.c
+++ b/pkcs11/gck/gck-module.c
@@ -32,8 +32,8 @@
#include "gck-manager.h"
#include "gck-memory-store.h"
#include "gck-module.h"
-#include "gck-private-key.h"
-#include "gck-public-key.h"
+#include "gck-private-xsa-key.h"
+#include "gck-public-xsa-key.h"
#include "gck-session.h"
#include "gck-store.h"
#include "gck-timer.h"
@@ -560,9 +560,9 @@ gck_module_init (GckModule *self)
self->pv->transient_objects = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, gck_util_dispose_unref);
/* Register session object factories */
- gck_module_register_factory (self, GCK_FACTORY_PRIVATE_KEY);
+ gck_module_register_factory (self, GCK_FACTORY_PRIVATE_XSA_KEY);
gck_module_register_factory (self, GCK_FACTORY_CERTIFICATE);
- gck_module_register_factory (self, GCK_FACTORY_PUBLIC_KEY);
+ gck_module_register_factory (self, GCK_FACTORY_PUBLIC_XSA_KEY);
gck_module_register_factory (self, GCK_FACTORY_CREDENTIAL);
}
diff --git a/pkcs11/gck/gck-private-key.c b/pkcs11/gck/gck-private-xsa-key.c
similarity index 70%
rename from pkcs11/gck/gck-private-key.c
rename to pkcs11/gck/gck-private-xsa-key.c
index 7d12c1c..fa310ad 100644
--- a/pkcs11/gck/gck-private-key.c
+++ b/pkcs11/gck/gck-private-xsa-key.c
@@ -1,22 +1,22 @@
-/*
+/*
* gnome-keyring
- *
+ *
* Copyright (C) 2008 Stefan Walter
- *
- * This program is free software; you can redistribute it and/or modify
+ *
+ * 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 Private
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 02111-1307, USA.
*/
#include "config.h"
@@ -26,19 +26,19 @@
#include "gck-attributes.h"
#include "gck-credential.h"
#include "gck-factory.h"
-#include "gck-private-key.h"
+#include "gck-private-xsa-key.h"
#include "gck-session.h"
#include "gck-transaction.h"
#include "gck-util.h"
-struct _GckPrivateKeyPrivate {
+struct _GckPrivateXsaKeyPrivate {
GckSexp *sexp;
};
-G_DEFINE_TYPE (GckPrivateKey, gck_private_key, GCK_TYPE_KEY);
+G_DEFINE_TYPE (GckPrivateXsaKey, gck_private_xsa_key, GCK_TYPE_KEY);
/* -----------------------------------------------------------------------------
- * INTERNAL
+ * INTERNAL
*/
@@ -53,26 +53,26 @@ create_rsa_private (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, gcry_sexp_t *skey)
gcry_mpi_t q = NULL;
gcry_mpi_t u = NULL;
CK_RV ret;
-
+
if (!gck_attributes_find_mpi (attrs, n_attrs, CKA_MODULUS, &n) ||
- !gck_attributes_find_mpi (attrs, n_attrs, CKA_PUBLIC_EXPONENT, &e) ||
- !gck_attributes_find_mpi (attrs, n_attrs, CKA_PRIVATE_EXPONENT, &d) ||
- !gck_attributes_find_mpi (attrs, n_attrs, CKA_PRIME_1, &p) ||
+ !gck_attributes_find_mpi (attrs, n_attrs, CKA_PUBLIC_EXPONENT, &e) ||
+ !gck_attributes_find_mpi (attrs, n_attrs, CKA_PRIVATE_EXPONENT, &d) ||
+ !gck_attributes_find_mpi (attrs, n_attrs, CKA_PRIME_1, &p) ||
!gck_attributes_find_mpi (attrs, n_attrs, CKA_PRIME_2, &q)) {
- ret = CKR_TEMPLATE_INCOMPLETE;
- goto done;
+ ret = CKR_TEMPLATE_INCOMPLETE;
+ goto done;
}
-
- /* Fix up the incoming key so gcrypt likes it */
+
+ /* Fix up the incoming key so gcrypt likes it */
if (gcry_mpi_cmp (p, q) > 0)
gcry_mpi_swap (p, q);
/* Compute U. */
u = gcry_mpi_snew (gcry_mpi_get_nbits (n));
gcry_mpi_invm (u, p, q);
-
- gcry = gcry_sexp_build (skey, NULL,
- "(private-key (rsa (n %m) (e %m) (d %m) (p %m) (q %m) (u %m)))",
+
+ gcry = gcry_sexp_build (skey, NULL,
+ "(private-key (rsa (n %m) (e %m) (d %m) (p %m) (q %m) (u %m)))",
n, e, d, p, q, u);
if (gcry != 0) {
@@ -80,9 +80,9 @@ create_rsa_private (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, gcry_sexp_t *skey)
ret = CKR_FUNCTION_FAILED;
goto done;
}
-
- gck_attributes_consume (attrs, n_attrs, CKA_MODULUS, CKA_PUBLIC_EXPONENT,
- CKA_PRIVATE_EXPONENT, CKA_PRIME_1, CKA_PRIME_2,
+
+ gck_attributes_consume (attrs, n_attrs, CKA_MODULUS, CKA_PUBLIC_EXPONENT,
+ CKA_PRIVATE_EXPONENT, CKA_PRIME_1, CKA_PRIME_2,
CKA_EXPONENT_1, CKA_EXPONENT_2, CKA_COEFFICIENT, G_MAXULONG);
ret = CKR_OK;
@@ -93,7 +93,7 @@ done:
gcry_mpi_release (p);
gcry_mpi_release (q);
gcry_mpi_release (u);
- return ret;
+ return ret;
}
static CK_RV
@@ -106,21 +106,21 @@ create_dsa_private (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, gcry_sexp_t *skey)
gcry_mpi_t y = NULL;
gcry_mpi_t value = NULL;
CK_RV ret;
-
+
if (!gck_attributes_find_mpi (attrs, n_attrs, CKA_PRIME, &p) ||
- !gck_attributes_find_mpi (attrs, n_attrs, CKA_SUBPRIME, &q) ||
+ !gck_attributes_find_mpi (attrs, n_attrs, CKA_SUBPRIME, &q) ||
!gck_attributes_find_mpi (attrs, n_attrs, CKA_BASE, &g) ||
!gck_attributes_find_mpi (attrs, n_attrs, CKA_VALUE, &value)) {
- ret = CKR_TEMPLATE_INCOMPLETE;
- goto done;
+ ret = CKR_TEMPLATE_INCOMPLETE;
+ goto done;
}
-
+
/* Calculate the public part from the private */
y = gcry_mpi_snew (gcry_mpi_get_nbits (value));
g_return_val_if_fail (y, CKR_GENERAL_ERROR);
- gcry_mpi_powm (y, g, value, p);
+ gcry_mpi_powm (y, g, value, p);
- gcry = gcry_sexp_build (skey, NULL,
+ gcry = gcry_sexp_build (skey, NULL,
"(private-key (dsa (p %m) (q %m) (g %m) (y %m) (x %m)))",
p, q, g, y, value);
@@ -130,7 +130,7 @@ create_dsa_private (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, gcry_sexp_t *skey)
goto done;
}
- gck_attributes_consume (attrs, n_attrs, CKA_PRIME, CKA_SUBPRIME,
+ gck_attributes_consume (attrs, n_attrs, CKA_PRIME, CKA_SUBPRIME,
CKA_BASE, CKA_VALUE, G_MAXULONG);
ret = CKR_OK;
@@ -144,21 +144,21 @@ done:
}
static void
-factory_create_private_key (GckSession *session, GckTransaction *transaction,
+factory_create_private_xsa_key (GckSession *session, GckTransaction *transaction,
CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, GckObject **object)
{
- GckPrivateKey *key;
+ GckPrivateXsaKey *key;
GckSexp *sexp;
-
+
g_return_if_fail (GCK_IS_TRANSACTION (transaction));
g_return_if_fail (attrs || !n_attrs);
g_return_if_fail (object);
- sexp = gck_private_key_create_sexp (session, transaction, attrs, n_attrs);
+ sexp = gck_private_xsa_key_create_sexp (session, transaction, attrs, n_attrs);
if (sexp == NULL)
return;
-
- key = g_object_new (GCK_TYPE_PRIVATE_KEY, "base-sexp", sexp,
+
+ key = g_object_new (GCK_TYPE_PRIVATE_XSA_KEY, "base-sexp", sexp,
"module", gck_session_get_module (session),
"manager", gck_manager_for_template (attrs, n_attrs, session),
NULL);
@@ -193,64 +193,64 @@ have_from_credential (GckCredential *cred, GckObject *object, gpointer unused)
}
/* -----------------------------------------------------------------------------
- * PRIVATE_KEY
+ * PRIVATE_XSA_KEY
*/
-static CK_RV
-gck_private_key_real_get_attribute (GckObject *base, GckSession *session, CK_ATTRIBUTE* attr)
+static CK_RV
+gck_private_xsa_key_real_get_attribute (GckObject *base, GckSession *session, CK_ATTRIBUTE* attr)
{
- GckPrivateKey *self = GCK_PRIVATE_KEY (base);
+ GckPrivateXsaKey *self = GCK_PRIVATE_XSA_KEY (base);
gboolean have;
-
+
switch (attr->type) {
case CKA_CLASS:
return gck_attribute_set_ulong (attr, CKO_PRIVATE_KEY);
-
+
case CKA_PRIVATE:
return gck_attribute_set_bool (attr, TRUE);
case CKA_SENSITIVE:
return gck_attribute_set_bool (attr, TRUE);
-
+
case CKA_DECRYPT:
- return gck_attribute_set_bool (attr, gck_key_get_algorithm (GCK_KEY (self)) == GCRY_PK_RSA);
-
+ return gck_attribute_set_bool (attr, gck_key_get_algorithm (GCK_KEY (self)) == GCRY_PK_RSA);
+
case CKA_SIGN:
return gck_attribute_set_bool (attr, TRUE);
-
+
case CKA_SIGN_RECOVER:
return gck_attribute_set_bool (attr, FALSE);
-
+
case CKA_UNWRAP:
return gck_attribute_set_bool (attr, FALSE);
-
+
case CKA_EXTRACTABLE:
return gck_attribute_set_bool (attr, FALSE);
-
+
case CKA_ALWAYS_SENSITIVE:
return gck_attribute_set_bool (attr, FALSE);
-
+
case CKA_NEVER_EXTRACTABLE:
return gck_attribute_set_bool (attr, FALSE);
-
+
case CKA_WRAP_WITH_TRUSTED:
return gck_attribute_set_bool (attr, FALSE);
-
+
case CKA_UNWRAP_TEMPLATE:
return CKR_ATTRIBUTE_TYPE_INVALID;
-
+
case CKA_ALWAYS_AUTHENTICATE:
have = self->pv->sexp ? TRUE : FALSE;
if (!have && session)
have = gck_session_for_each_credential (session, base, have_from_credential, NULL);
return gck_attribute_set_bool (attr, !have);
-
+
case CKA_MODULUS:
return gck_key_set_key_part (GCK_KEY (self), GCRY_PK_RSA, "n", attr);
-
+
case CKA_PUBLIC_EXPONENT:
return gck_key_set_key_part (GCK_KEY (self), GCRY_PK_RSA, "e", attr);
-
+
/* RSA private key parts */
case CKA_PRIVATE_EXPONENT:
case CKA_PRIME_1:
@@ -259,30 +259,30 @@ gck_private_key_real_get_attribute (GckObject *base, GckSession *session, CK_ATT
case CKA_EXPONENT_2:
case CKA_COEFFICIENT:
return CKR_ATTRIBUTE_SENSITIVE;
-
+
case CKA_PRIME:
return gck_key_set_key_part (GCK_KEY (self), GCRY_PK_DSA, "p", attr);
-
+
case CKA_SUBPRIME:
return gck_key_set_key_part (GCK_KEY (self), GCRY_PK_DSA, "q", attr);
-
+
case CKA_BASE:
return gck_key_set_key_part (GCK_KEY (self), GCRY_PK_DSA, "g", attr);
-
+
/* DSA private parts */
case CKA_VALUE:
return CKR_ATTRIBUTE_SENSITIVE;
- };
-
- return GCK_OBJECT_CLASS (gck_private_key_parent_class)->get_attribute (base, session, attr);
+ };
+
+ return GCK_OBJECT_CLASS (gck_private_xsa_key_parent_class)->get_attribute (base, session, attr);
}
static GckSexp*
-gck_private_key_real_acquire_crypto_sexp (GckKey *base, GckSession *session)
+gck_private_xsa_key_real_acquire_crypto_sexp (GckKey *base, GckSession *session)
{
- GckPrivateKey *self = GCK_PRIVATE_KEY (base);
+ GckPrivateXsaKey *self = GCK_PRIVATE_XSA_KEY (base);
GckSexp *sexp = NULL;
-
+
/* We have an unlocked private key here */
if (self->pv->sexp)
sexp = gck_sexp_ref (self->pv->sexp);
@@ -295,97 +295,60 @@ gck_private_key_real_acquire_crypto_sexp (GckKey *base, GckSession *session)
return sexp;
}
-static GObject*
-gck_private_key_constructor (GType type, guint n_props, GObjectConstructParam *props)
-{
- GckPrivateKey *self = GCK_PRIVATE_KEY (G_OBJECT_CLASS (gck_private_key_parent_class)->constructor(type, n_props, props));
- g_return_val_if_fail (self, NULL);
-
-
-
- return G_OBJECT (self);
-}
-
static void
-gck_private_key_init (GckPrivateKey *self)
+gck_private_xsa_key_init (GckPrivateXsaKey *self)
{
- self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GCK_TYPE_PRIVATE_KEY, GckPrivateKeyPrivate);
-
+ self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GCK_TYPE_PRIVATE_XSA_KEY, GckPrivateXsaKeyPrivate);
}
static void
-gck_private_key_dispose (GObject *obj)
+gck_private_xsa_key_dispose (GObject *obj)
{
- GckPrivateKey *self = GCK_PRIVATE_KEY (obj);
+ GckPrivateXsaKey *self = GCK_PRIVATE_XSA_KEY (obj);
if (self->pv->sexp)
gck_sexp_unref (self->pv->sexp);
self->pv->sexp = NULL;
- G_OBJECT_CLASS (gck_private_key_parent_class)->dispose (obj);
+ G_OBJECT_CLASS (gck_private_xsa_key_parent_class)->dispose (obj);
}
static void
-gck_private_key_finalize (GObject *obj)
+gck_private_xsa_key_finalize (GObject *obj)
{
- GckPrivateKey *self = GCK_PRIVATE_KEY (obj);
+ GckPrivateXsaKey *self = GCK_PRIVATE_XSA_KEY (obj);
g_assert (self->pv->sexp == NULL);
-
- G_OBJECT_CLASS (gck_private_key_parent_class)->finalize (obj);
-}
-
-static void
-gck_private_key_set_property (GObject *obj, guint prop_id, const GValue *value,
- GParamSpec *pspec)
-{
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
- break;
- }
-}
-static void
-gck_private_key_get_property (GObject *obj, guint prop_id, GValue *value,
- GParamSpec *pspec)
-{
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
- break;
- }
+ G_OBJECT_CLASS (gck_private_xsa_key_parent_class)->finalize (obj);
}
static void
-gck_private_key_class_init (GckPrivateKeyClass *klass)
+gck_private_xsa_key_class_init (GckPrivateXsaKeyClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GckObjectClass *gck_class = GCK_OBJECT_CLASS (klass);
GckKeyClass *key_class = GCK_KEY_CLASS (klass);
-
- gck_private_key_parent_class = g_type_class_peek_parent (klass);
- g_type_class_add_private (klass, sizeof (GckPrivateKeyPrivate));
-
- gobject_class->constructor = gck_private_key_constructor;
- gobject_class->dispose = gck_private_key_dispose;
- gobject_class->finalize = gck_private_key_finalize;
- gobject_class->set_property = gck_private_key_set_property;
- gobject_class->get_property = gck_private_key_get_property;
-
- gck_class->get_attribute = gck_private_key_real_get_attribute;
-
- key_class->acquire_crypto_sexp = gck_private_key_real_acquire_crypto_sexp;
+
+ gck_private_xsa_key_parent_class = g_type_class_peek_parent (klass);
+ g_type_class_add_private (klass, sizeof (GckPrivateXsaKeyPrivate));
+
+ gobject_class->dispose = gck_private_xsa_key_dispose;
+ gobject_class->finalize = gck_private_xsa_key_finalize;
+
+ gck_class->get_attribute = gck_private_xsa_key_real_get_attribute;
+
+ key_class->acquire_crypto_sexp = gck_private_xsa_key_real_acquire_crypto_sexp;
}
/* -----------------------------------------------------------------------------
- * PUBLIC
+ * PUBLIC
*/
void
-gck_private_key_set_unlocked_private (GckPrivateKey *self, GckSexp *sexp)
+gck_private_xsa_key_set_unlocked_private (GckPrivateXsaKey *self, GckSexp *sexp)
{
- g_return_if_fail (GCK_IS_PRIVATE_KEY (self));
+ g_return_if_fail (GCK_IS_PRIVATE_XSA_KEY (self));
g_return_if_fail (sexp);
if (sexp)
@@ -396,10 +359,10 @@ gck_private_key_set_unlocked_private (GckPrivateKey *self, GckSexp *sexp)
}
void
-gck_private_key_set_locked_private (GckPrivateKey *self, GckCredential *cred,
- GckSexp *sexp)
+gck_private_xsa_key_set_locked_private (GckPrivateXsaKey *self, GckCredential *cred,
+ GckSexp *sexp)
{
- g_return_if_fail (GCK_IS_PRIVATE_KEY (self));
+ g_return_if_fail (GCK_IS_PRIVATE_XSA_KEY (self));
g_return_if_fail (GCK_IS_CREDENTIAL (cred));
g_return_if_fail (gck_credential_get_object (cred) == GCK_OBJECT (self));
if (sexp != NULL)
@@ -408,24 +371,24 @@ gck_private_key_set_locked_private (GckPrivateKey *self, GckCredential *cred,
}
GckSexp*
-gck_private_key_create_sexp (GckSession *session, GckTransaction *transaction,
- CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
+gck_private_xsa_key_create_sexp (GckSession *session, GckTransaction *transaction,
+ CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
{
- CK_KEY_TYPE type;
- gcry_sexp_t sexp;
- CK_RV ret;
-
+ CK_KEY_TYPE type;
+ gcry_sexp_t sexp;
+ CK_RV ret;
+
g_return_val_if_fail (GCK_IS_TRANSACTION (transaction), NULL);
g_return_val_if_fail (attrs || !n_attrs, NULL);
-
+
if (!gck_attributes_find_ulong (attrs, n_attrs, CKA_KEY_TYPE, &type)) {
gck_transaction_fail (transaction, CKR_TEMPLATE_INCOMPLETE);
return NULL;
}
-
- gck_attributes_consume (attrs, n_attrs, CKA_KEY_TYPE, CKA_CLASS, G_MAXULONG);
- switch (type) {
+ gck_attributes_consume (attrs, n_attrs, CKA_KEY_TYPE, CKA_CLASS, G_MAXULONG);
+
+ switch (type) {
case CKK_RSA:
ret = create_rsa_private (attrs, n_attrs, &sexp);
break;
@@ -435,20 +398,19 @@ gck_private_key_create_sexp (GckSession *session, GckTransaction *transaction,
default:
ret = CKR_ATTRIBUTE_VALUE_INVALID;
break;
- };
+ };
-
if (ret != CKR_OK) {
gck_transaction_fail (transaction, ret);
return NULL;
}
-
+
g_return_val_if_fail (sexp, NULL);
return gck_sexp_new (sexp);
}
GckFactory*
-gck_private_key_get_factory (void)
+gck_private_xsa_key_get_factory (void)
{
static CK_OBJECT_CLASS klass = CKO_PRIVATE_KEY;
@@ -459,8 +421,8 @@ gck_private_key_get_factory (void)
static GckFactory factory = {
attributes,
G_N_ELEMENTS (attributes),
- factory_create_private_key
+ factory_create_private_xsa_key
};
-
+
return &factory;
}
diff --git a/pkcs11/gck/gck-private-xsa-key.h b/pkcs11/gck/gck-private-xsa-key.h
new file mode 100644
index 0000000..ddc2823
--- /dev/null
+++ b/pkcs11/gck/gck-private-xsa-key.h
@@ -0,0 +1,67 @@
+/*
+ * 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 Private
+ * 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 __GCK_PRIVATE_XSA_KEY_H__
+#define __GCK_PRIVATE_XSA_KEY_H__
+
+#include <glib-object.h>
+
+#include "gck-key.h"
+#include "gck-types.h"
+
+#define GCK_FACTORY_PRIVATE_XSA_KEY (gck_private_xsa_key_get_factory ())
+
+#define GCK_TYPE_PRIVATE_XSA_KEY (gck_private_xsa_key_get_type ())
+#define GCK_PRIVATE_XSA_KEY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCK_TYPE_PRIVATE_XSA_KEY, GckPrivateXsaKey))
+#define GCK_PRIVATE_XSA_KEY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCK_TYPE_PRIVATE_XSA_KEY, GckPrivateXsaKeyClass))
+#define GCK_IS_PRIVATE_XSA_KEY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCK_TYPE_PRIVATE_XSA_KEY))
+#define GCK_IS_PRIVATE_XSA_KEY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCK_TYPE_PRIVATE_XSA_KEY))
+#define GCK_PRIVATE_XSA_KEY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCK_TYPE_PRIVATE_XSA_KEY, GckPrivateXsaKeyClass))
+
+typedef struct _GckPrivateXsaKeyClass GckPrivateXsaKeyClass;
+typedef struct _GckPrivateXsaKeyPrivate GckPrivateXsaKeyPrivate;
+
+struct _GckPrivateXsaKey {
+ GckKey parent;
+ GckPrivateXsaKeyPrivate *pv;
+};
+
+struct _GckPrivateXsaKeyClass {
+ GckKeyClass parent_class;
+};
+
+GType gck_private_xsa_key_get_type (void);
+
+void gck_private_xsa_key_set_unlocked_private (GckPrivateXsaKey *self,
+ GckSexp *sexp);
+
+void gck_private_xsa_key_set_locked_private (GckPrivateXsaKey *self,
+ GckCredential *cred,
+ GckSexp *sexp);
+
+GckFactory* gck_private_xsa_key_get_factory (void);
+
+GckSexp* gck_private_xsa_key_create_sexp (GckSession *session,
+ GckTransaction *transaction,
+ CK_ATTRIBUTE_PTR attrs,
+ CK_ULONG n_attrs);
+
+#endif /* __GCK_PRIVATE_XSA_KEY_H__ */
diff --git a/pkcs11/gck/gck-public-key.c b/pkcs11/gck/gck-public-xsa-key.c
similarity index 65%
rename from pkcs11/gck/gck-public-key.c
rename to pkcs11/gck/gck-public-xsa-key.c
index f8a28a8..5cdd093 100644
--- a/pkcs11/gck/gck-public-key.c
+++ b/pkcs11/gck/gck-public-xsa-key.c
@@ -1,22 +1,22 @@
-/*
+/*
* gnome-keyring
- *
+ *
* Copyright (C) 2008 Stefan Walter
- *
- * This program is free software; you can redistribute it and/or modify
+ *
+ * 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 02111-1307, USA.
*/
#include "config.h"
@@ -26,34 +26,34 @@
#include "gck-attributes.h"
#include "gck-crypto.h"
#include "gck-factory.h"
-#include "gck-public-key.h"
+#include "gck-public-xsa-key.h"
#include "gck-session.h"
#include "gck-transaction.h"
#include "gck-util.h"
-G_DEFINE_TYPE (GckPublicKey, gck_public_key, GCK_TYPE_KEY);
+G_DEFINE_TYPE (GckPublicXsaKey, gck_public_xsa_key, GCK_TYPE_KEY);
/* -----------------------------------------------------------------------------
- * INTERNAL
+ * INTERNAL
*/
static CK_RV
-return_modulus_bits (GckPublicKey *self, CK_ATTRIBUTE_PTR attr)
+return_modulus_bits (GckPublicXsaKey *self, CK_ATTRIBUTE_PTR attr)
{
gcry_sexp_t numbers;
gcry_mpi_t mpi;
int algorithm;
CK_RV rv;
-
+
if (!gck_crypto_sexp_parse_key (gck_sexp_get (gck_key_get_base_sexp (GCK_KEY (self))),
&algorithm, NULL, &numbers))
g_return_val_if_reached (CKR_GENERAL_ERROR);
-
+
if (algorithm != GCRY_PK_RSA) {
gcry_sexp_release (numbers);
return CKR_ATTRIBUTE_TYPE_INVALID;
}
-
+
g_assert (numbers);
if (!gck_crypto_sexp_extract_mpi (numbers, &mpi, "n", NULL))
g_return_val_if_reached (CKR_GENERAL_ERROR);
@@ -72,15 +72,15 @@ create_rsa_public (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, gcry_sexp_t *skey)
gcry_mpi_t n = NULL;
gcry_mpi_t e = NULL;
CK_RV ret;
-
+
if (!gck_attributes_find_mpi (attrs, n_attrs, CKA_MODULUS, &n) ||
- !gck_attributes_find_mpi (attrs, n_attrs, CKA_PUBLIC_EXPONENT, &e)) {
- ret = CKR_TEMPLATE_INCOMPLETE;
- goto done;
+ !gck_attributes_find_mpi (attrs, n_attrs, CKA_PUBLIC_EXPONENT, &e)) {
+ ret = CKR_TEMPLATE_INCOMPLETE;
+ goto done;
}
-
- gcry = gcry_sexp_build (skey, NULL,
- "(public-key (rsa (n %m) (e %m)))",
+
+ gcry = gcry_sexp_build (skey, NULL,
+ "(public-key (rsa (n %m) (e %m)))",
n, e);
if (gcry != 0) {
@@ -88,14 +88,14 @@ create_rsa_public (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, gcry_sexp_t *skey)
ret = CKR_FUNCTION_FAILED;
goto done;
}
-
- gck_attributes_consume (attrs, n_attrs, CKA_MODULUS, CKA_PUBLIC_EXPONENT, CKA_MODULUS_BITS, G_MAXULONG);
+
+ gck_attributes_consume (attrs, n_attrs, CKA_MODULUS, CKA_PUBLIC_EXPONENT, CKA_MODULUS_BITS, G_MAXULONG);
ret = CKR_OK;
done:
gcry_mpi_release (n);
gcry_mpi_release (e);
- return ret;
+ return ret;
}
static CK_RV
@@ -107,16 +107,16 @@ create_dsa_public (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, gcry_sexp_t *skey)
gcry_mpi_t g = NULL;
gcry_mpi_t y = NULL;
CK_RV ret;
-
+
if (!gck_attributes_find_mpi (attrs, n_attrs, CKA_PRIME, &p) ||
- !gck_attributes_find_mpi (attrs, n_attrs, CKA_SUBPRIME, &q) ||
+ !gck_attributes_find_mpi (attrs, n_attrs, CKA_SUBPRIME, &q) ||
!gck_attributes_find_mpi (attrs, n_attrs, CKA_BASE, &g) ||
!gck_attributes_find_mpi (attrs, n_attrs, CKA_VALUE, &y)) {
- ret = CKR_TEMPLATE_INCOMPLETE;
- goto done;
+ ret = CKR_TEMPLATE_INCOMPLETE;
+ goto done;
}
-
- gcry = gcry_sexp_build (skey, NULL,
+
+ gcry = gcry_sexp_build (skey, NULL,
"(public-key (dsa (p %m) (q %m) (g %m) (y %m)))",
p, q, g, y);
@@ -126,7 +126,7 @@ create_dsa_public (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, gcry_sexp_t *skey)
goto done;
}
- gck_attributes_consume (attrs, n_attrs, CKA_PRIME, CKA_SUBPRIME,
+ gck_attributes_consume (attrs, n_attrs, CKA_PRIME, CKA_SUBPRIME,
CKA_BASE, CKA_VALUE, G_MAXULONG);
ret = CKR_OK;
@@ -139,18 +139,18 @@ done:
}
static void
-factory_create_public_key (GckSession *session, GckTransaction *transaction,
- CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, GckObject **object)
+factory_create_public_xsa_key (GckSession *session, GckTransaction *transaction,
+ CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, GckObject **object)
{
GckSexp *sexp;
-
+
g_return_if_fail (GCK_IS_TRANSACTION (transaction));
g_return_if_fail (attrs || !n_attrs);
g_return_if_fail (object);
- sexp = gck_public_key_create_sexp (session, transaction, attrs, n_attrs);
+ sexp = gck_public_xsa_key_create_sexp (session, transaction, attrs, n_attrs);
if (sexp != NULL) {
- *object = g_object_new (GCK_TYPE_PUBLIC_KEY, "base-sexp", sexp,
+ *object = g_object_new (GCK_TYPE_PUBLIC_XSA_KEY, "base-sexp", sexp,
"module", gck_session_get_module (session),
"manager", gck_manager_for_template (attrs, n_attrs, session),
NULL);
@@ -159,157 +159,107 @@ factory_create_public_key (GckSession *session, GckTransaction *transaction,
}
/* -----------------------------------------------------------------------------
- * PUBLIC_KEY
+ * PUBLIC_XSA_KEY
*/
-static CK_RV
-gck_public_key_real_get_attribute (GckObject *base, GckSession *session, CK_ATTRIBUTE* attr)
+static CK_RV
+gck_public_xsa_key_real_get_attribute (GckObject *base, GckSession *session, CK_ATTRIBUTE* attr)
{
- GckPublicKey *self = GCK_PUBLIC_KEY (base);
-
+ GckPublicXsaKey *self = GCK_PUBLIC_XSA_KEY (base);
+
switch (attr->type)
{
-
+
case CKA_CLASS:
return gck_attribute_set_ulong (attr, CKO_PUBLIC_KEY);
-
+
case CKA_ENCRYPT:
return gck_attribute_set_bool (attr, gck_key_get_algorithm (GCK_KEY (self)) == GCRY_PK_RSA);
-
+
case CKA_VERIFY:
return gck_attribute_set_bool (attr, TRUE);
-
+
case CKA_VERIFY_RECOVER:
return gck_attribute_set_bool (attr, FALSE);
-
+
case CKA_WRAP:
return gck_attribute_set_bool (attr, FALSE);
-
+
case CKA_TRUSTED:
return gck_attribute_set_bool (attr, FALSE);
-
+
case CKA_WRAP_TEMPLATE:
return CKR_ATTRIBUTE_TYPE_INVALID;
-
+
case CKA_MODULUS_BITS:
return return_modulus_bits (self, attr);
-
+
case CKA_MODULUS:
return gck_key_set_key_part (GCK_KEY (self), GCRY_PK_RSA, "n", attr);
-
+
case CKA_PUBLIC_EXPONENT:
return gck_key_set_key_part (GCK_KEY (self), GCRY_PK_RSA, "e", attr);
-
+
case CKA_PRIME:
return gck_key_set_key_part (GCK_KEY (self), GCRY_PK_DSA, "p", attr);
-
+
case CKA_SUBPRIME:
return gck_key_set_key_part (GCK_KEY (self), GCRY_PK_DSA, "q", attr);
-
+
case CKA_BASE:
return gck_key_set_key_part (GCK_KEY (self), GCRY_PK_DSA, "g", attr);
-
+
/* DSA public value */
case CKA_VALUE:
return gck_key_set_key_part (GCK_KEY (self), GCRY_PK_DSA, "y", attr);
};
-
- return GCK_OBJECT_CLASS (gck_public_key_parent_class)->get_attribute (base, session, attr);
+
+ return GCK_OBJECT_CLASS (gck_public_xsa_key_parent_class)->get_attribute (base, session, attr);
}
static GckSexp*
-gck_public_key_acquire_crypto_sexp (GckKey *self, GckSession *session)
+gck_public_xsa_key_acquire_crypto_sexp (GckKey *self, GckSession *session)
{
GckSexp* sexp;
-
+
sexp = gck_key_get_base_sexp (self);
if (sexp != NULL)
gck_sexp_ref (sexp);
-
- return sexp;
-}
-static GObject*
-gck_public_key_constructor (GType type, guint n_props, GObjectConstructParam *props)
-{
- GckPublicKey *self = GCK_PUBLIC_KEY (G_OBJECT_CLASS (gck_public_key_parent_class)->constructor(type, n_props, props));
- g_return_val_if_fail (self, NULL);
-
- return G_OBJECT (self);
+ return sexp;
}
static void
-gck_public_key_init (GckPublicKey *self)
+gck_public_xsa_key_init (GckPublicXsaKey *self)
{
}
static void
-gck_public_key_dispose (GObject *obj)
+gck_public_xsa_key_class_init (GckPublicXsaKeyClass *klass)
{
- G_OBJECT_CLASS (gck_public_key_parent_class)->dispose (obj);
-}
+ GckObjectClass *gck_class = GCK_OBJECT_CLASS (klass);
+ GckKeyClass *key_class = GCK_KEY_CLASS (klass);
-static void
-gck_public_key_finalize (GObject *obj)
-{
- G_OBJECT_CLASS (gck_public_key_parent_class)->finalize (obj);
-}
+ gck_public_xsa_key_parent_class = g_type_class_peek_parent (klass);
-static void
-gck_public_key_set_property (GObject *obj, guint prop_id, const GValue *value,
- GParamSpec *pspec)
-{
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
- break;
- }
-}
+ gck_class->get_attribute = gck_public_xsa_key_real_get_attribute;
-static void
-gck_public_key_get_property (GObject *obj, guint prop_id, GValue *value,
- GParamSpec *pspec)
-{
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
- break;
- }
-}
-
-static void
-gck_public_key_class_init (GckPublicKeyClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GckObjectClass *gck_class = GCK_OBJECT_CLASS (klass);
- GckKeyClass *key_class = GCK_KEY_CLASS (klass);
-
- gck_public_key_parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->constructor = gck_public_key_constructor;
- gobject_class->dispose = gck_public_key_dispose;
- gobject_class->finalize = gck_public_key_finalize;
- gobject_class->set_property = gck_public_key_set_property;
- gobject_class->get_property = gck_public_key_get_property;
-
- gck_class->get_attribute = gck_public_key_real_get_attribute;
-
- key_class->acquire_crypto_sexp = gck_public_key_acquire_crypto_sexp;
+ key_class->acquire_crypto_sexp = gck_public_xsa_key_acquire_crypto_sexp;
}
/* -----------------------------------------------------------------------------
- * PUBLIC
+ * PUBLIC
*/
GckSexp*
-gck_public_key_create_sexp (GckSession *session, GckTransaction *transaction,
- CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
+gck_public_xsa_key_create_sexp (GckSession *session, GckTransaction *transaction,
+ CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
{
- CK_KEY_TYPE type;
- gcry_sexp_t sexp;
- CK_RV ret;
-
+ CK_KEY_TYPE type;
+ gcry_sexp_t sexp;
+ CK_RV ret;
+
g_return_val_if_fail (GCK_IS_TRANSACTION (transaction), NULL);
g_return_val_if_fail (attrs || !n_attrs, NULL);
@@ -317,10 +267,10 @@ gck_public_key_create_sexp (GckSession *session, GckTransaction *transaction,
gck_transaction_fail (transaction, CKR_TEMPLATE_INCOMPLETE);
return NULL;
}
-
- gck_attributes_consume (attrs, n_attrs, CKA_KEY_TYPE, CKA_CLASS, G_MAXULONG);
- switch (type) {
+ gck_attributes_consume (attrs, n_attrs, CKA_KEY_TYPE, CKA_CLASS, G_MAXULONG);
+
+ switch (type) {
case CKK_RSA:
ret = create_rsa_public (attrs, n_attrs, &sexp);
break;
@@ -330,19 +280,19 @@ gck_public_key_create_sexp (GckSession *session, GckTransaction *transaction,
default:
ret = CKR_ATTRIBUTE_VALUE_INVALID;
break;
- };
+ };
if (ret != CKR_OK) {
gck_transaction_fail (transaction, ret);
return NULL;
}
-
+
g_return_val_if_fail (sexp, NULL);
return gck_sexp_new (sexp);
}
GckFactory*
-gck_public_key_get_factory (void)
+gck_public_xsa_key_get_factory (void)
{
static CK_OBJECT_CLASS klass = CKO_PUBLIC_KEY;
@@ -353,8 +303,8 @@ gck_public_key_get_factory (void)
static GckFactory factory = {
attributes,
G_N_ELEMENTS (attributes),
- factory_create_public_key
+ factory_create_public_xsa_key
};
-
+
return &factory;
}
diff --git a/pkcs11/gck/gck-public-xsa-key.h b/pkcs11/gck/gck-public-xsa-key.h
new file mode 100644
index 0000000..5cfd99a
--- /dev/null
+++ b/pkcs11/gck/gck-public-xsa-key.h
@@ -0,0 +1,60 @@
+/*
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef __GCK_PUBLIC_XSA_KEY_H__
+#define __GCK_PUBLIC_XSA_KEY_H__
+
+#include <glib-object.h>
+
+#include "gck-key.h"
+#include "gck-types.h"
+
+#define GCK_FACTORY_PUBLIC_XSA_KEY (gck_public_xsa_key_get_factory ())
+
+#define GCK_TYPE_PUBLIC_XSA_KEY (gck_public_xsa_key_get_type ())
+#define GCK_PUBLIC_XSA_KEY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCK_TYPE_PUBLIC_XSA_KEY, GckPublicXsaKey))
+#define GCK_PUBLIC_XSA_KEY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCK_TYPE_PUBLIC_XSA_KEY, GckPublicXsaKeyClass))
+#define GCK_IS_PUBLIC_XSA_KEY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCK_TYPE_PUBLIC_XSA_KEY))
+#define GCK_IS_PUBLIC_XSA_KEY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCK_TYPE_PUBLIC_XSA_KEY))
+#define GCK_PUBLIC_XSA_KEY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCK_TYPE_PUBLIC_XSA_KEY, GckPublicXsaKeyClass))
+
+typedef struct _GckPublicXsaKeyClass GckPublicXsaKeyClass;
+typedef struct _GckPublicXsaKeyPrivate GckPublicXsaKeyPrivate;
+
+struct _GckPublicXsaKey {
+ GckKey parent;
+ GckPublicXsaKeyPrivate *pv;
+};
+
+struct _GckPublicXsaKeyClass {
+ GckKeyClass parent_class;
+};
+
+GType gck_public_xsa_key_get_type (void);
+
+GckFactory* gck_public_xsa_key_get_factory (void);
+
+GckSexp* gck_public_xsa_key_create_sexp (GckSession *session,
+ GckTransaction *transaction,
+ CK_ATTRIBUTE_PTR attrs,
+ CK_ULONG n_attrs);
+
+#endif /* __GCK_PUBLIC_XSA_KEY_H__ */
diff --git a/pkcs11/gck/gck-types.h b/pkcs11/gck/gck-types.h
index 1b9f0a7..034214b 100644
--- a/pkcs11/gck/gck-types.h
+++ b/pkcs11/gck/gck-types.h
@@ -31,8 +31,8 @@ typedef struct _GckFactory GckFactory;
typedef struct _GckManager GckManager;
typedef struct _GckModule GckModule;
typedef struct _GckObject GckObject;
-typedef struct _GckPrivateKey GckPrivateKey;
-typedef struct _GckPublicKey GckPublicKey;
+typedef struct _GckPrivateXsaKey GckPrivateXsaKey;
+typedef struct _GckPublicXsaKey GckPublicXsaKey;
typedef struct _GckSecret GckSecret;
typedef struct _GckSession GckSession;
typedef struct _GckSessionPrivateKey GckSessionPrivateKey;
diff --git a/pkcs11/ssh-store/gck-ssh-private-key.c b/pkcs11/ssh-store/gck-ssh-private-key.c
index fdcbc5e..3b4a0d7 100644
--- a/pkcs11/ssh-store/gck-ssh-private-key.c
+++ b/pkcs11/ssh-store/gck-ssh-private-key.c
@@ -43,8 +43,8 @@ enum {
};
struct _GckSshPrivateKey {
- GckPrivateKey parent;
-
+ GckPrivateXsaKey parent;
+
GckSshPublicKey *pubkey;
gchar *label;
guchar *private_data;
@@ -53,7 +53,7 @@ struct _GckSshPrivateKey {
gboolean is_encrypted;
};
-G_DEFINE_TYPE (GckSshPrivateKey, gck_ssh_private_key, GCK_TYPE_PRIVATE_KEY);
+G_DEFINE_TYPE (GckSshPrivateKey, gck_ssh_private_key, GCK_TYPE_PRIVATE_XSA_KEY);
/* -----------------------------------------------------------------------------
* INTERNAL
@@ -126,7 +126,7 @@ realize_and_take_data (GckSshPrivateKey *self, gcry_sexp_t sexp, gchar *comment,
self->is_encrypted = TRUE;
if (unlock_private_key (self, "", 0, &wrapper) == CKR_OK) {
self->is_encrypted = FALSE;
- gck_private_key_set_unlocked_private (GCK_PRIVATE_KEY (self), wrapper);
+ gck_private_xsa_key_set_unlocked_private (GCK_PRIVATE_XSA_KEY (self), wrapper);
gck_sexp_unref (wrapper);
}
}
@@ -175,7 +175,7 @@ gck_ssh_private_key_unlock (GckObject *base, GckCredential *cred)
rv = unlock_private_key (self, password, n_password, &wrapper);
if (rv == CKR_OK) {
- gck_private_key_set_locked_private (GCK_PRIVATE_KEY (self), cred, wrapper);
+ gck_private_xsa_key_set_locked_private (GCK_PRIVATE_XSA_KEY (self), cred, wrapper);
gck_sexp_unref (wrapper);
}
diff --git a/pkcs11/ssh-store/gck-ssh-private-key.h b/pkcs11/ssh-store/gck-ssh-private-key.h
index 3cc95be..e5ca947 100644
--- a/pkcs11/ssh-store/gck-ssh-private-key.h
+++ b/pkcs11/ssh-store/gck-ssh-private-key.h
@@ -26,7 +26,7 @@
#include "gck-ssh-public-key.h"
-#include "gck/gck-private-key.h"
+#include "gck/gck-private-xsa-key.h"
#define GCK_TYPE_SSH_PRIVATE_KEY (gck_ssh_private_key_get_type ())
#define GCK_SSH_PRIVATE_KEY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCK_TYPE_SSH_PRIVATE_KEY, GckSshPrivateKey))
@@ -39,7 +39,7 @@ typedef struct _GckSshPrivateKey GckSshPrivateKey;
typedef struct _GckSshPrivateKeyClass GckSshPrivateKeyClass;
struct _GckSshPrivateKeyClass {
- GckPrivateKeyClass parent_class;
+ GckPrivateXsaKeyClass parent_class;
};
GType gck_ssh_private_key_get_type (void);
diff --git a/pkcs11/ssh-store/gck-ssh-public-key.c b/pkcs11/ssh-store/gck-ssh-public-key.c
index 34347ee..dce2be5 100644
--- a/pkcs11/ssh-store/gck-ssh-public-key.c
+++ b/pkcs11/ssh-store/gck-ssh-public-key.c
@@ -36,11 +36,11 @@ enum {
};
struct _GckSshPublicKey {
- GckPublicKey parent;
+ GckPublicXsaKey parent;
gchar *label;
};
-G_DEFINE_TYPE (GckSshPublicKey, gck_ssh_public_key, GCK_TYPE_PUBLIC_KEY);
+G_DEFINE_TYPE (GckSshPublicKey, gck_ssh_public_key, GCK_TYPE_PUBLIC_XSA_KEY);
/* -----------------------------------------------------------------------------
* OBJECT
diff --git a/pkcs11/ssh-store/gck-ssh-public-key.h b/pkcs11/ssh-store/gck-ssh-public-key.h
index 1d92098..6b17c24 100644
--- a/pkcs11/ssh-store/gck-ssh-public-key.h
+++ b/pkcs11/ssh-store/gck-ssh-public-key.h
@@ -24,7 +24,7 @@
#include <glib-object.h>
-#include "gck/gck-public-key.h"
+#include "gck/gck-public-xsa-key.h"
#define GCK_TYPE_SSH_PUBLIC_KEY (gck_ssh_public_key_get_type ())
#define GCK_SSH_PUBLIC_KEY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCK_TYPE_SSH_PUBLIC_KEY, GckSshPublicKey))
@@ -37,7 +37,7 @@ typedef struct _GckSshPublicKey GckSshPublicKey;
typedef struct _GckSshPublicKeyClass GckSshPublicKeyClass;
struct _GckSshPublicKeyClass {
- GckPublicKeyClass parent_class;
+ GckPublicXsaKeyClass parent_class;
};
GType gck_ssh_public_key_get_type (void);
diff --git a/pkcs11/user-store/gck-user-private-key.c b/pkcs11/user-store/gck-user-private-key.c
index eb08041..93ee0be 100644
--- a/pkcs11/user-store/gck-user-private-key.c
+++ b/pkcs11/user-store/gck-user-private-key.c
@@ -42,8 +42,8 @@ enum {
};
struct _GckUserPrivateKey {
- GckPrivateKey parent;
-
+ GckPrivateXsaKey parent;
+
guchar *private_data;
gsize n_private_data;
@@ -54,7 +54,7 @@ struct _GckUserPrivateKey {
static void gck_user_private_key_serializable (GckSerializableIface *iface);
-G_DEFINE_TYPE_EXTENDED (GckUserPrivateKey, gck_user_private_key, GCK_TYPE_PRIVATE_KEY, 0,
+G_DEFINE_TYPE_EXTENDED (GckUserPrivateKey, gck_user_private_key, GCK_TYPE_PRIVATE_XSA_KEY, 0,
G_IMPLEMENT_INTERFACE (GCK_TYPE_SERIALIZABLE, gck_user_private_key_serializable));
/* -----------------------------------------------------------------------------
@@ -71,7 +71,7 @@ factory_create_private_key (GckSession *session, GckTransaction *transaction,
g_return_if_fail (attrs || !n_attrs);
g_return_if_fail (object);
- sexp = gck_private_key_create_sexp (session, transaction, attrs, n_attrs);
+ sexp = gck_private_xsa_key_create_sexp (session, transaction, attrs, n_attrs);
if (sexp == NULL)
return;
diff --git a/pkcs11/user-store/gck-user-private-key.h b/pkcs11/user-store/gck-user-private-key.h
index 82dde14..3186fc8 100644
--- a/pkcs11/user-store/gck-user-private-key.h
+++ b/pkcs11/user-store/gck-user-private-key.h
@@ -27,7 +27,7 @@
#include "gck-user-private-key.h"
#include "gck/gck-secret.h"
-#include "gck/gck-private-key.h"
+#include "gck/gck-private-xsa-key.h"
#define GCK_FACTORY_USER_PRIVATE_KEY (gck_user_private_key_get_factory ())
@@ -42,7 +42,7 @@ typedef struct _GckUserPrivateKey GckUserPrivateKey;
typedef struct _GckUserPrivateKeyClass GckUserPrivateKeyClass;
struct _GckUserPrivateKeyClass {
- GckPrivateKeyClass parent_class;
+ GckPrivateXsaKeyClass parent_class;
};
GType gck_user_private_key_get_type (void);
diff --git a/pkcs11/user-store/gck-user-public-key.c b/pkcs11/user-store/gck-user-public-key.c
index 903a801..0eef087 100644
--- a/pkcs11/user-store/gck-user-public-key.c
+++ b/pkcs11/user-store/gck-user-public-key.c
@@ -34,12 +34,12 @@
#include <glib/gi18n.h>
struct _GckUserPublicKey {
- GckPublicKey parent;
+ GckPublicXsaKey parent;
};
static void gck_user_public_key_serializable (GckSerializableIface *iface);
-G_DEFINE_TYPE_EXTENDED (GckUserPublicKey, gck_user_public_key, GCK_TYPE_PUBLIC_KEY, 0,
+G_DEFINE_TYPE_EXTENDED (GckUserPublicKey, gck_user_public_key, GCK_TYPE_PUBLIC_XSA_KEY, 0,
G_IMPLEMENT_INTERFACE (GCK_TYPE_SERIALIZABLE, gck_user_public_key_serializable));
/* -----------------------------------------------------------------------------
@@ -55,7 +55,7 @@ factory_create_public_key (GckSession *session, GckTransaction *transaction,
g_return_if_fail (attrs || !n_attrs);
g_return_if_fail (object);
- sexp = gck_public_key_create_sexp (session, transaction, attrs, n_attrs);
+ sexp = gck_public_xsa_key_create_sexp (session, transaction, attrs, n_attrs);
if (sexp != NULL) {
*object = g_object_new (GCK_TYPE_USER_PUBLIC_KEY, "base-sexp", sexp,
"module", gck_session_get_module (session),
diff --git a/pkcs11/user-store/gck-user-public-key.h b/pkcs11/user-store/gck-user-public-key.h
index 0e289aa..89687bb 100644
--- a/pkcs11/user-store/gck-user-public-key.h
+++ b/pkcs11/user-store/gck-user-public-key.h
@@ -24,7 +24,7 @@
#include <glib-object.h>
-#include "gck/gck-public-key.h"
+#include "gck/gck-public-xsa-key.h"
#define GCK_FACTORY_USER_PUBLIC_KEY (gck_user_public_key_get_factory ())
@@ -39,7 +39,7 @@ typedef struct _GckUserPublicKey GckUserPublicKey;
typedef struct _GckUserPublicKeyClass GckUserPublicKeyClass;
struct _GckUserPublicKeyClass {
- GckPublicKeyClass parent_class;
+ GckPublicXsaKeyClass parent_class;
};
GType gck_user_public_key_get_type (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]