[gnome-keyring/dbus-api] [gck, secret-store, user-store] Rename GckLogin to GckSecret.
- From: Stefan Walter <stefw src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-keyring/dbus-api] [gck, secret-store, user-store] Rename GckLogin to GckSecret.
- Date: Fri, 7 Aug 2009 19:48:57 +0000 (UTC)
commit 8204424b682dbf72f0bc307411a56a1df0af2628
Author: Stefan Walter <Stefan Walter>
Date: Fri Aug 7 19:48:18 2009 +0000
[gck, secret-store, user-store] Rename GckLogin to GckSecret.
We can use the GckLogin class for more stuff like holding keyring
secrets etc... Rename and fine tune methods.
pkcs11/gck/Makefile.am | 2 +-
pkcs11/gck/gck-authenticator.c | 18 ++--
pkcs11/gck/gck-authenticator.h | 4 +-
pkcs11/gck/gck-certificate.c | 4 +-
pkcs11/gck/gck-data-file.c | 26 +++---
pkcs11/gck/gck-data-file.h | 6 +-
pkcs11/gck/gck-login.c | 154 ---------------------------
pkcs11/gck/gck-login.h | 58 ----------
pkcs11/gck/gck-secret.c | 25 -----
pkcs11/gck/gck-serializable.c | 4 +-
pkcs11/gck/gck-serializable.h | 8 +-
pkcs11/gck/gck-types.h | 2 +-
pkcs11/gck/tests/Makefile.am | 2 +-
pkcs11/gck/tests/dump-data-file.c | 4 +-
pkcs11/gck/tests/unit-test-authenticator.c | 10 +-
pkcs11/gck/tests/unit-test-data-file.c | 4 +-
pkcs11/gck/tests/unit-test-secret.c | 109 ++++++++++++--------
pkcs11/secret-store/gck-secret-binary.c | 10 +-
pkcs11/secret-store/gck-secret-collection.c | 6 +-
pkcs11/secret-store/gck-secret-collection.h | 2 +-
pkcs11/secret-store/gck-secret-item.c | 24 ++--
pkcs11/secret-store/gck-secret-item.h | 4 +-
pkcs11/secret-store/gck-secret-textual.c | 10 +-
pkcs11/user-store/gck-user-module.c | 14 ++--
pkcs11/user-store/gck-user-private-key.c | 14 ++--
pkcs11/user-store/gck-user-private-key.h | 2 +-
pkcs11/user-store/gck-user-public-key.c | 4 +-
pkcs11/user-store/gck-user-storage.c | 22 ++--
pkcs11/user-store/gck-user-storage.h | 10 +-
29 files changed, 174 insertions(+), 388 deletions(-)
---
diff --git a/pkcs11/gck/Makefile.am b/pkcs11/gck/Makefile.am
index 37f532e..2238f2c 100644
--- a/pkcs11/gck/Makefile.am
+++ b/pkcs11/gck/Makefile.am
@@ -30,13 +30,13 @@ libgck_la_SOURCES = \
gck-factory.c gck-factory.h \
gck-file-tracker.c gck-file-tracker.h \
gck-key.c gck-key.h \
- gck-login.c gck-login.h \
gck-manager.c gck-manager.h \
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-secret.c gck-secret.h \
gck-serializable.c gck-serializable.h \
gck-session.c gck-session.h \
gck-sexp.c gck-sexp.h \
diff --git a/pkcs11/gck/gck-authenticator.c b/pkcs11/gck/gck-authenticator.c
index 5c0d7f5..8337795 100644
--- a/pkcs11/gck/gck-authenticator.c
+++ b/pkcs11/gck/gck-authenticator.c
@@ -23,7 +23,7 @@
#include "gck-attributes.h"
#include "gck-authenticator.h"
-#include "gck-login.h"
+#include "gck-secret.h"
#include "gck-session.h"
#include "gck-transaction.h"
@@ -43,7 +43,7 @@ struct _GckAuthenticatorPrivate {
GckObject *object;
/* Optional login */
- GckLogin *login;
+ GckSecret *login;
/* Can limit by number of uses remaining */
gint uses_remaining;
@@ -271,7 +271,7 @@ gck_authenticator_class_init (GckAuthenticatorClass *klass)
g_object_class_install_property (gobject_class, PROP_LOGIN,
g_param_spec_object ("login", "Login", "Optiontal login",
- GCK_TYPE_LOGIN, G_PARAM_READWRITE));
+ GCK_TYPE_SECRET, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, PROP_USES_REMAINING,
g_param_spec_int ("uses-remaining", "Uses Remaining", "Uses remaining",
@@ -305,14 +305,14 @@ gck_authenticator_create (GckObject *object, CK_UTF8CHAR_PTR pin,
CK_ULONG n_pin, GckAuthenticator **result)
{
GckAuthenticator *auth;
- GckLogin *login = NULL;
+ GckSecret *login = NULL;
CK_RV rv;
g_return_val_if_fail (GCK_IS_OBJECT (object), CKR_GENERAL_ERROR);
g_return_val_if_fail (result, CKR_GENERAL_ERROR);
if (pin != NULL)
- login = gck_login_new (pin, n_pin);
+ login = gck_secret_new_from_login (pin, n_pin);
auth = g_object_new (GCK_TYPE_AUTHENTICATOR,
"module", gck_object_get_module (object),
@@ -328,7 +328,7 @@ gck_authenticator_create (GckObject *object, CK_UTF8CHAR_PTR pin,
return rv;
}
-GckLogin*
+GckSecret*
gck_authenticator_get_login (GckAuthenticator *self)
{
g_return_val_if_fail (GCK_IS_AUTHENTICATOR (self), NULL);
@@ -336,12 +336,12 @@ gck_authenticator_get_login (GckAuthenticator *self)
}
void
-gck_authenticator_set_login (GckAuthenticator *self, GckLogin *login)
+gck_authenticator_set_login (GckAuthenticator *self, GckSecret *login)
{
g_return_if_fail (GCK_IS_AUTHENTICATOR (self));
if (login) {
- g_return_if_fail (GCK_IS_LOGIN (login));
+ g_return_if_fail (GCK_IS_SECRET (login));
g_object_ref (login);
}
if (self->pv->login)
@@ -362,7 +362,7 @@ gck_authenticator_get_password (GckAuthenticator *self, gsize *n_password)
return NULL;
}
- return gck_login_get_password (self->pv->login, n_password);
+ return gck_secret_get_password (self->pv->login, n_password);
}
GckObject*
diff --git a/pkcs11/gck/gck-authenticator.h b/pkcs11/gck/gck-authenticator.h
index e2d75a8..de63d93 100644
--- a/pkcs11/gck/gck-authenticator.h
+++ b/pkcs11/gck/gck-authenticator.h
@@ -57,10 +57,10 @@ CK_RV gck_authenticator_create (GckObject *
CK_ULONG n_pin,
GckAuthenticator **result);
-GckLogin* gck_authenticator_get_login (GckAuthenticator *self);
+GckSecret* gck_authenticator_get_login (GckAuthenticator *self);
void gck_authenticator_set_login (GckAuthenticator *self,
- GckLogin *login);
+ GckSecret *login);
const gchar* gck_authenticator_get_password (GckAuthenticator *self,
gsize *n_password);
diff --git a/pkcs11/gck/gck-certificate.c b/pkcs11/gck/gck-certificate.c
index a3b4c41..100af10 100644
--- a/pkcs11/gck/gck-certificate.c
+++ b/pkcs11/gck/gck-certificate.c
@@ -517,7 +517,7 @@ gck_certificate_class_init (GckCertificateClass *klass)
}
static gboolean
-gck_certificate_real_load (GckSerializable *base, GckLogin *login, const guchar *data, gsize n_data)
+gck_certificate_real_load (GckSerializable *base, GckSecret *login, const guchar *data, gsize n_data)
{
GckCertificate *self = GCK_CERTIFICATE (base);
ASN1_TYPE asn1 = ASN1_TYPE_EMPTY;
@@ -573,7 +573,7 @@ gck_certificate_real_load (GckSerializable *base, GckLogin *login, const guchar
}
static gboolean
-gck_certificate_real_save (GckSerializable *base, GckLogin *login, guchar **data, gsize *n_data)
+gck_certificate_real_save (GckSerializable *base, GckSecret *login, guchar **data, gsize *n_data)
{
GckCertificate *self = GCK_CERTIFICATE (base);
diff --git a/pkcs11/gck/gck-data-file.c b/pkcs11/gck/gck-data-file.c
index ebb8c1f..e4e8c27 100644
--- a/pkcs11/gck/gck-data-file.c
+++ b/pkcs11/gck/gck-data-file.c
@@ -78,7 +78,7 @@ G_DEFINE_TYPE (GckDataFile, gck_data_file, G_TYPE_OBJECT);
#define PUBLIC_ALLOC (EggBufferAllocator)g_realloc
#define PRIVATE_ALLOC (EggBufferAllocator)egg_secure_realloc
-typedef GckDataResult (*BlockFunc) (guint block, EggBuffer *buffer, GckLogin *login, gpointer user_data);
+typedef GckDataResult (*BlockFunc) (guint block, EggBuffer *buffer, GckSecret *login, gpointer user_data);
#define FILE_HEADER ((const guchar*)"Gnome Keyring Store 2\n\r\0")
#define FILE_HEADER_LEN 24
@@ -178,7 +178,7 @@ write_all_bytes (int fd, const guchar *buf, gsize len)
}
static GckDataResult
-parse_file_blocks (int file, BlockFunc block_func, GckLogin *login, gpointer user_data)
+parse_file_blocks (int file, BlockFunc block_func, GckSecret *login, gpointer user_data)
{
gchar header[FILE_HEADER_LEN];
GckDataResult res;
@@ -337,7 +337,7 @@ validate_buffer (EggBuffer *buffer, gsize *offset)
}
static gboolean
-create_cipher (GckLogin *login, int calgo, int halgo, const guchar *salt,
+create_cipher (GckSecret *login, int calgo, int halgo, const guchar *salt,
gsize n_salt, guint iterations, gcry_cipher_hd_t *cipher)
{
gsize n_key, n_block;
@@ -360,10 +360,10 @@ create_cipher (GckLogin *login, int calgo, int halgo, const guchar *salt,
g_return_val_if_fail (key, FALSE);
iv = g_malloc0 (n_block);
- password = gck_login_get_password (login, &n_password);
+ password = gck_secret_get_password (login, &n_password);
if (!egg_symkey_generate_simple (calgo, halgo, password, n_password,
- salt, n_salt, iterations, &key, &iv)) {
+ salt, n_salt, iterations, &key, &iv)) {
gcry_free (key);
g_free (iv);
return FALSE;
@@ -389,7 +389,7 @@ create_cipher (GckLogin *login, int calgo, int halgo, const guchar *salt,
}
static gboolean
-encrypt_buffer (EggBuffer *input, GckLogin *login, EggBuffer *output)
+encrypt_buffer (EggBuffer *input, GckSecret *login, EggBuffer *output)
{
gcry_cipher_hd_t cipher;
gcry_error_t gcry;
@@ -455,7 +455,7 @@ encrypt_buffer (EggBuffer *input, GckLogin *login, EggBuffer *output)
}
static gboolean
-decrypt_buffer (EggBuffer *input, gsize *offset, GckLogin *login, EggBuffer *output)
+decrypt_buffer (EggBuffer *input, gsize *offset, GckSecret *login, EggBuffer *output)
{
gcry_cipher_hd_t cipher;
gcry_error_t gcry;
@@ -634,7 +634,7 @@ update_from_public_block (GckDataFile *self, EggBuffer *buffer)
}
static GckDataResult
-update_from_private_block (GckDataFile *self, EggBuffer *buffer, GckLogin *login)
+update_from_private_block (GckDataFile *self, EggBuffer *buffer, GckSecret *login)
{
EggBuffer custom;
GckDataResult res;
@@ -659,7 +659,7 @@ update_from_private_block (GckDataFile *self, EggBuffer *buffer, GckLogin *login
egg_buffer_init_full (&custom, 1024, egg_secure_realloc);
/* Decrypt the buffer */
- password = gck_login_get_password (login, &n_password);
+ password = gck_secret_get_password (login, &n_password);
if (!decrypt_buffer (buffer, &offset, login, &custom)) {
egg_buffer_uninit (&custom);
return GCK_DATA_FAILURE;
@@ -769,7 +769,7 @@ update_from_index_block (GckDataFile *self, EggBuffer *buffer)
}
static GckDataResult
-update_from_any_block (guint block, EggBuffer *buffer, GckLogin *login, gpointer user_data)
+update_from_any_block (guint block, EggBuffer *buffer, GckSecret *login, gpointer user_data)
{
UnknownBlock *unknown;
GckDataFile *self;
@@ -860,7 +860,7 @@ write_entries_to_block (GckDataFile *self, GHashTable *entries, EggBuffer *buffe
}
static GckDataResult
-write_private_to_block (GckDataFile *self, EggBuffer *buffer, GckLogin *login)
+write_private_to_block (GckDataFile *self, EggBuffer *buffer, GckSecret *login)
{
EggBuffer secure;
GckDataResult res;
@@ -1136,7 +1136,7 @@ gck_data_file_new (void)
}
GckDataResult
-gck_data_file_read_fd (GckDataFile *self, int fd, GckLogin *login)
+gck_data_file_read_fd (GckDataFile *self, int fd, GckSecret *login)
{
GckDataResult res;
@@ -1185,7 +1185,7 @@ gck_data_file_read_fd (GckDataFile *self, int fd, GckLogin *login)
}
GckDataResult
-gck_data_file_write_fd (GckDataFile *self, int fd, GckLogin *login)
+gck_data_file_write_fd (GckDataFile *self, int fd, GckSecret *login)
{
guint types[3] = { FILE_BLOCK_INDEX, FILE_BLOCK_PRIVATE, FILE_BLOCK_PUBLIC };
GList *unknowns, *unk;
diff --git a/pkcs11/gck/gck-data-file.h b/pkcs11/gck/gck-data-file.h
index bee4524..40f342e 100644
--- a/pkcs11/gck/gck-data-file.h
+++ b/pkcs11/gck/gck-data-file.h
@@ -25,7 +25,7 @@
#include <glib-object.h>
#include "gck-data-types.h"
-#include "gck-login.h"
+#include "gck-secret.h"
enum {
GCK_DATA_FILE_SECTION_PUBLIC = 0x01,
@@ -62,11 +62,11 @@ GckDataFile* gck_data_file_new (void);
GckDataResult gck_data_file_read_fd (GckDataFile *self,
int fd,
- GckLogin *login);
+ GckSecret *login);
GckDataResult gck_data_file_write_fd (GckDataFile *self,
int fd,
- GckLogin *login);
+ GckSecret *login);
gboolean gck_data_file_have_section (GckDataFile *self,
guint section);
diff --git a/pkcs11/gck/gck-secret.c b/pkcs11/gck/gck-secret.c
index 31e5a41..099a6f9 100644
--- a/pkcs11/gck/gck-secret.c
+++ b/pkcs11/gck/gck-secret.c
@@ -69,36 +69,11 @@ gck_secret_finalize (GObject *obj)
}
static void
-gck_secret_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_secret_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_secret_class_init (GckSecretClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
gobject_class->dispose = gck_secret_dispose;
gobject_class->finalize = gck_secret_finalize;
- gobject_class->set_property = gck_secret_set_property;
- gobject_class->get_property = gck_secret_get_property;
}
/* -----------------------------------------------------------------------------
diff --git a/pkcs11/gck/gck-serializable.c b/pkcs11/gck/gck-serializable.c
index b8933c3..ef42505 100644
--- a/pkcs11/gck/gck-serializable.c
+++ b/pkcs11/gck/gck-serializable.c
@@ -63,7 +63,7 @@ gck_serializable_get_type (void)
}
gboolean
-gck_serializable_load (GckSerializable *self, GckLogin *login, const guchar *data, gsize n_data)
+gck_serializable_load (GckSerializable *self, GckSecret *login, const guchar *data, gsize n_data)
{
g_return_val_if_fail (GCK_IS_SERIALIZABLE (self), FALSE);
g_return_val_if_fail (GCK_SERIALIZABLE_GET_INTERFACE (self)->load, FALSE);
@@ -71,7 +71,7 @@ gck_serializable_load (GckSerializable *self, GckLogin *login, const guchar *dat
}
gboolean
-gck_serializable_save (GckSerializable *self, GckLogin *login, guchar **data, gsize *n_data)
+gck_serializable_save (GckSerializable *self, GckSecret *login, guchar **data, gsize *n_data)
{
g_return_val_if_fail (GCK_IS_SERIALIZABLE (self), FALSE);
g_return_val_if_fail (GCK_SERIALIZABLE_GET_INTERFACE (self)->save, FALSE);
diff --git a/pkcs11/gck/gck-serializable.h b/pkcs11/gck/gck-serializable.h
index 585076e..f19878c 100644
--- a/pkcs11/gck/gck-serializable.h
+++ b/pkcs11/gck/gck-serializable.h
@@ -41,20 +41,20 @@ struct _GckSerializableIface {
const gchar *extension;
- gboolean (*load) (GckSerializable *self, GckLogin *login, const guchar *data, gsize n_data);
+ gboolean (*load) (GckSerializable *self, GckSecret *login, const guchar *data, gsize n_data);
- gboolean (*save) (GckSerializable *self, GckLogin *login, guchar **data, gsize *n_data);
+ gboolean (*save) (GckSerializable *self, GckSecret *login, guchar **data, gsize *n_data);
};
GType gck_serializable_get_type (void) G_GNUC_CONST;
gboolean gck_serializable_load (GckSerializable *self,
- GckLogin *login,
+ GckSecret *login,
const guchar *data,
gsize n_data);
gboolean gck_serializable_save (GckSerializable *self,
- GckLogin *login,
+ GckSecret *login,
guchar** data,
gsize *n_data);
diff --git a/pkcs11/gck/gck-types.h b/pkcs11/gck/gck-types.h
index ea27e6d..38cec60 100644
--- a/pkcs11/gck/gck-types.h
+++ b/pkcs11/gck/gck-types.h
@@ -28,12 +28,12 @@ typedef struct _GckCertificateKey GckCertificateKey;
typedef struct _GckCertificateTrust GckCertificateTrust;
typedef struct _GckKey GckKey;
typedef struct _GckFactoryInfo GckFactoryInfo;
-typedef struct _GckLogin GckLogin;
typedef struct _GckManager GckManager;
typedef struct _GckModule GckModule;
typedef struct _GckObject GckObject;
typedef struct _GckPrivateKey GckPrivateKey;
typedef struct _GckPublicKey GckPublicKey;
+typedef struct _GckSecret GckSecret;
typedef struct _GckSession GckSession;
typedef struct _GckSessionPrivateKey GckSessionPrivateKey;
typedef struct _GckSessionPublicKey GckSessionPublicKey;
diff --git a/pkcs11/gck/tests/Makefile.am b/pkcs11/gck/tests/Makefile.am
index 96fe68e..f72b940 100644
--- a/pkcs11/gck/tests/Makefile.am
+++ b/pkcs11/gck/tests/Makefile.am
@@ -17,7 +17,7 @@ UNIT_AUTO = \
unit-test-transaction.c \
unit-test-store.c \
unit-test-memory-store.c \
- unit-test-login.c \
+ unit-test-secret.c \
unit-test-data-file.c \
unit-test-file-tracker.c \
mock-locked-object.c mock-locked-object.h \
diff --git a/pkcs11/gck/tests/dump-data-file.c b/pkcs11/gck/tests/dump-data-file.c
index 0882b8e..32e3bde 100644
--- a/pkcs11/gck/tests/dump-data-file.c
+++ b/pkcs11/gck/tests/dump-data-file.c
@@ -60,7 +60,7 @@ main(int argc, char* argv[])
const gchar *password;
GckDataResult res;
GckDataFile *file;
- GckLogin *login;
+ GckSecret *login;
int fd;
g_type_init ();
@@ -74,7 +74,7 @@ main(int argc, char* argv[])
failure ("dump-data-file: couldn't open file: %s: %s", argv[1], g_strerror (errno));
password = getpass ("Password: ");
- login = gck_login_new ((guchar*)password, strlen (password));
+ login = gck_secret_new ((guchar*)password, strlen (password));
file = gck_data_file_new ();
res = gck_data_file_read_fd (file, fd, login);
diff --git a/pkcs11/gck/tests/unit-test-authenticator.c b/pkcs11/gck/tests/unit-test-authenticator.c
index ff2fe14..33b3507 100644
--- a/pkcs11/gck/tests/unit-test-authenticator.c
+++ b/pkcs11/gck/tests/unit-test-authenticator.c
@@ -27,8 +27,8 @@
#include "gck/gck-attributes.h"
#include "gck/gck-authenticator.h"
-#include "gck/gck-login.h"
#include "gck/gck-object.h"
+#include "gck/gck-secret.h"
#include "gck/gck-session.h"
#include "gck/gck-module.h"
@@ -223,7 +223,7 @@ DEFINE_TEST(authenticator_object_property)
DEFINE_TEST(authenticator_login_property)
{
GckAuthenticator *auth;
- GckLogin *check, *login;
+ GckSecret *check, *login;
const gchar *password;
gsize n_password;
CK_RV rv;
@@ -234,7 +234,7 @@ DEFINE_TEST(authenticator_login_property)
g_object_get (auth, "login", &check, NULL);
g_assert (check);
- password = gck_login_get_password (check, &n_password);
+ password = gck_secret_get_password (check, &n_password);
g_assert (n_password == 4);
g_assert (memcmp (password, "mock", 4) == 0);
g_object_unref (check);
@@ -242,8 +242,8 @@ DEFINE_TEST(authenticator_login_property)
check = gck_authenticator_get_login (auth);
g_assert (n_password == 4);
g_assert (memcmp (password, "mock", 4) == 0);
-
- login = gck_login_new ((guchar*)"xxx", -1);
+
+ login = gck_secret_new ((guchar*)"xxx", -1);
gck_authenticator_set_login (auth, login);
check = gck_authenticator_get_login (auth);
g_assert (n_password == 4);
diff --git a/pkcs11/gck/tests/unit-test-data-file.c b/pkcs11/gck/tests/unit-test-data-file.c
index 5a8996d..6112b1d 100644
--- a/pkcs11/gck/tests/unit-test-data-file.c
+++ b/pkcs11/gck/tests/unit-test-data-file.c
@@ -38,7 +38,7 @@ static gchar *write_filename = NULL;
static int write_fd = -1;
static int public_fd = -1;
static int private_fd = -1;
-static GckLogin *login = NULL;
+static GckSecret *login = NULL;
DEFINE_SETUP(file_store)
{
@@ -57,7 +57,7 @@ DEFINE_SETUP(file_store)
write_fd = g_open (write_filename, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
g_assert (write_fd != -1);
- login = gck_login_new ((CK_UTF8CHAR_PTR)"booo", 4);
+ login = gck_secret_new ((guchar*)"booo", 4);
}
DEFINE_TEARDOWN(file_store)
diff --git a/pkcs11/gck/tests/unit-test-secret.c b/pkcs11/gck/tests/unit-test-secret.c
index 40e5eb6..be558e3 100644
--- a/pkcs11/gck/tests/unit-test-secret.c
+++ b/pkcs11/gck/tests/unit-test-secret.c
@@ -1,5 +1,5 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* unit-test-login.c: Test gck-login.c
+/* unit-test-secret.c: Test gck-secret.c
Copyright (C) 2007 Stefan Walter
@@ -27,94 +27,117 @@
#include "run-auto-test.h"
-#include "gck/gck-login.h"
+#include "gck/gck-secret.h"
-DEFINE_TEST(test_login)
+DEFINE_TEST(test_secret)
{
- GckLogin *login;
+ GckSecret *secret;
const gchar *password;
gsize n_password;
- login = gck_login_new ((CK_UTF8CHAR_PTR)"test-pin", 8);
- g_assert (GCK_IS_LOGIN (login));
+ secret = gck_secret_new ((guchar*)"test-pin", 8);
+ g_assert (GCK_IS_SECRET (secret));
- password = gck_login_get_password (login, &n_password);
+ password = gck_secret_get_password (secret, &n_password);
g_assert (password);
g_assert_cmpuint (n_password, ==, 8);
g_assert (memcmp (password, "test-pin", 8) == 0);
- g_assert (gck_login_equals (login, (CK_UTF8CHAR_PTR)"test-pin", 8));
- g_assert (!gck_login_equals (login, (CK_UTF8CHAR_PTR)"test-pino", 9));
- g_assert (!gck_login_equals (login, NULL, 0));
- g_assert (gck_login_equals (login, (CK_UTF8CHAR_PTR)"test-pin", -1));
- g_assert (!gck_login_equals (login, (CK_UTF8CHAR_PTR)"", 0));
+ g_assert (gck_secret_equals (secret, (CK_UTF8CHAR_PTR)"test-pin", 8));
+ g_assert (!gck_secret_equals (secret, (CK_UTF8CHAR_PTR)"test-pino", 9));
+ g_assert (!gck_secret_equals (secret, NULL, 0));
+ g_assert (gck_secret_equals (secret, (CK_UTF8CHAR_PTR)"test-pin", -1));
+ g_assert (!gck_secret_equals (secret, (CK_UTF8CHAR_PTR)"", 0));
- g_object_unref (login);
+ g_object_unref (secret);
+}
+
+DEFINE_TEST(test_secret_from_login)
+{
+ GckSecret *secret;
+ const gchar *password;
+ gsize n_password;
+
+ secret = gck_secret_new_from_login ((guchar*)"test-pin", 8);
+ g_assert (GCK_IS_SECRET (secret));
+ password = gck_secret_get_password (secret, &n_password);
+ g_assert (password);
+ g_assert_cmpuint (n_password, ==, 8);
+ g_assert (memcmp (password, "test-pin", 8) == 0);
+ g_object_unref (secret);
+
+ secret = gck_secret_new_from_login ((guchar*)"test-pin", (CK_ULONG)-1);
+ g_assert (GCK_IS_SECRET (secret));
+ password = gck_secret_get_password (secret, &n_password);
+ g_assert (password);
+ g_assert_cmpuint (n_password, ==, 8);
+ g_assert (memcmp (password, "test-pin", 8) == 0);
+ g_object_unref (secret);
}
DEFINE_TEST(test_null_terminated)
{
- GckLogin *login;
+ GckSecret *secret;
const gchar *password;
gsize n_password;
- login = gck_login_new ((CK_UTF8CHAR_PTR)"null-terminated", -1);
- g_assert (GCK_IS_LOGIN (login));
+ secret = gck_secret_new ((CK_UTF8CHAR_PTR)"null-terminated", -1);
+ g_assert (GCK_IS_SECRET (secret));
- password = gck_login_get_password (login, &n_password);
+ password = gck_secret_get_password (secret, &n_password);
g_assert (password);
g_assert_cmpstr (password, ==, "null-terminated");
g_assert_cmpuint (n_password, ==, strlen ("null-terminated"));
- g_assert (gck_login_equals (login, (CK_UTF8CHAR_PTR)"null-terminated", strlen ("null-terminated")));
- g_assert (!gck_login_equals (login, (CK_UTF8CHAR_PTR)"test-pino", 9));
- g_assert (!gck_login_equals (login, NULL, 0));
- g_assert (gck_login_equals (login, (CK_UTF8CHAR_PTR)"null-terminated", -1));
- g_assert (!gck_login_equals (login, (CK_UTF8CHAR_PTR)"", 0));
+ g_assert (gck_secret_equals (secret, (CK_UTF8CHAR_PTR)"null-terminated", strlen ("null-terminated")));
+ g_assert (!gck_secret_equals (secret, (CK_UTF8CHAR_PTR)"test-pino", 9));
+ g_assert (!gck_secret_equals (secret, NULL, 0));
+ g_assert (gck_secret_equals (secret, (CK_UTF8CHAR_PTR)"null-terminated", -1));
+ g_assert (!gck_secret_equals (secret, (CK_UTF8CHAR_PTR)"", 0));
- g_object_unref (login);
+ g_object_unref (secret);
}
DEFINE_TEST(test_null)
{
- GckLogin *login;
+ GckSecret *secret;
const gchar *password;
gsize n_password;
- login = gck_login_new (NULL, 0);
- g_assert (GCK_IS_LOGIN (login));
+ secret = gck_secret_new (NULL, 0);
+ g_assert (GCK_IS_SECRET (secret));
- password = gck_login_get_password (login, &n_password);
+ password = gck_secret_get_password (secret, &n_password);
g_assert (password == NULL);
g_assert_cmpuint (n_password, ==, 0);
- g_assert (!gck_login_equals (login, (CK_UTF8CHAR_PTR)"null-terminated", strlen ("null-terminated")));
- g_assert (!gck_login_equals (login, (CK_UTF8CHAR_PTR)"test-pino", 9));
- g_assert (gck_login_equals (login, NULL, 0));
- g_assert (!gck_login_equals (login, (CK_UTF8CHAR_PTR)"null-terminated", -1));
- g_assert (!gck_login_equals (login, (CK_UTF8CHAR_PTR)"", 0));
+ g_assert (!gck_secret_equals (secret, (CK_UTF8CHAR_PTR)"null-terminated", strlen ("null-terminated")));
+ g_assert (!gck_secret_equals (secret, (CK_UTF8CHAR_PTR)"test-pino", 9));
+ g_assert (gck_secret_equals (secret, NULL, 0));
+ g_assert (!gck_secret_equals (secret, (CK_UTF8CHAR_PTR)"null-terminated", -1));
+ g_assert (!gck_secret_equals (secret, (CK_UTF8CHAR_PTR)"", 0));
- g_object_unref (login);
+ g_object_unref (secret);
}
DEFINE_TEST(test_empty)
{
- GckLogin *login;
+ GckSecret *secret;
const gchar *password;
gsize n_password;
- login = gck_login_new ((CK_UTF8CHAR_PTR)"", 0);
- g_assert (GCK_IS_LOGIN (login));
+ secret = gck_secret_new ((CK_UTF8CHAR_PTR)"", 0);
+ g_assert (GCK_IS_SECRET (secret));
- password = gck_login_get_password (login, &n_password);
+ password = gck_secret_get_password (secret, &n_password);
g_assert_cmpstr (password, ==, "");
g_assert_cmpuint (n_password, ==, 0);
- g_assert (!gck_login_equals (login, (CK_UTF8CHAR_PTR)"null-terminated", strlen ("null-terminated")));
- g_assert (!gck_login_equals (login, (CK_UTF8CHAR_PTR)"test-pino", 9));
- g_assert (!gck_login_equals (login, NULL, 0));
- g_assert (gck_login_equals (login, (CK_UTF8CHAR_PTR)"", -1));
- g_assert (gck_login_equals (login, (CK_UTF8CHAR_PTR)"", 0));
+ g_assert (!gck_secret_equals (secret, (CK_UTF8CHAR_PTR)"null-terminated", strlen ("null-terminated")));
+ g_assert (!gck_secret_equals (secret, (CK_UTF8CHAR_PTR)"test-pino", 9));
+ g_assert (!gck_secret_equals (secret, NULL, 0));
+ g_assert (gck_secret_equals (secret, (CK_UTF8CHAR_PTR)"", -1));
+ g_assert (gck_secret_equals (secret, (CK_UTF8CHAR_PTR)"", 0));
- g_object_unref (login);
+ g_object_unref (secret);
}
diff --git a/pkcs11/secret-store/gck-secret-binary.c b/pkcs11/secret-store/gck-secret-binary.c
index ac5afd8..6bcbbe1 100644
--- a/pkcs11/secret-store/gck-secret-binary.c
+++ b/pkcs11/secret-store/gck-secret-binary.c
@@ -34,7 +34,7 @@
#include "egg/egg-symkey.h"
#include "egg/egg-secure-memory.h"
-#include "gck/gck-login.h"
+#include "gck/gck-secret.h"
#include <glib.h>
@@ -474,7 +474,7 @@ generate_encrypted_data (EggBuffer *buffer, GckSecretCollection *collection)
GList *items, *l;
GHashTable *attributes;
const gchar *label;
- GckLogin *secret;
+ GckSecret *secret;
const gchar *password;
gsize n_password;
GList *acl;
@@ -494,7 +494,7 @@ generate_encrypted_data (EggBuffer *buffer, GckSecretCollection *collection)
secret = gck_secret_item_get_secret (item);
password = NULL;
if (secret != NULL)
- password = gck_login_get_password (secret, &n_password);
+ password = gck_secret_get_password (secret, &n_password);
/* TODO: Need to support binary secrets somehow */
buffer_add_utf8_string (buffer, password);
@@ -719,7 +719,7 @@ static void
setup_item_from_info (GckSecretItem *item, gboolean locked, ItemInfo *info)
{
GckSecretObject *obj = GCK_SECRET_OBJECT (item);
- GckLogin *secret;
+ GckSecret *secret;
const gchar *type;
gck_secret_object_set_label (obj, info->display_name);
@@ -735,7 +735,7 @@ setup_item_from_info (GckSecretItem *item, gboolean locked, ItemInfo *info)
gck_secret_item_set_secret (item, NULL);
} else {
- secret = gck_login_new_from_password (info->secret);
+ secret = gck_secret_new_from_password (info->secret);
gck_secret_item_set_secret (item, secret);
g_object_unref (secret);
g_object_set_data_full (G_OBJECT (item), "compat-acl", info->acl, gck_secret_compat_acl_free);
diff --git a/pkcs11/secret-store/gck-secret-collection.c b/pkcs11/secret-store/gck-secret-collection.c
index 37a879c..ac31756 100644
--- a/pkcs11/secret-store/gck-secret-collection.c
+++ b/pkcs11/secret-store/gck-secret-collection.c
@@ -152,7 +152,7 @@ gck_secret_collection_class_init (GckSecretCollectionClass *klass)
}
static gboolean
-gck_secret_collection_real_load (GckSerializable *base, GckLogin *login, const guchar *data, gsize n_data)
+gck_secret_collection_real_load (GckSerializable *base, GckSecret *login, const guchar *data, gsize n_data)
{
GckSecretCollection *self = GCK_SECRET_COLLECTION (base);
GckDataResult res;
@@ -170,7 +170,7 @@ gck_secret_collection_real_load (GckSerializable *base, GckLogin *login, const g
}
static gboolean
-gck_secret_collection_real_save (GckSerializable *base, GckLogin *login, guchar **data, gsize *n_data)
+gck_secret_collection_real_save (GckSerializable *base, GckSecret *login, guchar **data, gsize *n_data)
{
GckSecretCollection *self = GCK_SECRET_COLLECTION (base);
GckDataResult res;
@@ -201,7 +201,7 @@ gck_secret_collection_serializable (GckSerializableIface *iface)
* PUBLIC
*/
-GckLogin*
+GckSecret*
gck_secret_collection_lookup_secret (GckSecretCollection *self,
const gchar *identifier)
{
diff --git a/pkcs11/secret-store/gck-secret-collection.h b/pkcs11/secret-store/gck-secret-collection.h
index b2616d2..f91d121 100644
--- a/pkcs11/secret-store/gck-secret-collection.h
+++ b/pkcs11/secret-store/gck-secret-collection.h
@@ -60,7 +60,7 @@ GckSecretItem* gck_secret_collection_create_item (GckSecretCollection
void gck_secret_collection_remove_item (GckSecretCollection *self,
GckSecretItem *item);
-GckLogin* gck_secret_collection_lookup_secret (GckSecretCollection *self,
+GckSecret* gck_secret_collection_lookup_secret (GckSecretCollection *self,
const gchar *identifier);
const gchar * gck_secret_collection_get_master_password (GckSecretCollection *self);
diff --git a/pkcs11/secret-store/gck-secret-item.c b/pkcs11/secret-store/gck-secret-item.c
index aa56a75..a607bc2 100644
--- a/pkcs11/secret-store/gck-secret-item.c
+++ b/pkcs11/secret-store/gck-secret-item.c
@@ -25,7 +25,7 @@
#include "gck-secret-item.h"
#include "gck/gck-attributes.h"
-#include "gck/gck-login.h"
+#include "gck/gck-secret.h"
#include "gck/gck-transaction.h"
#include "pkcs11/pkcs11g.h"
@@ -41,7 +41,7 @@ enum {
struct _GckSecretItem {
GckSecretObject parent;
- GckLogin *secret;
+ GckSecret *secret;
GHashTable *fields;
GckSecretCollection *collection;
};
@@ -56,7 +56,7 @@ static gboolean
complete_set_secret (GckTransaction *transaction, GObject *obj, gpointer user_data)
{
GckSecretItem *self = GCK_SECRET_ITEM (obj);
- GckLogin *old_secret = user_data;
+ GckSecret *old_secret = user_data;
if (gck_transaction_get_failed (transaction)) {
gck_secret_item_set_secret (self, old_secret);
@@ -72,7 +72,7 @@ complete_set_secret (GckTransaction *transaction, GObject *obj, gpointer user_da
}
static void
-begin_set_secret (GckSecretItem *self, GckTransaction *transaction, GckLogin *secret)
+begin_set_secret (GckSecretItem *self, GckTransaction *transaction, GckSecret *secret)
{
g_assert (GCK_IS_SECRET_OBJECT (self));
g_assert (!gck_transaction_get_failed (transaction));
@@ -141,7 +141,7 @@ gck_secret_item_real_get_attribute (GckObject *base, GckSession *session, CK_ATT
if (gck_secret_item_real_is_locked (GCK_SECRET_OBJECT (self), session))
return CKR_USER_NOT_LOGGED_IN;
g_return_val_if_fail (self->secret, CKR_GENERAL_ERROR);
- password = gck_login_get_password (self->secret, &n_password);
+ password = gck_secret_get_password (self->secret, &n_password);
return gck_attribute_set_data (attr, password, n_password);
case CKA_G_COLLECTION:
@@ -162,7 +162,7 @@ gck_secret_item_real_set_attribute (GckObject *base, GckSession *session,
{
GckSecretItem *self = GCK_SECRET_ITEM (base);
GHashTable *fields;
- GckLogin *login;
+ GckSecret *secret;
CK_RV rv;
/* Check that the object is not locked */
@@ -173,8 +173,8 @@ gck_secret_item_real_set_attribute (GckObject *base, GckSession *session,
switch (attr->type) {
case CKA_VALUE:
- login = gck_login_new (attr->pValue, attr->ulValueLen);
- begin_set_secret (self, transaction, login);
+ secret = gck_secret_new (attr->pValue, attr->ulValueLen);
+ begin_set_secret (self, transaction, secret);
break;
case CKA_G_FIELDS:
@@ -306,7 +306,7 @@ gck_secret_item_class_init (GckSecretItemClass *klass)
g_object_class_install_property (gobject_class, PROP_SECRET,
g_param_spec_object ("secret", "Secret", "Item's Secret",
- GCK_TYPE_LOGIN, G_PARAM_READWRITE));
+ GCK_TYPE_SECRET, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, PROP_SECRET,
g_param_spec_object ("collection", "Collection", "Item's Collection",
@@ -328,15 +328,15 @@ gck_secret_item_get_collection (GckSecretItem *self)
return self->collection;
}
-GckLogin*
+GckSecret*
gck_secret_item_get_secret (GckSecretItem *self)
{
g_return_val_if_fail (GCK_IS_SECRET_ITEM (self), NULL);
- return self->secret;
+ return self->secret;
}
void
-gck_secret_item_set_secret (GckSecretItem *self, GckLogin *secret)
+gck_secret_item_set_secret (GckSecretItem *self, GckSecret *secret)
{
g_return_if_fail (GCK_IS_SECRET_ITEM (self));
diff --git a/pkcs11/secret-store/gck-secret-item.h b/pkcs11/secret-store/gck-secret-item.h
index 1366e0c..efe718c 100644
--- a/pkcs11/secret-store/gck-secret-item.h
+++ b/pkcs11/secret-store/gck-secret-item.h
@@ -44,10 +44,10 @@ GType gck_secret_item_get_type (void);
GckSecretCollection* gck_secret_item_get_collection (GckSecretItem *self);
-GckLogin* gck_secret_item_get_secret (GckSecretItem *self);
+GckSecret* gck_secret_item_get_secret (GckSecretItem *self);
void gck_secret_item_set_secret (GckSecretItem *self,
- GckLogin *secret);
+ GckSecret *secret);
GHashTable* gck_secret_item_get_fields (GckSecretItem *self);
diff --git a/pkcs11/secret-store/gck-secret-textual.c b/pkcs11/secret-store/gck-secret-textual.c
index fc3bfb8..4b91e5f 100644
--- a/pkcs11/secret-store/gck-secret-textual.c
+++ b/pkcs11/secret-store/gck-secret-textual.c
@@ -31,7 +31,7 @@
#include "egg/egg-secure-memory.h"
-#include "gck/gck-login.h"
+#include "gck/gck-secret.h"
#include <glib.h>
@@ -307,7 +307,7 @@ generate_item (GKeyFile *file, GckSecretItem *item)
GHashTable *attributes;
const gchar *value;
const gchar *groupname;
- GckLogin *secret;
+ GckSecret *secret;
const gchar *password;
gsize n_password;
@@ -330,7 +330,7 @@ generate_item (GKeyFile *file, GckSecretItem *item)
secret = gck_secret_item_get_secret (item);
if (secret != NULL) {
- password = gck_login_get_password (secret, &n_password);
+ password = gck_secret_get_password (secret, &n_password);
/* TODO: What about non-textual passwords? */
if (password != NULL)
g_key_file_set_value (file, groupname, "secret", (gchar*)password);
@@ -350,7 +350,7 @@ parse_item (GKeyFile *file, GckSecretItem *item, const gchar **groups)
GHashTable *attributes;
const gchar *groupname;
GError *err = NULL;
- GckLogin *secret;
+ GckSecret *secret;
gchar *val;
guint64 num;
gint type;
@@ -383,7 +383,7 @@ parse_item (GKeyFile *file, GckSecretItem *item, const gchar **groups)
if (val == NULL) {
gck_secret_item_set_secret (item, NULL);
} else {
- secret = gck_login_new ((guchar*)val, strlen (val));
+ secret = gck_secret_new ((guchar*)val, strlen (val));
gck_secret_item_set_secret (item, secret);
g_object_unref (secret);
g_free (val);
diff --git a/pkcs11/user-store/gck-user-module.c b/pkcs11/user-store/gck-user-module.c
index a916550..da6bfce 100644
--- a/pkcs11/user-store/gck-user-module.c
+++ b/pkcs11/user-store/gck-user-module.c
@@ -29,8 +29,8 @@
#include "gck/gck-certificate.h"
#include "gck/gck-data-asn1.h"
-#include "gck/gck-login.h"
#include "gck/gck-manager.h"
+#include "gck/gck-secret.h"
#include "gck/gck-transaction.h"
#include "gck/gck-util.h"
@@ -147,7 +147,7 @@ gck_user_module_real_login_change (GckModule *base, CK_SLOT_ID slot_id, CK_UTF8C
CK_ULONG n_old_pin, CK_UTF8CHAR_PTR new_pin, CK_ULONG n_new_pin)
{
GckUserModule *self = GCK_USER_MODULE (base);
- GckLogin *old_login, *new_login;
+ GckSecret *old_login, *new_login;
GckTransaction *transaction;
CK_RV rv;
@@ -156,8 +156,8 @@ gck_user_module_real_login_change (GckModule *base, CK_SLOT_ID slot_id, CK_UTF8C
* sessions will remain logged in, and vice versa.
*/
- old_login = gck_login_new (old_pin, n_old_pin);
- new_login = gck_login_new (new_pin, n_new_pin);
+ old_login = gck_secret_new_from_login (old_pin, n_old_pin);
+ new_login = gck_secret_new_from_login (new_pin, n_new_pin);
transaction = gck_transaction_new ();
@@ -177,7 +177,7 @@ static CK_RV
gck_user_module_real_login_user (GckModule *base, CK_SLOT_ID slot_id, CK_UTF8CHAR_PTR pin, CK_ULONG n_pin)
{
GckUserModule *self = GCK_USER_MODULE (base);
- GckLogin *login;
+ GckSecret *login;
CK_RV rv;
/* See if this application has logged in */
@@ -192,7 +192,7 @@ gck_user_module_real_login_user (GckModule *base, CK_SLOT_ID slot_id, CK_UTF8CHA
g_return_val_if_fail (login == NULL, CKR_GENERAL_ERROR);
/* So actually unlock the store */
- login = gck_login_new (pin, n_pin);
+ login = gck_secret_new_from_login (pin, n_pin);
rv = gck_user_storage_unlock (self->storage, login);
g_object_unref (login);
@@ -202,7 +202,7 @@ gck_user_module_real_login_user (GckModule *base, CK_SLOT_ID slot_id, CK_UTF8CHA
g_return_val_if_fail (login != NULL, CKR_GENERAL_ERROR);
/* Compare our pin to the one used originally */
- if (!gck_login_equals (login, pin, n_pin))
+ if (!gck_secret_equals (login, pin, n_pin))
rv = CKR_PIN_INCORRECT;
else
rv = CKR_OK;
diff --git a/pkcs11/user-store/gck-user-private-key.c b/pkcs11/user-store/gck-user-private-key.c
index fff5234..9453ccf 100644
--- a/pkcs11/user-store/gck-user-private-key.c
+++ b/pkcs11/user-store/gck-user-private-key.c
@@ -27,9 +27,9 @@
#include "gck/gck-crypto.h"
#include "gck/gck-data-der.h"
#include "gck/gck-factory.h"
-#include "gck/gck-login.h"
#include "gck/gck-manager.h"
#include "gck/gck-object.h"
+#include "gck/gck-secret.h"
#include "gck/gck-serializable.h"
#include "gck/gck-session.h"
#include "gck/gck-sexp.h"
@@ -49,7 +49,7 @@ struct _GckUserPrivateKey {
GckSexp *private_sexp;
gboolean is_encrypted;
- GckLogin *login;
+ GckSecret *login;
};
static void gck_user_private_key_serializable (GckSerializableIface *iface);
@@ -115,7 +115,7 @@ gck_user_private_key_real_acquire_crypto_sexp (GckKey *base, GckSession *unused)
g_return_val_if_fail (self->login, NULL);
g_return_val_if_fail (self->is_encrypted, NULL);
- password = gck_login_get_password (self->login, &n_password);
+ password = gck_secret_get_password (self->login, &n_password);
res = gck_data_der_read_private_pkcs8 (self->private_data, self->n_private_data,
password, n_password, &sexp);
g_return_val_if_fail (res == GCK_DATA_SUCCESS, NULL);
@@ -198,7 +198,7 @@ gck_user_private_key_class_init (GckUserPrivateKeyClass *klass)
}
static gboolean
-gck_user_private_key_real_load (GckSerializable *base, GckLogin *login, const guchar *data, gsize n_data)
+gck_user_private_key_real_load (GckSerializable *base, GckSecret *login, const guchar *data, gsize n_data)
{
GckUserPrivateKey *self = GCK_USER_PRIVATE_KEY (base);
GckDataResult res;
@@ -225,7 +225,7 @@ gck_user_private_key_real_load (GckSerializable *base, GckLogin *login, const gu
return FALSE;
}
- password = gck_login_get_password (login, &n_password);
+ password = gck_secret_get_password (login, &n_password);
res = gck_data_der_read_private_pkcs8 (data, n_data, password, n_password, &sexp);
}
@@ -284,7 +284,7 @@ gck_user_private_key_real_load (GckSerializable *base, GckLogin *login, const gu
}
static gboolean
-gck_user_private_key_real_save (GckSerializable *base, GckLogin *login, guchar **data, gsize *n_data)
+gck_user_private_key_real_save (GckSerializable *base, GckSecret *login, guchar **data, gsize *n_data)
{
GckUserPrivateKey *self = GCK_USER_PRIVATE_KEY (base);
const gchar *password;
@@ -298,7 +298,7 @@ gck_user_private_key_real_save (GckSerializable *base, GckLogin *login, guchar *
sexp = gck_user_private_key_real_acquire_crypto_sexp (GCK_KEY (self), NULL);
g_return_val_if_fail (sexp, FALSE);
- password = gck_login_get_password (login, &n_password);
+ password = gck_secret_get_password (login, &n_password);
if (password == NULL)
*data = gck_data_der_write_private_pkcs8_plain (gck_sexp_get (sexp), n_data);
else
diff --git a/pkcs11/user-store/gck-user-private-key.h b/pkcs11/user-store/gck-user-private-key.h
index ba6e12d..9d101e0 100644
--- a/pkcs11/user-store/gck-user-private-key.h
+++ b/pkcs11/user-store/gck-user-private-key.h
@@ -26,7 +26,7 @@
#include "gck-user-private-key.h"
-#include "gck/gck-login.h"
+#include "gck/gck-secret.h"
#include "gck/gck-private-key.h"
#define GCK_FACTORY_USER_PRIVATE_KEY (gck_user_private_key_get_factory ())
diff --git a/pkcs11/user-store/gck-user-public-key.c b/pkcs11/user-store/gck-user-public-key.c
index a9c750d..56259df 100644
--- a/pkcs11/user-store/gck-user-public-key.c
+++ b/pkcs11/user-store/gck-user-public-key.c
@@ -114,7 +114,7 @@ gck_user_public_key_class_init (GckUserPublicKeyClass *klass)
static gboolean
-gck_user_public_key_real_load (GckSerializable *base, GckLogin *login, const guchar *data, gsize n_data)
+gck_user_public_key_real_load (GckSerializable *base, GckSecret *login, const guchar *data, gsize n_data)
{
GckUserPublicKey *self = GCK_USER_PUBLIC_KEY (base);
GckDataResult res;
@@ -150,7 +150,7 @@ gck_user_public_key_real_load (GckSerializable *base, GckLogin *login, const guc
}
static gboolean
-gck_user_public_key_real_save (GckSerializable *base, GckLogin *login, guchar **data, gsize *n_data)
+gck_user_public_key_real_save (GckSerializable *base, GckSecret *login, guchar **data, gsize *n_data)
{
GckUserPublicKey *self = GCK_USER_PUBLIC_KEY (base);
GckSexp *wrapper;
diff --git a/pkcs11/user-store/gck-user-storage.c b/pkcs11/user-store/gck-user-storage.c
index 89c85ec..8eea500 100644
--- a/pkcs11/user-store/gck-user-storage.c
+++ b/pkcs11/user-store/gck-user-storage.c
@@ -28,9 +28,9 @@
#include "gck/gck-certificate.h"
#include "gck/gck-data-asn1.h"
#include "gck/gck-data-file.h"
-#include "gck/gck-login.h"
#include "gck/gck-manager.h"
#include "gck/gck-module.h"
+#include "gck/gck-secret.h"
#include "gck/gck-serializable.h"
#include "gck/gck-util.h"
@@ -67,7 +67,7 @@ struct _GckUserStorage {
gchar *filename;
GckDataFile *file;
time_t last_mtime;
- GckLogin *login;
+ GckSecret *login;
/* Mapping of objects loaded */
GHashTable *object_to_identifier;
@@ -589,7 +589,7 @@ data_file_entry_removed (GckDataFile *store, const gchar *identifier, GckUserSto
static void
relock_object (GckUserStorage *self, GckTransaction *transaction, const gchar *path,
- const gchar *identifier, GckLogin *old_login, GckLogin *new_login)
+ const gchar *identifier, GckSecret *old_login, GckSecret *new_login)
{
GError *error = NULL;
GckObject *object;
@@ -674,8 +674,8 @@ relock_object (GckUserStorage *self, GckTransaction *transaction, const gchar *p
typedef struct _RelockArgs {
GckUserStorage *self;
GckTransaction *transaction;
- GckLogin *old_login;
- GckLogin *new_login;
+ GckSecret *old_login;
+ GckSecret *new_login;
} RelockArgs;
static void
@@ -702,7 +702,7 @@ relock_each_object (GckDataFile *file, const gchar *identifier, gpointer data)
}
static CK_RV
-refresh_with_login (GckUserStorage *self, GckLogin *login)
+refresh_with_login (GckUserStorage *self, GckSecret *login)
{
GckDataResult res;
struct stat sb;
@@ -1004,7 +1004,7 @@ gck_user_storage_class_init (GckUserStorageClass *klass)
g_object_class_install_property (gobject_class, PROP_LOGIN,
g_param_spec_object ("login", "Login", "Login used to unlock",
- GCK_TYPE_LOGIN, G_PARAM_READABLE));
+ GCK_TYPE_SECRET, G_PARAM_READABLE));
}
/* -----------------------------------------------------------------------------
@@ -1180,7 +1180,7 @@ gck_user_storage_destroy (GckUserStorage *self, GckTransaction *transaction, Gck
void
gck_user_storage_relock (GckUserStorage *self, GckTransaction *transaction,
- GckLogin *old_login, GckLogin *new_login)
+ GckSecret *old_login, GckSecret *new_login)
{
GckDataFile *file;
GckDataResult res;
@@ -1245,7 +1245,7 @@ gck_user_storage_relock (GckUserStorage *self, GckTransaction *transaction,
}
CK_RV
-gck_user_storage_unlock (GckUserStorage *self, GckLogin *login)
+gck_user_storage_unlock (GckUserStorage *self, GckSecret *login)
{
CK_RV rv;
@@ -1279,7 +1279,7 @@ gck_user_storage_unlock (GckUserStorage *self, GckLogin *login)
CK_RV
gck_user_storage_lock (GckUserStorage *self)
{
- GckLogin *prev;
+ GckSecret *prev;
CK_RV rv;
g_return_val_if_fail (GCK_IS_USER_STORAGE (self), CKR_GENERAL_ERROR);
@@ -1322,7 +1322,7 @@ gck_user_storage_get_directory (GckUserStorage *self)
return self->directory;
}
-GckLogin*
+GckSecret*
gck_user_storage_get_login (GckUserStorage *self)
{
g_return_val_if_fail (GCK_IS_USER_STORAGE (self), NULL);
diff --git a/pkcs11/user-store/gck-user-storage.h b/pkcs11/user-store/gck-user-storage.h
index 29faf41..15ff7fd 100644
--- a/pkcs11/user-store/gck-user-storage.h
+++ b/pkcs11/user-store/gck-user-storage.h
@@ -24,8 +24,8 @@
#include <glib-object.h>
-#include "gck/gck-login.h"
#include "gck/gck-manager.h"
+#include "gck/gck-secret.h"
#include "gck/gck-store.h"
#include "gck/gck-transaction.h"
@@ -52,7 +52,7 @@ GckManager* gck_user_storage_get_manager (GckUserStor
const gchar* gck_user_storage_get_directory (GckUserStorage *self);
-GckLogin* gck_user_storage_get_login (GckUserStorage *self);
+GckSecret* gck_user_storage_get_login (GckUserStorage *self);
gulong gck_user_storage_token_flags (GckUserStorage *self);
@@ -68,11 +68,11 @@ void gck_user_storage_destroy (GckUserStor
void gck_user_storage_relock (GckUserStorage *self,
GckTransaction *transaction,
- GckLogin *old_login,
- GckLogin *new_login);
+ GckSecret *old_login,
+ GckSecret *new_login);
CK_RV gck_user_storage_unlock (GckUserStorage *self,
- GckLogin *login);
+ GckSecret *login);
CK_RV gck_user_storage_lock (GckUserStorage *self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]