[gnome-keyring] Massive cleanup of line endings and file names.



commit cf0192e26a095c7f1840cd34b3cd1476d696a7b9
Author: Stef Walter <stef memberwebs com>
Date:   Thu May 27 03:21:59 2010 +0000

    Massive cleanup of line endings and file names.
    
     * Cleanup all line endings for pkcs11 code.
     * Rename C namespace to GKM
    
    This is big "rip off the bandaid fast" change in order
    to prevent later constant pain with git and naming.

 configure.in                                       |    4 +-
 daemon/Makefile.am                                 |   14 +-
 daemon/pkcs11/gkd-pkcs11.c                         |   42 +-
 daemon/ssh-agent/.gitignore                        |    2 +-
 pkcs11/Makefile.am                                 |    6 +-
 pkcs11/gck/Makefile.am                             |   99 --
 pkcs11/gck/gck-aes-key.h                           |   57 -
 pkcs11/gck/gck-certificate-key.h                   |   57 -
 pkcs11/gck/gck-certificate-trust.h                 |   57 -
 pkcs11/gck/gck-certificate.h                       |   75 --
 pkcs11/gck/gck-credential.h                        |   95 --
 pkcs11/gck/gck-data-types.h                        |   15 -
 pkcs11/gck/gck-memory-store.h                      |   48 -
 pkcs11/gck/gck-null-key.h                          |   52 -
 pkcs11/gck/gck-object.h                            |  155 ---
 pkcs11/gck/gck-private-xsa-key.h                   |   67 --
 pkcs11/gck/gck-public-xsa-key.h                    |   60 --
 pkcs11/gck/gck-secret-key.h                        |   51 -
 pkcs11/gck/gck-secret.h                            |   67 --
 pkcs11/gck/gck-sexp-key.h                          |   71 --
 pkcs11/gck/gck-store.h                             |  102 --
 pkcs11/gck/gck-transaction.h                       |   82 --
 pkcs11/gck/gck-types.h                             |   51 -
 pkcs11/gck/tests/unit-test-data-file.c             |  587 -----------
 pkcs11/gck/tests/unit-test-secret.c                |  178 ----
 pkcs11/{gck => gkm}/.gitignore                     |    4 +-
 pkcs11/gkm/Makefile.am                             |   99 ++
 pkcs11/{gck/gck-aes-key.c => gkm/gkm-aes-key.c}    |  104 +-
 pkcs11/gkm/gkm-aes-key.h                           |   57 +
 .../gkm-aes-mechanism.c}                           |   66 +-
 .../gkm-aes-mechanism.h}                           |   26 +-
 .../{gck/gck-attributes.c => gkm/gkm-attributes.c} |  192 ++--
 .../{gck/gck-attributes.h => gkm/gkm-attributes.h} |   84 +-
 .../gkm-certificate-key.c}                         |  110 +-
 pkcs11/gkm/gkm-certificate-key.h                   |   57 +
 .../gkm-certificate-trust.c}                       |  192 ++--
 pkcs11/gkm/gkm-certificate-trust.h                 |   57 +
 .../gck-certificate.c => gkm/gkm-certificate.c}    |  532 +++++-----
 pkcs11/gkm/gkm-certificate.h                       |   75 ++
 .../{gck/gck-credential.c => gkm/gkm-credential.c} |  242 +++---
 pkcs11/gkm/gkm-credential.h                        |   95 ++
 pkcs11/{gck/gck-crypto.c => gkm/gkm-crypto.c}      |  267 +++---
 pkcs11/{gck/gck-crypto.h => gkm/gkm-crypto.h}      |   82 +-
 .../{gck/gck-data-asn1.c => gkm/gkm-data-asn1.c}   |   42 +-
 .../{gck/gck-data-asn1.h => gkm/gkm-data-asn1.h}   |   16 +-
 pkcs11/{gck/gck-data-der.c => gkm/gkm-data-der.c}  |  862 ++++++++--------
 pkcs11/{gck/gck-data-der.h => gkm/gkm-data-der.h}  |   78 +-
 .../{gck/gck-data-file.c => gkm/gkm-data-file.c}   |  794 ++++++++--------
 .../{gck/gck-data-file.h => gkm/gkm-data-file.h}   |  106 +-
 pkcs11/gkm/gkm-data-types.h                        |   15 +
 pkcs11/{gck/gck-dh-key.c => gkm/gkm-dh-key.c}      |   74 +-
 pkcs11/{gck/gck-dh-key.h => gkm/gkm-dh-key.h}      |   42 +-
 .../gck-dh-mechanism.c => gkm/gkm-dh-mechanism.c}  |   78 +-
 .../gck-dh-mechanism.h => gkm/gkm-dh-mechanism.h}  |   22 +-
 .../gkm-dh-private-key.c}                          |  122 ++--
 .../gkm-dh-private-key.h}                          |   40 +-
 .../gkm-dh-public-key.c}                           |  104 +-
 .../gkm-dh-public-key.h}                           |   38 +-
 pkcs11/{gck/gck-factory.c => gkm/gkm-factory.c}    |   17 +-
 pkcs11/{gck/gck-factory.h => gkm/gkm-factory.h}    |   28 +-
 .../gck-file-tracker.c => gkm/gkm-file-tracker.c}  |  126 ++--
 .../gck-file-tracker.h => gkm/gkm-file-tracker.h}  |   41 +-
 pkcs11/{gck/gck-manager.c => gkm/gkm-manager.c}    |  526 +++++-----
 pkcs11/{gck/gck-manager.h => gkm/gkm-manager.h}    |  125 ++--
 .../{gck/gck-marshal.list => gkm/gkm-marshal.list} |    0
 .../gkm-mechanism-dsa.c}                           |   18 +-
 .../gkm-mechanism-dsa.h}                           |   14 +-
 .../gkm-mechanism-rsa.c}                           |   28 +-
 .../gkm-mechanism-rsa.h}                           |   20 +-
 .../gck-memory-store.c => gkm/gkm-memory-store.c}  |  158 ++--
 pkcs11/gkm/gkm-memory-store.h                      |   48 +
 .../{gck/gck-module-ep.h => gkm/gkm-module-ep.h}   | 1070 ++++++++++----------
 pkcs11/{gck/gck-module.c => gkm/gkm-module.c}      |  730 +++++++-------
 pkcs11/{gck/gck-module.h => gkm/gkm-module.h}      |  220 ++--
 pkcs11/{gck/gck-null-key.c => gkm/gkm-null-key.c}  |   68 +-
 pkcs11/gkm/gkm-null-key.h                          |   52 +
 .../gkm-null-mechanism.c}                          |   58 +-
 .../gkm-null-mechanism.h}                          |   26 +-
 pkcs11/{gck/gck-object.c => gkm/gkm-object.c}      |  578 ++++++------
 pkcs11/gkm/gkm-object.h                            |  155 +++
 .../gkm-private-xsa-key.c}                         |  210 ++--
 pkcs11/gkm/gkm-private-xsa-key.h                   |   67 ++
 .../gkm-public-xsa-key.c}                          |  140 ++--
 pkcs11/gkm/gkm-public-xsa-key.h                    |   60 ++
 .../{gck/gck-secret-key.c => gkm/gkm-secret-key.c} |   75 +-
 pkcs11/gkm/gkm-secret-key.h                        |   51 +
 pkcs11/{gck/gck-secret.c => gkm/gkm-secret.c}      |   96 +-
 pkcs11/gkm/gkm-secret.h                            |   67 ++
 .../gck-serializable.c => gkm/gkm-serializable.c}  |   54 +-
 .../gck-serializable.h => gkm/gkm-serializable.h}  |   55 +-
 pkcs11/{gck/gck-session.c => gkm/gkm-session.c}    |  926 +++++++++---------
 pkcs11/{gck/gck-session.h => gkm/gkm-session.h}    |  322 +++---
 pkcs11/{gck/gck-sexp-key.c => gkm/gkm-sexp-key.c}  |  134 ++--
 pkcs11/gkm/gkm-sexp-key.h                          |   71 ++
 pkcs11/{gck/gck-sexp.c => gkm/gkm-sexp.c}          |   76 +-
 pkcs11/{gck/gck-sexp.h => gkm/gkm-sexp.h}          |   46 +-
 pkcs11/{gck/gck-store.c => gkm/gkm-store.c}        |  216 ++--
 pkcs11/gkm/gkm-store.h                             |  102 ++
 pkcs11/{gck/gck-timer.c => gkm/gkm-timer.c}        |   56 +-
 pkcs11/{gck/gck-timer.h => gkm/gkm-timer.h}        |   38 +-
 .../gck-transaction.c => gkm/gkm-transaction.c}    |  246 +++---
 pkcs11/gkm/gkm-transaction.h                       |   82 ++
 pkcs11/gkm/gkm-types.h                             |   51 +
 pkcs11/{gck/gck-util.c => gkm/gkm-util.c}          |   36 +-
 pkcs11/{gck/gck-util.h => gkm/gkm-util.h}          |   38 +-
 pkcs11/{gck => gkm}/pk.asn                         |   14 +-
 pkcs11/{gck => gkm}/pkix.asn                       |   42 +-
 pkcs11/{gck => gkm}/tests/.gitignore               |    0
 pkcs11/{gck => gkm}/tests/Makefile.am              |    7 +-
 pkcs11/{gck => gkm}/tests/dump-data-file.c         |   54 +-
 pkcs11/{gck => gkm}/tests/mock-locked-object.c     |   54 +-
 pkcs11/{gck => gkm}/tests/mock-locked-object.h     |   28 +-
 .../tests/test-data/ca-certificates.crt            |    0
 .../tests/test-data/data-file-private.store        |  Bin 494 -> 494 bytes
 .../tests/test-data/data-file-public.store         |  Bin 216 -> 216 bytes
 .../tests/test-data/der-pkcs8-PBE-MD5-DES.key      |  Bin 677 -> 677 bytes
 .../tests/test-data/der-pkcs8-PBE-SHA1-3DES.key    |  Bin 678 -> 678 bytes
 .../tests/test-data/der-pkcs8-PBE-SHA1-DES.key     |  Bin 677 -> 677 bytes
 .../tests/test-data/der-pkcs8-PBE-SHA1-RC2-40.key  |  Bin 678 -> 678 bytes
 .../tests/test-data/der-pkcs8-PBE-SHA1-RC4-128.key |  Bin 673 -> 673 bytes
 .../{gck => gkm}/tests/test-data/der-pkcs8-dsa.key |  Bin 335 -> 335 bytes
 .../tests/test-data/der-pkcs8-encrypted-pkcs5.key  |  Bin 677 -> 677 bytes
 .../tests/test-data/der-pkcs8-v2-des.key           |  Bin 711 -> 711 bytes
 .../tests/test-data/der-pkcs8-v2-des3.key          |  Bin 714 -> 714 bytes
 pkcs11/{gck => gkm}/tests/test-data/der-pkcs8.key  |  Bin 635 -> 635 bytes
 .../{gck => gkm}/tests/test-data/pem-rsa-enc.key   |    0
 .../tests/test-data/test-certificate-1.der         |  Bin 813 -> 813 bytes
 .../tests/test-data/test-certificate-2.der         |  Bin 1346 -> 1346 bytes
 pkcs11/{gck => gkm}/tests/test-module.c            |   34 +-
 pkcs11/{gck => gkm}/tests/test-module.h            |    8 +-
 pkcs11/{gck => gkm}/tests/test.asn                 |    0
 pkcs11/{gck => gkm}/tests/unit-test-attributes.c   |  162 ++--
 pkcs11/{gck => gkm}/tests/unit-test-credential.c   |   98 +-
 pkcs11/{gck => gkm}/tests/unit-test-data-asn1.c    |   34 +-
 pkcs11/{gck => gkm}/tests/unit-test-data-der.c     |  256 +++---
 pkcs11/gkm/tests/unit-test-data-file.c             |  587 +++++++++++
 pkcs11/{gck => gkm}/tests/unit-test-file-tracker.c |   98 +-
 pkcs11/{gck => gkm}/tests/unit-test-memory-store.c |  240 +++---
 pkcs11/{gck => gkm}/tests/unit-test-object.c       |  126 ++--
 pkcs11/gkm/tests/unit-test-secret.c                |  178 ++++
 pkcs11/{gck => gkm}/tests/unit-test-sexp.c         |   14 +-
 pkcs11/{gck => gkm}/tests/unit-test-store.c        |   38 +-
 pkcs11/{gck => gkm}/tests/unit-test-timer.c        |   54 +-
 pkcs11/{gck => gkm}/tests/unit-test-transaction.c  |  226 ++--
 pkcs11/pkcs11g.h                                   |   36 +-
 pkcs11/pkcs11n.h                                   |  442 ++++----
 pkcs11/plex-layer/Makefile.am                      |   15 +-
 .../{gck-plex-layer.c => gkm-plex-layer.c}         |  116 ++--
 .../{gck-plex-layer.h => gkm-plex-layer.h}         |   24 +-
 pkcs11/roots-store/Makefile.am                     |   32 +-
 pkcs11/roots-store/gck-roots-certificate.c         |  216 ----
 pkcs11/roots-store/gck-roots-certificate.h         |   55 -
 pkcs11/roots-store/gck-roots-module.h              |   45 -
 pkcs11/roots-store/gkm-roots-certificate.c         |  216 ++++
 pkcs11/roots-store/gkm-roots-certificate.h         |   55 +
 .../{gck-roots-module.c => gkm-roots-module.c}     |  228 +++---
 pkcs11/roots-store/gkm-roots-module.h              |   45 +
 ...k-roots-standalone.c => gkm-roots-standalone.c} |   24 +-
 .../gkm-roots-store.h}                             |   22 +-
 pkcs11/roots-store/tests/Makefile.am               |    4 +-
 pkcs11/roots-store/tests/p11-tests.conf            |    4 +-
 pkcs11/roots-store/tests/test-module.c             |    4 +-
 pkcs11/rpc-layer/.gitignore                        |    2 +-
 pkcs11/rpc-layer/Makefile.am                       |   53 +-
 pkcs11/rpc-layer/gck-rpc-layer.h                   |   25 -
 pkcs11/rpc-layer/gck-rpc-private.h                 |  342 -------
 ...on-standalone.c => gkm-rpc-daemon-standalone.c} |   40 +-
 .../{gck-rpc-dispatch.c => gkm-rpc-dispatch.c}     |  624 ++++++------
 pkcs11/rpc-layer/gkm-rpc-layer.h                   |   25 +
 .../{gck-rpc-message.c => gkm-rpc-message.c}       |  224 ++--
 .../{gck-rpc-module.c => gkm-rpc-module.c}         |  452 ++++----
 pkcs11/rpc-layer/gkm-rpc-private.h                 |  342 +++++++
 .../rpc-layer/{gck-rpc-util.c => gkm-rpc-util.c}   |   48 +-
 pkcs11/secret-store/Makefile.am                    |   46 +-
 pkcs11/secret-store/gck-secret-collection.c        |  967 ------------------
 pkcs11/secret-store/gck-secret-collection.h        |  104 --
 pkcs11/secret-store/gck-secret-data.h              |   70 --
 pkcs11/secret-store/gck-secret-item.c              |  499 ---------
 pkcs11/secret-store/gck-secret-item.h              |   61 --
 pkcs11/secret-store/gck-secret-module.h            |   44 -
 pkcs11/secret-store/gck-secret-object.h            |   81 --
 pkcs11/secret-store/gck-secret-search.h            |   54 -
 .../{gck-secret-binary.c => gkm-secret-binary.c}   |  370 ++++----
 .../{gck-secret-binary.h => gkm-secret-binary.h}   |   34 +-
 pkcs11/secret-store/gkm-secret-collection.c        |  967 ++++++++++++++++++
 pkcs11/secret-store/gkm-secret-collection.h        |  104 ++
 .../{gck-secret-compat.c => gkm-secret-compat.c}   |   30 +-
 .../{gck-secret-compat.h => gkm-secret-compat.h}   |   42 +-
 .../{gck-secret-data.c => gkm-secret-data.c}       |  118 ++--
 pkcs11/secret-store/gkm-secret-data.h              |   70 ++
 .../{gck-secret-fields.c => gkm-secret-fields.c}   |   90 +-
 .../{gck-secret-fields.h => gkm-secret-fields.h}   |   74 +-
 pkcs11/secret-store/gkm-secret-item.c              |  499 +++++++++
 pkcs11/secret-store/gkm-secret-item.h              |   61 ++
 .../{gck-secret-module.c => gkm-secret-module.c}   |  316 +++---
 pkcs11/secret-store/gkm-secret-module.h            |   44 +
 .../{gck-secret-object.c => gkm-secret-object.c}   |  236 +++---
 pkcs11/secret-store/gkm-secret-object.h            |   81 ++
 .../{gck-secret-search.c => gkm-secret-search.c}   |  212 ++--
 pkcs11/secret-store/gkm-secret-search.h            |   54 +
 ...secret-standalone.c => gkm-secret-standalone.c} |   24 +-
 .../{gck-secret-store.h => gkm-secret-store.h}     |   22 +-
 .../{gck-secret-textual.c => gkm-secret-textual.c} |  292 +++---
 .../{gck-secret-textual.h => gkm-secret-textual.h} |   32 +-
 .../{gck-secret-types.h => gkm-secret-types.h}     |   36 +-
 pkcs11/secret-store/tests/Makefile.am              |    6 +-
 pkcs11/secret-store/tests/test-secret-module.c     |  150 ++--
 pkcs11/secret-store/tests/test-secret-module.h     |   16 +-
 .../secret-store/tests/unit-test-secret-binary.c   |   94 +-
 .../tests/unit-test-secret-collection.c            |  274 +++---
 .../secret-store/tests/unit-test-secret-compat.c   |   56 +-
 pkcs11/secret-store/tests/unit-test-secret-data.c  |  166 ++--
 .../secret-store/tests/unit-test-secret-fields.c   |  146 ++--
 pkcs11/secret-store/tests/unit-test-secret-item.c  |  278 +++---
 .../secret-store/tests/unit-test-secret-object.c   |   88 +-
 .../secret-store/tests/unit-test-secret-search.c   |  176 ++--
 .../secret-store/tests/unit-test-secret-textual.c  |   84 +-
 pkcs11/ssh-store/Makefile.am                       |   36 +-
 pkcs11/ssh-store/gck-ssh-module.h                  |   46 -
 pkcs11/ssh-store/gck-ssh-private-key.c             |  378 -------
 pkcs11/ssh-store/gck-ssh-private-key.h             |   62 --
 pkcs11/ssh-store/gck-ssh-public-key.c              |  153 ---
 pkcs11/ssh-store/gck-ssh-public-key.h              |   53 -
 .../{gck-ssh-module.c => gkm-ssh-module.c}         |  176 ++--
 pkcs11/ssh-store/gkm-ssh-module.h                  |   46 +
 .../{gck-ssh-openssh.c => gkm-ssh-openssh.c}       |  136 ++--
 .../{gck-ssh-openssh.h => gkm-ssh-openssh.h}       |   16 +-
 pkcs11/ssh-store/gkm-ssh-private-key.c             |  378 +++++++
 pkcs11/ssh-store/gkm-ssh-private-key.h             |   62 ++
 pkcs11/ssh-store/gkm-ssh-public-key.c              |  153 +++
 pkcs11/ssh-store/gkm-ssh-public-key.h              |   53 +
 .../{gck-ssh-standalone.c => gkm-ssh-standalone.c} |   18 +-
 .../gck-user-store.h => ssh-store/gkm-ssh-store.h} |   22 +-
 pkcs11/ssh-store/tests/Makefile.am                 |    6 +-
 pkcs11/ssh-store/tests/test-ssh-module.c           |   52 +-
 pkcs11/ssh-store/tests/test-ssh-module.h           |    6 +-
 pkcs11/ssh-store/tests/unit-test-private-key.c     |   42 +-
 pkcs11/ssh-store/tests/unit-test-ssh-openssh.c     |   48 +-
 pkcs11/template/gck-xxx.h                          |   49 -
 pkcs11/template/{gck-xxx.c => gkm-xxx.c}           |   94 +-
 pkcs11/template/gkm-xxx.h                          |   49 +
 pkcs11/template/{gck-zzz.c => gkm-zzz.c}           |   33 +-
 pkcs11/template/{gck-zzz.h => gkm-zzz.h}           |   15 +-
 pkcs11/user-store/Makefile.am                      |   36 +-
 pkcs11/user-store/gck-user-module.c                |  350 -------
 pkcs11/user-store/gck-user-module.h                |   45 -
 pkcs11/user-store/gck-user-private-key.h           |   52 -
 pkcs11/user-store/gck-user-public-key.c            |  205 ----
 pkcs11/user-store/gck-user-public-key.h            |   51 -
 pkcs11/user-store/gck-user-storage.h               |   79 --
 pkcs11/user-store/gkm-user-module.c                |  350 +++++++
 pkcs11/user-store/gkm-user-module.h                |   45 +
 ...k-user-private-key.c => gkm-user-private-key.c} |  284 +++---
 pkcs11/user-store/gkm-user-private-key.h           |   52 +
 pkcs11/user-store/gkm-user-public-key.c            |  205 ++++
 pkcs11/user-store/gkm-user-public-key.h            |   51 +
 ...gck-user-standalone.c => gkm-user-standalone.c} |   18 +-
 .../{gck-user-storage.c => gkm-user-storage.c}     |  922 +++++++++---------
 pkcs11/user-store/gkm-user-storage.h               |   79 ++
 .../gkm-user-store.h}                              |   22 +-
 pkcs11/user-store/tests/Makefile.am                |    4 +-
 pkcs11/user-store/tests/p11-tests.conf             |    4 +-
 pkcs11/user-store/tests/test-module.c              |    4 +-
 po/POTFILES.in                                     |    6 +-
 264 files changed, 16352 insertions(+), 16363 deletions(-)
---
diff --git a/configure.in b/configure.in
index f09d7d4..e37224e 100644
--- a/configure.in
+++ b/configure.in
@@ -574,8 +574,8 @@ gp11/tests/Makefile
 pam/Makefile
 pam/tests/Makefile
 pkcs11/Makefile
-pkcs11/gck/Makefile
-pkcs11/gck/tests/Makefile
+pkcs11/gkm/Makefile
+pkcs11/gkm/tests/Makefile
 pkcs11/plex-layer/Makefile
 pkcs11/roots-store/Makefile
 pkcs11/roots-store/tests/Makefile
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 6427643..3461718 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -35,13 +35,13 @@ gnome_keyring_daemon_LDADD = \
 	$(top_builddir)/daemon/control/libgkd-control.la \
 	$(top_builddir)/daemon/prompt/libgkd-prompt.la \
 	$(top_builddir)/daemon/ssh-agent/libgkd-ssh-agent.la \
-	$(top_builddir)/pkcs11/plex-layer/libgck-plex-layer.la \
-	$(top_builddir)/pkcs11/roots-store/libgck-roots-store.la \
-	$(top_builddir)/pkcs11/rpc-layer/libgck-rpc-layer.la \
-	$(top_builddir)/pkcs11/secret-store/libgck-secret-store.la \
-	$(top_builddir)/pkcs11/ssh-store/libgck-ssh-store.la \
-	$(top_builddir)/pkcs11/user-store/libgck-user-store.la \
-	$(top_builddir)/pkcs11/gck/libgck.la \
+	$(top_builddir)/pkcs11/plex-layer/libgkm-plex-layer.la \
+	$(top_builddir)/pkcs11/roots-store/libgkm-roots-store.la \
+	$(top_builddir)/pkcs11/rpc-layer/libgkm-rpc-layer.la \
+	$(top_builddir)/pkcs11/secret-store/libgkm-secret-store.la \
+	$(top_builddir)/pkcs11/ssh-store/libgkm-ssh-store.la \
+	$(top_builddir)/pkcs11/user-store/libgkm-user-store.la \
+	$(top_builddir)/pkcs11/gkm/libgkm.la \
 	$(top_builddir)/gp11/libgp11.la \
 	$(top_builddir)/egg/libegg-dbus.la \
 	$(DAEMON_LIBS) \
diff --git a/daemon/pkcs11/gkd-pkcs11.c b/daemon/pkcs11/gkd-pkcs11.c
index 1e97169..c5f569d 100644
--- a/daemon/pkcs11/gkd-pkcs11.c
+++ b/daemon/pkcs11/gkd-pkcs11.c
@@ -27,12 +27,12 @@
 
 #include "egg/egg-cleanup.h"
 
-#include "pkcs11/plex-layer/gck-plex-layer.h"
-#include "pkcs11/roots-store/gck-roots-store.h"
-#include "pkcs11/rpc-layer/gck-rpc-layer.h"
-#include "pkcs11/secret-store/gck-secret-store.h"
-#include "pkcs11/ssh-store/gck-ssh-store.h"
-#include "pkcs11/user-store/gck-user-store.h"
+#include "pkcs11/plex-layer/gkm-plex-layer.h"
+#include "pkcs11/roots-store/gkm-roots-store.h"
+#include "pkcs11/rpc-layer/gkm-rpc-layer.h"
+#include "pkcs11/secret-store/gkm-secret-store.h"
+#include "pkcs11/ssh-store/gkm-ssh-store.h"
+#include "pkcs11/user-store/gkm-user-store.h"
 
 #include "ssh-agent/gkd-ssh-agent.h"
 
@@ -50,7 +50,7 @@ pkcs11_daemon_cleanup (gpointer unused)
 	g_assert (pkcs11_roof);
 
 	gkd_ssh_agent_uninitialize ();
-	gck_rpc_layer_uninitialize ();
+	gkm_rpc_layer_uninitialize ();
 	rv = (pkcs11_roof->C_Finalize) (NULL);
 
 	if (rv != CKR_OK)
@@ -71,26 +71,26 @@ gkd_pkcs11_initialize (void)
 	CK_RV rv;
 
 	/* Secrets */
-	secret_store = gck_secret_store_get_functions ();
+	secret_store = gkm_secret_store_get_functions ();
 
 	/* SSH storage */
-	ssh_store = gck_ssh_store_get_functions ();
+	ssh_store = gkm_ssh_store_get_functions ();
 
 	/* Root certificates */
-	roots_store = gck_roots_store_get_functions ();
+	roots_store = gkm_roots_store_get_functions ();
 
 	/* User certificates */
-	user_store = gck_user_store_get_functions ();
+	user_store = gkm_user_store_get_functions ();
 
 	/* Add all of those into the multiplexing layer */
-	gck_plex_layer_add_module (ssh_store);
+	gkm_plex_layer_add_module (ssh_store);
 #ifdef ROOT_CERTIFICATES
-	gck_plex_layer_add_module (roots_store);
+	gkm_plex_layer_add_module (roots_store);
 #endif
-	gck_plex_layer_add_module (secret_store);
-	gck_plex_layer_add_module (user_store);
+	gkm_plex_layer_add_module (secret_store);
+	gkm_plex_layer_add_module (user_store);
 
-	pkcs11_base = gck_plex_layer_get_functions ();
+	pkcs11_base = gkm_plex_layer_get_functions ();
 
 	/* The auth component is the top component */
 	gkd_pkcs11_auth_chain_functions (pkcs11_base);
@@ -119,7 +119,7 @@ gkd_pkcs11_initialize (void)
 	egg_cleanup_register (pkcs11_daemon_cleanup, NULL);
 
 	ret = gkd_ssh_agent_initialize (pkcs11_roof) &&
-	      gck_rpc_layer_initialize (pkcs11_roof);
+	      gkm_rpc_layer_initialize (pkcs11_roof);
 
 	return ret;
 }
@@ -127,14 +127,14 @@ gkd_pkcs11_initialize (void)
 static void
 pkcs11_rpc_cleanup (gpointer unused)
 {
-	gck_rpc_layer_shutdown ();
+	gkm_rpc_layer_shutdown ();
 }
 
 static gboolean
 accept_rpc_client (GIOChannel *channel, GIOCondition cond, gpointer unused)
 {
 	if (cond == G_IO_IN)
-		gck_rpc_layer_accept ();
+		gkm_rpc_layer_accept ();
 
 	return TRUE;
 }
@@ -149,7 +149,7 @@ gkd_pkcs11_startup_pkcs11 (void)
 	base_dir = gkd_util_get_master_directory ();
 	g_return_val_if_fail (base_dir, FALSE);
 
-	sock = gck_rpc_layer_startup (base_dir);
+	sock = gkm_rpc_layer_startup (base_dir);
 	if (sock == -1)
 		return FALSE;
 
@@ -194,7 +194,7 @@ gkd_pkcs11_startup_ssh (void)
 	g_io_add_watch (channel, G_IO_IN | G_IO_HUP, accept_ssh_client, NULL);
 	g_io_channel_unref (channel);
 
-	/* gck-ssh-agent sets the environment variable */
+	/* gkm-ssh-agent sets the environment variable */
 	gkd_util_push_environment ("SSH_AUTH_SOCK", g_getenv ("SSH_AUTH_SOCK"));
 
 	egg_cleanup_register (pkcs11_ssh_cleanup, NULL);
diff --git a/daemon/ssh-agent/.gitignore b/daemon/ssh-agent/.gitignore
index 986e277..4c544c5 100644
--- a/daemon/ssh-agent/.gitignore
+++ b/daemon/ssh-agent/.gitignore
@@ -1,4 +1,4 @@
 /.*
-/gck-ssh-agent-standalone
+/gkd-ssh-agent-standalone
 /Makefile
 /Makefile.in
diff --git a/pkcs11/Makefile.am b/pkcs11/Makefile.am
index 599d038..0daa888 100644
--- a/pkcs11/Makefile.am
+++ b/pkcs11/Makefile.am
@@ -1,17 +1,17 @@
 
-# TODO: Are we sure this is the best location for these headers? 
+# TODO: Are we sure this is the best location for these headers?
 incdir = $(includedir)/gp11
 
 inc_HEADERS = \
 	pkcs11.h \
 	pkcs11g.h \
 	pkcs11n.h
-	
+
 EXTRA_DIST = \
 	pkcs11i.h
 
 SUBDIRS = . \
-	gck \
+	gkm \
 	roots-store \
 	rpc-layer \
 	plex-layer \
diff --git a/pkcs11/gck/.gitignore b/pkcs11/gkm/.gitignore
similarity index 71%
rename from pkcs11/gck/.gitignore
rename to pkcs11/gkm/.gitignore
index 10f4637..9ed6cf0 100644
--- a/pkcs11/gck/.gitignore
+++ b/pkcs11/gkm/.gitignore
@@ -4,5 +4,5 @@
 /temporary-test
 /asn1-def-pk.h
 /asn1-def-pkix.h
-/gck-marshal.c
-/gck-marshal.h
+/gkm-marshal.c
+/gkm-marshal.h
diff --git a/pkcs11/gkm/Makefile.am b/pkcs11/gkm/Makefile.am
new file mode 100644
index 0000000..d9ba884
--- /dev/null
+++ b/pkcs11/gkm/Makefile.am
@@ -0,0 +1,99 @@
+
+INCLUDES = \
+	-I$(top_builddir) \
+	-I$(top_srcdir) \
+	$(GOBJECT_CFLAGS) \
+	$(LIBGCRYPT_CFLAGS) \
+	$(GLIB_CFLAGS)
+
+# ------------------------------------------------------------------------------
+# The GKM library
+
+noinst_LTLIBRARIES = \
+	libgkm.la
+
+BUILT_SOURCES = \
+	gkm-marshal.c gkm-marshal.h \
+	asn1-def-pk.h asn1-def-pkix.h
+
+libgkm_la_SOURCES = \
+	gkm-aes-key.c gkm-aes-key.h \
+	gkm-aes-mechanism.c gkm-aes-mechanism.h \
+	gkm-attributes.c gkm-attributes.h \
+	gkm-certificate.c gkm-certificate.h \
+	gkm-certificate-key.c gkm-certificate-key.h \
+	gkm-certificate-trust.c gkm-certificate-trust.h \
+	gkm-credential.c gkm-credential.h \
+	gkm-crypto.c gkm-crypto.h \
+	gkm-data-asn1.c gkm-data-asn1.h \
+	gkm-data-der.c gkm-data-der.h \
+	gkm-data-file.c gkm-data-file.h \
+	gkm-data-types.h \
+	gkm-dh-key.c gkm-dh-key.h \
+	gkm-dh-mechanism.c gkm-dh-mechanism.h \
+	gkm-dh-private-key.c gkm-dh-private-key.h \
+	gkm-dh-public-key.c gkm-dh-public-key.h \
+	gkm-factory.c gkm-factory.h \
+	gkm-file-tracker.c gkm-file-tracker.h \
+	gkm-manager.c gkm-manager.h \
+	gkm-mechanism-dsa.c gkm-mechanism-dsa.h \
+	gkm-mechanism-rsa.c gkm-mechanism-rsa.h \
+	gkm-memory-store.c gkm-memory-store.h \
+	gkm-module.c gkm-module.h gkm-module-ep.h \
+	gkm-null-key.c gkm-null-key.h \
+	gkm-null-mechanism.c gkm-null-mechanism.h \
+	gkm-object.c gkm-object.h \
+	gkm-private-xsa-key.c gkm-private-xsa-key.h \
+	gkm-public-xsa-key.c gkm-public-xsa-key.h \
+	gkm-secret.c gkm-secret.h \
+	gkm-secret-key.c gkm-secret-key.h \
+	gkm-serializable.c gkm-serializable.h \
+	gkm-session.c gkm-session.h \
+	gkm-sexp.c gkm-sexp.h \
+	gkm-sexp-key.c gkm-sexp-key.h \
+	gkm-store.c gkm-store.h \
+	gkm-timer.c gkm-timer.h \
+	gkm-transaction.c gkm-transaction.h \
+	gkm-types.h \
+	gkm-util.c gkm-util.h \
+	$(BUILT_SOURCES)
+
+libgkm_la_CFLAGS = \
+	$(GOBJECT_CFLAGS) \
+	$(LIBGCRYPT_CFLAGS) \
+	$(LIBTASN1_CFLAGS) \
+	$(GLIB_CFLAGS)
+
+libgkm_la_LIBADD = \
+	$(top_builddir)/egg/libegg.la \
+	$(GOBJECT_LIBS) \
+	$(LIBGCRYPT_LIBS) \
+	$(GLIB_LIBS)
+
+gkm-marshal.h: gkm-marshal.list $(GLIB_GENMARSHAL)
+	$(GLIB_GENMARSHAL) $< --header --prefix=gkm_marshal > $@
+
+gkm-marshal.c: gkm-marshal.list $(GLIB_GENMARSHAL)
+	echo "#include \"gkm-marshal.h\"" > $@ && \
+	$(GLIB_GENMARSHAL) $< --body --prefix=gkm_marshal >> $@
+
+asn1-def-pk.h: pk.asn
+	$(ASN1PARSER) -o asn1-def-pk.h $<
+
+asn1-def-pkix.h: pkix.asn
+	$(ASN1PARSER) -o asn1-def-pkix.h $<
+
+EXTRA_DIST = \
+	gkm-marshal.list \
+	pkix.asn \
+	pk.asn
+
+# -------------------------------------------------------------------------------
+
+if WITH_TESTS
+TESTS_DIR = tests
+else
+TESTS_DIR =
+endif
+
+SUBDIRS = . $(TESTS_DIR)
diff --git a/pkcs11/gck/gck-aes-key.c b/pkcs11/gkm/gkm-aes-key.c
similarity index 63%
rename from pkcs11/gck/gck-aes-key.c
rename to pkcs11/gkm/gkm-aes-key.c
index 14d11e5..d53e911 100644
--- a/pkcs11/gck/gck-aes-key.c
+++ b/pkcs11/gkm/gkm-aes-key.c
@@ -23,23 +23,23 @@
 
 #include "pkcs11/pkcs11.h"
 
-#include "gck-aes-mechanism.h"
-#include "gck-attributes.h"
-#include "gck-crypto.h"
-#include "gck-aes-key.h"
-#include "gck-session.h"
-#include "gck-transaction.h"
-#include "gck-util.h"
+#include "gkm-aes-mechanism.h"
+#include "gkm-attributes.h"
+#include "gkm-crypto.h"
+#include "gkm-aes-key.h"
+#include "gkm-session.h"
+#include "gkm-transaction.h"
+#include "gkm-util.h"
 
 #include "egg/egg-secure-memory.h"
 
-struct _GckAesKey {
-	GckSecretKey parent;
+struct _GkmAesKey {
+	GkmSecretKey parent;
 	gpointer value;
 	gsize n_value;
 };
 
-G_DEFINE_TYPE (GckAesKey, gck_aes_key, GCK_TYPE_SECRET_KEY);
+G_DEFINE_TYPE (GkmAesKey, gkm_aes_key, GKM_TYPE_SECRET_KEY);
 
 /* -----------------------------------------------------------------------------
  * INTERNAL
@@ -61,14 +61,14 @@ algorithm_for_length (gsize length)
 }
 
 static CK_RV
-attribute_set_check_value (GckAesKey *self, CK_ATTRIBUTE *attr)
+attribute_set_check_value (GkmAesKey *self, CK_ATTRIBUTE *attr)
 {
 	gcry_cipher_hd_t cih;
 	gcry_error_t gcry;
 	gpointer data;
 	CK_RV rv;
 
-	g_assert (GCK_IS_AES_KEY (self));
+	g_assert (GKM_IS_AES_KEY (self));
 	g_assert (attr);
 
 	/* Just asking for the length */
@@ -77,7 +77,7 @@ attribute_set_check_value (GckAesKey *self, CK_ATTRIBUTE *attr)
 		return CKR_OK;
 	}
 
-	cih = gck_aes_key_get_cipher (self, GCRY_CIPHER_MODE_ECB);
+	cih = gkm_aes_key_get_cipher (self, GCRY_CIPHER_MODE_ECB);
 	if (cih == NULL)
 		return CKR_FUNCTION_FAILED;
 
@@ -90,7 +90,7 @@ attribute_set_check_value (GckAesKey *self, CK_ATTRIBUTE *attr)
 
 	/* Use the first three bytes */
 	g_assert (self->n_value > 3);
-	rv = gck_attribute_set_data (attr, data, 3);
+	rv = gkm_attribute_set_data (attr, data, 3);
 
 	gcry_cipher_close (cih);
 	g_free (data);
@@ -98,28 +98,28 @@ attribute_set_check_value (GckAesKey *self, CK_ATTRIBUTE *attr)
 	return rv;
 }
 
-static GckObject*
-factory_create_aes_key (GckSession *session, GckTransaction *transaction,
+static GkmObject*
+factory_create_aes_key (GkmSession *session, GkmTransaction *transaction,
                         CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
 {
-	GckAesKey *key;
-	GckManager *manager;
+	GkmAesKey *key;
+	GkmManager *manager;
 	CK_ATTRIBUTE_PTR value;
 
-	value = gck_attributes_find (attrs, n_attrs, CKA_VALUE);
+	value = gkm_attributes_find (attrs, n_attrs, CKA_VALUE);
 	if (value == NULL) {
-		gck_transaction_fail (transaction, CKR_TEMPLATE_INCOMPLETE);
+		gkm_transaction_fail (transaction, CKR_TEMPLATE_INCOMPLETE);
 		return NULL;
 	}
 
 	if (algorithm_for_length (value->ulValueLen) == 0) {
-		gck_transaction_fail (transaction, CKR_TEMPLATE_INCONSISTENT);
+		gkm_transaction_fail (transaction, CKR_TEMPLATE_INCONSISTENT);
 		return NULL;
 	}
 
-	manager = gck_manager_for_template (attrs, n_attrs, session);
-	key = g_object_new (GCK_TYPE_AES_KEY,
-	                    "module", gck_session_get_module (session),
+	manager = gkm_manager_for_template (attrs, n_attrs, session);
+	key = g_object_new (GKM_TYPE_AES_KEY,
+	                    "module", gkm_session_get_module (session),
 	                    "manager", manager,
 	                    NULL);
 
@@ -127,11 +127,11 @@ factory_create_aes_key (GckSession *session, GckTransaction *transaction,
 	key->n_value = value->ulValueLen;
 	memcpy (key->value, value->pValue, key->n_value);
 
-	gck_attribute_consume (value);
+	gkm_attribute_consume (value);
 
-	gck_session_complete_object_creation (session, transaction, GCK_OBJECT (key),
+	gkm_session_complete_object_creation (session, transaction, GKM_OBJECT (key),
 	                                      TRUE, attrs, n_attrs);
-	return GCK_OBJECT (key);
+	return GKM_OBJECT (key);
 }
 
 /* -----------------------------------------------------------------------------
@@ -139,46 +139,46 @@ factory_create_aes_key (GckSession *session, GckTransaction *transaction,
  */
 
 static CK_RV
-gck_aes_key_real_get_attribute (GckObject *base, GckSession *session, CK_ATTRIBUTE *attr)
+gkm_aes_key_real_get_attribute (GkmObject *base, GkmSession *session, CK_ATTRIBUTE *attr)
 {
-	GckAesKey *self = GCK_AES_KEY (base);
+	GkmAesKey *self = GKM_AES_KEY (base);
 
 	switch (attr->type)
 	{
 	case CKA_KEY_TYPE:
-		return gck_attribute_set_ulong (attr, CKK_AES);
+		return gkm_attribute_set_ulong (attr, CKK_AES);
 
 	case CKA_UNWRAP:
 	case CKA_WRAP:
-		return gck_attribute_set_bool (attr, CK_TRUE);
+		return gkm_attribute_set_bool (attr, CK_TRUE);
 
 	case CKA_VALUE:
-		return gck_attribute_set_data (attr, self->value, self->n_value);
+		return gkm_attribute_set_data (attr, self->value, self->n_value);
 
 	case CKA_VALUE_LEN:
-		return gck_attribute_set_ulong (attr, self->n_value);
+		return gkm_attribute_set_ulong (attr, self->n_value);
 
 	case CKA_CHECK_VALUE:
 		return attribute_set_check_value (self, attr);
 
 	case CKA_ALLOWED_MECHANISMS:
-		return gck_attribute_set_data (attr, (CK_VOID_PTR)GCK_AES_MECHANISMS,
-		                               sizeof (GCK_AES_MECHANISMS));
+		return gkm_attribute_set_data (attr, (CK_VOID_PTR)GKM_AES_MECHANISMS,
+		                               sizeof (GKM_AES_MECHANISMS));
 	};
 
-	return GCK_OBJECT_CLASS (gck_aes_key_parent_class)->get_attribute (base, session, attr);
+	return GKM_OBJECT_CLASS (gkm_aes_key_parent_class)->get_attribute (base, session, attr);
 }
 
 static void
-gck_aes_key_init (GckAesKey *self)
+gkm_aes_key_init (GkmAesKey *self)
 {
 
 }
 
 static void
-gck_aes_key_finalize (GObject *obj)
+gkm_aes_key_finalize (GObject *obj)
 {
-	GckAesKey *self = GCK_AES_KEY (obj);
+	GkmAesKey *self = GKM_AES_KEY (obj);
 
 	if (self->value) {
 		egg_secure_clear (self->value, self->n_value);
@@ -187,28 +187,28 @@ gck_aes_key_finalize (GObject *obj)
 		self->n_value = 0;
 	}
 
-	G_OBJECT_CLASS (gck_aes_key_parent_class)->finalize (obj);
+	G_OBJECT_CLASS (gkm_aes_key_parent_class)->finalize (obj);
 }
 
 static void
-gck_aes_key_class_init (GckAesKeyClass *klass)
+gkm_aes_key_class_init (GkmAesKeyClass *klass)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	GckObjectClass *gck_class = GCK_OBJECT_CLASS (klass);
+	GkmObjectClass *gkm_class = GKM_OBJECT_CLASS (klass);
 
-	gck_aes_key_parent_class = g_type_class_peek_parent (klass);
+	gkm_aes_key_parent_class = g_type_class_peek_parent (klass);
 
-	gobject_class->finalize = gck_aes_key_finalize;
+	gobject_class->finalize = gkm_aes_key_finalize;
 
-	gck_class->get_attribute = gck_aes_key_real_get_attribute;
+	gkm_class->get_attribute = gkm_aes_key_real_get_attribute;
 }
 
 /* -----------------------------------------------------------------------------
  * PUBLIC
  */
 
-GckFactory*
-gck_aes_key_get_factory (void)
+GkmFactory*
+gkm_aes_key_get_factory (void)
 {
 	static CK_OBJECT_CLASS klass = CKO_SECRET_KEY;
 	static CK_KEY_TYPE type = CKK_AES;
@@ -218,7 +218,7 @@ gck_aes_key_get_factory (void)
 		{ CKA_KEY_TYPE, &type, sizeof (type) }
 	};
 
-	static GckFactory factory = {
+	static GkmFactory factory = {
 		attributes,
 		G_N_ELEMENTS (attributes),
 		factory_create_aes_key
@@ -228,11 +228,11 @@ gck_aes_key_get_factory (void)
 }
 
 gsize
-gck_aes_key_get_block_size (GckAesKey *self)
+gkm_aes_key_get_block_size (GkmAesKey *self)
 {
 	int algorithm;
 
-	g_return_val_if_fail (GCK_IS_AES_KEY (self), 0);
+	g_return_val_if_fail (GKM_IS_AES_KEY (self), 0);
 
 	algorithm = algorithm_for_length (self->n_value);
 	g_return_val_if_fail (algorithm != 0, 0);
@@ -241,13 +241,13 @@ gck_aes_key_get_block_size (GckAesKey *self)
 }
 
 gcry_cipher_hd_t
-gck_aes_key_get_cipher (GckAesKey *self, int mode)
+gkm_aes_key_get_cipher (GkmAesKey *self, int mode)
 {
 	gcry_cipher_hd_t cih;
 	gcry_error_t gcry;
 	int algorithm;
 
-	g_return_val_if_fail (GCK_IS_AES_KEY (self), NULL);
+	g_return_val_if_fail (GKM_IS_AES_KEY (self), NULL);
 
 	algorithm = algorithm_for_length (self->n_value);
 	g_return_val_if_fail (algorithm != 0, NULL);
diff --git a/pkcs11/gkm/gkm-aes-key.h b/pkcs11/gkm/gkm-aes-key.h
new file mode 100644
index 0000000..c3fc9ea
--- /dev/null
+++ b/pkcs11/gkm/gkm-aes-key.h
@@ -0,0 +1,57 @@
+/*
+ * 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 __GKM_AES_KEY_H__
+#define __GKM_AES_KEY_H__
+
+#include <glib-object.h>
+
+#include "gkm-secret-key.h"
+#include "gkm-types.h"
+
+#include <gcrypt.h>
+
+#define GKM_FACTORY_AES_KEY            (gkm_aes_key_get_factory ())
+
+#define GKM_TYPE_AES_KEY               (gkm_aes_key_get_type ())
+#define GKM_AES_KEY(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_AES_KEY, GkmAesKey))
+#define GKM_AES_KEY_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_AES_KEY, GkmAesKeyClass))
+#define GKM_IS_AES_KEY(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_AES_KEY))
+#define GKM_IS_AES_KEY_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_AES_KEY))
+#define GKM_AES_KEY_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_AES_KEY, GkmAesKeyClass))
+
+typedef struct _GkmAesKeyClass GkmAesKeyClass;
+typedef struct _GkmAesKeyPrivate GkmAesKeyPrivate;
+
+struct _GkmAesKeyClass {
+	GkmSecretKeyClass parent_class;
+};
+
+GType                     gkm_aes_key_get_type           (void);
+
+GkmFactory*               gkm_aes_key_get_factory        (void);
+
+gsize                     gkm_aes_key_get_block_size     (GkmAesKey *self);
+
+gcry_cipher_hd_t          gkm_aes_key_get_cipher         (GkmAesKey *self,
+                                                          int mode);
+
+#endif /* __GKM_AES_KEY_H__ */
diff --git a/pkcs11/gck/gck-aes-mechanism.c b/pkcs11/gkm/gkm-aes-mechanism.c
similarity index 76%
rename from pkcs11/gck/gck-aes-mechanism.c
rename to pkcs11/gkm/gkm-aes-mechanism.c
index 1389560..9742450 100644
--- a/pkcs11/gck/gck-aes-mechanism.c
+++ b/pkcs11/gkm/gkm-aes-mechanism.c
@@ -21,18 +21,18 @@
 
 #include "config.h"
 
-#include "gck-aes-key.h"
-#include "gck-aes-mechanism.h"
-#include "gck-session.h"
-#include "gck-transaction.h"
-#include "gck-util.h"
+#include "gkm-aes-key.h"
+#include "gkm-aes-mechanism.h"
+#include "gkm-session.h"
+#include "gkm-transaction.h"
+#include "gkm-util.h"
 
 #include "egg/egg-libgcrypt.h"
 #include "egg/egg-padding.h"
 #include "egg/egg-secure-memory.h"
 
 static CK_RV
-retrieve_length (GckSession *session, GckObject *wrapped, gsize *length)
+retrieve_length (GkmSession *session, GkmObject *wrapped, gsize *length)
 {
 	CK_ATTRIBUTE attr;
 	CK_RV rv;
@@ -41,14 +41,14 @@ retrieve_length (GckSession *session, GckObject *wrapped, gsize *length)
 	attr.pValue = NULL;
 	attr.ulValueLen = 0;
 
-	rv = gck_object_get_attribute (wrapped, session, &attr);
+	rv = gkm_object_get_attribute (wrapped, session, &attr);
 	if (rv == CKR_OK)
 		*length = attr.ulValueLen;
 	return rv;
 }
 
 static CK_RV
-retrieve_value (GckSession *session, GckObject *wrapped,
+retrieve_value (GkmSession *session, GkmObject *wrapped,
                 gpointer *value, gsize *n_value)
 {
 	CK_ATTRIBUTE attr;
@@ -62,7 +62,7 @@ retrieve_value (GckSession *session, GckObject *wrapped,
 	attr.pValue = egg_secure_alloc (*n_value);
 	attr.ulValueLen = *n_value;
 
-	rv = gck_object_get_attribute (wrapped, session, &attr);
+	rv = gkm_object_get_attribute (wrapped, session, &attr);
 	if (rv == CKR_OK)
 		*value = attr.pValue;
 	else
@@ -72,30 +72,30 @@ retrieve_value (GckSession *session, GckObject *wrapped,
 }
 
 CK_RV
-gck_aes_mechanism_wrap (GckSession *session, CK_MECHANISM_PTR mech,
-                        GckObject *wrapper, GckObject *wrapped,
+gkm_aes_mechanism_wrap (GkmSession *session, CK_MECHANISM_PTR mech,
+                        GkmObject *wrapper, GkmObject *wrapped,
                         CK_BYTE_PTR output, CK_ULONG_PTR n_output)
 {
 	gcry_cipher_hd_t cih;
 	gcry_error_t gcry;
-	GckAesKey *key;
+	GkmAesKey *key;
 	gpointer value, padded;
 	gsize n_value, n_padded;
 	gsize block, pos;
 	gboolean ret;
 	CK_RV rv;
 
-	g_return_val_if_fail (GCK_IS_SESSION (session), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (GKM_IS_SESSION (session), CKR_GENERAL_ERROR);
 	g_return_val_if_fail (mech, CKR_GENERAL_ERROR);
 	g_return_val_if_fail (mech->mechanism == CKM_AES_CBC_PAD, CKR_GENERAL_ERROR);
-	g_return_val_if_fail (GCK_IS_OBJECT (wrapped), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (GKM_IS_OBJECT (wrapped), CKR_GENERAL_ERROR);
 	g_return_val_if_fail (n_output, CKR_GENERAL_ERROR);
 
-	if (!GCK_IS_AES_KEY (wrapper))
+	if (!GKM_IS_AES_KEY (wrapper))
 		return CKR_WRAPPING_KEY_TYPE_INCONSISTENT;
-	key = GCK_AES_KEY (wrapper);
+	key = GKM_AES_KEY (wrapper);
 
-	block = gck_aes_key_get_block_size (key);
+	block = gkm_aes_key_get_block_size (key);
 	g_return_val_if_fail (block != 0, CKR_GENERAL_ERROR);
 
 	/* They just want the length */
@@ -109,7 +109,7 @@ gck_aes_mechanism_wrap (GckSession *session, CK_MECHANISM_PTR mech,
 		return CKR_OK;
 	}
 
-	cih = gck_aes_key_get_cipher (key, GCRY_CIPHER_MODE_CBC);
+	cih = gkm_aes_key_get_cipher (key, GCRY_CIPHER_MODE_CBC);
 	if (cih == NULL)
 		return CKR_FUNCTION_FAILED;
 
@@ -140,44 +140,44 @@ gck_aes_mechanism_wrap (GckSession *session, CK_MECHANISM_PTR mech,
 
 	gcry_cipher_close (cih);
 
-	rv = gck_util_return_data (output, n_output, padded, n_padded);
+	rv = gkm_util_return_data (output, n_output, padded, n_padded);
 	egg_secure_free (padded);
 	return rv;
 }
 
 CK_RV
-gck_aes_mechanism_unwrap (GckSession *session, CK_MECHANISM_PTR mech,
-                          GckObject *wrapper, CK_VOID_PTR input, CK_ULONG n_input,
+gkm_aes_mechanism_unwrap (GkmSession *session, CK_MECHANISM_PTR mech,
+                          GkmObject *wrapper, CK_VOID_PTR input, CK_ULONG n_input,
                           CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs,
-                          GckObject **unwrapped)
+                          GkmObject **unwrapped)
 {
 	gcry_cipher_hd_t cih;
 	gcry_error_t gcry;
 	CK_ATTRIBUTE attr;
 	GArray *array;
-	GckAesKey *key;
+	GkmAesKey *key;
 	gpointer padded, value;
 	gsize n_padded, n_value;
-	GckTransaction *transaction;
+	GkmTransaction *transaction;
 	gsize block, pos;
 	gboolean ret;
 
-	g_return_val_if_fail (GCK_IS_SESSION (session), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (GKM_IS_SESSION (session), CKR_GENERAL_ERROR);
 	g_return_val_if_fail (mech, CKR_GENERAL_ERROR);
 	g_return_val_if_fail (mech->mechanism == CKM_AES_CBC_PAD, CKR_GENERAL_ERROR);
-	g_return_val_if_fail (GCK_IS_OBJECT (wrapper), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (GKM_IS_OBJECT (wrapper), CKR_GENERAL_ERROR);
 
-	if (!GCK_IS_AES_KEY (wrapper))
+	if (!GKM_IS_AES_KEY (wrapper))
 		return CKR_WRAPPING_KEY_TYPE_INCONSISTENT;
-	key = GCK_AES_KEY (wrapper);
+	key = GKM_AES_KEY (wrapper);
 
-	block = gck_aes_key_get_block_size (key);
+	block = gkm_aes_key_get_block_size (key);
 	g_return_val_if_fail (block != 0, CKR_GENERAL_ERROR);
 
 	if (n_input == 0 || n_input % block != 0)
 		return CKR_WRAPPED_KEY_LEN_RANGE;
 
-	cih = gck_aes_key_get_cipher (key, GCRY_CIPHER_MODE_CBC);
+	cih = gkm_aes_key_get_cipher (key, GCRY_CIPHER_MODE_CBC);
 	if (cih == NULL)
 		return CKR_FUNCTION_FAILED;
 
@@ -218,14 +218,14 @@ gck_aes_mechanism_unwrap (GckSession *session, CK_MECHANISM_PTR mech,
 	/* Add the remainder of the attributes */
 	g_array_append_vals (array, attrs, n_attrs);
 
-	transaction = gck_transaction_new ();
+	transaction = gkm_transaction_new ();
 
 	/* Now create an object with these attributes */
-	*unwrapped = gck_session_create_object_for_attributes (session, transaction,
+	*unwrapped = gkm_session_create_object_for_attributes (session, transaction,
 	                                                       (CK_ATTRIBUTE_PTR)array->data, array->len);
 
 	egg_secure_free (value);
 	g_array_free (array, TRUE);
 
-	return gck_transaction_complete_and_unref (transaction);
+	return gkm_transaction_complete_and_unref (transaction);
 }
diff --git a/pkcs11/gck/gck-aes-mechanism.h b/pkcs11/gkm/gkm-aes-mechanism.h
similarity index 77%
rename from pkcs11/gck/gck-aes-mechanism.h
rename to pkcs11/gkm/gkm-aes-mechanism.h
index de9c982..a473d4b 100644
--- a/pkcs11/gck/gck-aes-mechanism.h
+++ b/pkcs11/gkm/gkm-aes-mechanism.h
@@ -19,36 +19,36 @@
  * 02111-1307, USA.
  */
 
-#ifndef GCK_AES_MECHANISM_H_
-#define GCK_AES_MECHANISM_H_
+#ifndef GKM_AES_MECHANISM_H_
+#define GKM_AES_MECHANISM_H_
 
-#include "gck-types.h"
+#include "gkm-types.h"
 
 #include "pkcs11/pkcs11.h"
 
 #include <glib.h>
 
-#define GCK_AES_MECHANISM_MIN_LENGTH     16
-#define GCK_AES_MECHANISM_MAX_LENGTH     32
+#define GKM_AES_MECHANISM_MIN_LENGTH     16
+#define GKM_AES_MECHANISM_MAX_LENGTH     32
 
-static const CK_MECHANISM_TYPE GCK_AES_MECHANISMS[] = {
+static const CK_MECHANISM_TYPE GKM_AES_MECHANISMS[] = {
 	CKM_AES_CBC_PAD
 };
 
-CK_RV                   gck_aes_mechanism_wrap                 (GckSession *session,
+CK_RV                   gkm_aes_mechanism_wrap                 (GkmSession *session,
                                                                 CK_MECHANISM_PTR mech,
-                                                                GckObject *wrapper,
-                                                                GckObject *wrapped,
+                                                                GkmObject *wrapper,
+                                                                GkmObject *wrapped,
                                                                 CK_BYTE_PTR output,
                                                                 CK_ULONG_PTR n_output);
 
-CK_RV                   gck_aes_mechanism_unwrap               (GckSession *session,
+CK_RV                   gkm_aes_mechanism_unwrap               (GkmSession *session,
                                                                 CK_MECHANISM_PTR mech,
-                                                                GckObject *wrapper,
+                                                                GkmObject *wrapper,
                                                                 CK_VOID_PTR input,
                                                                 CK_ULONG n_input,
                                                                 CK_ATTRIBUTE_PTR attrs,
                                                                 CK_ULONG n_attrs,
-                                                                GckObject **unwrapped);
+                                                                GkmObject **unwrapped);
 
-#endif /* GCK_AES_MECHANISM_H_ */
+#endif /* GKM_AES_MECHANISM_H_ */
diff --git a/pkcs11/gck/gck-attributes.c b/pkcs11/gkm/gkm-attributes.c
similarity index 76%
rename from pkcs11/gck/gck-attributes.c
rename to pkcs11/gkm/gkm-attributes.c
index b2c7c53..21e5f34 100644
--- a/pkcs11/gck/gck-attributes.c
+++ b/pkcs11/gkm/gkm-attributes.c
@@ -1,28 +1,28 @@
-/* 
+/*
  * 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  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  License for more details.
- *  
- * You should have received a copy of the GNU Lesser General 
+ *
+ * You should have received a copy of the GNU Lesser General
  * 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"
 
-#include "gck-attributes.h"
-#include "gck-util.h"
+#include "gkm-attributes.h"
+#include "gkm-util.h"
 
 #include <stdarg.h>
 #include <stdio.h>
@@ -30,7 +30,7 @@
 
 
 CK_RV
-gck_attribute_get_bool (CK_ATTRIBUTE_PTR attr, gboolean *value)
+gkm_attribute_get_bool (CK_ATTRIBUTE_PTR attr, gboolean *value)
 {
 	CK_BBOOL* bool;
 
@@ -46,7 +46,7 @@ gck_attribute_get_bool (CK_ATTRIBUTE_PTR attr, gboolean *value)
 }
 
 CK_RV
-gck_attribute_get_ulong (CK_ATTRIBUTE_PTR attr, CK_ULONG *value)
+gkm_attribute_get_ulong (CK_ATTRIBUTE_PTR attr, CK_ULONG *value)
 {
 	CK_ULONG* ulong;
 
@@ -93,7 +93,7 @@ timegm (struct tm *t)
 #endif // NOT_HAVE_TIMEGM
 
 CK_RV
-gck_attribute_get_time (CK_ATTRIBUTE_PTR attr, glong *when)
+gkm_attribute_get_time (CK_ATTRIBUTE_PTR attr, glong *when)
 {
 	struct tm tm;
 	gchar buf[15];
@@ -127,7 +127,7 @@ gck_attribute_get_time (CK_ATTRIBUTE_PTR attr, glong *when)
 }
 
 CK_RV
-gck_attribute_get_string (CK_ATTRIBUTE_PTR attr, gchar **value)
+gkm_attribute_get_string (CK_ATTRIBUTE_PTR attr, gchar **value)
 {
 	g_return_val_if_fail (attr, CKR_GENERAL_ERROR);
 	g_return_val_if_fail (value, CKR_GENERAL_ERROR);
@@ -148,7 +148,7 @@ gck_attribute_get_string (CK_ATTRIBUTE_PTR attr, gchar **value)
 }
 
 CK_RV
-gck_attribute_get_mpi (CK_ATTRIBUTE_PTR attr, gcry_mpi_t *value)
+gkm_attribute_get_mpi (CK_ATTRIBUTE_PTR attr, gcry_mpi_t *value)
 {
 	gcry_error_t gcry;
 
@@ -163,7 +163,7 @@ gck_attribute_get_mpi (CK_ATTRIBUTE_PTR attr, gcry_mpi_t *value)
 }
 
 CK_RV
-gck_attribute_get_template (CK_ATTRIBUTE_PTR attr, GArray **template)
+gkm_attribute_get_template (CK_ATTRIBUTE_PTR attr, GArray **template)
 {
 	CK_ULONG n_attrs;
 
@@ -178,46 +178,46 @@ gck_attribute_get_template (CK_ATTRIBUTE_PTR attr, GArray **template)
 	if (n_attrs != 0 && !attr->pValue)
 		return CKR_ATTRIBUTE_VALUE_INVALID;
 
-	*template = gck_template_new (attr->pValue, n_attrs);
+	*template = gkm_template_new (attr->pValue, n_attrs);
 	return CKR_OK;
 }
 
 CK_RV
-gck_attribute_set_empty (CK_ATTRIBUTE_PTR attr)
+gkm_attribute_set_empty (CK_ATTRIBUTE_PTR attr)
 {
-	return gck_attribute_set_data (attr, "", 0);
+	return gkm_attribute_set_data (attr, "", 0);
 }
 
 CK_RV
-gck_attribute_set_bool (CK_ATTRIBUTE_PTR attr, CK_BBOOL value)
+gkm_attribute_set_bool (CK_ATTRIBUTE_PTR attr, CK_BBOOL value)
 {
-	return gck_attribute_set_data (attr, &value, sizeof (CK_BBOOL));
+	return gkm_attribute_set_data (attr, &value, sizeof (CK_BBOOL));
 }
 
 CK_RV
-gck_attribute_set_ulong (CK_ATTRIBUTE_PTR attr, CK_ULONG value)
+gkm_attribute_set_ulong (CK_ATTRIBUTE_PTR attr, CK_ULONG value)
 {
-	return gck_attribute_set_data (attr, &value, sizeof (CK_ULONG));
+	return gkm_attribute_set_data (attr, &value, sizeof (CK_ULONG));
 }
 
 CK_RV
-gck_attribute_set_string (CK_ATTRIBUTE_PTR attr, const gchar* string)
+gkm_attribute_set_string (CK_ATTRIBUTE_PTR attr, const gchar* string)
 {
-	return gck_attribute_set_data (attr, (CK_VOID_PTR)string, 
+	return gkm_attribute_set_data (attr, (CK_VOID_PTR)string,
 	                               string ? strlen (string) : 0);
 }
 
 CK_RV
-gck_attribute_set_date (CK_ATTRIBUTE_PTR attr, time_t time)
+gkm_attribute_set_date (CK_ATTRIBUTE_PTR attr, time_t time)
 {
 	CK_DATE date;
 	struct tm tm;
 	gchar buf[16];
-	
+
 	/* 'Empty' date as defined in PKCS#11 */
 	if (time == (time_t)-1)
-		return gck_attribute_set_data (attr, NULL, 0);
-	
+		return gkm_attribute_set_data (attr, NULL, 0);
+
 	if (!attr->pValue) {
 		attr->ulValueLen = sizeof (CK_DATE);
 		return CKR_OK;
@@ -225,31 +225,31 @@ gck_attribute_set_date (CK_ATTRIBUTE_PTR attr, time_t time)
 
 	if (!gmtime_r (&time, &tm))
 		g_return_val_if_reached (CKR_GENERAL_ERROR);
-		
+
 	g_assert (sizeof (date.year) == 4);
 	snprintf ((char*)buf, 5, "%04d", 1900 + tm.tm_year);
 	memcpy (date.year, buf, 4);
-	 
+
 	g_assert (sizeof (date.month) == 2);
 	snprintf ((char*)buf, 3, "%02d", tm.tm_mon + 1);
 	memcpy (date.month, buf, 2);
-	
+
 	g_assert (sizeof (date.day) == 2);
 	snprintf ((char*)buf, 3, "%02d", tm.tm_mday);
 	memcpy (date.day, buf, 2);
-		
-	return gck_attribute_set_data (attr, &date, sizeof (date));
+
+	return gkm_attribute_set_data (attr, &date, sizeof (date));
 }
 
 CK_RV
-gck_attribute_set_time (CK_ATTRIBUTE_PTR attr, glong when)
+gkm_attribute_set_time (CK_ATTRIBUTE_PTR attr, glong when)
 {
 	struct tm tm;
 	gchar buf[20];
 
 	/* 'Empty' time as defined in PKCS#11 */
 	if (when == (glong)-1)
-		return gck_attribute_set_data (attr, NULL, 0);
+		return gkm_attribute_set_data (attr, NULL, 0);
 
 	if (!attr->pValue) {
 		attr->ulValueLen = 16;
@@ -263,27 +263,27 @@ gck_attribute_set_time (CK_ATTRIBUTE_PTR attr, glong when)
 	if (!strftime(buf, sizeof (buf), "%Y%m%d%H%M%S00", &tm))
 		g_return_val_if_reached (CKR_GENERAL_ERROR);
 
-	return gck_attribute_set_data (attr, buf, 16);
+	return gkm_attribute_set_data (attr, buf, 16);
 }
 
 CK_RV
-gck_attribute_set_data (CK_ATTRIBUTE_PTR attr, gconstpointer value, gsize n_value)
+gkm_attribute_set_data (CK_ATTRIBUTE_PTR attr, gconstpointer value, gsize n_value)
 {
-	CK_RV rv = gck_util_return_data (attr->pValue, &(attr->ulValueLen), value, n_value);
+	CK_RV rv = gkm_util_return_data (attr->pValue, &(attr->ulValueLen), value, n_value);
 	if (rv == CKR_BUFFER_TOO_SMALL)
 		attr->ulValueLen = (CK_ULONG)-1;
 	return rv;
 }
 
 CK_RV
-gck_attribute_set_mpi (CK_ATTRIBUTE_PTR attr, gcry_mpi_t mpi)
+gkm_attribute_set_mpi (CK_ATTRIBUTE_PTR attr, gcry_mpi_t mpi)
 {
 	gsize len;
-  	gcry_error_t gcry;
+	gcry_error_t gcry;
 
 	g_assert (attr);
 	g_assert (mpi);
-	
+
 	/* Get the size */
 	gcry = gcry_mpi_print (GCRYMPI_FMT_USG, NULL, 0, &len, mpi);
 	g_return_val_if_fail (gcry == 0, CKR_GENERAL_ERROR);
@@ -292,22 +292,22 @@ gck_attribute_set_mpi (CK_ATTRIBUTE_PTR attr, gcry_mpi_t mpi)
 		attr->ulValueLen = len;
 		return CKR_OK;
 	}
-	
+
 	if (len > attr->ulValueLen) {
 		attr->ulValueLen = (CK_ULONG)-1;
 		return CKR_BUFFER_TOO_SMALL;
 	}
 
 	/* Write in directly to attribute */
-	gcry = gcry_mpi_print (GCRYMPI_FMT_USG, attr->pValue, len, &len, mpi);	
+	gcry = gcry_mpi_print (GCRYMPI_FMT_USG, attr->pValue, len, &len, mpi);
 	g_return_val_if_fail (gcry == 0, CKR_GENERAL_ERROR);
-	
+
 	attr->ulValueLen = len;
 	return CKR_OK;
 }
 
 CK_RV
-gck_attribute_set_template (CK_ATTRIBUTE_PTR attr, GArray *template)
+gkm_attribute_set_template (CK_ATTRIBUTE_PTR attr, GArray *template)
 {
 	CK_ATTRIBUTE_PTR array;
 	CK_ATTRIBUTE_PTR at;
@@ -350,14 +350,14 @@ gck_attribute_set_template (CK_ATTRIBUTE_PTR attr, GArray *template)
 }
 
 gboolean
-gck_attribute_equal (gconstpointer v1, gconstpointer v2)
+gkm_attribute_equal (gconstpointer v1, gconstpointer v2)
 {
 	const CK_ATTRIBUTE *a1 = v1;
 	const CK_ATTRIBUTE *a2 = v2;
-	
+
 	g_assert (a1);
 	g_assert (a2);
-	
+
 	if (a1 == a2)
 		return TRUE;
 	if (a1->type != a2->type)
@@ -371,46 +371,46 @@ gck_attribute_equal (gconstpointer v1, gconstpointer v2)
 
 	g_assert (a1->pValue);
 	g_assert (a2->pValue);
-	
+
 	return memcmp (a1->pValue, a2->pValue, a1->ulValueLen) == 0;
 }
 
 guint
-gck_attribute_hash (gconstpointer v)
+gkm_attribute_hash (gconstpointer v)
 {
 	const CK_ATTRIBUTE *a = v;
 	const signed char *p;
 	guint i, h;
-	
+
 	g_assert (a);
-	
+
 	p = (const signed char*)&(a->type);
 	h = *p;
 	for(i = 0; i < sizeof (CK_ATTRIBUTE_PTR); ++i)
 		h = (h << 5) - h + *(p++);
-	
+
 	p = a->pValue;
 	for(i = 0; i < a->ulValueLen; ++i)
 		h = (h << 5) - h + *(p++);
-	
+
 	return h;
 }
 
 gboolean
-gck_attribute_consumed (CK_ATTRIBUTE_PTR attr)
+gkm_attribute_consumed (CK_ATTRIBUTE_PTR attr)
 {
 	g_return_val_if_fail (attr, FALSE);
 	return attr->type == (CK_ULONG)-1;
 }
 
 void
-gck_attribute_consume (CK_ATTRIBUTE_PTR attr)
+gkm_attribute_consume (CK_ATTRIBUTE_PTR attr)
 {
 	attr->type = (CK_ULONG)-1;
 }
 
 void
-gck_attributes_consume (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, ...)
+gkm_attributes_consume (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, ...)
 {
 	CK_ATTRIBUTE_TYPE type;
 	GArray *types;
@@ -423,10 +423,10 @@ gck_attributes_consume (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, ...)
 	while ((type = va_arg (va, CK_ATTRIBUTE_TYPE)) != G_MAXULONG)
 		 g_array_append_val (types, type);
 	va_end (va);
-	
+
 	/* Consume each attribute whose type was in the var args */
 	for (i = 0; i < n_attrs; ++i) {
-		if (gck_attribute_consumed (&attrs[i]))
+		if (gkm_attribute_consumed (&attrs[i]))
 			continue;
 		for (j = 0; j < types->len; ++j) {
 			if (attrs[i].type == g_array_index (types, CK_ATTRIBUTE_TYPE, j)) {
@@ -435,55 +435,55 @@ gck_attributes_consume (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, ...)
 			}
 		}
 	}
-	
+
 	g_array_free (types, TRUE);
 }
 
 gboolean
-gck_attributes_contains (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, CK_ATTRIBUTE_PTR attr)
+gkm_attributes_contains (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, CK_ATTRIBUTE_PTR attr)
 {
 	CK_ULONG i;
-	
+
 	g_assert (attrs || !n_attrs);
 	g_assert (attr);
-	
+
 	for (i = 0; i < n_attrs; ++i) {
-		if (gck_attribute_equal (attr, &attrs[i]))
+		if (gkm_attribute_equal (attr, &attrs[i]))
 			return TRUE;
 	}
-	
+
 	return FALSE;
 }
 
 CK_ATTRIBUTE_PTR
-gck_attributes_find (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, CK_ATTRIBUTE_TYPE type)
+gkm_attributes_find (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, CK_ATTRIBUTE_TYPE type)
 {
 	CK_ULONG i;
-	
+
 	g_assert (attrs || !n_attrs);
-	
+
 	for (i = 0; i < n_attrs; ++i) {
 		if(attrs[i].type == type)
 			return &attrs[i];
 	}
-	
+
 	return NULL;
 }
 
 gboolean
-gck_attributes_find_boolean (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, CK_ATTRIBUTE_TYPE type, gboolean *value)
+gkm_attributes_find_boolean (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, CK_ATTRIBUTE_TYPE type, gboolean *value)
 {
 	CK_ATTRIBUTE_PTR attr;
-	
+
 	g_assert (attrs || !n_attrs);
-	
-	attr = gck_attributes_find (attrs, n_attrs, type);
+
+	attr = gkm_attributes_find (attrs, n_attrs, type);
 	if (attr == NULL)
 		return FALSE;
-	
+
 	if (attr->ulValueLen != sizeof (CK_BBOOL))
 		return FALSE;
-	
+
 	if (value != NULL)
 		*value = *((CK_BBOOL*)attr->pValue) == CK_TRUE ? TRUE : FALSE;
 
@@ -491,19 +491,19 @@ gck_attributes_find_boolean (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, CK_ATTRIB
 }
 
 gboolean
-gck_attributes_find_ulong (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, CK_ATTRIBUTE_TYPE type, gulong *value)
+gkm_attributes_find_ulong (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, CK_ATTRIBUTE_TYPE type, gulong *value)
 {
 	CK_ATTRIBUTE_PTR attr;
-	
+
 	g_assert (attrs || !n_attrs);
-	
-	attr = gck_attributes_find (attrs, n_attrs, type);
+
+	attr = gkm_attributes_find (attrs, n_attrs, type);
 	if (attr == NULL)
 		return FALSE;
-	
+
 	if (attr->ulValueLen != sizeof (CK_ULONG))
 		return FALSE;
-	
+
 	if (value != NULL)
 		*value = *((CK_ULONG*)attr->pValue);
 
@@ -511,37 +511,37 @@ gck_attributes_find_ulong (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, CK_ATTRIBUT
 }
 
 gboolean
-gck_attributes_find_mpi (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs,
+gkm_attributes_find_mpi (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs,
                          CK_ATTRIBUTE_TYPE type, gcry_mpi_t *value)
 {
 	CK_ATTRIBUTE_PTR attr;
 
 	g_assert (attrs || !n_attrs);
 
-	attr = gck_attributes_find (attrs, n_attrs, type);
+	attr = gkm_attributes_find (attrs, n_attrs, type);
 	if (attr == NULL)
 		return FALSE;
 
-	return gck_attribute_get_mpi (attr, value) == CKR_OK;
+	return gkm_attribute_get_mpi (attr, value) == CKR_OK;
 }
 
 gboolean
-gck_attributes_find_string (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs,
+gkm_attributes_find_string (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs,
                             CK_ATTRIBUTE_TYPE type, gchar **value)
 {
 	CK_ATTRIBUTE_PTR attr;
 
 	g_return_val_if_fail (attrs || !n_attrs, FALSE);
 
-	attr = gck_attributes_find (attrs, n_attrs, type);
+	attr = gkm_attributes_find (attrs, n_attrs, type);
 	if (attr == NULL)
 		return FALSE;
 
-	return gck_attribute_get_string (attr, value) == CKR_OK;
+	return gkm_attribute_get_string (attr, value) == CKR_OK;
 }
 
 GArray*
-gck_template_new (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
+gkm_template_new (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
 {
 	GArray *template = g_array_new (FALSE, FALSE, sizeof (CK_ATTRIBUTE));
 	CK_ATTRIBUTE_PTR pat;
@@ -560,7 +560,7 @@ gck_template_new (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
 }
 
 void
-gck_template_set (GArray *template, CK_ATTRIBUTE_PTR attr)
+gkm_template_set (GArray *template, CK_ATTRIBUTE_PTR attr)
 {
 	CK_ATTRIBUTE_PTR pat;
 	CK_ATTRIBUTE at;
@@ -569,7 +569,7 @@ gck_template_set (GArray *template, CK_ATTRIBUTE_PTR attr)
 	g_return_if_fail (template);
 	g_return_if_fail (attr);
 
-	pat = gck_attributes_find ((CK_ATTRIBUTE_PTR)template->data, template->len, attr->type);
+	pat = gkm_attributes_find ((CK_ATTRIBUTE_PTR)template->data, template->len, attr->type);
 
 	/* Remove any previous value */
 	for (i = 0; i < template->len; ++i) {
@@ -588,7 +588,7 @@ gck_template_set (GArray *template, CK_ATTRIBUTE_PTR attr)
 }
 
 void
-gck_template_free (GArray *template)
+gkm_template_free (GArray *template)
 {
 	guint i;
 
@@ -601,15 +601,15 @@ gck_template_free (GArray *template)
 }
 
 gboolean
-gck_template_find_boolean (GArray *template, CK_ATTRIBUTE_TYPE type, gboolean *value)
+gkm_template_find_boolean (GArray *template, CK_ATTRIBUTE_TYPE type, gboolean *value)
 {
 	g_return_val_if_fail (template, FALSE);
-	return gck_attributes_find_boolean ((CK_ATTRIBUTE_PTR)template->data, template->len, type, value);
+	return gkm_attributes_find_boolean ((CK_ATTRIBUTE_PTR)template->data, template->len, type, value);
 }
 
 gboolean
-gck_template_find_ulong (GArray *template, CK_ATTRIBUTE_TYPE type, gulong *value)
+gkm_template_find_ulong (GArray *template, CK_ATTRIBUTE_TYPE type, gulong *value)
 {
 	g_return_val_if_fail (template, FALSE);
-	return gck_attributes_find_ulong ((CK_ATTRIBUTE_PTR)template->data, template->len, type, value);
+	return gkm_attributes_find_ulong ((CK_ATTRIBUTE_PTR)template->data, template->len, type, value);
 }
diff --git a/pkcs11/gck/gck-attributes.h b/pkcs11/gkm/gkm-attributes.h
similarity index 69%
rename from pkcs11/gck/gck-attributes.h
rename to pkcs11/gkm/gkm-attributes.h
index e392eab..943d7d9 100644
--- a/pkcs11/gck/gck-attributes.h
+++ b/pkcs11/gkm/gkm-attributes.h
@@ -1,26 +1,26 @@
-/* 
+/*
  * 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  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  License for more details.
- *  
- * You should have received a copy of the GNU Lesser General 
+ *
+ * You should have received a copy of the GNU Lesser General
  * 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.
  */
 
-#ifndef GCK_ATTRIBUTE_H_
-#define GCK_ATTRIBUTE_H_
+#ifndef GKM_ATTRIBUTE_H_
+#define GKM_ATTRIBUTE_H_
 
 #include <glib.h>
 
@@ -28,107 +28,107 @@
 
 #include "pkcs11/pkcs11.h"
 
-CK_RV                 gck_attribute_get_bool                           (CK_ATTRIBUTE_PTR attr,
+CK_RV                 gkm_attribute_get_bool                           (CK_ATTRIBUTE_PTR attr,
                                                                         gboolean *value);
 
-CK_RV                 gck_attribute_get_ulong                          (CK_ATTRIBUTE_PTR attr,
+CK_RV                 gkm_attribute_get_ulong                          (CK_ATTRIBUTE_PTR attr,
                                                                         CK_ULONG *value);
 
-CK_RV                 gck_attribute_get_time                           (CK_ATTRIBUTE_PTR attr,
+CK_RV                 gkm_attribute_get_time                           (CK_ATTRIBUTE_PTR attr,
                                                                         glong *value);
 
-CK_RV                 gck_attribute_get_string                         (CK_ATTRIBUTE_PTR attr,
+CK_RV                 gkm_attribute_get_string                         (CK_ATTRIBUTE_PTR attr,
                                                                         gchar **value);
 
-CK_RV                 gck_attribute_get_mpi                            (CK_ATTRIBUTE_PTR attr,
+CK_RV                 gkm_attribute_get_mpi                            (CK_ATTRIBUTE_PTR attr,
                                                                         gcry_mpi_t *value);
 
-CK_RV                 gck_attribute_get_template                       (CK_ATTRIBUTE_PTR attr,
+CK_RV                 gkm_attribute_get_template                       (CK_ATTRIBUTE_PTR attr,
                                                                         GArray **template);
 
-CK_RV                 gck_attribute_set_empty                          (CK_ATTRIBUTE_PTR attr);
+CK_RV                 gkm_attribute_set_empty                          (CK_ATTRIBUTE_PTR attr);
 
-CK_RV                 gck_attribute_set_bool                           (CK_ATTRIBUTE_PTR attr,
+CK_RV                 gkm_attribute_set_bool                           (CK_ATTRIBUTE_PTR attr,
                                                                         CK_BBOOL value);
 
-CK_RV                 gck_attribute_set_ulong                          (CK_ATTRIBUTE_PTR attr, 
+CK_RV                 gkm_attribute_set_ulong                          (CK_ATTRIBUTE_PTR attr,
                                                                         CK_ULONG value);
 
-CK_RV                 gck_attribute_set_string                         (CK_ATTRIBUTE_PTR attr, 
+CK_RV                 gkm_attribute_set_string                         (CK_ATTRIBUTE_PTR attr,
                                                                         const gchar* string);
 
-CK_RV                 gck_attribute_set_date                           (CK_ATTRIBUTE_PTR attr,
+CK_RV                 gkm_attribute_set_date                           (CK_ATTRIBUTE_PTR attr,
                                                                         time_t when);
 
-CK_RV                 gck_attribute_set_time                           (CK_ATTRIBUTE_PTR attr,
+CK_RV                 gkm_attribute_set_time                           (CK_ATTRIBUTE_PTR attr,
                                                                         glong when);
 
-CK_RV                 gck_attribute_set_data                           (CK_ATTRIBUTE_PTR attr,
+CK_RV                 gkm_attribute_set_data                           (CK_ATTRIBUTE_PTR attr,
                                                                         gconstpointer value,
                                                                         gsize n_value);
 
-CK_RV                 gck_attribute_set_mpi                            (CK_ATTRIBUTE_PTR attr, 
+CK_RV                 gkm_attribute_set_mpi                            (CK_ATTRIBUTE_PTR attr,
                                                                         gcry_mpi_t mpi);
 
-CK_RV                 gck_attribute_set_template                       (CK_ATTRIBUTE_PTR attr,
+CK_RV                 gkm_attribute_set_template                       (CK_ATTRIBUTE_PTR attr,
                                                                         GArray *template);
 
-guint                 gck_attribute_hash                               (gconstpointer v);
+guint                 gkm_attribute_hash                               (gconstpointer v);
 
-gboolean              gck_attribute_equal                              (gconstpointer a,
+gboolean              gkm_attribute_equal                              (gconstpointer a,
                                                                         gconstpointer b);
 
-void                  gck_attribute_consume                            (CK_ATTRIBUTE_PTR attr);
+void                  gkm_attribute_consume                            (CK_ATTRIBUTE_PTR attr);
 
-gboolean              gck_attribute_consumed                           (CK_ATTRIBUTE_PTR attr);
+gboolean              gkm_attribute_consumed                           (CK_ATTRIBUTE_PTR attr);
 
 
 
-gboolean              gck_attributes_contains                          (CK_ATTRIBUTE_PTR attrs,
+gboolean              gkm_attributes_contains                          (CK_ATTRIBUTE_PTR attrs,
                                                                         CK_ULONG n_attrs,
                                                                         CK_ATTRIBUTE_PTR attr);
 
-void                  gck_attributes_consume                           (CK_ATTRIBUTE_PTR attrs, 
+void                  gkm_attributes_consume                           (CK_ATTRIBUTE_PTR attrs,
                                                                         CK_ULONG n_attrs, ...);
 
-CK_ATTRIBUTE_PTR      gck_attributes_find                              (CK_ATTRIBUTE_PTR attrs,
+CK_ATTRIBUTE_PTR      gkm_attributes_find                              (CK_ATTRIBUTE_PTR attrs,
                                                                         CK_ULONG n_attrs,
                                                                         CK_ATTRIBUTE_TYPE type);
 
-gboolean              gck_attributes_find_boolean                      (CK_ATTRIBUTE_PTR attrs,
+gboolean              gkm_attributes_find_boolean                      (CK_ATTRIBUTE_PTR attrs,
                                                                         CK_ULONG n_attrs,
                                                                         CK_ATTRIBUTE_TYPE type,
                                                                         gboolean *value);
 
-gboolean              gck_attributes_find_ulong                        (CK_ATTRIBUTE_PTR attrs,
+gboolean              gkm_attributes_find_ulong                        (CK_ATTRIBUTE_PTR attrs,
                                                                         CK_ULONG n_attrs,
                                                                         CK_ATTRIBUTE_TYPE type,
                                                                         gulong *value);
 
-gboolean              gck_attributes_find_mpi                          (CK_ATTRIBUTE_PTR attrs,
+gboolean              gkm_attributes_find_mpi                          (CK_ATTRIBUTE_PTR attrs,
                                                                         CK_ULONG n_attrs,
                                                                         CK_ATTRIBUTE_TYPE type,
                                                                         gcry_mpi_t *mpi);
 
-gboolean              gck_attributes_find_string                       (CK_ATTRIBUTE_PTR attrs,
+gboolean              gkm_attributes_find_string                       (CK_ATTRIBUTE_PTR attrs,
                                                                         CK_ULONG n_attrs,
                                                                         CK_ATTRIBUTE_TYPE type,
                                                                         gchar **value);
 
-GArray*               gck_template_new                                 (CK_ATTRIBUTE_PTR attrs,
+GArray*               gkm_template_new                                 (CK_ATTRIBUTE_PTR attrs,
                                                                         CK_ULONG n_attrs);
 
-void                  gck_template_set                                 (GArray *template,
+void                  gkm_template_set                                 (GArray *template,
                                                                         CK_ATTRIBUTE_PTR attr);
 
-void                  gck_template_free                                (GArray *template);
+void                  gkm_template_free                                (GArray *template);
 
-gboolean              gck_template_find_boolean                        (GArray *template,
+gboolean              gkm_template_find_boolean                        (GArray *template,
                                                                         CK_ATTRIBUTE_TYPE type,
                                                                         gboolean *value);
 
-gboolean              gck_template_find_ulong                          (GArray *template,
+gboolean              gkm_template_find_ulong                          (GArray *template,
                                                                         CK_ATTRIBUTE_TYPE type,
                                                                         gulong *value);
 
-#endif /* GCK_ATTRIBUTE_H_ */
+#endif /* GKM_ATTRIBUTE_H_ */
diff --git a/pkcs11/gck/gck-certificate-key.c b/pkcs11/gkm/gkm-certificate-key.c
similarity index 52%
rename from pkcs11/gck/gck-certificate-key.c
rename to pkcs11/gkm/gkm-certificate-key.c
index cd2cda6..d592dcd 100644
--- a/pkcs11/gck/gck-certificate-key.c
+++ b/pkcs11/gkm/gkm-certificate-key.c
@@ -1,32 +1,32 @@
-/* 
+/*
  * 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"
 
-#include "gck-attributes.h"
-#include "gck-certificate.h"
-#include "gck-certificate-key.h"
+#include "gkm-attributes.h"
+#include "gkm-certificate.h"
+#include "gkm-certificate-key.h"
 
-#include "gck-object.h"
-#include "gck-util.h"
+#include "gkm-object.h"
+#include "gkm-util.h"
 
 #include <glib/gi18n.h>
 
@@ -35,54 +35,54 @@ enum {
 	PROP_CERTIFICATE
 };
 
-struct _GckCertificateKeyPrivate {
-	GckCertificate *certificate;
+struct _GkmCertificateKeyPrivate {
+	GkmCertificate *certificate;
 };
 
-G_DEFINE_TYPE (GckCertificateKey, gck_certificate_key, GCK_TYPE_PUBLIC_XSA_KEY);
+G_DEFINE_TYPE (GkmCertificateKey, gkm_certificate_key, GKM_TYPE_PUBLIC_XSA_KEY);
 
 /* -----------------------------------------------------------------------------
- * OBJECT 
+ * OBJECT
  */
 
 static CK_RV
-gck_certificate_key_get_attribute (GckObject *base, GckSession *session, CK_ATTRIBUTE_PTR attr)
+gkm_certificate_key_get_attribute (GkmObject *base, GkmSession *session, CK_ATTRIBUTE_PTR attr)
 {
-	GckCertificateKey *self = GCK_CERTIFICATE_KEY (base);
-	
+	GkmCertificateKey *self = GKM_CERTIFICATE_KEY (base);
+
 	switch (attr->type) {
 	case CKA_LABEL:
 		if (self->pv->certificate)
-			return gck_object_get_attribute (GCK_OBJECT (self->pv->certificate), session, attr);
-		return gck_attribute_set_string (attr, "");
+			return gkm_object_get_attribute (GKM_OBJECT (self->pv->certificate), session, attr);
+		return gkm_attribute_set_string (attr, "");
 	}
-	
-	return GCK_OBJECT_CLASS (gck_certificate_key_parent_class)->get_attribute (base, session, attr);
+
+	return GKM_OBJECT_CLASS (gkm_certificate_key_parent_class)->get_attribute (base, session, attr);
 }
 
 static void
-gck_certificate_key_init (GckCertificateKey *self)
+gkm_certificate_key_init (GkmCertificateKey *self)
 {
-	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GCK_TYPE_CERTIFICATE_KEY, GckCertificateKeyPrivate);
+	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GKM_TYPE_CERTIFICATE_KEY, GkmCertificateKeyPrivate);
 }
 
 static void
-gck_certificate_key_finalize (GObject *obj)
+gkm_certificate_key_finalize (GObject *obj)
 {
-	GckCertificateKey *self = GCK_CERTIFICATE_KEY (obj);
-	
+	GkmCertificateKey *self = GKM_CERTIFICATE_KEY (obj);
+
 	if (self->pv->certificate)
 		g_object_remove_weak_pointer (G_OBJECT (self->pv->certificate), (gpointer*)&(self->pv->certificate));
 	self->pv->certificate = NULL;
-		
-	G_OBJECT_CLASS (gck_certificate_key_parent_class)->finalize (obj);
+
+	G_OBJECT_CLASS (gkm_certificate_key_parent_class)->finalize (obj);
 }
 
 static void
-gck_certificate_key_set_property (GObject *obj, guint prop_id, const GValue *value, 
+gkm_certificate_key_set_property (GObject *obj, guint prop_id, const GValue *value,
                            GParamSpec *pspec)
 {
-	GckCertificateKey *self = GCK_CERTIFICATE_KEY (obj);
+	GkmCertificateKey *self = GKM_CERTIFICATE_KEY (obj);
 
 	switch (prop_id) {
 	case PROP_CERTIFICATE:
@@ -98,14 +98,14 @@ gck_certificate_key_set_property (GObject *obj, guint prop_id, const GValue *val
 }
 
 static void
-gck_certificate_key_get_property (GObject *obj, guint prop_id, GValue *value, 
+gkm_certificate_key_get_property (GObject *obj, guint prop_id, GValue *value,
                            GParamSpec *pspec)
 {
-	GckCertificateKey *self = GCK_CERTIFICATE_KEY (obj);
+	GkmCertificateKey *self = GKM_CERTIFICATE_KEY (obj);
 
 	switch (prop_id) {
 	case PROP_CERTIFICATE:
-		g_value_set_object (value, gck_certificate_key_get_certificate (self));
+		g_value_set_object (value, gkm_certificate_key_get_certificate (self));
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -114,39 +114,39 @@ gck_certificate_key_get_property (GObject *obj, guint prop_id, GValue *value,
 }
 
 static void
-gck_certificate_key_class_init (GckCertificateKeyClass *klass)
+gkm_certificate_key_class_init (GkmCertificateKeyClass *klass)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	GckObjectClass *gck_class = GCK_OBJECT_CLASS (klass);
-    
-	gobject_class->finalize = gck_certificate_key_finalize;
-	gobject_class->set_property = gck_certificate_key_set_property;
-	gobject_class->get_property = gck_certificate_key_get_property;
-	
-	gck_class->get_attribute = gck_certificate_key_get_attribute;
-	
-	g_type_class_add_private (klass, sizeof (GckCertificateKeyPrivate));
-	
+	GkmObjectClass *gkm_class = GKM_OBJECT_CLASS (klass);
+
+	gobject_class->finalize = gkm_certificate_key_finalize;
+	gobject_class->set_property = gkm_certificate_key_set_property;
+	gobject_class->get_property = gkm_certificate_key_get_property;
+
+	gkm_class->get_attribute = gkm_certificate_key_get_attribute;
+
+	g_type_class_add_private (klass, sizeof (GkmCertificateKeyPrivate));
+
 	g_object_class_install_property (gobject_class, PROP_CERTIFICATE,
-	           g_param_spec_object ("certificate", "Certificate", "Certificate this key belongs to", 
-	                                GCK_TYPE_CERTIFICATE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));	
+	           g_param_spec_object ("certificate", "Certificate", "Certificate this key belongs to",
+	                                GKM_TYPE_CERTIFICATE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
 }
 
 /* -----------------------------------------------------------------------------
- * PUBLIC 
+ * PUBLIC
  */
 
-GckCertificateKey*
-gck_certificate_key_new (GckModule *module, GckManager *manager, GckCertificate *cert)
+GkmCertificateKey*
+gkm_certificate_key_new (GkmModule *module, GkmManager *manager, GkmCertificate *cert)
 {
-	return g_object_new (GCK_TYPE_CERTIFICATE_KEY, "module", module,
+	return g_object_new (GKM_TYPE_CERTIFICATE_KEY, "module", module,
 	                     "manager", manager, "certificate", cert, NULL);
 }
 
-GckCertificate*
-gck_certificate_key_get_certificate (GckCertificateKey *self)
+GkmCertificate*
+gkm_certificate_key_get_certificate (GkmCertificateKey *self)
 {
-	g_return_val_if_fail (GCK_IS_CERTIFICATE_KEY (self), NULL);
+	g_return_val_if_fail (GKM_IS_CERTIFICATE_KEY (self), NULL);
 	g_return_val_if_fail (self->pv->certificate, NULL);
 	return self->pv->certificate;
 }
diff --git a/pkcs11/gkm/gkm-certificate-key.h b/pkcs11/gkm/gkm-certificate-key.h
new file mode 100644
index 0000000..791ee35
--- /dev/null
+++ b/pkcs11/gkm/gkm-certificate-key.h
@@ -0,0 +1,57 @@
+/*
+ * 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 __GKM_CERTIFICATE_KEY_H__
+#define __GKM_CERTIFICATE_KEY_H__
+
+#include <glib-object.h>
+
+#include "gkm-public-xsa-key.h"
+#include "gkm-types.h"
+
+#define GKM_TYPE_CERTIFICATE_KEY               (gkm_certificate_key_get_type ())
+#define GKM_CERTIFICATE_KEY(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_CERTIFICATE_KEY, GkmCertificateKey))
+#define GKM_CERTIFICATE_KEY_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_CERTIFICATE_KEY, GkmCertificateKeyClass))
+#define GKM_IS_CERTIFICATE_KEY(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_CERTIFICATE_KEY))
+#define GKM_IS_CERTIFICATE_KEY_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_CERTIFICATE_KEY))
+#define GKM_CERTIFICATE_KEY_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_CERTIFICATE_KEY, GkmCertificateKeyClass))
+
+typedef struct _GkmCertificateKeyClass GkmCertificateKeyClass;
+typedef struct _GkmCertificateKeyPrivate GkmCertificateKeyPrivate;
+
+struct _GkmCertificateKey {
+	GkmPublicXsaKey parent;
+	GkmCertificateKeyPrivate *pv;
+};
+
+struct _GkmCertificateKeyClass {
+	GkmPublicXsaKeyClass parent_class;
+};
+
+GType               gkm_certificate_key_get_type               (void);
+
+GkmCertificateKey*  gkm_certificate_key_new                    (GkmModule *module,
+                                                                GkmManager *manager,
+                                                                GkmCertificate *cert);
+
+GkmCertificate*     gkm_certificate_key_get_certificate        (GkmCertificateKey *self);
+
+#endif /* __GKM_CERTIFICATE_KEY_H__ */
diff --git a/pkcs11/gck/gck-certificate-trust.c b/pkcs11/gkm/gkm-certificate-trust.c
similarity index 67%
rename from pkcs11/gck/gck-certificate-trust.c
rename to pkcs11/gkm/gkm-certificate-trust.c
index 41db470..cbcd7c2 100644
--- a/pkcs11/gck/gck-certificate-trust.c
+++ b/pkcs11/gkm/gkm-certificate-trust.c
@@ -1,33 +1,33 @@
-/* 
+/*
  * gnome-trustring
- * 
+ *
  * 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"
 
-#include "gck-attributes.h"
-#include "gck-certificate.h"
-#include "gck-certificate-trust.h"
-#include "gck-data-der.h"
+#include "gkm-attributes.h"
+#include "gkm-certificate.h"
+#include "gkm-certificate-trust.h"
+#include "gkm-data-der.h"
 
-#include "gck-object.h"
-#include "gck-util.h"
+#include "gkm-object.h"
+#include "gkm-util.h"
 
 #include "pkcs11/pkcs11g.h"
 #include "pkcs11/pkcs11n.h"
@@ -39,11 +39,11 @@ enum {
 	PROP_CERTIFICATE
 };
 
-struct _GckCertificateTrustPrivate {
-	GckCertificate *certificate;
+struct _GkmCertificateTrustPrivate {
+	GkmCertificate *certificate;
 };
 
-G_DEFINE_TYPE (GckCertificateTrust, gck_certificate_trust, GCK_TYPE_OBJECT);
+G_DEFINE_TYPE (GkmCertificateTrust, gkm_certificate_trust, GKM_TYPE_OBJECT);
 
 #define PKIX_KEY_USAGE_DIGITAL_SIGNATURE 0x80
 #define PKIX_KEY_USAGE_NON_REPUDIATION 0x40
@@ -64,43 +64,43 @@ static void
 init_quarks (void)
 {
 	static volatile gsize quarks_inited = 0;
-	
+
 	if (g_once_init_enter (&quarks_inited)) {
 		#define QUARK(name, value) \
 			name = g_quark_from_static_string(value)
- 
-	 	QUARK (OID_KEY_USAGE, "2.5.29.15");
+
+		QUARK (OID_KEY_USAGE, "2.5.29.15");
 
 		#undef QUARK
-		
+
 		g_once_init_leave (&quarks_inited, 1);
 	}
 }
 
 static CK_RV
-has_key_usage (GckCertificateTrust *self, guint check, CK_ULONG *val)
+has_key_usage (GkmCertificateTrust *self, guint check, CK_ULONG *val)
 {
-	GckDataResult res;
+	GkmDataResult res;
 	const guchar *extension;
 	gsize n_extension;
 	guint usage;
 
 	g_return_val_if_fail (self->pv->certificate, CKR_GENERAL_ERROR);
 	*val = CKT_NETSCAPE_TRUST_UNKNOWN;
-	
+
 	/* Find out the key usage */
-	extension = gck_certificate_get_extension (self->pv->certificate, OID_KEY_USAGE, 
+	extension = gkm_certificate_get_extension (self->pv->certificate, OID_KEY_USAGE,
 	                                           &n_extension, NULL);
 	if (!extension)
 		return CKR_OK;
-	
-	res = gck_data_der_read_key_usage (extension, n_extension, &usage);
-	
-	if (res != GCK_DATA_SUCCESS) {
+
+	res = gkm_data_der_read_key_usage (extension, n_extension, &usage);
+
+	if (res != GKM_DATA_SUCCESS) {
 		g_warning ("invalid key usage in certificate");
 		return CKR_GENERAL_ERROR;
 	}
-			
+
 	if ((usage & check) == check)
 		*val = CKT_NETSCAPE_TRUSTED;
 	else
@@ -110,21 +110,21 @@ has_key_usage (GckCertificateTrust *self, guint check, CK_ULONG *val)
 }
 
 static CK_RV
-read_key_usage (GckCertificateTrust *self, guint check, CK_ATTRIBUTE_PTR attr)
+read_key_usage (GkmCertificateTrust *self, guint check, CK_ATTRIBUTE_PTR attr)
 {
 	CK_ULONG value;
 	CK_RV rv;
-	
-	g_assert (GCK_IS_CERTIFICATE_TRUST (self));
-	
+
+	g_assert (GKM_IS_CERTIFICATE_TRUST (self));
+
 	rv = has_key_usage (self, check, &value);
 	if (rv == CKR_OK)
-		rv = gck_attribute_set_ulong (attr, value);
+		rv = gkm_attribute_set_ulong (attr, value);
 	return rv;
 }
 
 static CK_RV
-has_enhanced_usage (GckCertificateTrust *self, CK_ATTRIBUTE_TYPE type, CK_ULONG *val)
+has_enhanced_usage (GkmCertificateTrust *self, CK_ATTRIBUTE_TYPE type, CK_ULONG *val)
 {
 	gboolean bval;
 	CK_ULONG nval;
@@ -132,28 +132,28 @@ has_enhanced_usage (GckCertificateTrust *self, CK_ATTRIBUTE_TYPE type, CK_ULONG
 	g_return_val_if_fail (self->pv->certificate, CKR_GENERAL_ERROR);
 
 	/* Check if we have the purpose setup */
-	if (!gck_object_get_attribute_boolean (GCK_OBJECT (self->pv->certificate), 
+	if (!gkm_object_get_attribute_boolean (GKM_OBJECT (self->pv->certificate),
 	                                       NULL, type, &bval))
 		bval = FALSE;
-	
+
 	/* Don't have the purpose */
 	if (bval != TRUE) {
 		*val = CKT_NETSCAPE_UNTRUSTED;
 		return CKR_OK;
 	}
-	
+
 	/* Ascertain the trust in this certificate */
-	if (!gck_object_get_attribute_boolean (GCK_OBJECT (self->pv->certificate), 
+	if (!gkm_object_get_attribute_boolean (GKM_OBJECT (self->pv->certificate),
 	                                       NULL, CKA_TRUSTED, &bval))
 		bval = FALSE;
-	
+
 	if (bval != TRUE) {
 		*val = CKT_NETSCAPE_TRUST_UNKNOWN;
 		return CKR_OK;
 	}
-	
+
 	/* See if we can delegate the purpase (ie: CA) */
-	if (!gck_object_get_attribute_ulong (GCK_OBJECT (self->pv->certificate),
+	if (!gkm_object_get_attribute_ulong (GKM_OBJECT (self->pv->certificate),
 	                                     NULL, CKA_CERTIFICATE_CATEGORY, &nval))
 		nval = 0;
 
@@ -163,60 +163,60 @@ has_enhanced_usage (GckCertificateTrust *self, CK_ATTRIBUTE_TYPE type, CK_ULONG
 }
 
 static CK_RV
-read_enhanced_usage (GckCertificateTrust *self, CK_ATTRIBUTE_TYPE type, 
+read_enhanced_usage (GkmCertificateTrust *self, CK_ATTRIBUTE_TYPE type,
                      CK_ATTRIBUTE_PTR attr)
 {
 	CK_ULONG value;
 	CK_RV rv;
 
-	g_assert (GCK_IS_CERTIFICATE_TRUST (self));
+	g_assert (GKM_IS_CERTIFICATE_TRUST (self));
 
 	rv = has_enhanced_usage (self, type, &value);
 	if (rv == CKR_OK)
-		rv = gck_attribute_set_ulong (attr, value);
+		rv = gkm_attribute_set_ulong (attr, value);
 	return rv;
 }
 
 static CK_RV
-hash_certificate (GckCertificateTrust *self, int algo, CK_ATTRIBUTE_PTR result)
+hash_certificate (GkmCertificateTrust *self, int algo, CK_ATTRIBUTE_PTR result)
 {
 	guchar *hash;
 	gsize n_hash;
 	CK_RV rv;
 
-	g_assert (GCK_IS_CERTIFICATE_TRUST (self));
+	g_assert (GKM_IS_CERTIFICATE_TRUST (self));
 
 	g_return_val_if_fail (self->pv->certificate, CKR_GENERAL_ERROR);
 
-	hash = gck_certificate_hash (self->pv->certificate, algo, &n_hash);
+	hash = gkm_certificate_hash (self->pv->certificate, algo, &n_hash);
 	g_return_val_if_fail (hash, CKR_GENERAL_ERROR);
-	
-	rv = gck_attribute_set_data (result, hash, n_hash);
+
+	rv = gkm_attribute_set_data (result, hash, n_hash);
 	g_free (hash);
-	
+
 	return rv;
 }
 
 /* -----------------------------------------------------------------------------
- * OBJECT 
+ * OBJECT
  */
 
 static CK_RV
-gck_certificate_trust_get_attribute (GckObject *base, GckSession *session, CK_ATTRIBUTE_PTR attr)
+gkm_certificate_trust_get_attribute (GkmObject *base, GkmSession *session, CK_ATTRIBUTE_PTR attr)
 {
-	GckCertificateTrust *self = GCK_CERTIFICATE_TRUST (base);
-	
+	GkmCertificateTrust *self = GKM_CERTIFICATE_TRUST (base);
+
 	switch (attr->type)
 	{
 	case CKA_PRIVATE:
-		return gck_attribute_set_bool (attr, CK_FALSE);
-		
+		return gkm_attribute_set_bool (attr, CK_FALSE);
+
 	case CKA_TRUST_STEP_UP_APPROVED:
-		return gck_attribute_set_bool (attr, CK_FALSE);
+		return gkm_attribute_set_bool (attr, CK_FALSE);
 
 	case CKA_CLASS:
-		return gck_attribute_set_ulong (attr, CKO_NETSCAPE_TRUST);
-		
+		return gkm_attribute_set_ulong (attr, CKO_NETSCAPE_TRUST);
+
 	/* Key restrictions */
 	case CKA_TRUST_DIGITAL_SIGNATURE:
 		return read_key_usage (self, PKIX_KEY_USAGE_DIGITAL_SIGNATURE, attr);
@@ -269,7 +269,7 @@ gck_certificate_trust_get_attribute (GckObject *base, GckSession *session, CK_AT
 	case CKA_SERIAL_NUMBER:
 	case CKA_ISSUER:
 		g_return_val_if_fail (self->pv->certificate, CKR_GENERAL_ERROR);
-		return gck_object_get_attribute (GCK_OBJECT (self->pv->certificate), session, attr);
+		return gkm_object_get_attribute (GKM_OBJECT (self->pv->certificate), session, attr);
 
 	case CKA_CERT_MD5_HASH:
 		return hash_certificate (self, GCRY_MD_MD5, attr);
@@ -279,33 +279,33 @@ gck_certificate_trust_get_attribute (GckObject *base, GckSession *session, CK_AT
 	default:
 		break;
 	};
-	
-	return GCK_OBJECT_CLASS (gck_certificate_trust_parent_class)->get_attribute (base, session, attr);
+
+	return GKM_OBJECT_CLASS (gkm_certificate_trust_parent_class)->get_attribute (base, session, attr);
 }
 
 static void
-gck_certificate_trust_init (GckCertificateTrust *self)
+gkm_certificate_trust_init (GkmCertificateTrust *self)
 {
-	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GCK_TYPE_CERTIFICATE_TRUST, GckCertificateTrustPrivate);
+	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GKM_TYPE_CERTIFICATE_TRUST, GkmCertificateTrustPrivate);
 }
 
 static void
-gck_certificate_trust_finalize (GObject *obj)
+gkm_certificate_trust_finalize (GObject *obj)
 {
-	GckCertificateTrust *self = GCK_CERTIFICATE_TRUST (obj);
-	
+	GkmCertificateTrust *self = GKM_CERTIFICATE_TRUST (obj);
+
 	if (self->pv->certificate)
 		g_object_remove_weak_pointer (G_OBJECT (self->pv->certificate), (gpointer*)&(self->pv->certificate));
 	self->pv->certificate = NULL;
-		
-	G_OBJECT_CLASS (gck_certificate_trust_parent_class)->finalize (obj);
+
+	G_OBJECT_CLASS (gkm_certificate_trust_parent_class)->finalize (obj);
 }
 
 static void
-gck_certificate_trust_set_property (GObject *obj, guint prop_id, const GValue *value, 
+gkm_certificate_trust_set_property (GObject *obj, guint prop_id, const GValue *value,
                            GParamSpec *pspec)
 {
-	GckCertificateTrust *self = GCK_CERTIFICATE_TRUST (obj);
+	GkmCertificateTrust *self = GKM_CERTIFICATE_TRUST (obj);
 
 	switch (prop_id) {
 	case PROP_CERTIFICATE:
@@ -321,14 +321,14 @@ gck_certificate_trust_set_property (GObject *obj, guint prop_id, const GValue *v
 }
 
 static void
-gck_certificate_trust_get_property (GObject *obj, guint prop_id, GValue *value, 
+gkm_certificate_trust_get_property (GObject *obj, guint prop_id, GValue *value,
                            GParamSpec *pspec)
 {
-	GckCertificateTrust *self = GCK_CERTIFICATE_TRUST (obj);
+	GkmCertificateTrust *self = GKM_CERTIFICATE_TRUST (obj);
 
 	switch (prop_id) {
 	case PROP_CERTIFICATE:
-		g_value_set_object (value, gck_certificate_trust_get_certificate (self));
+		g_value_set_object (value, gkm_certificate_trust_get_certificate (self));
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -337,41 +337,41 @@ gck_certificate_trust_get_property (GObject *obj, guint prop_id, GValue *value,
 }
 
 static void
-gck_certificate_trust_class_init (GckCertificateTrustClass *klass)
+gkm_certificate_trust_class_init (GkmCertificateTrustClass *klass)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	GckObjectClass *gck_class = GCK_OBJECT_CLASS (klass);
-    
-	gobject_class->finalize = gck_certificate_trust_finalize;
-	gobject_class->set_property = gck_certificate_trust_set_property;
-	gobject_class->get_property = gck_certificate_trust_get_property;
-	
-	gck_class->get_attribute = gck_certificate_trust_get_attribute;
-	
-	g_type_class_add_private (klass, sizeof (GckCertificateTrustPrivate));
-	
+	GkmObjectClass *gkm_class = GKM_OBJECT_CLASS (klass);
+
+	gobject_class->finalize = gkm_certificate_trust_finalize;
+	gobject_class->set_property = gkm_certificate_trust_set_property;
+	gobject_class->get_property = gkm_certificate_trust_get_property;
+
+	gkm_class->get_attribute = gkm_certificate_trust_get_attribute;
+
+	g_type_class_add_private (klass, sizeof (GkmCertificateTrustPrivate));
+
 	g_object_class_install_property (gobject_class, PROP_CERTIFICATE,
-	           g_param_spec_object ("certificate", "Certificate", "Certificate this trust belongs to", 
-	                                GCK_TYPE_CERTIFICATE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-	
+	           g_param_spec_object ("certificate", "Certificate", "Certificate this trust belongs to",
+	                                GKM_TYPE_CERTIFICATE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
 	init_quarks ();
 }
 
 /* -----------------------------------------------------------------------------
- * PUBLIC 
+ * PUBLIC
  */
 
-GckCertificateTrust*
-gck_certificate_trust_new (GckModule *module, GckManager *manager, GckCertificate *cert)
+GkmCertificateTrust*
+gkm_certificate_trust_new (GkmModule *module, GkmManager *manager, GkmCertificate *cert)
 {
-	return g_object_new (GCK_TYPE_CERTIFICATE_TRUST, "module", module,
+	return g_object_new (GKM_TYPE_CERTIFICATE_TRUST, "module", module,
 	                     "manager", manager, "certificate", cert, NULL);
 }
 
-GckCertificate*
-gck_certificate_trust_get_certificate (GckCertificateTrust *self)
+GkmCertificate*
+gkm_certificate_trust_get_certificate (GkmCertificateTrust *self)
 {
-	g_return_val_if_fail (GCK_IS_CERTIFICATE_TRUST (self), NULL);
+	g_return_val_if_fail (GKM_IS_CERTIFICATE_TRUST (self), NULL);
 	g_return_val_if_fail (self->pv->certificate, NULL);
 	return self->pv->certificate;
 }
diff --git a/pkcs11/gkm/gkm-certificate-trust.h b/pkcs11/gkm/gkm-certificate-trust.h
new file mode 100644
index 0000000..91dc638
--- /dev/null
+++ b/pkcs11/gkm/gkm-certificate-trust.h
@@ -0,0 +1,57 @@
+/*
+ * gnome-trustring
+ *
+ * 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 __GKM_CERTIFICATE_TRUST_H__
+#define __GKM_CERTIFICATE_TRUST_H__
+
+#include <glib-object.h>
+
+#include "gkm-object.h"
+#include "gkm-types.h"
+
+#define GKM_TYPE_CERTIFICATE_TRUST               (gkm_certificate_trust_get_type ())
+#define GKM_CERTIFICATE_TRUST(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_CERTIFICATE_TRUST, GkmCertificateTrust))
+#define GKM_CERTIFICATE_TRUST_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_CERTIFICATE_TRUST, GkmCertificateTrustClass))
+#define GKM_IS_CERTIFICATE_TRUST(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_CERTIFICATE_TRUST))
+#define GKM_IS_CERTIFICATE_TRUST_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_CERTIFICATE_TRUST))
+#define GKM_CERTIFICATE_TRUST_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_CERTIFICATE_TRUST, GkmCertificateTrustClass))
+
+typedef struct _GkmCertificateTrustClass GkmCertificateTrustClass;
+typedef struct _GkmCertificateTrustPrivate GkmCertificateTrustPrivate;
+
+struct _GkmCertificateTrust {
+	GkmObject parent;
+	GkmCertificateTrustPrivate *pv;
+};
+
+struct _GkmCertificateTrustClass {
+	GkmObjectClass parent_class;
+};
+
+GType                 gkm_certificate_trust_get_type               (void);
+
+GkmCertificateTrust*  gkm_certificate_trust_new                    (GkmModule *module,
+                                                                    GkmManager *manager,
+                                                                    GkmCertificate *cert);
+
+GkmCertificate*       gkm_certificate_trust_get_certificate        (GkmCertificateTrust *self);
+
+#endif /* __GKM_CERTIFICATE_TRUST_H__ */
diff --git a/pkcs11/gck/gck-certificate.c b/pkcs11/gkm/gkm-certificate.c
similarity index 63%
rename from pkcs11/gck/gck-certificate.c
rename to pkcs11/gkm/gkm-certificate.c
index d547b26..28dfad8 100644
--- a/pkcs11/gck/gck-certificate.c
+++ b/pkcs11/gkm/gkm-certificate.c
@@ -1,40 +1,40 @@
-/* 
+/*
  * 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  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  License for more details.
- *  
- * You should have received a copy of the GNU Lesser General 
+ *
+ * You should have received a copy of the GNU Lesser General
  * 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"
 
-#include "gck-attributes.h"
-#include "gck-certificate.h"
-#include "gck-certificate-key.h"
-#include "gck-crypto.h"
-#include "gck-data-asn1.h"
-#include "gck-data-der.h"
-#include "gck-factory.h"
-#include "gck-sexp-key.h"
-#include "gck-manager.h"
-#include "gck-session.h"
-#include "gck-sexp.h"
-#include "gck-serializable.h"
-#include "gck-transaction.h"
-#include "gck-util.h"
+#include "gkm-attributes.h"
+#include "gkm-certificate.h"
+#include "gkm-certificate-key.h"
+#include "gkm-crypto.h"
+#include "gkm-data-asn1.h"
+#include "gkm-data-der.h"
+#include "gkm-factory.h"
+#include "gkm-sexp-key.h"
+#include "gkm-manager.h"
+#include "gkm-session.h"
+#include "gkm-sexp.h"
+#include "gkm-serializable.h"
+#include "gkm-transaction.h"
+#include "gkm-util.h"
 
 #include "pkcs11/pkcs11.h"
 #include "pkcs11/pkcs11g.h"
@@ -49,8 +49,8 @@ enum {
 	PROP_PUBLIC_KEY
 };
 
-struct _GckCertificatePrivate {
-	GckCertificateKey *key;
+struct _GkmCertificatePrivate {
+	GkmCertificateKey *key;
 	ASN1_TYPE asn1;
 	guchar *data;
 	gsize n_data;
@@ -66,33 +66,33 @@ static GQuark OID_USAGE_CLIENT_AUTH;
 static GQuark OID_USAGE_CODE_SIGNING;
 static GQuark OID_USAGE_EMAIL;
 static GQuark OID_USAGE_TIME_STAMPING;
-static GQuark OID_USAGE_IPSEC_ENDPOINT;	
+static GQuark OID_USAGE_IPSEC_ENDPOINT;
 static GQuark OID_USAGE_IPSEC_TUNNEL;
 static GQuark OID_USAGE_IPSEC_USER;
 static GQuark OID_USAGE_IKE_INTERMEDIATE;
 
-static void gck_certificate_serializable (GckSerializableIface *iface);
+static void gkm_certificate_serializable (GkmSerializableIface *iface);
 
-G_DEFINE_TYPE_EXTENDED (GckCertificate, gck_certificate, GCK_TYPE_OBJECT, 0,
-               G_IMPLEMENT_INTERFACE (GCK_TYPE_SERIALIZABLE, gck_certificate_serializable));
+G_DEFINE_TYPE_EXTENDED (GkmCertificate, gkm_certificate, GKM_TYPE_OBJECT, 0,
+               G_IMPLEMENT_INTERFACE (GKM_TYPE_SERIALIZABLE, gkm_certificate_serializable));
 
 /* -----------------------------------------------------------------------------
- * INTERNAL 
+ * INTERNAL
  */
 
 static void
 init_quarks (void)
 {
 	static volatile gsize quarks_inited = 0;
-	
+
 	if (g_once_init_enter (&quarks_inited)) {
 		#define QUARK(name, value) \
 			name = g_quark_from_static_string(value)
- 
+
 		QUARK (OID_BASIC_CONSTRAINTS, "2.5.29.19");
-	 	QUARK (OID_ENHANCED_USAGE, "2.5.29.37");
-	 	
-	 	QUARK (OID_USAGE_SSH_AUTH, "ssh-authentication");
+		QUARK (OID_ENHANCED_USAGE, "2.5.29.37");
+
+		QUARK (OID_USAGE_SSH_AUTH, "ssh-authentication");
 		QUARK (OID_USAGE_SERVER_AUTH, "1.3.6.1.5.5.7.3.1");
 		QUARK (OID_USAGE_CLIENT_AUTH, "1.3.6.1.5.5.7.3.2");
 		QUARK (OID_USAGE_CODE_SIGNING, "1.3.6.1.5.5.7.3.3");
@@ -104,62 +104,62 @@ init_quarks (void)
 		QUARK (OID_USAGE_IKE_INTERMEDIATE, "1.3.6.1.5.5.8.2.2");
 
 		#undef QUARK
-		
+
 		g_once_init_leave (&quarks_inited, 1);
 	}
 }
 
-static gboolean 
-has_certificate_purposes (GckCertificate *self)
+static gboolean
+has_certificate_purposes (GkmCertificate *self)
 {
 	const guchar *extension;
 	gsize n_extension;
-	
+
 	/* TODO: Storage of certificate purposes in the store */
-	
-	extension = gck_certificate_get_extension (self, OID_ENHANCED_USAGE, &n_extension, NULL);
+
+	extension = gkm_certificate_get_extension (self, OID_ENHANCED_USAGE, &n_extension, NULL);
 	return extension != NULL;
 }
 
 static CK_RV
-lookup_certificate_purposes (GckCertificate *self, GQuark **oids)
+lookup_certificate_purposes (GkmCertificate *self, GQuark **oids)
 {
-	GckDataResult res;
+	GkmDataResult res;
 	const guchar *extension;
 	gsize n_extension;
 
 	*oids = NULL;
-	
+
 	/* TODO: Storage of certificate purposes in the store */
-        
-	extension = gck_certificate_get_extension (self, OID_ENHANCED_USAGE, &n_extension, NULL);
-	
+
+	extension = gkm_certificate_get_extension (self, OID_ENHANCED_USAGE, &n_extension, NULL);
+
 	/* No enhanced usage noted, any are allowed */
 	if (!extension)
 		return CKR_OK;
 
-	res = gck_data_der_read_enhanced_usage (extension, n_extension, oids);
-	
-	if (res != GCK_DATA_SUCCESS)
+	res = gkm_data_der_read_enhanced_usage (extension, n_extension, oids);
+
+	if (res != GKM_DATA_SUCCESS)
 		return CKR_GENERAL_ERROR;
-	
+
 	return CKR_OK;
 }
 
 
 static gboolean
-check_certificate_purpose (GckCertificate *self, GQuark oid)
+check_certificate_purpose (GkmCertificate *self, GQuark oid)
 {
 	GQuark *usages, *usage;
 	gboolean ret;
-	
+
 	if (lookup_certificate_purposes (self, &usages) != CKR_OK)
 		return FALSE;
-		
+
 	/* No usages noted, any are allowed */
 	if (!usages)
 		return TRUE;
-	
+
 	ret = FALSE;
 	for (usage = usages; *usage; ++usage) {
 		if (*usage == oid) {
@@ -169,40 +169,40 @@ check_certificate_purpose (GckCertificate *self, GQuark oid)
 	}
 
 	g_free (usages);
-	
+
 	return ret;
 }
 
 static CK_RV
-read_certificate_purpose (GckCertificate *self, GQuark oid, CK_ATTRIBUTE_PTR attr)
+read_certificate_purpose (GkmCertificate *self, GQuark oid, CK_ATTRIBUTE_PTR attr)
 {
 	gboolean value = check_certificate_purpose (self, oid);
-	gck_attribute_set_bool (attr, value);
+	gkm_attribute_set_bool (attr, value);
 	return CKR_OK;
 }
 
 
 static CK_RV
-read_certificate_purposes (GckCertificate *self, CK_ATTRIBUTE_PTR attr)
+read_certificate_purposes (GkmCertificate *self, CK_ATTRIBUTE_PTR attr)
 {
 	GQuark *purposes, *purpose;
 	GString *result;
 	CK_RV ret;
-	
+
 	ret = lookup_certificate_purposes (self, &purposes);
 	if (ret != CKR_OK)
 		return ret;
-		
+
 	/* Convert into a space delimited string */
 	result = g_string_sized_new (128);
 	for (purpose = purposes; purpose && *purpose; ++purpose) {
 		g_string_append (result, g_quark_to_string (*purpose));
 		g_string_append_c (result, ' ');
 	}
-	
+
 	g_free (purposes);
-	
-	gck_attribute_set_string (attr, result->str);
+
+	gkm_attribute_set_string (attr, result->str);
 	g_string_free (result, TRUE);
 
 	return CKR_OK;
@@ -210,19 +210,19 @@ read_certificate_purposes (GckCertificate *self, CK_ATTRIBUTE_PTR attr)
 
 
 static gint
-find_certificate_extension (GckCertificate *self, GQuark oid)
+find_certificate_extension (GkmCertificate *self, GQuark oid)
 {
 	GQuark exoid;
 	gchar *name;
 	guint index;
 	int res, len;
-	
+
 	g_assert (oid);
-	g_assert (GCK_IS_CERTIFICATE (self));
+	g_assert (GKM_IS_CERTIFICATE (self));
 	g_assert (self->pv->asn1);
-	
+
 	for (index = 1; TRUE; ++index) {
-		
+
 		/* Make sure it is present */
 		len = 0;
 		name = g_strdup_printf ("tbsCertificate.extensions.?%u", index);
@@ -237,236 +237,236 @@ find_certificate_extension (GckCertificate *self, GQuark oid)
 		g_free (name);
 
 		if(exoid == oid)
-			return index;		
+			return index;
 	}
-	
+
 	return 0;
 }
 
-static GckObject*
-factory_create_certificate (GckSession *session, GckTransaction *transaction, 
+static GkmObject*
+factory_create_certificate (GkmSession *session, GkmTransaction *transaction,
                             CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
 {
 	CK_ATTRIBUTE_PTR attr;
-	GckCertificate *cert;
+	GkmCertificate *cert;
 
-	g_return_val_if_fail (GCK_IS_TRANSACTION (transaction), NULL);
+	g_return_val_if_fail (GKM_IS_TRANSACTION (transaction), NULL);
 	g_return_val_if_fail (attrs || !n_attrs, NULL);
 
 	/* Dig out the value */
-	attr = gck_attributes_find (attrs, n_attrs, CKA_VALUE);
+	attr = gkm_attributes_find (attrs, n_attrs, CKA_VALUE);
 	if (attr == NULL) {
-		gck_transaction_fail (transaction, CKR_TEMPLATE_INCOMPLETE);
+		gkm_transaction_fail (transaction, CKR_TEMPLATE_INCOMPLETE);
 		return NULL;
 	}
-	
-	cert = g_object_new (GCK_TYPE_CERTIFICATE,
-	                     "module", gck_session_get_module (session),
-	                     "manager", gck_manager_for_template (attrs, n_attrs, session),
+
+	cert = g_object_new (GKM_TYPE_CERTIFICATE,
+	                     "module", gkm_session_get_module (session),
+	                     "manager", gkm_manager_for_template (attrs, n_attrs, session),
 	                     NULL);
-	
+
 	/* Load the certificate from the data specified */
-	if (!gck_serializable_load (GCK_SERIALIZABLE (cert), NULL, attr->pValue, attr->ulValueLen)) {
-		gck_transaction_fail (transaction, CKR_ATTRIBUTE_VALUE_INVALID);
+	if (!gkm_serializable_load (GKM_SERIALIZABLE (cert), NULL, attr->pValue, attr->ulValueLen)) {
+		gkm_transaction_fail (transaction, CKR_ATTRIBUTE_VALUE_INVALID);
 		g_object_unref (cert);
 		return NULL;
 	}
-		
+
 	/* Note that we ignore the subject */
- 	gck_attributes_consume (attrs, n_attrs, CKA_VALUE, CKA_SUBJECT, G_MAXULONG);
+	gkm_attributes_consume (attrs, n_attrs, CKA_VALUE, CKA_SUBJECT, G_MAXULONG);
 
-	gck_session_complete_object_creation (session, transaction, GCK_OBJECT (cert),
+	gkm_session_complete_object_creation (session, transaction, GKM_OBJECT (cert),
 	                                      TRUE, attrs, n_attrs);
-	return GCK_OBJECT (cert);
+	return GKM_OBJECT (cert);
 }
 
 /* -----------------------------------------------------------------------------
- * KEY 
+ * KEY
  */
 
-static CK_RV 
-gck_certificate_real_get_attribute (GckObject *base, GckSession *session, CK_ATTRIBUTE* attr)
+static CK_RV
+gkm_certificate_real_get_attribute (GkmObject *base, GkmSession *session, CK_ATTRIBUTE* attr)
 {
-	GckCertificate *self = GCK_CERTIFICATE (base);
+	GkmCertificate *self = GKM_CERTIFICATE (base);
 	CK_ULONG category;
 	const guchar *cdata;
 	guchar *data;
 	gsize n_data;
 	time_t when;
 	CK_RV rv;
-	
+
 	switch (attr->type) {
-	
+
 	case CKA_CLASS:
-		return gck_attribute_set_ulong (attr, CKO_CERTIFICATE);
-		
+		return gkm_attribute_set_ulong (attr, CKO_CERTIFICATE);
+
 	case CKA_PRIVATE:
-		return gck_attribute_set_bool (attr, FALSE);
-		
+		return gkm_attribute_set_bool (attr, FALSE);
+
 	case CKA_LABEL:
-		return gck_attribute_set_string (attr, gck_certificate_get_label (self)); 
-		
+		return gkm_attribute_set_string (attr, gkm_certificate_get_label (self));
+
 	case CKA_CERTIFICATE_TYPE:
-		return gck_attribute_set_ulong (attr, CKC_X_509);
-		
+		return gkm_attribute_set_ulong (attr, CKC_X_509);
+
 	case CKA_TRUSTED:
-		return gck_attribute_set_bool (attr, FALSE);
-		
+		return gkm_attribute_set_bool (attr, FALSE);
+
 	case CKA_CERTIFICATE_CATEGORY:
-		if (!gck_certificate_calc_category (self, &category))
+		if (!gkm_certificate_calc_category (self, &category))
 			return CKR_FUNCTION_FAILED;
-		return gck_attribute_set_ulong (attr, category);
-		
+		return gkm_attribute_set_ulong (attr, category);
+
 	case CKA_CHECK_VALUE:
 		g_return_val_if_fail (self->pv->data, CKR_GENERAL_ERROR);
 		n_data = gcry_md_get_algo_dlen (GCRY_MD_SHA1);
 		g_return_val_if_fail (n_data && n_data > 3, CKR_GENERAL_ERROR);
 		data = g_new0 (guchar, n_data);
 		gcry_md_hash_buffer (GCRY_MD_SHA1, data, self->pv->data, self->pv->n_data);
-		rv = gck_attribute_set_data (attr, data, 3);
+		rv = gkm_attribute_set_data (attr, data, 3);
 		g_free (data);
 		return rv;
-	
+
 	case CKA_START_DATE:
 	case CKA_END_DATE:
 		g_return_val_if_fail (self->pv->asn1, CKR_GENERAL_ERROR);
-		if (!egg_asn1_read_time (self->pv->asn1, 
-		                              attr->type == CKA_START_DATE ? 
-		                                       "tbsCertificate.validity.notBefore" : 
+		if (!egg_asn1_read_time (self->pv->asn1,
+		                              attr->type == CKA_START_DATE ?
+		                                       "tbsCertificate.validity.notBefore" :
 		                                       "tbsCertificate.validity.notAfter",
 		                              &when))
 			return CKR_FUNCTION_FAILED;
-		return gck_attribute_set_date (attr, when);
+		return gkm_attribute_set_date (attr, when);
 
 	case CKA_SUBJECT:
 		g_return_val_if_fail (self->pv->asn1, CKR_GENERAL_ERROR);
-		cdata = egg_asn1_read_element (self->pv->asn1, self->pv->data, self->pv->n_data, 
+		cdata = egg_asn1_read_element (self->pv->asn1, self->pv->data, self->pv->n_data,
 		                                    "tbsCertificate.subject", &n_data);
 		g_return_val_if_fail (cdata, CKR_GENERAL_ERROR);
-		return gck_attribute_set_data (attr, cdata, n_data);
+		return gkm_attribute_set_data (attr, cdata, n_data);
 
 	case CKA_ID:
 		if (!self->pv->key)
-			return gck_attribute_set_data (attr, NULL, 0);
-		return gck_object_get_attribute (GCK_OBJECT (self->pv->key), session, attr);
+			return gkm_attribute_set_data (attr, NULL, 0);
+		return gkm_object_get_attribute (GKM_OBJECT (self->pv->key), session, attr);
 
 	case CKA_ISSUER:
 		g_return_val_if_fail (self->pv->asn1, CKR_GENERAL_ERROR);
-		cdata = egg_asn1_read_element (self->pv->asn1, self->pv->data, self->pv->n_data, 
+		cdata = egg_asn1_read_element (self->pv->asn1, self->pv->data, self->pv->n_data,
 		                                    "tbsCertificate.issuer", &n_data);
 		g_return_val_if_fail (cdata, CKR_GENERAL_ERROR);
-		return gck_attribute_set_data (attr, cdata, n_data);
-		
+		return gkm_attribute_set_data (attr, cdata, n_data);
+
 	case CKA_SERIAL_NUMBER:
 		g_return_val_if_fail (self->pv->asn1, CKR_GENERAL_ERROR);
-		cdata = egg_asn1_read_element (self->pv->asn1, self->pv->data, self->pv->n_data, 
+		cdata = egg_asn1_read_element (self->pv->asn1, self->pv->data, self->pv->n_data,
 		                                    "tbsCertificate.serialNumber", &n_data);
 		g_return_val_if_fail (cdata, CKR_GENERAL_ERROR);
-		return gck_attribute_set_data (attr, cdata, n_data);		
-		
+		return gkm_attribute_set_data (attr, cdata, n_data);
+
 	case CKA_VALUE:
 		g_return_val_if_fail (self->pv->data, CKR_GENERAL_ERROR);
-		return gck_attribute_set_data (attr, self->pv->data, self->pv->n_data);
+		return gkm_attribute_set_data (attr, self->pv->data, self->pv->n_data);
 
-	/* These are only used for strange online certificates which we don't support */	
+	/* These are only used for strange online certificates which we don't support */
 	case CKA_URL:
 	case CKA_HASH_OF_SUBJECT_PUBLIC_KEY:
 	case CKA_HASH_OF_ISSUER_PUBLIC_KEY:
-		return gck_attribute_set_data (attr, "", 0);
-	
+		return gkm_attribute_set_data (attr, "", 0);
+
 	/* What in the world is this doing in the spec? */
 	case CKA_JAVA_MIDP_SECURITY_DOMAIN:
-		return gck_attribute_set_ulong (attr, 0); /* 0 = unspecified */
-		
+		return gkm_attribute_set_ulong (attr, 0); /* 0 = unspecified */
+
 	case CKA_GNOME_PURPOSE_RESTRICTED:
-		gck_attribute_set_bool (attr, has_certificate_purposes (self));
+		gkm_attribute_set_bool (attr, has_certificate_purposes (self));
 		return CKR_OK;
-		
+
 	case CKA_GNOME_PURPOSE_OIDS:
 		return read_certificate_purposes (self, attr);
 
 	case CKA_GNOME_PURPOSE_SSH_AUTH:
 		return read_certificate_purpose (self, OID_USAGE_SSH_AUTH, attr);
-		
+
 	case CKA_GNOME_PURPOSE_SERVER_AUTH:
 		return read_certificate_purpose (self, OID_USAGE_SERVER_AUTH, attr);
-		
+
 	case CKA_GNOME_PURPOSE_CLIENT_AUTH:
 		return read_certificate_purpose (self, OID_USAGE_CLIENT_AUTH, attr);
-		
+
 	case CKA_GNOME_PURPOSE_CODE_SIGNING:
 		return read_certificate_purpose (self, OID_USAGE_CODE_SIGNING, attr);
-		
+
 	case CKA_GNOME_PURPOSE_EMAIL_PROTECTION:
 		return read_certificate_purpose (self, OID_USAGE_EMAIL, attr);
-		
+
 	case CKA_GNOME_PURPOSE_IPSEC_END_SYSTEM:
 		return read_certificate_purpose (self, OID_USAGE_IPSEC_ENDPOINT, attr);
-		
+
 	case CKA_GNOME_PURPOSE_IPSEC_TUNNEL:
 		return read_certificate_purpose (self, OID_USAGE_IPSEC_TUNNEL, attr);
-		
+
 	case CKA_GNOME_PURPOSE_IPSEC_USER:
 		return read_certificate_purpose (self, OID_USAGE_IPSEC_USER, attr);
-		
+
 	case CKA_GNOME_PURPOSE_TIME_STAMPING:
 		return read_certificate_purpose (self, OID_USAGE_TIME_STAMPING, attr);
 	};
 
-	return GCK_OBJECT_CLASS (gck_certificate_parent_class)->get_attribute (base, session, attr);
+	return GKM_OBJECT_CLASS (gkm_certificate_parent_class)->get_attribute (base, session, attr);
 }
 
-static GObject* 
-gck_certificate_constructor (GType type, guint n_props, GObjectConstructParam *props) 
+static GObject*
+gkm_certificate_constructor (GType type, guint n_props, GObjectConstructParam *props)
 {
-	GckCertificate *self = GCK_CERTIFICATE (G_OBJECT_CLASS (gck_certificate_parent_class)->constructor(type, n_props, props));
-	g_return_val_if_fail (self, NULL);	
+	GkmCertificate *self = GKM_CERTIFICATE (G_OBJECT_CLASS (gkm_certificate_parent_class)->constructor(type, n_props, props));
+	g_return_val_if_fail (self, NULL);
 
 
 	return G_OBJECT (self);
 }
 
 static void
-gck_certificate_init (GckCertificate *self)
+gkm_certificate_init (GkmCertificate *self)
 {
-	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GCK_TYPE_CERTIFICATE, GckCertificatePrivate);
+	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GKM_TYPE_CERTIFICATE, GkmCertificatePrivate);
 
 }
 
 static void
-gck_certificate_dispose (GObject *obj)
+gkm_certificate_dispose (GObject *obj)
 {
-	GckCertificate *self = GCK_CERTIFICATE (obj);
-	
+	GkmCertificate *self = GKM_CERTIFICATE (obj);
+
 	if (self->pv->key)
 		g_object_unref (self->pv->key);
 	self->pv->key = NULL;
-	
-	G_OBJECT_CLASS (gck_certificate_parent_class)->dispose (obj);
+
+	G_OBJECT_CLASS (gkm_certificate_parent_class)->dispose (obj);
 }
 
 static void
-gck_certificate_finalize (GObject *obj)
+gkm_certificate_finalize (GObject *obj)
 {
-	GckCertificate *self = GCK_CERTIFICATE (obj);
-	
+	GkmCertificate *self = GKM_CERTIFICATE (obj);
+
 	g_assert (!self->pv->key);
 	g_free (self->pv->data);
 	g_free (self->pv->label);
 	asn1_delete_structure (&self->pv->asn1);
 
-	G_OBJECT_CLASS (gck_certificate_parent_class)->finalize (obj);
+	G_OBJECT_CLASS (gkm_certificate_parent_class)->finalize (obj);
 }
 
 static void
-gck_certificate_set_property (GObject *obj, guint prop_id, const GValue *value, 
+gkm_certificate_set_property (GObject *obj, guint prop_id, const GValue *value,
                               GParamSpec *pspec)
 {
-	GckCertificate *self = GCK_CERTIFICATE (obj);
-	
+	GkmCertificate *self = GKM_CERTIFICATE (obj);
+
 	switch (prop_id) {
 	case PROP_LABEL:
-		gck_certificate_set_label (self, g_value_get_string (value));
+		gkm_certificate_set_label (self, g_value_get_string (value));
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -475,17 +475,17 @@ gck_certificate_set_property (GObject *obj, guint prop_id, const GValue *value,
 }
 
 static void
-gck_certificate_get_property (GObject *obj, guint prop_id, GValue *value, 
+gkm_certificate_get_property (GObject *obj, guint prop_id, GValue *value,
                               GParamSpec *pspec)
 {
-	GckCertificate *self = GCK_CERTIFICATE (obj);
-	
+	GkmCertificate *self = GKM_CERTIFICATE (obj);
+
 	switch (prop_id) {
 	case PROP_LABEL:
-		g_value_set_string (value, gck_certificate_get_label (self));
+		g_value_set_string (value, gkm_certificate_get_label (self));
 		break;
 	case PROP_PUBLIC_KEY:
-		g_value_set_object (value, gck_certificate_get_public_key (self));
+		g_value_set_object (value, gkm_certificate_get_public_key (self));
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -494,89 +494,89 @@ gck_certificate_get_property (GObject *obj, guint prop_id, GValue *value,
 }
 
 static void
-gck_certificate_class_init (GckCertificateClass *klass)
+gkm_certificate_class_init (GkmCertificateClass *klass)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	GckObjectClass *gck_class = GCK_OBJECT_CLASS (klass);
-	
-	gck_certificate_parent_class = g_type_class_peek_parent (klass);
-	g_type_class_add_private (klass, sizeof (GckCertificatePrivate));
-
-	gobject_class->constructor = gck_certificate_constructor;
-	gobject_class->dispose = gck_certificate_dispose;
-	gobject_class->finalize = gck_certificate_finalize;
-	gobject_class->set_property = gck_certificate_set_property;
-	gobject_class->get_property = gck_certificate_get_property;
-	
-	gck_class->get_attribute = gck_certificate_real_get_attribute;
-    
+	GkmObjectClass *gkm_class = GKM_OBJECT_CLASS (klass);
+
+	gkm_certificate_parent_class = g_type_class_peek_parent (klass);
+	g_type_class_add_private (klass, sizeof (GkmCertificatePrivate));
+
+	gobject_class->constructor = gkm_certificate_constructor;
+	gobject_class->dispose = gkm_certificate_dispose;
+	gobject_class->finalize = gkm_certificate_finalize;
+	gobject_class->set_property = gkm_certificate_set_property;
+	gobject_class->get_property = gkm_certificate_get_property;
+
+	gkm_class->get_attribute = gkm_certificate_real_get_attribute;
+
 	g_object_class_install_property (gobject_class, PROP_PUBLIC_KEY,
-	           g_param_spec_object ("public-key", "Public Key", "Public key contained in certificate", 
-	                                GCK_TYPE_CERTIFICATE_KEY, G_PARAM_READABLE));
-	
+	           g_param_spec_object ("public-key", "Public Key", "Public key contained in certificate",
+	                                GKM_TYPE_CERTIFICATE_KEY, G_PARAM_READABLE));
+
 	g_object_class_install_property (gobject_class, PROP_PUBLIC_KEY,
-	           g_param_spec_string ("label", "Label", "Label of the certificate", 
+	           g_param_spec_string ("label", "Label", "Label of the certificate",
 	                                "", G_PARAM_READWRITE));
-	
+
 	init_quarks ();
 }
 
-static gboolean 
-gck_certificate_real_load (GckSerializable *base, GckSecret *login, const guchar *data, gsize n_data)
+static gboolean
+gkm_certificate_real_load (GkmSerializable *base, GkmSecret *login, const guchar *data, gsize n_data)
 {
-	GckCertificate *self = GCK_CERTIFICATE (base);
+	GkmCertificate *self = GKM_CERTIFICATE (base);
 	ASN1_TYPE asn1 = ASN1_TYPE_EMPTY;
-	GckDataResult res;
+	GkmDataResult res;
 	guchar *copy, *keydata;
 	gsize n_keydata;
 	gcry_sexp_t sexp;
-	GckSexp *wrapper;
-		
-	g_return_val_if_fail (GCK_IS_CERTIFICATE (self), FALSE);
+	GkmSexp *wrapper;
+
+	g_return_val_if_fail (GKM_IS_CERTIFICATE (self), FALSE);
 	g_return_val_if_fail (data, FALSE);
 	g_return_val_if_fail (n_data, FALSE);
-		
+
 	copy = g_memdup (data, n_data);
-		
+
 	/* Parse the ASN1 data */
-	res = gck_data_der_read_certificate (copy, n_data, &asn1);
-	if (res != GCK_DATA_SUCCESS) {
+	res = gkm_data_der_read_certificate (copy, n_data, &asn1);
+	if (res != GKM_DATA_SUCCESS) {
 		g_warning ("couldn't parse certificate data");
 		g_free (copy);
 		return FALSE;
 	}
-		
+
 	/* Generate a raw public key from our certificate */
 	keydata = egg_asn1_encode (asn1, "tbsCertificate.subjectPublicKeyInfo", &n_keydata, NULL);
 	g_return_val_if_fail (keydata, FALSE);
 
 	/* Now create us a nice public key with that identifier */
-	res = gck_data_der_read_public_key_info (keydata, n_keydata, &sexp);
+	res = gkm_data_der_read_public_key_info (keydata, n_keydata, &sexp);
 	g_free (keydata);
 
 	switch (res) {
 
 	/* Create ourselves a public key with that */
-	case GCK_DATA_SUCCESS:
-		wrapper = gck_sexp_new (sexp);
+	case GKM_DATA_SUCCESS:
+		wrapper = gkm_sexp_new (sexp);
 		if (!self->pv->key)
-			self->pv->key = gck_certificate_key_new (gck_object_get_module (GCK_OBJECT (self)),
-			                                         gck_object_get_manager (GCK_OBJECT (self)),
+			self->pv->key = gkm_certificate_key_new (gkm_object_get_module (GKM_OBJECT (self)),
+			                                         gkm_object_get_manager (GKM_OBJECT (self)),
 			                                         self);
-		gck_sexp_key_set_base (GCK_SEXP_KEY (self->pv->key), wrapper);
-		gck_sexp_unref (wrapper);
+		gkm_sexp_key_set_base (GKM_SEXP_KEY (self->pv->key), wrapper);
+		gkm_sexp_unref (wrapper);
 		break;
 
 	/* Unknown type of public key for this certificate, just ignore */
-	case GCK_DATA_UNRECOGNIZED:
+	case GKM_DATA_UNRECOGNIZED:
 		if (self->pv->key)
 			g_object_unref (self->pv->key);
 		self->pv->key = NULL;
 		break;
 
 	/* Bad key, drop certificate */
-	case GCK_DATA_FAILURE:
-	case GCK_DATA_LOCKED:
+	case GKM_DATA_FAILURE:
+	case GKM_DATA_LOCKED:
 		g_warning ("couldn't parse certificate key data");
 		g_free (copy);
 		asn1_delete_structure (&asn1);
@@ -597,84 +597,84 @@ gck_certificate_real_load (GckSerializable *base, GckSecret *login, const guchar
 	return TRUE;
 }
 
-static gboolean 
-gck_certificate_real_save (GckSerializable *base, GckSecret *login, guchar **data, gsize *n_data)
+static gboolean
+gkm_certificate_real_save (GkmSerializable *base, GkmSecret *login, guchar **data, gsize *n_data)
 {
-	GckCertificate *self = GCK_CERTIFICATE (base);
-	
-	g_return_val_if_fail (GCK_IS_CERTIFICATE (self), FALSE);
+	GkmCertificate *self = GKM_CERTIFICATE (base);
+
+	g_return_val_if_fail (GKM_IS_CERTIFICATE (self), FALSE);
 	g_return_val_if_fail (data, FALSE);
 	g_return_val_if_fail (n_data, FALSE);
-	
+
 	*n_data = self->pv->n_data;
 	*data = g_memdup (self->pv->data, self->pv->n_data);
 	return TRUE;
 }
 
-static void 
-gck_certificate_serializable (GckSerializableIface *iface)
+static void
+gkm_certificate_serializable (GkmSerializableIface *iface)
 {
 	iface->extension = ".cer";
-	iface->load = gck_certificate_real_load;
-	iface->save = gck_certificate_real_save;
+	iface->load = gkm_certificate_real_load;
+	iface->save = gkm_certificate_real_save;
 }
 
 /* -----------------------------------------------------------------------------
- * PUBLIC 
+ * PUBLIC
  */
 
 gboolean
-gck_certificate_calc_category (GckCertificate *self, CK_ULONG* category)
+gkm_certificate_calc_category (GkmCertificate *self, CK_ULONG* category)
 {
 	const guchar *extension;
-	GckManager *manager;
+	GkmManager *manager;
 	gsize n_extension;
-	GckDataResult res;
+	GkmDataResult res;
 	gboolean is_ca;
-	GckObject *object;
-	
-	g_return_val_if_fail (GCK_IS_CERTIFICATE (self), CKR_GENERAL_ERROR);
+	GkmObject *object;
+
+	g_return_val_if_fail (GKM_IS_CERTIFICATE (self), CKR_GENERAL_ERROR);
 	g_return_val_if_fail (category, CKR_GENERAL_ERROR);
-	
+
 	/* First see if we have a private key for this certificate */
-	manager = gck_object_get_manager (GCK_OBJECT (self));
+	manager = gkm_object_get_manager (GKM_OBJECT (self));
 	if (manager != NULL) {
-		object = gck_manager_find_related (manager, CKO_PRIVATE_KEY, GCK_OBJECT (self));
+		object = gkm_manager_find_related (manager, CKO_PRIVATE_KEY, GKM_OBJECT (self));
 		if (object != NULL) {
 			*category = 1; /* token user */
 			return TRUE;
 		}
 	}
-	
+
 	/* Read in the Basic Constraints section */
-	extension = gck_certificate_get_extension (self, OID_BASIC_CONSTRAINTS, &n_extension, NULL);
+	extension = gkm_certificate_get_extension (self, OID_BASIC_CONSTRAINTS, &n_extension, NULL);
 	if (extension != NULL) {
-		res = gck_data_der_read_basic_constraints (extension, n_extension, &is_ca, NULL);
-		
-		if (res != GCK_DATA_SUCCESS)
+		res = gkm_data_der_read_basic_constraints (extension, n_extension, &is_ca, NULL);
+
+		if (res != GKM_DATA_SUCCESS)
 			return FALSE;
-		
+
 		if (is_ca)
 			*category = 2; /* authority */
-		else 
+		else
 			*category = 3; /* other entity */
 
 	} else {
 		*category = 0; /* unspecified */
 	}
-		
+
 	return TRUE;
 }
 
-GckCertificateKey*
-gck_certificate_get_public_key (GckCertificate *self)
+GkmCertificateKey*
+gkm_certificate_get_public_key (GkmCertificate *self)
 {
-	g_return_val_if_fail (GCK_IS_CERTIFICATE (self), NULL);
+	g_return_val_if_fail (GKM_IS_CERTIFICATE (self), NULL);
 	return self->pv->key;
 }
 
 const guchar*
-gck_certificate_get_extension (GckCertificate *self, GQuark oid, 
+gkm_certificate_get_extension (GkmCertificate *self, GQuark oid,
                                gsize *n_extension, gboolean *critical)
 {
 	const guchar *result;
@@ -682,22 +682,22 @@ gck_certificate_get_extension (GckCertificate *self, GQuark oid,
 	guchar *val;
 	gsize n_val;
 	gint index;
-	
-	g_return_val_if_fail (GCK_IS_CERTIFICATE (self), NULL);
+
+	g_return_val_if_fail (GKM_IS_CERTIFICATE (self), NULL);
 	g_return_val_if_fail (self->pv->asn1, NULL);
 	g_return_val_if_fail (oid, NULL);
 	g_return_val_if_fail (n_extension, NULL);
-	
+
 	index = find_certificate_extension (self, oid);
 	if (index <= 0)
 		return NULL;
-		
+
 	/* Read the critical status */
 	if (critical) {
 		name = g_strdup_printf ("tbsCertificate.extensions.?%u.critical", index);
 		val = egg_asn1_read_value (self->pv->asn1, name, &n_val, NULL);
 		g_free (name);
-		
+
 		/*
 		 * We're pretty liberal in what we accept as critical. The goal
 		 * here is not to accidentally mark as non-critical what some
@@ -709,72 +709,72 @@ gck_certificate_get_extension (GckCertificate *self, GQuark oid,
 			*critical = TRUE;
 		g_free (val);
 	}
-		
+
 	/* And the extension value */
 	name = g_strdup_printf ("tbsCertificate.extensions.?%u.extnValue", index);
-	result = egg_asn1_read_content (self->pv->asn1, self->pv->data, self->pv->n_data, 
+	result = egg_asn1_read_content (self->pv->asn1, self->pv->data, self->pv->n_data,
 	                                     name, n_extension);
 	g_free (name);
-		
+
 	return result;
 }
 
 const gchar*
-gck_certificate_get_label (GckCertificate *self)
+gkm_certificate_get_label (GkmCertificate *self)
 {
 	gchar *label;
-		
-	g_return_val_if_fail (GCK_IS_CERTIFICATE (self), "");
-		
+
+	g_return_val_if_fail (GKM_IS_CERTIFICATE (self), "");
+
 	if (!self->pv->label) {
 		g_return_val_if_fail (self->pv->asn1, "");
-		
+
 		/* Look for the CN in the certificate */
 		label = egg_asn1_read_dn_part (self->pv->asn1, "tbsCertificate.subject.rdnSequence", "cn");
-			
+
 		/* Otherwise use the full DN */
 		if (!label)
 			label = egg_asn1_read_dn (self->pv->asn1, "tbsCertificate.subject.rdnSequence");
-		
+
 		if (!label)
 			label = g_strdup (_("Unnamed Certificate"));
-			
+
 		self->pv->label = label;
 
 	}
-		
+
 	return self->pv->label;
 }
 
-void 
-gck_certificate_set_label (GckCertificate *self, const gchar *label)
+void
+gkm_certificate_set_label (GkmCertificate *self, const gchar *label)
 {
-	g_return_if_fail (GCK_IS_CERTIFICATE (self));
+	g_return_if_fail (GKM_IS_CERTIFICATE (self));
 	g_free (self->pv->label);
 	self->pv->label = g_strdup (label);
 	g_object_notify (G_OBJECT (self), "label");
 }
 
 guchar*
-gck_certificate_hash (GckCertificate *self, int hash_algo, gsize *n_hash)
+gkm_certificate_hash (GkmCertificate *self, int hash_algo, gsize *n_hash)
 {
 	guchar *hash;
-	
-	g_return_val_if_fail (GCK_IS_CERTIFICATE (self), NULL);
+
+	g_return_val_if_fail (GKM_IS_CERTIFICATE (self), NULL);
 	g_return_val_if_fail (self->pv->data, NULL);
 	g_return_val_if_fail (n_hash, NULL);
-	
+
 	*n_hash = gcry_md_get_algo_dlen (hash_algo);
 	g_return_val_if_fail (*n_hash > 0, NULL);
-	
+
 	hash = g_malloc0 (*n_hash);
 	gcry_md_hash_buffer (hash_algo, hash, self->pv->data, self->pv->n_data);
-	
+
 	return hash;
 }
 
-GckFactory*
-gck_certificate_get_factory (void)
+GkmFactory*
+gkm_certificate_get_factory (void)
 {
 	static CK_OBJECT_CLASS klass = CKO_CERTIFICATE;
 	static CK_CERTIFICATE_TYPE type = CKC_X_509;
@@ -784,11 +784,11 @@ gck_certificate_get_factory (void)
 		{ CKA_CERTIFICATE_TYPE, &type, sizeof (type) },
 	};
 
-	static GckFactory factory = {
+	static GkmFactory factory = {
 		attributes,
 		G_N_ELEMENTS (attributes),
 		factory_create_certificate
 	};
-	
+
 	return &factory;
 }
diff --git a/pkcs11/gkm/gkm-certificate.h b/pkcs11/gkm/gkm-certificate.h
new file mode 100644
index 0000000..0269be1
--- /dev/null
+++ b/pkcs11/gkm/gkm-certificate.h
@@ -0,0 +1,75 @@
+/*
+ * 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  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  License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * 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 __GKM_CERTIFICATE_H__
+#define __GKM_CERTIFICATE_H__
+
+#include <glib-object.h>
+
+#include "gkm-object.h"
+#include "gkm-types.h"
+
+#define GKM_FACTORY_CERTIFICATE            (gkm_certificate_get_factory ())
+
+#define GKM_TYPE_CERTIFICATE               (gkm_certificate_get_type ())
+#define GKM_CERTIFICATE(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_CERTIFICATE, GkmCertificate))
+#define GKM_CERTIFICATE_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_CERTIFICATE, GkmCertificateClass))
+#define GKM_IS_CERTIFICATE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_CERTIFICATE))
+#define GKM_IS_CERTIFICATE_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_CERTIFICATE))
+#define GKM_CERTIFICATE_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_CERTIFICATE, GkmCertificateClass))
+
+typedef struct _GkmCertificateClass GkmCertificateClass;
+typedef struct _GkmCertificatePrivate GkmCertificatePrivate;
+
+struct _GkmCertificate {
+	GkmObject parent;
+	GkmCertificatePrivate *pv;
+};
+
+struct _GkmCertificateClass {
+	GkmObjectClass parent_class;
+};
+
+GType                      gkm_certificate_get_type               (void);
+
+GkmFactory*                gkm_certificate_get_factory            (void);
+
+gboolean                   gkm_certificate_calc_category          (GkmCertificate *self,
+                                                                   CK_ULONG* category);
+
+GkmCertificateKey*         gkm_certificate_get_public_key         (GkmCertificate *self);
+
+const guchar*              gkm_certificate_get_extension          (GkmCertificate *self,
+                                                                   GQuark oid,
+                                                                   gsize *n_extension,
+                                                                   gboolean *critical);
+
+const gchar*               gkm_certificate_get_label              (GkmCertificate *self);
+
+void                       gkm_certificate_set_label              (GkmCertificate *self,
+                                                                   const gchar *label);
+
+guchar*                    gkm_certificate_hash                   (GkmCertificate *self,
+                                                                   int hash_algo,
+                                                                   gsize *n_hash);
+
+
+#endif /* __GKM_CERTIFICATE_H__ */
diff --git a/pkcs11/gck/gck-credential.c b/pkcs11/gkm/gkm-credential.c
similarity index 56%
rename from pkcs11/gck/gck-credential.c
rename to pkcs11/gkm/gkm-credential.c
index e3a6d58..25281f6 100644
--- a/pkcs11/gck/gck-credential.c
+++ b/pkcs11/gkm/gkm-credential.c
@@ -21,11 +21,11 @@
 
 #include "config.h"
 
-#include "gck-attributes.h"
-#include "gck-credential.h"
-#include "gck-secret.h"
-#include "gck-session.h"
-#include "gck-transaction.h"
+#include "gkm-attributes.h"
+#include "gkm-credential.h"
+#include "gkm-secret.h"
+#include "gkm-session.h"
+#include "gkm-transaction.h"
 
 #include "pkcs11/pkcs11.h"
 #include "pkcs11/pkcs11i.h"
@@ -36,45 +36,45 @@ enum {
 	PROP_SECRET
 };
 
-struct _GckCredentialPrivate {
+struct _GkmCredentialPrivate {
 
 	/* The object we authenticated */
-	GckObject *object;
+	GkmObject *object;
 
 	/* Secret which created this credential */
-	GckSecret *secret;
+	GkmSecret *secret;
 
 	/* Stored data */
 	GType user_type;
 	gpointer user_data;
 };
 
-G_DEFINE_TYPE (GckCredential, gck_credential, GCK_TYPE_OBJECT);
+G_DEFINE_TYPE (GkmCredential, gkm_credential, GKM_TYPE_OBJECT);
 
 /* -----------------------------------------------------------------------------
  * INTERNAL
  */
 
-static GckObject*
-factory_create_credential (GckSession *session, GckTransaction *transaction,
+static GkmObject*
+factory_create_credential (GkmSession *session, GkmTransaction *transaction,
                               CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
 {
 	CK_OBJECT_HANDLE handle;
-	GckCredential *cred;
+	GkmCredential *cred;
 	CK_ATTRIBUTE *attr;
-	GckManager *manager;
-	GckModule *module;
-	GckObject *object = NULL;
+	GkmManager *manager;
+	GkmModule *module;
+	GkmObject *object = NULL;
 	CK_RV rv;
 
-	g_return_val_if_fail (GCK_IS_TRANSACTION (transaction), NULL);
+	g_return_val_if_fail (GKM_IS_TRANSACTION (transaction), NULL);
 	g_return_val_if_fail (attrs || !n_attrs, NULL);
 
 	/* The handle is optional */
-	if (gck_attributes_find_ulong (attrs, n_attrs, CKA_G_OBJECT, &handle)) {
-		rv = gck_session_lookup_readable_object (session, handle, &object);
+	if (gkm_attributes_find_ulong (attrs, n_attrs, CKA_G_OBJECT, &handle)) {
+		rv = gkm_session_lookup_readable_object (session, handle, &object);
 		if (rv != CKR_OK) {
-			gck_transaction_fail (transaction, rv);
+			gkm_transaction_fail (transaction, rv);
 			return NULL;
 		}
 	} else {
@@ -82,41 +82,41 @@ factory_create_credential (GckSession *session, GckTransaction *transaction,
 	}
 
 	/* The value is optional */
-	attr = gck_attributes_find (attrs, n_attrs, CKA_VALUE);
+	attr = gkm_attributes_find (attrs, n_attrs, CKA_VALUE);
 
-	gck_attributes_consume (attrs, n_attrs, CKA_VALUE, CKA_G_OBJECT, G_MAXULONG);
+	gkm_attributes_consume (attrs, n_attrs, CKA_VALUE, CKA_G_OBJECT, G_MAXULONG);
 
-	module = gck_session_get_module (session);
-	manager = gck_manager_for_template (attrs, n_attrs, session);
-	rv = gck_credential_create (module, manager, object,
+	module = gkm_session_get_module (session);
+	manager = gkm_manager_for_template (attrs, n_attrs, session);
+	rv = gkm_credential_create (module, manager, object,
 	                            attr ? attr->pValue : NULL,
 	                            attr ? attr->ulValueLen : 0, &cred);
 
 	if (rv == CKR_OK) {
-		gck_session_complete_object_creation (session, transaction, GCK_OBJECT (cred),
+		gkm_session_complete_object_creation (session, transaction, GKM_OBJECT (cred),
 		                                      TRUE, attrs, n_attrs);
-		return GCK_OBJECT (cred);
+		return GKM_OBJECT (cred);
 	} else {
-		gck_transaction_fail (transaction, rv);
+		gkm_transaction_fail (transaction, rv);
 		return NULL;
 	}
 }
 
 static void
-self_destruct (GckCredential *self)
+self_destruct (GkmCredential *self)
 {
-	GckTransaction *transaction;
+	GkmTransaction *transaction;
 	CK_RV rv;
 
-	g_assert (GCK_IS_CREDENTIAL (self));
+	g_assert (GKM_IS_CREDENTIAL (self));
 
-	transaction = gck_transaction_new ();
+	transaction = gkm_transaction_new ();
 
 	/* Destroy ourselves */
-	gck_object_destroy (GCK_OBJECT (self), transaction);
+	gkm_object_destroy (GKM_OBJECT (self), transaction);
 
-	gck_transaction_complete (transaction);
-	rv = gck_transaction_get_result (transaction);
+	gkm_transaction_complete (transaction);
+	rv = gkm_transaction_get_result (transaction);
 	g_object_unref (transaction);
 
 	if (rv != CKR_OK)
@@ -126,14 +126,14 @@ self_destruct (GckCredential *self)
 static void
 object_went_away (gpointer data, GObject *old_object)
 {
-	GckCredential *self = data;
-	g_return_if_fail (GCK_IS_CREDENTIAL (self));
+	GkmCredential *self = data;
+	g_return_if_fail (GKM_IS_CREDENTIAL (self));
 	self->pv->object = NULL;
 	self_destruct (self);
 }
 
 static void
-clear_data (GckCredential *self)
+clear_data (GkmCredential *self)
 {
 	if (!self->pv->user_data)
 		return;
@@ -152,49 +152,49 @@ clear_data (GckCredential *self)
  */
 
 static CK_RV
-gck_credential_real_get_attribute (GckObject *base, GckSession *session, CK_ATTRIBUTE *attr)
+gkm_credential_real_get_attribute (GkmObject *base, GkmSession *session, CK_ATTRIBUTE *attr)
 {
-	GckCredential *self = GCK_CREDENTIAL (base);
+	GkmCredential *self = GKM_CREDENTIAL (base);
 	CK_OBJECT_HANDLE handle;
 
 	switch (attr->type) {
 
 	case CKA_CLASS:
-		return gck_attribute_set_ulong (attr, CKO_G_CREDENTIAL);
+		return gkm_attribute_set_ulong (attr, CKO_G_CREDENTIAL);
 
 	case CKA_PRIVATE:
-		return gck_attribute_set_bool (attr, TRUE);
+		return gkm_attribute_set_bool (attr, TRUE);
 
 	case CKA_G_OBJECT:
-		handle = self->pv->object ? gck_object_get_handle (self->pv->object) : 0;
-		return gck_attribute_set_ulong (attr, handle);
+		handle = self->pv->object ? gkm_object_get_handle (self->pv->object) : 0;
+		return gkm_attribute_set_ulong (attr, handle);
 
 	case CKA_VALUE:
 		return CKR_ATTRIBUTE_SENSITIVE;
 	};
 
-	return GCK_OBJECT_CLASS (gck_credential_parent_class)->get_attribute (base, session, attr);
+	return GKM_OBJECT_CLASS (gkm_credential_parent_class)->get_attribute (base, session, attr);
 }
 
 static GObject*
-gck_credential_constructor (GType type, guint n_props, GObjectConstructParam *props)
+gkm_credential_constructor (GType type, guint n_props, GObjectConstructParam *props)
 {
-	GckCredential *self = GCK_CREDENTIAL (G_OBJECT_CLASS (gck_credential_parent_class)->constructor(type, n_props, props));
+	GkmCredential *self = GKM_CREDENTIAL (G_OBJECT_CLASS (gkm_credential_parent_class)->constructor(type, n_props, props));
 	g_return_val_if_fail (self, NULL);
 
 	return G_OBJECT (self);
 }
 
 static void
-gck_credential_init (GckCredential *self)
+gkm_credential_init (GkmCredential *self)
 {
-	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GCK_TYPE_CREDENTIAL, GckCredentialPrivate);
+	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GKM_TYPE_CREDENTIAL, GkmCredentialPrivate);
 }
 
 static void
-gck_credential_dispose (GObject *obj)
+gkm_credential_dispose (GObject *obj)
 {
-	GckCredential *self = GCK_CREDENTIAL (obj);
+	GkmCredential *self = GKM_CREDENTIAL (obj);
 
 	if (self->pv->object)
 		g_object_weak_unref (G_OBJECT (self->pv->object), object_went_away, self);
@@ -202,38 +202,38 @@ gck_credential_dispose (GObject *obj)
 
 	clear_data (self);
 
-	G_OBJECT_CLASS (gck_credential_parent_class)->dispose (obj);
+	G_OBJECT_CLASS (gkm_credential_parent_class)->dispose (obj);
 }
 
 static void
-gck_credential_finalize (GObject *obj)
+gkm_credential_finalize (GObject *obj)
 {
-	GckCredential *self = GCK_CREDENTIAL (obj);
+	GkmCredential *self = GKM_CREDENTIAL (obj);
 
 	g_assert (!self->pv->object);
 	g_assert (!self->pv->user_type);
 	g_assert (!self->pv->user_data);
 
-	G_OBJECT_CLASS (gck_credential_parent_class)->finalize (obj);
+	G_OBJECT_CLASS (gkm_credential_parent_class)->finalize (obj);
 }
 
 static void
-gck_credential_set_property (GObject *obj, guint prop_id, const GValue *value,
+gkm_credential_set_property (GObject *obj, guint prop_id, const GValue *value,
                                 GParamSpec *pspec)
 {
-	GckCredential *self = GCK_CREDENTIAL (obj);
-	GckObject *object;
+	GkmCredential *self = GKM_CREDENTIAL (obj);
+	GkmObject *object;
 
 	switch (prop_id) {
 	case PROP_OBJECT:
 		object = g_value_get_object (value);
 		if (object)
-			gck_credential_connect (self, object);
+			gkm_credential_connect (self, object);
 		else
 			g_return_if_fail (!self->pv->object);
 		break;
 	case PROP_SECRET:
-		gck_credential_set_secret (self, g_value_get_object (value));
+		gkm_credential_set_secret (self, g_value_get_object (value));
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -242,17 +242,17 @@ gck_credential_set_property (GObject *obj, guint prop_id, const GValue *value,
 }
 
 static void
-gck_credential_get_property (GObject *obj, guint prop_id, GValue *value,
+gkm_credential_get_property (GObject *obj, guint prop_id, GValue *value,
                               GParamSpec *pspec)
 {
-	GckCredential *self = GCK_CREDENTIAL (obj);
+	GkmCredential *self = GKM_CREDENTIAL (obj);
 
 	switch (prop_id) {
 	case PROP_OBJECT:
-		g_value_set_object (value, gck_credential_get_object (self));
+		g_value_set_object (value, gkm_credential_get_object (self));
 		break;
 	case PROP_SECRET:
-		g_value_set_object (value, gck_credential_get_secret (self));
+		g_value_set_object (value, gkm_credential_get_secret (self));
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -261,37 +261,37 @@ gck_credential_get_property (GObject *obj, guint prop_id, GValue *value,
 }
 
 static void
-gck_credential_class_init (GckCredentialClass *klass)
+gkm_credential_class_init (GkmCredentialClass *klass)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	GckObjectClass *gck_class = GCK_OBJECT_CLASS (klass);
+	GkmObjectClass *gkm_class = GKM_OBJECT_CLASS (klass);
 
-	gck_credential_parent_class = g_type_class_peek_parent (klass);
-	g_type_class_add_private (klass, sizeof (GckCredentialPrivate));
+	gkm_credential_parent_class = g_type_class_peek_parent (klass);
+	g_type_class_add_private (klass, sizeof (GkmCredentialPrivate));
 
-	gobject_class->constructor = gck_credential_constructor;
-	gobject_class->dispose = gck_credential_dispose;
-	gobject_class->finalize = gck_credential_finalize;
-	gobject_class->set_property = gck_credential_set_property;
-	gobject_class->get_property = gck_credential_get_property;
+	gobject_class->constructor = gkm_credential_constructor;
+	gobject_class->dispose = gkm_credential_dispose;
+	gobject_class->finalize = gkm_credential_finalize;
+	gobject_class->set_property = gkm_credential_set_property;
+	gobject_class->get_property = gkm_credential_get_property;
 
-	gck_class->get_attribute = gck_credential_real_get_attribute;
+	gkm_class->get_attribute = gkm_credential_real_get_attribute;
 
 	g_object_class_install_property (gobject_class, PROP_OBJECT,
 	           g_param_spec_object ("object", "Object", "Object authenticated",
-	                                GCK_TYPE_OBJECT, G_PARAM_READWRITE));
+	                                GKM_TYPE_OBJECT, G_PARAM_READWRITE));
 
 	g_object_class_install_property (gobject_class, PROP_SECRET,
 	           g_param_spec_object ("secret", "Secret", "Optiontal secret",
-	                                GCK_TYPE_SECRET, G_PARAM_READWRITE));
+	                                GKM_TYPE_SECRET, G_PARAM_READWRITE));
 }
 
 /* -----------------------------------------------------------------------------
  * PUBLIC
  */
 
-GckFactory*
-gck_credential_get_factory (void)
+GkmFactory*
+gkm_credential_get_factory (void)
 {
 	static CK_OBJECT_CLASS klass = CKO_G_CREDENTIAL;
 
@@ -299,7 +299,7 @@ gck_credential_get_factory (void)
 		{ CKA_CLASS, &klass, sizeof (klass) },
 	};
 
-	static GckFactory factory = {
+	static GkmFactory factory = {
 		attributes,
 		G_N_ELEMENTS (attributes),
 		factory_create_credential
@@ -309,20 +309,20 @@ gck_credential_get_factory (void)
 }
 
 CK_RV
-gck_credential_create (GckModule *module, GckManager *manager, GckObject *object,
-                       CK_UTF8CHAR_PTR pin, CK_ULONG n_pin, GckCredential **result)
+gkm_credential_create (GkmModule *module, GkmManager *manager, GkmObject *object,
+                       CK_UTF8CHAR_PTR pin, CK_ULONG n_pin, GkmCredential **result)
 {
-	GckCredential *cred;
-	GckSecret *secret = NULL;
+	GkmCredential *cred;
+	GkmSecret *secret = NULL;
 	CK_RV rv;
 
-	g_return_val_if_fail (GCK_IS_MODULE (module), CKR_GENERAL_ERROR);
-	g_return_val_if_fail (!object || GCK_IS_OBJECT (object), CKR_GENERAL_ERROR);
-	g_return_val_if_fail (!manager || GCK_IS_MANAGER (manager), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (GKM_IS_MODULE (module), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (!object || GKM_IS_OBJECT (object), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (!manager || GKM_IS_MANAGER (manager), CKR_GENERAL_ERROR);
 	g_return_val_if_fail (result, CKR_GENERAL_ERROR);
 
-	secret = gck_secret_new_from_login (pin, n_pin);
-	cred = g_object_new (GCK_TYPE_CREDENTIAL,
+	secret = gkm_secret_new_from_login (pin, n_pin);
+	cred = g_object_new (GKM_TYPE_CREDENTIAL,
 	                     "module", module,
 	                     "manager", manager,
 	                     "secret", secret,
@@ -332,7 +332,7 @@ gck_credential_create (GckModule *module, GckManager *manager, GckObject *object
 
 	/* If we have an object, the unlock must work */
 	if (object) {
-		rv = gck_object_unlock (object, cred);
+		rv = gkm_object_unlock (object, cred);
 		if (rv == CKR_OK)
 			*result = cred;
 		else
@@ -348,30 +348,30 @@ gck_credential_create (GckModule *module, GckManager *manager, GckObject *object
 }
 
 void
-gck_credential_connect (GckCredential *self, GckObject *object)
+gkm_credential_connect (GkmCredential *self, GkmObject *object)
 {
-	g_return_if_fail (GCK_IS_CREDENTIAL (self));
-	g_return_if_fail (GCK_IS_OBJECT (object));
+	g_return_if_fail (GKM_IS_CREDENTIAL (self));
+	g_return_if_fail (GKM_IS_OBJECT (object));
 	g_return_if_fail (self->pv->object == NULL);
-	g_return_if_fail (GCK_OBJECT (self) != object);
+	g_return_if_fail (GKM_OBJECT (self) != object);
 	self->pv->object = object;
 	g_object_weak_ref (G_OBJECT (self->pv->object), object_went_away, self);
 }
 
-GckSecret*
-gck_credential_get_secret (GckCredential *self)
+GkmSecret*
+gkm_credential_get_secret (GkmCredential *self)
 {
-	g_return_val_if_fail (GCK_IS_CREDENTIAL (self), NULL);
+	g_return_val_if_fail (GKM_IS_CREDENTIAL (self), NULL);
 	return self->pv->secret;
 }
 
 void
-gck_credential_set_secret (GckCredential *self, GckSecret *secret)
+gkm_credential_set_secret (GkmCredential *self, GkmSecret *secret)
 {
-	g_return_if_fail (GCK_IS_CREDENTIAL (self));
+	g_return_if_fail (GKM_IS_CREDENTIAL (self));
 
 	if (secret) {
-		g_return_if_fail (GCK_IS_SECRET (secret));
+		g_return_if_fail (GKM_IS_SECRET (secret));
 		g_object_ref (secret);
 	}
 	if (self->pv->secret)
@@ -382,9 +382,9 @@ gck_credential_set_secret (GckCredential *self, GckSecret *secret)
 }
 
 const gchar*
-gck_credential_get_password (GckCredential *self, gsize *n_password)
+gkm_credential_get_password (GkmCredential *self, gsize *n_password)
 {
-	g_return_val_if_fail (GCK_IS_CREDENTIAL (self), NULL);
+	g_return_val_if_fail (GKM_IS_CREDENTIAL (self), NULL);
 	g_return_val_if_fail (n_password, NULL);
 
 	if (!self->pv->secret) {
@@ -392,20 +392,20 @@ gck_credential_get_password (GckCredential *self, gsize *n_password)
 		return NULL;
 	}
 
-	return gck_secret_get_password (self->pv->secret, n_password);
+	return gkm_secret_get_password (self->pv->secret, n_password);
 }
 
-GckObject*
-gck_credential_get_object (GckCredential *self)
+GkmObject*
+gkm_credential_get_object (GkmCredential *self)
 {
-	g_return_val_if_fail (GCK_IS_CREDENTIAL (self), NULL);
+	g_return_val_if_fail (GKM_IS_CREDENTIAL (self), NULL);
 	return self->pv->object;
 }
 
 gpointer
-gck_credential_peek_data (GckCredential *self, GType type)
+gkm_credential_peek_data (GkmCredential *self, GType type)
 {
-	g_return_val_if_fail (GCK_IS_CREDENTIAL (self), NULL);
+	g_return_val_if_fail (GKM_IS_CREDENTIAL (self), NULL);
 	if (!self->pv->user_data)
 		return NULL;
 	g_return_val_if_fail (type == self->pv->user_type, NULL);
@@ -413,10 +413,10 @@ gck_credential_peek_data (GckCredential *self, GType type)
 }
 
 gpointer
-gck_credential_pop_data (GckCredential *self, GType type)
+gkm_credential_pop_data (GkmCredential *self, GType type)
 {
 	gpointer data = NULL;
-	g_return_val_if_fail (GCK_IS_CREDENTIAL (self), NULL);
+	g_return_val_if_fail (GKM_IS_CREDENTIAL (self), NULL);
 
 	if (self->pv->user_data) {
 		g_return_val_if_fail (type == self->pv->user_type, NULL);
@@ -428,14 +428,14 @@ gck_credential_pop_data (GckCredential *self, GType type)
 			g_assert_not_reached ();
 	}
 
-	gck_object_mark_used (GCK_OBJECT (self));
+	gkm_object_mark_used (GKM_OBJECT (self));
 	return data;
 }
 
 void
-gck_credential_set_data (GckCredential *self, GType type, gpointer data)
+gkm_credential_set_data (GkmCredential *self, GType type, gpointer data)
 {
-	g_return_if_fail (GCK_IS_CREDENTIAL (self));
+	g_return_if_fail (GKM_IS_CREDENTIAL (self));
 
 	if (data) {
 		g_return_if_fail (type);
@@ -456,23 +456,23 @@ gck_credential_set_data (GckCredential *self, GType type, gpointer data)
 }
 
 gboolean
-gck_credential_for_each (GckSession *session, GckObject *object,
-                         GckCredentialFunc func, gpointer user_data)
+gkm_credential_for_each (GkmSession *session, GkmObject *object,
+                         GkmCredentialFunc func, gpointer user_data)
 {
 	CK_OBJECT_HANDLE handle;
 	CK_OBJECT_CLASS klass;
 	CK_ATTRIBUTE attrs[2];
 	GList *results, *l;
-	GckCredential *cred;
+	GkmCredential *cred;
 	gboolean ret;
 
-	g_return_val_if_fail (GCK_IS_SESSION (session), FALSE);
-	g_return_val_if_fail (GCK_IS_OBJECT (object), FALSE);
+	g_return_val_if_fail (GKM_IS_SESSION (session), FALSE);
+	g_return_val_if_fail (GKM_IS_OBJECT (object), FALSE);
 	g_return_val_if_fail (func, FALSE);
 
 	/* Do we have one right on the session */
-	cred = gck_session_get_credential (session);
-	if (cred && gck_credential_get_object (cred) == object) {
+	cred = gkm_session_get_credential (session);
+	if (cred && gkm_credential_get_object (cred) == object) {
 		g_object_ref (cred);
 		ret = (func) (cred, object, user_data);
 		g_object_unref (cred);
@@ -485,13 +485,13 @@ gck_credential_for_each (GckSession *session, GckObject *object,
 	attrs[0].pValue = &klass;
 	attrs[0].ulValueLen = sizeof (klass);
 
-	handle = gck_object_get_handle (object);
+	handle = gkm_object_get_handle (object);
 	attrs[1].type = CKA_G_OBJECT;
 	attrs[1].pValue = &handle;
 	attrs[1].ulValueLen = sizeof (handle);
 
 	/* Find any on the session */
-	results = gck_manager_find_by_attributes (gck_session_get_manager (session),
+	results = gkm_manager_find_by_attributes (gkm_session_get_manager (session),
 	                                          attrs, G_N_ELEMENTS (attrs));
 
 	for (l = results; l; l = g_list_next (l)) {
@@ -508,7 +508,7 @@ gck_credential_for_each (GckSession *session, GckObject *object,
 		return TRUE;
 
 	/* Find any in the token */
-	results = gck_manager_find_by_attributes (gck_module_get_manager (gck_session_get_module (session)),
+	results = gkm_manager_find_by_attributes (gkm_module_get_manager (gkm_session_get_module (session)),
 	                                          attrs, G_N_ELEMENTS (attrs));
 
 	for (l = results; l; l = g_list_next (l)) {
diff --git a/pkcs11/gkm/gkm-credential.h b/pkcs11/gkm/gkm-credential.h
new file mode 100644
index 0000000..f7f53b7
--- /dev/null
+++ b/pkcs11/gkm/gkm-credential.h
@@ -0,0 +1,95 @@
+/*
+ * gnome-keyring
+ *
+ * Copyright (C) 2009 Stefan Walter
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General  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  License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * 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 __GKM_CREDENTIAL_H__
+#define __GKM_CREDENTIAL_H__
+
+#include <glib-object.h>
+
+#include "gkm-object.h"
+#include "gkm-types.h"
+
+#define GKM_FACTORY_CREDENTIAL            (gkm_credential_get_factory ())
+
+#define GKM_TYPE_CREDENTIAL               (gkm_credential_get_type ())
+#define GKM_CREDENTIAL(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_CREDENTIAL, GkmCredential))
+#define GKM_CREDENTIAL_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_CREDENTIAL, GkmCredentialClass))
+#define GKM_IS_CREDENTIAL(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_CREDENTIAL))
+#define GKM_IS_CREDENTIAL_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_CREDENTIAL))
+#define GKM_CREDENTIAL_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_CREDENTIAL, GkmCredentialClass))
+
+typedef struct _GkmCredentialClass GkmCredentialClass;
+typedef struct _GkmCredentialPrivate GkmCredentialPrivate;
+
+struct _GkmCredential {
+	GkmObject parent;
+	GkmCredentialPrivate *pv;
+};
+
+struct _GkmCredentialClass {
+	GkmObjectClass parent_class;
+};
+
+GType                      gkm_credential_get_type               (void);
+
+GkmFactory*                gkm_credential_get_factory            (void);
+
+CK_RV                      gkm_credential_create                 (GkmModule *module,
+                                                                  GkmManager *manager,
+                                                                  GkmObject *object,
+                                                                  CK_UTF8CHAR_PTR pin,
+                                                                  CK_ULONG n_pin,
+                                                                  GkmCredential **result);
+
+void                       gkm_credential_connect                (GkmCredential *self,
+                                                                  GkmObject *object);
+
+GkmSecret*                 gkm_credential_get_secret             (GkmCredential *self);
+
+void                       gkm_credential_set_secret             (GkmCredential *self,
+                                                                  GkmSecret *login);
+
+const gchar*               gkm_credential_get_password           (GkmCredential *self,
+                                                                  gsize *n_password);
+
+GkmObject*                 gkm_credential_get_object             (GkmCredential *self);
+
+gpointer                   gkm_credential_peek_data              (GkmCredential *self,
+                                                                  GType type);
+
+gpointer                   gkm_credential_pop_data               (GkmCredential *self,
+                                                                  GType type);
+
+void                       gkm_credential_set_data               (GkmCredential *self,
+                                                                  GType type,
+                                                                  gpointer data);
+
+typedef gboolean           (*GkmCredentialFunc)                  (GkmCredential *cred,
+                                                                  GkmObject *object,
+                                                                  gpointer user_data);
+
+
+gboolean                   gkm_credential_for_each               (GkmSession *self,
+                                                                  GkmObject *object,
+                                                                  GkmCredentialFunc func,
+                                                                  gpointer user_data);
+
+#endif /* __GKM_CREDENTIAL_H__ */
diff --git a/pkcs11/gck/gck-crypto.c b/pkcs11/gkm/gkm-crypto.c
similarity index 67%
rename from pkcs11/gck/gck-crypto.c
rename to pkcs11/gkm/gkm-crypto.c
index 32fd20e..b77dfe5 100644
--- a/pkcs11/gck/gck-crypto.c
+++ b/pkcs11/gkm/gkm-crypto.c
@@ -1,35 +1,35 @@
-/* 
+/*
  * 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  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  License for more details.
- *  
- * You should have received a copy of the GNU Lesser General 
+ *
+ * You should have received a copy of the GNU Lesser General
  * 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"
 
-#include "gck-crypto.h"
-#include "gck-aes-mechanism.h"
-#include "gck-dh-mechanism.h"
-#include "gck-mechanism-dsa.h"
-#include "gck-mechanism-rsa.h"
-#include "gck-null-mechanism.h"
-#include "gck-session.h"
-#include "gck-sexp.h"
-#include "gck-sexp-key.h"
+#include "gkm-crypto.h"
+#include "gkm-aes-mechanism.h"
+#include "gkm-dh-mechanism.h"
+#include "gkm-mechanism-dsa.h"
+#include "gkm-mechanism-rsa.h"
+#include "gkm-null-mechanism.h"
+#include "gkm-session.h"
+#include "gkm-sexp.h"
+#include "gkm-sexp-key.h"
 
 #include "egg/egg-libgcrypt.h"
 #include "egg/egg-secure-memory.h"
@@ -39,7 +39,7 @@
  */
 
 CK_RV
-gck_crypto_data_to_sexp (const gchar *format, guint nbits, EggPadding padding,
+gkm_crypto_data_to_sexp (const gchar *format, guint nbits, EggPadding padding,
                          CK_BYTE_PTR data, CK_ULONG n_data, gcry_sexp_t *sexp)
 {
 	gpointer padded = NULL;
@@ -49,8 +49,8 @@ gck_crypto_data_to_sexp (const gchar *format, guint nbits, EggPadding padding,
 	gsize block;
 
 	g_assert (format);
-	g_assert (sexp);	
-	
+	g_assert (sexp);
+
 	g_return_val_if_fail (data, CKR_ARGUMENTS_BAD);
 
 	block = (nbits + 7) / 8;
@@ -61,9 +61,9 @@ gck_crypto_data_to_sexp (const gchar *format, guint nbits, EggPadding padding,
 		if (!(padding) (g_realloc, block, data, n_data, &padded, &n_padded))
 			return CKR_DATA_LEN_RANGE;
 	}
-		
+
 	/* Prepare the input s expression */
-	gcry = gcry_mpi_scan (&mpi, GCRYMPI_FMT_USG, 
+	gcry = gcry_mpi_scan (&mpi, GCRYMPI_FMT_USG,
 	                      padded ? padded : data,
 	                      padded ? n_padded : n_data, NULL);
 	g_free (padded);
@@ -80,7 +80,7 @@ gck_crypto_data_to_sexp (const gchar *format, guint nbits, EggPadding padding,
 }
 
 CK_RV
-gck_crypto_sexp_to_data (gcry_sexp_t sexp, guint bits, CK_BYTE_PTR data,
+gkm_crypto_sexp_to_data (gcry_sexp_t sexp, guint bits, CK_BYTE_PTR data,
                          CK_ULONG *n_data, EggPadding padding, ...)
 {
 	gcry_sexp_t at = NULL;
@@ -99,9 +99,9 @@ gck_crypto_sexp_to_data (gcry_sexp_t sexp, guint bits, CK_BYTE_PTR data,
 
 	/* First try and dig out sexp child based on arguments */
 	va_start (va, padding);
-	at = gck_sexp_get_childv (sexp, va);
+	at = gkm_sexp_get_childv (sexp, va);
 	va_end (va);
-	
+
 	/* It's expected we would find it */
 	g_return_val_if_fail (at != NULL, CKR_GENERAL_ERROR);
 
@@ -145,266 +145,266 @@ gck_crypto_sexp_to_data (gcry_sexp_t sexp, guint bits, CK_BYTE_PTR data,
 
 
 CK_RV
-gck_crypto_encrypt (GckSession *session, CK_MECHANISM_TYPE mech, CK_BYTE_PTR data,
+gkm_crypto_encrypt (GkmSession *session, CK_MECHANISM_TYPE mech, CK_BYTE_PTR data,
                     CK_ULONG n_data, CK_BYTE_PTR encrypted, CK_ULONG_PTR n_encrypted)
 {
-	GckSexp *sexp;
+	GkmSexp *sexp;
 
 	switch (mech) {
 	case CKM_RSA_PKCS:
 	case CKM_RSA_X_509:
-		sexp = gck_session_get_crypto_state (session);
+		sexp = gkm_session_get_crypto_state (session);
 		g_return_val_if_fail (sexp, CKR_GENERAL_ERROR);
-		return gck_crypto_encrypt_xsa (gck_sexp_get (sexp), mech, data, n_data, encrypted, n_encrypted);
+		return gkm_crypto_encrypt_xsa (gkm_sexp_get (sexp), mech, data, n_data, encrypted, n_encrypted);
 	default:
 		g_return_val_if_reached (CKR_GENERAL_ERROR);
 	}
 }
 
 CK_RV
-gck_crypto_encrypt_xsa (gcry_sexp_t sexp, CK_MECHANISM_TYPE mech, CK_BYTE_PTR data,
+gkm_crypto_encrypt_xsa (gcry_sexp_t sexp, CK_MECHANISM_TYPE mech, CK_BYTE_PTR data,
                         CK_ULONG n_data, CK_BYTE_PTR encrypted, CK_ULONG_PTR n_encrypted)
 {
 	int algorithm;
 	CK_RV rv;
-	
+
 	g_return_val_if_fail (sexp, CKR_GENERAL_ERROR);
 	g_return_val_if_fail (n_encrypted, CKR_ARGUMENTS_BAD);
 	g_return_val_if_fail (data, CKR_ARGUMENTS_BAD);
-	
-	if (!gck_sexp_parse_key (sexp, &algorithm, NULL, NULL))
+
+	if (!gkm_sexp_parse_key (sexp, &algorithm, NULL, NULL))
 		g_return_val_if_reached (CKR_GENERAL_ERROR);
 
-	/* 
+	/*
 	 * The algorithm checks below are merely sanity checks.
 	 * Other code should have checed this at an earlier stage
 	 * and return the right error codes if invalid.
 	 */
-	
+
 	switch (mech) {
 	case CKM_RSA_PKCS:
-		g_return_val_if_fail (algorithm == GCRY_PK_RSA, CKR_GENERAL_ERROR); 
-		rv = gck_mechanism_rsa_encrypt (sexp, egg_padding_pkcs1_pad_02, data, n_data, encrypted, n_encrypted);
+		g_return_val_if_fail (algorithm == GCRY_PK_RSA, CKR_GENERAL_ERROR);
+		rv = gkm_mechanism_rsa_encrypt (sexp, egg_padding_pkcs1_pad_02, data, n_data, encrypted, n_encrypted);
 		break;
 	case CKM_RSA_X_509:
 		g_return_val_if_fail (algorithm == GCRY_PK_RSA, CKR_GENERAL_ERROR);
-		rv = gck_mechanism_rsa_encrypt (sexp, egg_padding_zero_pad, data, n_data, encrypted, n_encrypted);
+		rv = gkm_mechanism_rsa_encrypt (sexp, egg_padding_zero_pad, data, n_data, encrypted, n_encrypted);
 		break;
 	default:
 		/* Again shouldn't be reached */
 		g_return_val_if_reached (CKR_GENERAL_ERROR);
 	};
-	
-	return rv;	
+
+	return rv;
 }
 
 CK_RV
-gck_crypto_decrypt (GckSession *session, CK_MECHANISM_TYPE mech, CK_BYTE_PTR encrypted,
+gkm_crypto_decrypt (GkmSession *session, CK_MECHANISM_TYPE mech, CK_BYTE_PTR encrypted,
                     CK_ULONG n_encrypted, CK_BYTE_PTR data, CK_ULONG_PTR n_data)
 {
-	GckSexp *sexp;
+	GkmSexp *sexp;
 
 	switch (mech) {
 	case CKM_RSA_PKCS:
 	case CKM_RSA_X_509:
-		sexp = gck_session_get_crypto_state (session);
+		sexp = gkm_session_get_crypto_state (session);
 		g_return_val_if_fail (sexp, CKR_GENERAL_ERROR);
-		return gck_crypto_decrypt_xsa (gck_sexp_get (sexp), mech, encrypted, n_encrypted, data, n_data);
+		return gkm_crypto_decrypt_xsa (gkm_sexp_get (sexp), mech, encrypted, n_encrypted, data, n_data);
 	default:
 		g_return_val_if_reached (CKR_GENERAL_ERROR);
 	}
 }
 
 CK_RV
-gck_crypto_decrypt_xsa (gcry_sexp_t sexp, CK_MECHANISM_TYPE mech, CK_BYTE_PTR encrypted,
+gkm_crypto_decrypt_xsa (gcry_sexp_t sexp, CK_MECHANISM_TYPE mech, CK_BYTE_PTR encrypted,
                         CK_ULONG n_encrypted, CK_BYTE_PTR data, CK_ULONG_PTR n_data)
 {
 	int algorithm;
 	CK_RV rv;
-	
+
 	g_return_val_if_fail (sexp, CKR_GENERAL_ERROR);
 	g_return_val_if_fail (n_data, CKR_ARGUMENTS_BAD);
 	g_return_val_if_fail (encrypted, CKR_ARGUMENTS_BAD);
-	
-	if (!gck_sexp_parse_key (sexp, &algorithm, NULL, NULL))
+
+	if (!gkm_sexp_parse_key (sexp, &algorithm, NULL, NULL))
 		g_return_val_if_reached (CKR_GENERAL_ERROR);
 
-	/* 
+	/*
 	 * The algorithm checks below are merely sanity checks.
 	 * Other code should have checed this at an earlier stage
 	 * and return the right error codes if invalid.
 	 */
-	
+
 	switch (mech) {
 	case CKM_RSA_PKCS:
-		g_return_val_if_fail (algorithm == GCRY_PK_RSA, CKR_GENERAL_ERROR); 
-		rv = gck_mechanism_rsa_decrypt (sexp, egg_padding_pkcs1_unpad_02, encrypted, n_encrypted, data, n_data);
+		g_return_val_if_fail (algorithm == GCRY_PK_RSA, CKR_GENERAL_ERROR);
+		rv = gkm_mechanism_rsa_decrypt (sexp, egg_padding_pkcs1_unpad_02, encrypted, n_encrypted, data, n_data);
 		break;
 	case CKM_RSA_X_509:
 		g_return_val_if_fail (algorithm == GCRY_PK_RSA, CKR_GENERAL_ERROR);
-		rv = gck_mechanism_rsa_decrypt (sexp, NULL, encrypted, n_encrypted, data, n_data);
+		rv = gkm_mechanism_rsa_decrypt (sexp, NULL, encrypted, n_encrypted, data, n_data);
 		break;
 	default:
 		/* Again shouldn't be reached */
 		g_return_val_if_reached (CKR_GENERAL_ERROR);
 	};
-	
-	return rv;	
+
+	return rv;
 }
 
 CK_RV
-gck_crypto_sign (GckSession *session, CK_MECHANISM_TYPE mech, CK_BYTE_PTR data,
+gkm_crypto_sign (GkmSession *session, CK_MECHANISM_TYPE mech, CK_BYTE_PTR data,
                  CK_ULONG n_data, CK_BYTE_PTR signature, CK_ULONG_PTR n_signature)
 {
-	GckSexp *sexp;
+	GkmSexp *sexp;
 
 	switch (mech) {
 	case CKM_RSA_PKCS:
 	case CKM_RSA_X_509:
 	case CKM_DSA:
-		sexp = gck_session_get_crypto_state (session);
+		sexp = gkm_session_get_crypto_state (session);
 		g_return_val_if_fail (sexp, CKR_GENERAL_ERROR);
-		return gck_crypto_sign_xsa (gck_sexp_get (sexp), mech, data, n_data, signature, n_signature);
+		return gkm_crypto_sign_xsa (gkm_sexp_get (sexp), mech, data, n_data, signature, n_signature);
 	default:
 		g_return_val_if_reached (CKR_GENERAL_ERROR);
 	}
 }
 
 CK_RV
-gck_crypto_sign_xsa (gcry_sexp_t sexp, CK_MECHANISM_TYPE mech, CK_BYTE_PTR data,
+gkm_crypto_sign_xsa (gcry_sexp_t sexp, CK_MECHANISM_TYPE mech, CK_BYTE_PTR data,
                      CK_ULONG n_data, CK_BYTE_PTR signature, CK_ULONG_PTR n_signature)
 {
 	int algorithm;
 	CK_RV rv;
-	
+
 	g_return_val_if_fail (sexp, CKR_GENERAL_ERROR);
 	g_return_val_if_fail (n_signature, CKR_ARGUMENTS_BAD);
 	g_return_val_if_fail (data, CKR_ARGUMENTS_BAD);
-	
-	if (!gck_sexp_parse_key (sexp, &algorithm, NULL, NULL))
+
+	if (!gkm_sexp_parse_key (sexp, &algorithm, NULL, NULL))
 		g_return_val_if_reached (CKR_GENERAL_ERROR);
 
-	/* 
+	/*
 	 * The algorithm checks below are merely sanity checks.
 	 * Other code should have checed this at an earlier stage
 	 * and return the right error codes if invalid.
 	 */
-	
+
 	switch (mech) {
 	case CKM_RSA_PKCS:
-		g_return_val_if_fail (algorithm == GCRY_PK_RSA, CKR_GENERAL_ERROR); 
-		rv = gck_mechanism_rsa_sign (sexp, egg_padding_pkcs1_pad_01, data, n_data, signature, n_signature);
+		g_return_val_if_fail (algorithm == GCRY_PK_RSA, CKR_GENERAL_ERROR);
+		rv = gkm_mechanism_rsa_sign (sexp, egg_padding_pkcs1_pad_01, data, n_data, signature, n_signature);
 		break;
 	case CKM_RSA_X_509:
 		g_return_val_if_fail (algorithm == GCRY_PK_RSA, CKR_GENERAL_ERROR);
-		rv = gck_mechanism_rsa_sign (sexp, egg_padding_zero_pad, data, n_data, signature, n_signature);
+		rv = gkm_mechanism_rsa_sign (sexp, egg_padding_zero_pad, data, n_data, signature, n_signature);
 		break;
 	case CKM_DSA:
 		g_return_val_if_fail (algorithm == GCRY_PK_DSA, CKR_GENERAL_ERROR);
-		rv = gck_mechanism_dsa_sign (sexp, data, n_data, signature, n_signature);
+		rv = gkm_mechanism_dsa_sign (sexp, data, n_data, signature, n_signature);
 		break;
 	default:
 		/* Again shouldn't be reached */
 		g_return_val_if_reached (CKR_GENERAL_ERROR);
 	};
-	
+
 	return rv;
 }
 
 CK_RV
-gck_crypto_verify (GckSession *session, CK_MECHANISM_TYPE mech, CK_BYTE_PTR data,
+gkm_crypto_verify (GkmSession *session, CK_MECHANISM_TYPE mech, CK_BYTE_PTR data,
                    CK_ULONG n_data, CK_BYTE_PTR signature, CK_ULONG n_signature)
 {
-	GckSexp *sexp;
+	GkmSexp *sexp;
 
 	switch (mech) {
 	case CKM_RSA_PKCS:
 	case CKM_RSA_X_509:
 	case CKM_DSA:
-		sexp = gck_session_get_crypto_state (session);
+		sexp = gkm_session_get_crypto_state (session);
 		g_return_val_if_fail (sexp, CKR_GENERAL_ERROR);
-		return gck_crypto_verify_xsa (gck_sexp_get (sexp), mech, data, n_data, signature, n_signature);
+		return gkm_crypto_verify_xsa (gkm_sexp_get (sexp), mech, data, n_data, signature, n_signature);
 	default:
 		g_return_val_if_reached (CKR_GENERAL_ERROR);
 	}
 }
 
 CK_RV
-gck_crypto_verify_xsa (gcry_sexp_t sexp, CK_MECHANISM_TYPE mech, CK_BYTE_PTR data,
+gkm_crypto_verify_xsa (gcry_sexp_t sexp, CK_MECHANISM_TYPE mech, CK_BYTE_PTR data,
                        CK_ULONG n_data, CK_BYTE_PTR signature, CK_ULONG n_signature)
 {
 	int algorithm;
 	CK_RV rv;
-	
+
 	g_return_val_if_fail (sexp, CKR_GENERAL_ERROR);
 	g_return_val_if_fail (signature, CKR_ARGUMENTS_BAD);
 	g_return_val_if_fail (data, CKR_ARGUMENTS_BAD);
-	
-	if (!gck_sexp_parse_key (sexp, &algorithm, NULL, NULL))
+
+	if (!gkm_sexp_parse_key (sexp, &algorithm, NULL, NULL))
 		g_return_val_if_reached (CKR_GENERAL_ERROR);
 
-	/* 
+	/*
 	 * The algorithm checks below are merely sanity checks.
 	 * Other code should have checed this at an earlier stage
 	 * and return the right error codes if invalid.
 	 */
-	
+
 	switch (mech) {
 	case CKM_RSA_PKCS:
-		g_return_val_if_fail (algorithm == GCRY_PK_RSA, CKR_GENERAL_ERROR); 
-		rv = gck_mechanism_rsa_verify (sexp, egg_padding_pkcs1_pad_01, data, n_data, signature, n_signature);
+		g_return_val_if_fail (algorithm == GCRY_PK_RSA, CKR_GENERAL_ERROR);
+		rv = gkm_mechanism_rsa_verify (sexp, egg_padding_pkcs1_pad_01, data, n_data, signature, n_signature);
 		break;
 	case CKM_RSA_X_509:
 		g_return_val_if_fail (algorithm == GCRY_PK_RSA, CKR_GENERAL_ERROR);
-		rv = gck_mechanism_rsa_verify (sexp, egg_padding_zero_pad, data, n_data, signature, n_signature);
+		rv = gkm_mechanism_rsa_verify (sexp, egg_padding_zero_pad, data, n_data, signature, n_signature);
 		break;
 	case CKM_DSA:
 		g_return_val_if_fail (algorithm == GCRY_PK_DSA, CKR_GENERAL_ERROR);
-		rv = gck_mechanism_dsa_verify (sexp, data, n_data, signature, n_signature);
+		rv = gkm_mechanism_dsa_verify (sexp, data, n_data, signature, n_signature);
 		break;
 	default:
 		/* Again shouldn't be reached */
 		g_return_val_if_reached (CKR_GENERAL_ERROR);
 	};
-	
+
 	return rv;
 }
 
-CK_RV 
-gck_crypto_perform (GckSession *session, CK_MECHANISM_TYPE mech, CK_ATTRIBUTE_TYPE method,
+CK_RV
+gkm_crypto_perform (GkmSession *session, CK_MECHANISM_TYPE mech, CK_ATTRIBUTE_TYPE method,
                     CK_BYTE_PTR bufone, CK_ULONG n_bufone, CK_BYTE_PTR buftwo, CK_ULONG_PTR n_buftwo)
 {
-	g_return_val_if_fail (GCK_IS_SESSION (session), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (GKM_IS_SESSION (session), CKR_GENERAL_ERROR);
 	g_return_val_if_fail (method, CKR_GENERAL_ERROR);
 	g_return_val_if_fail (n_buftwo, CKR_GENERAL_ERROR);
-	
+
 	switch (method) {
 	case CKA_ENCRYPT:
-		return gck_crypto_encrypt (session, mech, bufone, n_bufone, buftwo, n_buftwo);
+		return gkm_crypto_encrypt (session, mech, bufone, n_bufone, buftwo, n_buftwo);
 	case CKA_DECRYPT:
-		return gck_crypto_decrypt (session, mech, bufone, n_bufone, buftwo, n_buftwo);
+		return gkm_crypto_decrypt (session, mech, bufone, n_bufone, buftwo, n_buftwo);
 	case CKA_SIGN:
-		return gck_crypto_sign (session, mech, bufone, n_bufone, buftwo, n_buftwo);
+		return gkm_crypto_sign (session, mech, bufone, n_bufone, buftwo, n_buftwo);
 	case CKA_VERIFY:
-		return gck_crypto_verify (session, mech, bufone, n_bufone, buftwo, *n_buftwo);
+		return gkm_crypto_verify (session, mech, bufone, n_bufone, buftwo, *n_buftwo);
 	default:
 		g_return_val_if_reached (CKR_GENERAL_ERROR);
 	}
 }
 
 CK_RV
-gck_crypto_generate_key_pair (GckSession *session, CK_MECHANISM_TYPE mech,
+gkm_crypto_generate_key_pair (GkmSession *session, CK_MECHANISM_TYPE mech,
                               CK_ATTRIBUTE_PTR pub_atts, CK_ULONG n_pub_atts,
                               CK_ATTRIBUTE_PTR priv_atts, CK_ULONG n_priv_atts,
-                              GckObject **pub_key, GckObject **priv_key)
+                              GkmObject **pub_key, GkmObject **priv_key)
 {
-	g_return_val_if_fail (GCK_IS_SESSION (session), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (GKM_IS_SESSION (session), CKR_GENERAL_ERROR);
 	g_return_val_if_fail (pub_key, CKR_GENERAL_ERROR);
 	g_return_val_if_fail (priv_key, CKR_GENERAL_ERROR);
 
 	switch (mech) {
 	case CKM_DH_PKCS_KEY_PAIR_GEN:
-		return gck_dh_mechanism_generate (session, pub_atts, n_pub_atts,
+		return gkm_dh_mechanism_generate (session, pub_atts, n_pub_atts,
 		                                  priv_atts, n_priv_atts,
 		                                  pub_key, priv_key);
 	default:
@@ -413,22 +413,22 @@ gck_crypto_generate_key_pair (GckSession *session, CK_MECHANISM_TYPE mech,
 }
 
 CK_RV
-gck_crypto_derive_key (GckSession *session, CK_MECHANISM_PTR mech, GckObject *base,
-                       CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, GckObject **derived)
+gkm_crypto_derive_key (GkmSession *session, CK_MECHANISM_PTR mech, GkmObject *base,
+                       CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, GkmObject **derived)
 {
-	g_return_val_if_fail (GCK_IS_SESSION (session), CKR_GENERAL_ERROR);
-	g_return_val_if_fail (GCK_IS_OBJECT (base), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (GKM_IS_SESSION (session), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (GKM_IS_OBJECT (base), CKR_GENERAL_ERROR);
 	g_return_val_if_fail (derived, CKR_GENERAL_ERROR);
 
-	if (!gck_object_has_attribute_ulong (base, session, CKA_ALLOWED_MECHANISMS, mech->mechanism))
+	if (!gkm_object_has_attribute_ulong (base, session, CKA_ALLOWED_MECHANISMS, mech->mechanism))
 		return CKR_KEY_TYPE_INCONSISTENT;
 
-	if (!gck_object_has_attribute_boolean (base, session, CKA_DERIVE, TRUE))
+	if (!gkm_object_has_attribute_boolean (base, session, CKA_DERIVE, TRUE))
 		return CKR_KEY_FUNCTION_NOT_PERMITTED;
 
 	switch (mech->mechanism) {
 	case CKM_DH_PKCS_DERIVE:
-		return gck_dh_mechanism_derive (session, mech, base, attrs,
+		return gkm_dh_mechanism_derive (session, mech, base, attrs,
 		                                n_attrs, derived);
 	default:
 		return CKR_MECHANISM_INVALID;
@@ -436,27 +436,27 @@ gck_crypto_derive_key (GckSession *session, CK_MECHANISM_PTR mech, GckObject *ba
 }
 
 CK_RV
-gck_crypto_wrap_key (GckSession *session, CK_MECHANISM_PTR mech, GckObject *wrapper,
-                     GckObject *wrapped, CK_BYTE_PTR output, CK_ULONG_PTR n_output)
+gkm_crypto_wrap_key (GkmSession *session, CK_MECHANISM_PTR mech, GkmObject *wrapper,
+                     GkmObject *wrapped, CK_BYTE_PTR output, CK_ULONG_PTR n_output)
 {
-	g_return_val_if_fail (GCK_IS_SESSION (session), CKR_GENERAL_ERROR);
-	g_return_val_if_fail (GCK_IS_OBJECT (wrapper), CKR_GENERAL_ERROR);
-	g_return_val_if_fail (GCK_IS_OBJECT (wrapped), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (GKM_IS_SESSION (session), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (GKM_IS_OBJECT (wrapper), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (GKM_IS_OBJECT (wrapped), CKR_GENERAL_ERROR);
 	g_return_val_if_fail (mech, CKR_GENERAL_ERROR);
 	g_return_val_if_fail (n_output, CKR_GENERAL_ERROR);
 
-	if (!gck_object_has_attribute_ulong (wrapper, session, CKA_ALLOWED_MECHANISMS, mech->mechanism))
+	if (!gkm_object_has_attribute_ulong (wrapper, session, CKA_ALLOWED_MECHANISMS, mech->mechanism))
 		return CKR_KEY_TYPE_INCONSISTENT;
 
-	if (!gck_object_has_attribute_boolean (wrapper, session, CKA_WRAP, TRUE))
+	if (!gkm_object_has_attribute_boolean (wrapper, session, CKA_WRAP, TRUE))
 		return CKR_KEY_FUNCTION_NOT_PERMITTED;
 
 	switch (mech->mechanism) {
 	case CKM_AES_CBC_PAD:
-		return gck_aes_mechanism_wrap (session, mech, wrapper, wrapped,
+		return gkm_aes_mechanism_wrap (session, mech, wrapper, wrapped,
 		                               output, n_output);
 	case CKM_G_NULL:
-		return gck_null_mechanism_wrap (session, mech, wrapper, wrapped,
+		return gkm_null_mechanism_wrap (session, mech, wrapper, wrapped,
 		                                output, n_output);
 	default:
 		return CKR_MECHANISM_INVALID;
@@ -464,27 +464,27 @@ gck_crypto_wrap_key (GckSession *session, CK_MECHANISM_PTR mech, GckObject *wrap
 }
 
 CK_RV
-gck_crypto_unwrap_key (GckSession *session, CK_MECHANISM_PTR mech, GckObject *wrapper,
+gkm_crypto_unwrap_key (GkmSession *session, CK_MECHANISM_PTR mech, GkmObject *wrapper,
                        CK_VOID_PTR input, CK_ULONG n_input, CK_ATTRIBUTE_PTR attrs,
-                       CK_ULONG n_attrs, GckObject **unwrapped)
+                       CK_ULONG n_attrs, GkmObject **unwrapped)
 {
-	g_return_val_if_fail (GCK_IS_SESSION (session), CKR_GENERAL_ERROR);
-	g_return_val_if_fail (GCK_IS_OBJECT (wrapper), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (GKM_IS_SESSION (session), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (GKM_IS_OBJECT (wrapper), CKR_GENERAL_ERROR);
 	g_return_val_if_fail (mech, CKR_GENERAL_ERROR);
 	g_return_val_if_fail (unwrapped, CKR_GENERAL_ERROR);
 
-	if (!gck_object_has_attribute_ulong (wrapper, session, CKA_ALLOWED_MECHANISMS, mech->mechanism))
+	if (!gkm_object_has_attribute_ulong (wrapper, session, CKA_ALLOWED_MECHANISMS, mech->mechanism))
 		return CKR_KEY_TYPE_INCONSISTENT;
 
-	if (!gck_object_has_attribute_boolean (wrapper, session, CKA_UNWRAP, TRUE))
+	if (!gkm_object_has_attribute_boolean (wrapper, session, CKA_UNWRAP, TRUE))
 		return CKR_KEY_FUNCTION_NOT_PERMITTED;
 
 	switch (mech->mechanism) {
 	case CKM_AES_CBC_PAD:
-		return gck_aes_mechanism_unwrap (session, mech, wrapper, input,
+		return gkm_aes_mechanism_unwrap (session, mech, wrapper, input,
 		                                 n_input, attrs, n_attrs, unwrapped);
 	case CKM_G_NULL:
-		return gck_null_mechanism_unwrap (session, mech, wrapper, input,
+		return gkm_null_mechanism_unwrap (session, mech, wrapper, input,
 		                                  n_input, attrs, n_attrs, unwrapped);
 	default:
 		return CKR_MECHANISM_INVALID;
@@ -496,34 +496,34 @@ gck_crypto_unwrap_key (GckSession *session, CK_MECHANISM_PTR mech, GckObject *wr
  */
 
 CK_RV
-gck_crypto_prepare (GckSession *session, CK_MECHANISM_TYPE mech, GckObject *key)
+gkm_crypto_prepare (GkmSession *session, CK_MECHANISM_TYPE mech, GkmObject *key)
 {
-	g_return_val_if_fail (GCK_IS_SESSION (session), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (GKM_IS_SESSION (session), CKR_GENERAL_ERROR);
 
 	switch (mech) {
 	case CKM_RSA_PKCS:
 	case CKM_RSA_X_509:
 	case CKM_DSA:
-		return gck_crypto_prepare_xsa (session, mech, key);
+		return gkm_crypto_prepare_xsa (session, mech, key);
 	default:
 		g_return_val_if_reached (CKR_GENERAL_ERROR);
 	}
 }
 
 CK_RV
-gck_crypto_prepare_xsa (GckSession *session, CK_MECHANISM_TYPE mech, GckObject *key)
+gkm_crypto_prepare_xsa (GkmSession *session, CK_MECHANISM_TYPE mech, GkmObject *key)
 {
-	GckSexp *sexp;
+	GkmSexp *sexp;
 
-	g_return_val_if_fail (GCK_IS_SESSION (session), CKR_GENERAL_ERROR);
-	g_return_val_if_fail (GCK_IS_SEXP_KEY (key), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (GKM_IS_SESSION (session), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (GKM_IS_SEXP_KEY (key), CKR_GENERAL_ERROR);
 
 	/* Load up the actual sexp we're going to use */
-	sexp = gck_sexp_key_acquire_crypto_sexp (GCK_SEXP_KEY (key), session);
+	sexp = gkm_sexp_key_acquire_crypto_sexp (GKM_SEXP_KEY (key), session);
 	if (sexp == NULL)
 		return CKR_USER_NOT_LOGGED_IN;
 
-	gck_session_set_crypto_state (session, sexp, gck_sexp_unref);
+	gkm_session_set_crypto_state (session, sexp, gkm_sexp_unref);
 	return CKR_OK;
 }
 
@@ -533,19 +533,18 @@ gck_crypto_prepare_xsa (GckSession *session, CK_MECHANISM_TYPE mech, GckObject *
 
 
 void
-gck_crypto_initialize (void)
+gkm_crypto_initialize (void)
 {
 	egg_libgcrypt_initialize ();
 }
 
 gulong
-gck_crypto_secret_key_length (CK_KEY_TYPE type)
+gkm_crypto_secret_key_length (CK_KEY_TYPE type)
 {
 	switch (type) {
 	case CKK_AES:
-		return GCK_AES_MECHANISM_MIN_LENGTH;
+		return GKM_AES_MECHANISM_MIN_LENGTH;
 	default:
 		return 0;
 	}
 }
-
diff --git a/pkcs11/gck/gck-crypto.h b/pkcs11/gkm/gkm-crypto.h
similarity index 80%
rename from pkcs11/gck/gck-crypto.h
rename to pkcs11/gkm/gkm-crypto.h
index d9c60b3..010b027 100644
--- a/pkcs11/gck/gck-crypto.h
+++ b/pkcs11/gkm/gkm-crypto.h
@@ -1,28 +1,28 @@
-/* 
+/*
  * 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  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  License for more details.
- *  
- * You should have received a copy of the GNU Lesser General 
+ *
+ * You should have received a copy of the GNU Lesser General
  * 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.
  */
 
-#ifndef GCKCRYPTO_H_
-#define GCKCRYPTO_H_
+#ifndef GKM_CRYPTO_H_
+#define GKM_CRYPTO_H_
 
-#include "gck-types.h"
+#include "gkm-types.h"
 
 #include "pkcs11/pkcs11.h"
 
@@ -32,17 +32,17 @@
 
 #include <gcrypt.h>
 
-void                     gck_crypto_initialize                         (void);
+void                     gkm_crypto_initialize                         (void);
 
-CK_RV                    gck_crypto_prepare                            (GckSession *session,
+CK_RV                    gkm_crypto_prepare                            (GkmSession *session,
                                                                         CK_MECHANISM_TYPE mech,
-                                                                        GckObject *key);
+                                                                        GkmObject *key);
 
-CK_RV                    gck_crypto_prepare_xsa                        (GckSession *session,
+CK_RV                    gkm_crypto_prepare_xsa                        (GkmSession *session,
                                                                         CK_MECHANISM_TYPE mech,
-                                                                        GckObject *key);
+                                                                        GkmObject *key);
 
-CK_RV                    gck_crypto_perform                            (GckSession *session,
+CK_RV                    gkm_crypto_perform                            (GkmSession *session,
                                                                         CK_MECHANISM_TYPE mech,
                                                                         CK_ATTRIBUTE_TYPE method,
                                                                         CK_BYTE_PTR bufone,
@@ -50,108 +50,108 @@ CK_RV                    gck_crypto_perform                            (GckSessi
                                                                         CK_BYTE_PTR buftwo,
                                                                         CK_ULONG_PTR n_buftwo);
 
-CK_RV                    gck_crypto_encrypt                            (GckSession *session,
+CK_RV                    gkm_crypto_encrypt                            (GkmSession *session,
                                                                         CK_MECHANISM_TYPE mech,
                                                                         CK_BYTE_PTR data,
                                                                         CK_ULONG n_data,
                                                                         CK_BYTE_PTR encrypted,
                                                                         CK_ULONG_PTR n_encrypted);
 
-CK_RV                    gck_crypto_encrypt_xsa                        (gcry_sexp_t sexp,
+CK_RV                    gkm_crypto_encrypt_xsa                        (gcry_sexp_t sexp,
                                                                         CK_MECHANISM_TYPE mech,
                                                                         CK_BYTE_PTR data,
                                                                         CK_ULONG n_data,
                                                                         CK_BYTE_PTR encrypted,
                                                                         CK_ULONG_PTR n_encrypted);
 
-CK_RV                    gck_crypto_decrypt                            (GckSession *session,
+CK_RV                    gkm_crypto_decrypt                            (GkmSession *session,
                                                                         CK_MECHANISM_TYPE mech,
                                                                         CK_BYTE_PTR encrypted,
                                                                         CK_ULONG n_encrypted,
                                                                         CK_BYTE_PTR data,
                                                                         CK_ULONG_PTR n_data);
 
-CK_RV                    gck_crypto_decrypt_xsa                        (gcry_sexp_t sexp,
+CK_RV                    gkm_crypto_decrypt_xsa                        (gcry_sexp_t sexp,
                                                                         CK_MECHANISM_TYPE mech,
                                                                         CK_BYTE_PTR encrypted,
                                                                         CK_ULONG n_encrypted,
                                                                         CK_BYTE_PTR data,
                                                                         CK_ULONG_PTR n_data);
 
-CK_RV                    gck_crypto_sign                               (GckSession *session,
+CK_RV                    gkm_crypto_sign                               (GkmSession *session,
                                                                         CK_MECHANISM_TYPE mech,
                                                                         CK_BYTE_PTR data,
                                                                         CK_ULONG n_data,
                                                                         CK_BYTE_PTR signature,
                                                                         CK_ULONG_PTR n_signature);
 
-CK_RV                    gck_crypto_sign_xsa                           (gcry_sexp_t sexp,
+CK_RV                    gkm_crypto_sign_xsa                           (gcry_sexp_t sexp,
                                                                         CK_MECHANISM_TYPE mech,
                                                                         CK_BYTE_PTR data,
                                                                         CK_ULONG n_data,
                                                                         CK_BYTE_PTR signature,
                                                                         CK_ULONG_PTR n_signature);
 
-CK_RV                    gck_crypto_verify                             (GckSession *session,
+CK_RV                    gkm_crypto_verify                             (GkmSession *session,
                                                                         CK_MECHANISM_TYPE mech,
                                                                         CK_BYTE_PTR data,
                                                                         CK_ULONG n_data,
                                                                         CK_BYTE_PTR signature,
                                                                         CK_ULONG n_signature);
 
-CK_RV                    gck_crypto_verify_xsa                         (gcry_sexp_t sexp,
+CK_RV                    gkm_crypto_verify_xsa                         (gcry_sexp_t sexp,
                                                                         CK_MECHANISM_TYPE mech,
                                                                         CK_BYTE_PTR data,
                                                                         CK_ULONG n_data,
                                                                         CK_BYTE_PTR signature,
                                                                         CK_ULONG n_signature);
 
-CK_RV                    gck_crypto_sexp_to_data                       (gcry_sexp_t sexp,
+CK_RV                    gkm_crypto_sexp_to_data                       (gcry_sexp_t sexp,
                                                                         guint bits,
                                                                         CK_BYTE_PTR data,
                                                                         CK_ULONG *n_data,
                                                                         EggPadding padding,
                                                                         ...) G_GNUC_NULL_TERMINATED;
 
-CK_RV                    gck_crypto_data_to_sexp                       (const gchar *format,
+CK_RV                    gkm_crypto_data_to_sexp                       (const gchar *format,
                                                                         guint nbits,
                                                                         EggPadding padding,
                                                                         CK_BYTE_PTR data,
                                                                         CK_ULONG n_data,
                                                                         gcry_sexp_t *sexp);
 
-CK_RV                    gck_crypto_generate_key_pair                  (GckSession *session,
+CK_RV                    gkm_crypto_generate_key_pair                  (GkmSession *session,
                                                                         CK_MECHANISM_TYPE mech,
                                                                         CK_ATTRIBUTE_PTR pub_atts,
                                                                         CK_ULONG n_pub_atts,
                                                                         CK_ATTRIBUTE_PTR priv_atts,
                                                                         CK_ULONG n_priv_atts,
-                                                                        GckObject **pub_key,
-                                                                        GckObject **priv_key);
+                                                                        GkmObject **pub_key,
+                                                                        GkmObject **priv_key);
 
-CK_RV                    gck_crypto_derive_key                         (GckSession *session,
+CK_RV                    gkm_crypto_derive_key                         (GkmSession *session,
                                                                         CK_MECHANISM_PTR mech,
-                                                                        GckObject *base,
+                                                                        GkmObject *base,
                                                                         CK_ATTRIBUTE_PTR attrs,
                                                                         CK_ULONG n_attrs,
-                                                                        GckObject **derived);
+                                                                        GkmObject **derived);
 
-CK_RV                    gck_crypto_wrap_key                           (GckSession *session,
+CK_RV                    gkm_crypto_wrap_key                           (GkmSession *session,
                                                                         CK_MECHANISM_PTR mech,
-                                                                        GckObject *wrapper,
-                                                                        GckObject *wrapped,
+                                                                        GkmObject *wrapper,
+                                                                        GkmObject *wrapped,
                                                                         CK_BYTE_PTR output,
                                                                         CK_ULONG_PTR n_output);
 
-CK_RV                    gck_crypto_unwrap_key                         (GckSession *session,
+CK_RV                    gkm_crypto_unwrap_key                         (GkmSession *session,
                                                                         CK_MECHANISM_PTR mech,
-                                                                        GckObject *wrapper,
+                                                                        GkmObject *wrapper,
                                                                         CK_VOID_PTR input,
                                                                         CK_ULONG n_input,
                                                                         CK_ATTRIBUTE_PTR attrs,
                                                                         CK_ULONG n_attrs,
-                                                                        GckObject **unwrapped);
+                                                                        GkmObject **unwrapped);
 
-gulong                   gck_crypto_secret_key_length                  (CK_KEY_TYPE type);
+gulong                   gkm_crypto_secret_key_length                  (CK_KEY_TYPE type);
 
-#endif /* GCKCRYPTO_H_ */
+#endif /* GKM_CRYPTO_H_ */
diff --git a/pkcs11/gck/gck-data-asn1.c b/pkcs11/gkm/gkm-data-asn1.c
similarity index 81%
rename from pkcs11/gck/gck-data-asn1.c
rename to pkcs11/gkm/gkm-data-asn1.c
index 3cb97e2..4a6bd7b 100644
--- a/pkcs11/gck/gck-data-asn1.c
+++ b/pkcs11/gkm/gkm-data-asn1.c
@@ -23,50 +23,50 @@
 
 #include "config.h"
 
-#include "gck-data-asn1.h"
+#include "gkm-data-asn1.h"
 
 gboolean
-gck_data_asn1_read_mpi (ASN1_TYPE asn, const gchar *part, gcry_mpi_t *mpi)
+gkm_data_asn1_read_mpi (ASN1_TYPE asn, const gchar *part, gcry_mpi_t *mpi)
 {
-  	gcry_error_t gcry;
-  	gsize sz;
-  	guchar *buf;
+	gcry_error_t gcry;
+	gsize sz;
+	guchar *buf;
 
 	buf = egg_asn1_read_value (asn, part, &sz, (EggAllocator)g_realloc);
 	if (!buf)
 		return FALSE;
-	
+
 	gcry = gcry_mpi_scan (mpi, GCRYMPI_FMT_STD, buf, sz, &sz);
 	g_free (buf);
 
 	if (gcry != 0)
 		return FALSE;
-	
+
 	return TRUE;
 }
 
 gboolean
-gck_data_asn1_read_secure_mpi (ASN1_TYPE asn, const gchar *part, gcry_mpi_t *mpi)
+gkm_data_asn1_read_secure_mpi (ASN1_TYPE asn, const gchar *part, gcry_mpi_t *mpi)
 {
-  	gcry_error_t gcry;
-  	gsize sz;
-  	guchar *buf;
+	gcry_error_t gcry;
+	gsize sz;
+	guchar *buf;
 
 	buf = egg_asn1_read_value (asn, part, &sz, (EggAllocator)gcry_realloc);
 	if (!buf)
 		return FALSE;
-	
+
 	gcry = gcry_mpi_scan (mpi, GCRYMPI_FMT_STD, buf, sz, &sz);
 	gcry_free (buf);
 
 	if (gcry != 0)
 		return FALSE;
-	
+
 	return TRUE;
 }
 
 gboolean
-gck_data_asn1_write_mpi (ASN1_TYPE asn, const gchar *part, gcry_mpi_t mpi)
+gkm_data_asn1_write_mpi (ASN1_TYPE asn, const gchar *part, gcry_mpi_t mpi)
 {
 	gcry_error_t gcry;
 	gsize len;
@@ -76,22 +76,22 @@ gck_data_asn1_write_mpi (ASN1_TYPE asn, const gchar *part, gcry_mpi_t mpi)
 	g_assert (asn);
 	g_assert (part);
 	g_assert (mpi);
-	
+
 	/* Get the size */
 	gcry = gcry_mpi_print (GCRYMPI_FMT_STD, NULL, 0, &len, mpi);
 	g_return_val_if_fail (gcry == 0, FALSE);
-	g_return_val_if_fail (len > 0, FALSE); 
+	g_return_val_if_fail (len > 0, FALSE);
 
 	buf = gcry_calloc_secure (len, 1);
-	
-	gcry = gcry_mpi_print (GCRYMPI_FMT_STD, buf, len, &len, mpi);	
+
+	gcry = gcry_mpi_print (GCRYMPI_FMT_STD, buf, len, &len, mpi);
 	g_return_val_if_fail (gcry == 0, FALSE);
-	
+
 	res = asn1_write_value (asn, part, buf, len);
 	gcry_free (buf);
-	
+
 	if (res != ASN1_SUCCESS)
 		return FALSE;
-		
+
 	return TRUE;
 }
diff --git a/pkcs11/gck/gck-data-asn1.h b/pkcs11/gkm/gkm-data-asn1.h
similarity index 73%
rename from pkcs11/gck/gck-data-asn1.h
rename to pkcs11/gkm/gkm-data-asn1.h
index 683f6f3..77886d2 100644
--- a/pkcs11/gck/gck-data-asn1.h
+++ b/pkcs11/gkm/gkm-data-asn1.h
@@ -1,5 +1,5 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* gck-data-asn1.h - ASN.1 helper routines
+/* gkm-data-asn1.h - ASN.1 helper routines
 
    Copyright (C) 2007 Stefan Walter
 
@@ -21,19 +21,19 @@
    Author: Stef Walter <stef memberwebs com>
 */
 
-#ifndef GCK_DATA_ASN_H_
-#define GCK_DATA_ASN_H_
+#ifndef GKM_DATA_ASN_H_
+#define GKM_DATA_ASN_H_
 
 #include "egg/egg-asn1.h"
 #include <gcrypt.h>
 
-gboolean           gck_data_asn1_read_mpi                      (ASN1_TYPE asn, const gchar *part, 
+gboolean           gkm_data_asn1_read_mpi                      (ASN1_TYPE asn, const gchar *part,
                                                                 gcry_mpi_t *mpi);
 
-gboolean           gck_data_asn1_read_secure_mpi               (ASN1_TYPE asn, const gchar *part, 
+gboolean           gkm_data_asn1_read_secure_mpi               (ASN1_TYPE asn, const gchar *part,
                                                                 gcry_mpi_t *mpi);
 
-gboolean           gck_data_asn1_write_mpi                     (ASN1_TYPE asn, const gchar *part, 
+gboolean           gkm_data_asn1_write_mpi                     (ASN1_TYPE asn, const gchar *part,
                                                                 gcry_mpi_t mpi);
-                                        
-#endif /*GCK_DATA_ASN_H_*/
+
+#endif /*GKM_DATA_ASN_H_*/
diff --git a/pkcs11/gck/gck-data-der.c b/pkcs11/gkm/gkm-data-der.c
similarity index 64%
rename from pkcs11/gck/gck-data-der.c
rename to pkcs11/gkm/gkm-data-der.c
index 37d8003..e2a5403 100644
--- a/pkcs11/gck/gck-data-der.c
+++ b/pkcs11/gkm/gkm-data-der.c
@@ -1,5 +1,5 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* gck-data-der.c - parsing and serializing of common crypto DER structures 
+/* gkm-data-der.c - parsing and serializing of common crypto DER structures
 
    Copyright (C) 2007 Stefan Walter
 
@@ -23,10 +23,10 @@
 
 #include "config.h"
 
-#include "gck-data-asn1.h"
-#include "gck-data-der.h"
-#include "gck-data-types.h"
-#include "gck-sexp.h"
+#include "gkm-data-asn1.h"
+#include "gkm-data-der.h"
+#include "gkm-data-types.h"
+#include "gkm-sexp.h"
 
 #include "egg/egg-secure-memory.h"
 #include "egg/egg-symkey.h"
@@ -56,9 +56,9 @@ init_quarks (void)
 		QUARK (OID_PKIX1_RSA, "1.2.840.113549.1.1.1");
 		QUARK (OID_PKIX1_DSA, "1.2.840.10040.4.1");
 		QUARK (OID_PKCS12_PBE_3DES_SHA1, "1.2.840.113549.1.12.1.3");
-		
+
 		#undef QUARK
-		
+
 		g_once_init_leave (&quarks_inited, 1);
 	}
 }
@@ -73,42 +73,42 @@ init_quarks (void)
 	"    (n %m)"     \
 	"    (e %m)))"
 
-GckDataResult
-gck_data_der_read_public_key_rsa (const guchar *data, gsize n_data, gcry_sexp_t *s_key)
+GkmDataResult
+gkm_data_der_read_public_key_rsa (const guchar *data, gsize n_data, gcry_sexp_t *s_key)
 {
-	GckDataResult ret = GCK_DATA_UNRECOGNIZED;
+	GkmDataResult ret = GKM_DATA_UNRECOGNIZED;
 	ASN1_TYPE asn = ASN1_TYPE_EMPTY;
 	gcry_mpi_t n, e;
 	int res;
 
 	n = e = NULL;
-	
+
 	asn = egg_asn1_decode ("PK.RSAPublicKey", data, n_data);
 	if (!asn)
 		goto done;
-		
-	ret = GCK_DATA_FAILURE;
-    
-	if (!gck_data_asn1_read_mpi (asn, "modulus", &n) || 
-	    !gck_data_asn1_read_mpi (asn, "publicExponent", &e))
+
+	ret = GKM_DATA_FAILURE;
+
+	if (!gkm_data_asn1_read_mpi (asn, "modulus", &n) ||
+	    !gkm_data_asn1_read_mpi (asn, "publicExponent", &e))
 		goto done;
-		
+
 	res = gcry_sexp_build (s_key, NULL, SEXP_PUBLIC_RSA, n, e);
 	if (res)
 		goto done;
 
 	g_assert (*s_key);
-	ret = GCK_DATA_SUCCESS;
+	ret = GKM_DATA_SUCCESS;
 
 done:
 	if (asn)
 		asn1_delete_structure (&asn);
 	gcry_mpi_release (n);
 	gcry_mpi_release (e);
-	
-	if (ret == GCK_DATA_FAILURE)
+
+	if (ret == GKM_DATA_FAILURE)
 		g_message ("invalid RSA public key");
-		
+
 	return ret;
 }
 
@@ -122,10 +122,10 @@ done:
 	"    (q %m)"     \
 	"    (u %m)))"
 
-GckDataResult
-gck_data_der_read_private_key_rsa (const guchar *data, gsize n_data, gcry_sexp_t *s_key)
+GkmDataResult
+gkm_data_der_read_private_key_rsa (const guchar *data, gsize n_data, gcry_sexp_t *s_key)
 {
-	GckDataResult ret = GCK_DATA_UNRECOGNIZED;
+	GkmDataResult ret = GKM_DATA_UNRECOGNIZED;
 	gcry_mpi_t n, e, d, p, q, u;
 	gcry_mpi_t tmp;
 	guint version;
@@ -133,32 +133,32 @@ gck_data_der_read_private_key_rsa (const guchar *data, gsize n_data, gcry_sexp_t
 	ASN1_TYPE asn = ASN1_TYPE_EMPTY;
 
 	n = e = d = p = q = u = NULL;
-	
+
 	asn = egg_asn1_decode ("PK.RSAPrivateKey", data, n_data);
 	if (!asn)
 		goto done;
-		
-	ret = GCK_DATA_FAILURE;
-	
+
+	ret = GKM_DATA_FAILURE;
+
 	if (!egg_asn1_read_uint (asn, "version", &version))
 		goto done;
-	
+
 	/* We only support simple version */
 	if (version != 0) {
-		ret = GCK_DATA_UNRECOGNIZED;
+		ret = GKM_DATA_UNRECOGNIZED;
 		g_message ("unsupported version of RSA key: %u", version);
 		goto done;
 	}
-    
-	if (!gck_data_asn1_read_secure_mpi (asn, "modulus", &n) || 
-	    !gck_data_asn1_read_secure_mpi (asn, "publicExponent", &e) ||
-	    !gck_data_asn1_read_secure_mpi (asn, "privateExponent", &d) ||
-	    !gck_data_asn1_read_secure_mpi (asn, "prime1", &p) ||
-	    !gck_data_asn1_read_secure_mpi (asn, "prime2", &q) || 
-	    !gck_data_asn1_read_secure_mpi (asn, "coefficient", &u))
+
+	if (!gkm_data_asn1_read_secure_mpi (asn, "modulus", &n) ||
+	    !gkm_data_asn1_read_secure_mpi (asn, "publicExponent", &e) ||
+	    !gkm_data_asn1_read_secure_mpi (asn, "privateExponent", &d) ||
+	    !gkm_data_asn1_read_secure_mpi (asn, "prime1", &p) ||
+	    !gkm_data_asn1_read_secure_mpi (asn, "prime2", &q) ||
+	    !gkm_data_asn1_read_secure_mpi (asn, "coefficient", &u))
 		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) {
 		/* P shall be smaller then Q!  Swap primes.  iqmp becomes u.  */
 		tmp = p;
@@ -174,7 +174,7 @@ gck_data_der_read_private_key_rsa (const guchar *data, gsize n_data, gcry_sexp_t
 		goto done;
 
 	g_assert (*s_key);
-	ret = GCK_DATA_SUCCESS;
+	ret = GKM_DATA_SUCCESS;
 
 done:
 	if (asn)
@@ -185,10 +185,10 @@ done:
 	gcry_mpi_release (p);
 	gcry_mpi_release (q);
 	gcry_mpi_release (u);
-	
-	if (ret == GCK_DATA_FAILURE)
+
+	if (ret == GKM_DATA_FAILURE)
 		g_message ("invalid RSA key");
-		
+
 	return ret;
 }
 
@@ -200,35 +200,35 @@ done:
 	"    (g %m)"     \
 	"    (y %m)))"
 
-GckDataResult
-gck_data_der_read_public_key_dsa (const guchar *data, gsize n_data, gcry_sexp_t *s_key)
+GkmDataResult
+gkm_data_der_read_public_key_dsa (const guchar *data, gsize n_data, gcry_sexp_t *s_key)
 {
-	GckDataResult ret = GCK_DATA_UNRECOGNIZED;
+	GkmDataResult ret = GKM_DATA_UNRECOGNIZED;
 	ASN1_TYPE asn = ASN1_TYPE_EMPTY;
 	gcry_mpi_t p, q, g, y;
 	int res;
 
 	p = q = g = y = NULL;
-	
+
 	asn = egg_asn1_decode ("PK.DSAPublicKey", data, n_data);
 	if (!asn)
 		goto done;
-	
-	ret = GCK_DATA_FAILURE;
-    
-	if (!gck_data_asn1_read_mpi (asn, "p", &p) || 
-	    !gck_data_asn1_read_mpi (asn, "q", &q) ||
-	    !gck_data_asn1_read_mpi (asn, "g", &g) ||
-	    !gck_data_asn1_read_mpi (asn, "Y", &y))
-	    	goto done;
+
+	ret = GKM_DATA_FAILURE;
+
+	if (!gkm_data_asn1_read_mpi (asn, "p", &p) ||
+	    !gkm_data_asn1_read_mpi (asn, "q", &q) ||
+	    !gkm_data_asn1_read_mpi (asn, "g", &g) ||
+	    !gkm_data_asn1_read_mpi (asn, "Y", &y))
+		goto done;
 
 	res = gcry_sexp_build (s_key, NULL, SEXP_PUBLIC_DSA, p, q, g, y);
 	if (res)
 		goto done;
-		
+
 	g_assert (*s_key);
-	ret = GCK_DATA_SUCCESS;
-	
+	ret = GKM_DATA_SUCCESS;
+
 done:
 	if (asn)
 		asn1_delete_structure (&asn);
@@ -236,48 +236,48 @@ done:
 	gcry_mpi_release (q);
 	gcry_mpi_release (g);
 	gcry_mpi_release (y);
-	
-	if (ret == GCK_DATA_FAILURE) 
+
+	if (ret == GKM_DATA_FAILURE)
 		g_message ("invalid public DSA key");
-		
-	return ret;	
+
+	return ret;
 }
 
-GckDataResult
-gck_data_der_read_public_key_dsa_parts (const guchar *keydata, gsize n_keydata,
+GkmDataResult
+gkm_data_der_read_public_key_dsa_parts (const guchar *keydata, gsize n_keydata,
                                         const guchar *params, gsize n_params,
                                         gcry_sexp_t *s_key)
 {
 	gcry_mpi_t p, q, g, y;
-	GckDataResult ret = GCK_DATA_UNRECOGNIZED;
+	GkmDataResult ret = GKM_DATA_UNRECOGNIZED;
 	ASN1_TYPE asn_params = ASN1_TYPE_EMPTY;
 	ASN1_TYPE asn_key = ASN1_TYPE_EMPTY;
 	int res;
 
 	p = q = g = y = NULL;
-	
+
 	asn_params = egg_asn1_decode ("PK.DSAParameters", params, n_params);
 	asn_key = egg_asn1_decode ("PK.DSAPublicPart", keydata, n_keydata);
 	if (!asn_params || !asn_key)
 		goto done;
-	
-	ret = GCK_DATA_FAILURE;
-    
-	if (!gck_data_asn1_read_mpi (asn_params, "p", &p) || 
-	    !gck_data_asn1_read_mpi (asn_params, "q", &q) ||
-	    !gck_data_asn1_read_mpi (asn_params, "g", &g))
-	    	goto done;
-	    	
-	if (!gck_data_asn1_read_mpi (asn_key, "", &y))
+
+	ret = GKM_DATA_FAILURE;
+
+	if (!gkm_data_asn1_read_mpi (asn_params, "p", &p) ||
+	    !gkm_data_asn1_read_mpi (asn_params, "q", &q) ||
+	    !gkm_data_asn1_read_mpi (asn_params, "g", &g))
+		goto done;
+
+	if (!gkm_data_asn1_read_mpi (asn_key, "", &y))
 		goto done;
 
 	res = gcry_sexp_build (s_key, NULL, SEXP_PUBLIC_DSA, p, q, g, y);
 	if (res)
 		goto done;
-		
+
 	g_assert (*s_key);
-	ret = GCK_DATA_SUCCESS;
-	
+	ret = GKM_DATA_SUCCESS;
+
 done:
 	if (asn_key)
 		asn1_delete_structure (&asn_key);
@@ -287,11 +287,11 @@ done:
 	gcry_mpi_release (q);
 	gcry_mpi_release (g);
 	gcry_mpi_release (y);
-	
-	if (ret == GCK_DATA_FAILURE) 
+
+	if (ret == GKM_DATA_FAILURE)
 		g_message ("invalid DSA key");
-		
-	return ret;	
+
+	return ret;
 }
 
 #define SEXP_PRIVATE_DSA  \
@@ -303,35 +303,35 @@ done:
 	"    (y %m)"     \
 	"    (x %m)))"
 
-GckDataResult
-gck_data_der_read_private_key_dsa (const guchar *data, gsize n_data, gcry_sexp_t *s_key)
+GkmDataResult
+gkm_data_der_read_private_key_dsa (const guchar *data, gsize n_data, gcry_sexp_t *s_key)
 {
 	gcry_mpi_t p, q, g, y, x;
-	GckDataResult ret = GCK_DATA_UNRECOGNIZED;
+	GkmDataResult ret = GKM_DATA_UNRECOGNIZED;
 	int res;
 	ASN1_TYPE asn;
 
 	p = q = g = y = x = NULL;
-	
+
 	asn = egg_asn1_decode ("PK.DSAPrivateKey", data, n_data);
 	if (!asn)
 		goto done;
-	
-	ret = GCK_DATA_FAILURE;
-    
-	if (!gck_data_asn1_read_secure_mpi (asn, "p", &p) || 
-	    !gck_data_asn1_read_secure_mpi (asn, "q", &q) ||
-	    !gck_data_asn1_read_secure_mpi (asn, "g", &g) ||
-	    !gck_data_asn1_read_secure_mpi (asn, "Y", &y) ||
-	    !gck_data_asn1_read_secure_mpi (asn, "priv", &x))
+
+	ret = GKM_DATA_FAILURE;
+
+	if (!gkm_data_asn1_read_secure_mpi (asn, "p", &p) ||
+	    !gkm_data_asn1_read_secure_mpi (asn, "q", &q) ||
+	    !gkm_data_asn1_read_secure_mpi (asn, "g", &g) ||
+	    !gkm_data_asn1_read_secure_mpi (asn, "Y", &y) ||
+	    !gkm_data_asn1_read_secure_mpi (asn, "priv", &x))
 		goto done;
-		
+
 	res = gcry_sexp_build (s_key, NULL, SEXP_PRIVATE_DSA, p, q, g, y, x);
 	if (res)
 		goto done;
-		
+
 	g_assert (*s_key);
-	ret = GCK_DATA_SUCCESS;
+	ret = GKM_DATA_SUCCESS;
 
 done:
 	if (asn)
@@ -341,52 +341,52 @@ done:
 	gcry_mpi_release (g);
 	gcry_mpi_release (y);
 	gcry_mpi_release (x);
-	
-	if (ret == GCK_DATA_FAILURE) 
+
+	if (ret == GKM_DATA_FAILURE)
 		g_message ("invalid DSA key");
-		
+
 	return ret;
 }
 
-GckDataResult
-gck_data_der_read_private_key_dsa_parts (const guchar *keydata, gsize n_keydata,
-                                         const guchar *params, gsize n_params, 
+GkmDataResult
+gkm_data_der_read_private_key_dsa_parts (const guchar *keydata, gsize n_keydata,
+                                         const guchar *params, gsize n_params,
                                          gcry_sexp_t *s_key)
 {
 	gcry_mpi_t p, q, g, y, x;
-	GckDataResult ret = GCK_DATA_UNRECOGNIZED;
+	GkmDataResult ret = GKM_DATA_UNRECOGNIZED;
 	int res;
 	ASN1_TYPE asn_params = ASN1_TYPE_EMPTY;
 	ASN1_TYPE asn_key = ASN1_TYPE_EMPTY;
 
 	p = q = g = y = x = NULL;
-	
+
 	asn_params = egg_asn1_decode ("PK.DSAParameters", params, n_params);
 	asn_key = egg_asn1_decode ("PK.DSAPrivatePart", keydata, n_keydata);
 	if (!asn_params || !asn_key)
 		goto done;
-	
-	ret = GCK_DATA_FAILURE;
-    
-	if (!gck_data_asn1_read_secure_mpi (asn_params, "p", &p) || 
-	    !gck_data_asn1_read_secure_mpi (asn_params, "q", &q) ||
-	    !gck_data_asn1_read_secure_mpi (asn_params, "g", &g))
-	    	goto done;
-	    	
-	if (!gck_data_asn1_read_secure_mpi (asn_key, "", &x))
+
+	ret = GKM_DATA_FAILURE;
+
+	if (!gkm_data_asn1_read_secure_mpi (asn_params, "p", &p) ||
+	    !gkm_data_asn1_read_secure_mpi (asn_params, "q", &q) ||
+	    !gkm_data_asn1_read_secure_mpi (asn_params, "g", &g))
+		goto done;
+
+	if (!gkm_data_asn1_read_secure_mpi (asn_key, "", &x))
 		goto done;
 
 	/* Now we calculate y */
 	y = gcry_mpi_snew (1024);
-  	gcry_mpi_powm (y, g, x, p);
+	gcry_mpi_powm (y, g, x, p);
 
 	res = gcry_sexp_build (s_key, NULL, SEXP_PRIVATE_DSA, p, q, g, y, x);
 	if (res)
 		goto done;
-		
+
 	g_assert (*s_key);
-	ret = GCK_DATA_SUCCESS;
-	
+	ret = GKM_DATA_SUCCESS;
+
 done:
 	if (asn_key)
 		asn1_delete_structure (&asn_key);
@@ -397,179 +397,179 @@ done:
 	gcry_mpi_release (g);
 	gcry_mpi_release (y);
 	gcry_mpi_release (x);
-	
-	if (ret == GCK_DATA_FAILURE) 
+
+	if (ret == GKM_DATA_FAILURE)
 		g_message ("invalid DSA key");
-		
-	return ret;	
+
+	return ret;
 }
 
-GckDataResult  
-gck_data_der_read_public_key (const guchar *data, gsize n_data, gcry_sexp_t *s_key)
+GkmDataResult
+gkm_data_der_read_public_key (const guchar *data, gsize n_data, gcry_sexp_t *s_key)
 {
-	GckDataResult res;
-	
-	res = gck_data_der_read_public_key_rsa (data, n_data, s_key);
-	if (res == GCK_DATA_UNRECOGNIZED)
-		res = gck_data_der_read_public_key_dsa (data, n_data, s_key);
-		
+	GkmDataResult res;
+
+	res = gkm_data_der_read_public_key_rsa (data, n_data, s_key);
+	if (res == GKM_DATA_UNRECOGNIZED)
+		res = gkm_data_der_read_public_key_dsa (data, n_data, s_key);
+
 	return res;
 }
 
-GckDataResult
-gck_data_der_read_public_key_info (const guchar* data, gsize n_data, gcry_sexp_t* s_key)
+GkmDataResult
+gkm_data_der_read_public_key_info (const guchar* data, gsize n_data, gcry_sexp_t* s_key)
 {
-	GckDataResult ret = GCK_DATA_UNRECOGNIZED;
+	GkmDataResult ret = GKM_DATA_UNRECOGNIZED;
 	GQuark oid;
 	ASN1_TYPE asn;
 	gsize n_key, n_params;
 	const guchar *params;
 	guchar *key = NULL;
-	
+
 	init_quarks ();
 
 	asn = egg_asn1_decode ("PKIX1.SubjectPublicKeyInfo", data, n_data);
 	if (!asn)
 		goto done;
-	
-	ret = GCK_DATA_FAILURE;
-    
+
+	ret = GKM_DATA_FAILURE;
+
 	/* Figure out the algorithm */
 	oid = egg_asn1_read_oid (asn, "algorithm.algorithm");
 	if (!oid)
 		goto done;
-		
+
 	/* A bit string so we cannot process in place */
 	key = egg_asn1_read_value (asn, "subjectPublicKey", &n_key, NULL);
 	if (!key)
 		goto done;
 	n_key /= 8;
-		
+
 	/* An RSA key is simple */
 	if (oid == OID_PKIX1_RSA) {
-		ret = gck_data_der_read_public_key_rsa (key, n_key, s_key);
-		
+		ret = gkm_data_der_read_public_key_rsa (key, n_key, s_key);
+
 	/* A DSA key paramaters are stored separately */
 	} else if (oid == OID_PKIX1_DSA) {
 		params = egg_asn1_read_element (asn, data, n_data, "algorithm.parameters", &n_params);
 		if (!params)
 			goto done;
-		ret = gck_data_der_read_public_key_dsa_parts (key, n_key, params, n_params, s_key);
-		
+		ret = gkm_data_der_read_public_key_dsa_parts (key, n_key, params, n_params, s_key);
+
 	} else {
 		g_message ("unsupported key algorithm in certificate: %s", g_quark_to_string (oid));
-		ret = GCK_DATA_UNRECOGNIZED;
+		ret = GKM_DATA_UNRECOGNIZED;
 		goto done;
 	}
-	
+
 done:
 	if (asn)
 		asn1_delete_structure (&asn);
-	
+
 	g_free (key);
-		
-	if (ret == GCK_DATA_FAILURE)
+
+	if (ret == GKM_DATA_FAILURE)
 		g_message ("invalid subject public-key info");
-		
+
 	return ret;
 }
 
-GckDataResult
-gck_data_der_read_private_key (const guchar *data, gsize n_data, gcry_sexp_t *s_key)
+GkmDataResult
+gkm_data_der_read_private_key (const guchar *data, gsize n_data, gcry_sexp_t *s_key)
 {
-	GckDataResult res;
-	
-	res = gck_data_der_read_private_key_rsa (data, n_data, s_key);
-	if (res == GCK_DATA_UNRECOGNIZED)
-		res = gck_data_der_read_private_key_dsa (data, n_data, s_key);
-		
+	GkmDataResult res;
+
+	res = gkm_data_der_read_private_key_rsa (data, n_data, s_key);
+	if (res == GKM_DATA_UNRECOGNIZED)
+		res = gkm_data_der_read_private_key_dsa (data, n_data, s_key);
+
 	return res;
 }
 
-GckDataResult
-gck_data_der_read_private_pkcs8_plain (const guchar *data, gsize n_data, gcry_sexp_t *s_key)
+GkmDataResult
+gkm_data_der_read_private_pkcs8_plain (const guchar *data, gsize n_data, gcry_sexp_t *s_key)
 {
 	ASN1_TYPE asn = ASN1_TYPE_EMPTY;
-	GckDataResult ret;
+	GkmDataResult ret;
 	int algorithm;
 	GQuark key_algo;
 	const guchar *keydata;
 	gsize n_keydata;
 	const guchar *params;
 	gsize n_params;
-	
-	ret = GCK_DATA_UNRECOGNIZED;
-	
+
+	ret = GKM_DATA_UNRECOGNIZED;
+
 	init_quarks ();
-	
+
 	asn = egg_asn1_decode ("PKIX1.pkcs-8-PrivateKeyInfo", data, n_data);
 	if (!asn)
 		goto done;
 
-	ret = GCK_DATA_FAILURE;
+	ret = GKM_DATA_FAILURE;
 	algorithm = 0;
-		
+
 	key_algo = egg_asn1_read_oid (asn, "privateKeyAlgorithm.algorithm");
-  	if (!key_algo)
-  		goto done;
-  	else if (key_algo == OID_PKIX1_RSA)
-  		algorithm = GCRY_PK_RSA;
-  	else if (key_algo == OID_PKIX1_DSA)
-  		algorithm = GCRY_PK_DSA;
-  		
-  	if (!algorithm) {
-  		ret = GCK_DATA_UNRECOGNIZED;
-  		goto done;
-  	}
+	if (!key_algo)
+		goto done;
+	else if (key_algo == OID_PKIX1_RSA)
+		algorithm = GCRY_PK_RSA;
+	else if (key_algo == OID_PKIX1_DSA)
+		algorithm = GCRY_PK_DSA;
+
+	if (!algorithm) {
+		ret = GKM_DATA_UNRECOGNIZED;
+		goto done;
+	}
 
 	keydata = egg_asn1_read_content (asn, data, n_data, "privateKey", &n_keydata);
 	if (!keydata)
 		goto done;
-		
-	params = egg_asn1_read_element (asn, data, n_data, "privateKeyAlgorithm.parameters", 
+
+	params = egg_asn1_read_element (asn, data, n_data, "privateKeyAlgorithm.parameters",
 	                                     &n_params);
-		
-	ret = GCK_DATA_SUCCESS;
-	
+
+	ret = GKM_DATA_SUCCESS;
+
 done:
-	if (ret == GCK_DATA_SUCCESS) {		
+	if (ret == GKM_DATA_SUCCESS) {
 		switch (algorithm) {
 		case GCRY_PK_RSA:
-			ret = gck_data_der_read_private_key_rsa (keydata, n_keydata, s_key);
+			ret = gkm_data_der_read_private_key_rsa (keydata, n_keydata, s_key);
 			break;
 		case GCRY_PK_DSA:
 			/* Try the normal one block format */
-			ret = gck_data_der_read_private_key_dsa (keydata, n_keydata, s_key);
-			
+			ret = gkm_data_der_read_private_key_dsa (keydata, n_keydata, s_key);
+
 			/* Otherwise try the two part format that everyone seems to like */
-			if (ret == GCK_DATA_UNRECOGNIZED && params && n_params)
-				ret = gck_data_der_read_private_key_dsa_parts (keydata, n_keydata, 
+			if (ret == GKM_DATA_UNRECOGNIZED && params && n_params)
+				ret = gkm_data_der_read_private_key_dsa_parts (keydata, n_keydata,
 				                                               params, n_params, s_key);
 			break;
 		default:
 			g_message ("invalid or unsupported key type in PKCS#8 key");
-			ret = GCK_DATA_UNRECOGNIZED;
+			ret = GKM_DATA_UNRECOGNIZED;
 			break;
 		};
-		
-	} else if (ret == GCK_DATA_FAILURE) {
+
+	} else if (ret == GKM_DATA_FAILURE) {
 		g_message ("invalid PKCS#8 key");
 	}
-	
+
 	if (asn)
 		asn1_delete_structure (&asn);
-	
+
 	return ret;
 }
 
-GckDataResult
-gck_data_der_read_private_pkcs8_crypted (const guchar *data, gsize n_data, const gchar *password, 
+GkmDataResult
+gkm_data_der_read_private_pkcs8_crypted (const guchar *data, gsize n_data, const gchar *password,
                                          gsize n_password, gcry_sexp_t *s_key)
 {
 	ASN1_TYPE asn = ASN1_TYPE_EMPTY;
 	gcry_cipher_hd_t cih = NULL;
 	gcry_error_t gcry;
-	GckDataResult ret, r;
+	GkmDataResult ret, r;
 	GQuark scheme;
 	guchar *crypted = NULL;
 	const guchar *params;
@@ -578,64 +578,64 @@ gck_data_der_read_private_pkcs8_crypted (const guchar *data, gsize n_data, const
 
 	init_quarks ();
 
-	ret = GCK_DATA_UNRECOGNIZED;
-	
+	ret = GKM_DATA_UNRECOGNIZED;
+
 	asn = egg_asn1_decode ("PKIX1.pkcs-8-EncryptedPrivateKeyInfo", data, n_data);
 	if (!asn)
 		goto done;
 
-	ret = GCK_DATA_FAILURE;
+	ret = GKM_DATA_FAILURE;
 
 	/* Figure out the type of encryption */
 	scheme = egg_asn1_read_oid (asn, "encryptionAlgorithm.algorithm");
 	if (!scheme)
 		goto done;
-		
+
 	params = egg_asn1_read_element (asn, data, n_data, "encryptionAlgorithm.parameters", &n_params);
 	if (!params)
 		goto done;
 
-	/* 
-	 * Parse the encryption stuff into a cipher. 
+	/*
+	 * Parse the encryption stuff into a cipher.
 	 */
 	r = egg_symkey_read_cipher (scheme, password, n_password, params, n_params, &cih);
-	if (r == GCK_DATA_UNRECOGNIZED) {
-		ret = GCK_DATA_FAILURE;
+	if (r == GKM_DATA_UNRECOGNIZED) {
+		ret = GKM_DATA_FAILURE;
 		goto done;
-	} else if (r != GCK_DATA_SUCCESS) {
+	} else if (r != GKM_DATA_SUCCESS) {
 		ret = r;
 		goto done;
 	}
-			
+
 	crypted = egg_asn1_read_value (asn, "encryptedData", &n_crypted, (EggAllocator)egg_secure_realloc);
 	if (!crypted)
 		goto done;
-	
+
 	gcry = gcry_cipher_decrypt (cih, crypted, n_crypted, NULL, 0);
 	gcry_cipher_close (cih);
 	cih = NULL;
-		
+
 	if (gcry != 0) {
 		g_warning ("couldn't decrypt pkcs8 data: %s", gcry_strerror (gcry));
 		goto done;
 	}
-		
+
 	/* Unpad the DER data */
 	l = egg_asn1_element_length (crypted, n_crypted);
 	if (l <= 0 || l > n_crypted) {
-		ret = GCK_DATA_LOCKED;
+		ret = GKM_DATA_LOCKED;
 		goto done;
-	} 
+	}
 	n_crypted = l;
-		
+
 	/* Try to parse the resulting key */
-	ret = gck_data_der_read_private_pkcs8_plain (crypted, n_crypted, s_key);
+	ret = gkm_data_der_read_private_pkcs8_plain (crypted, n_crypted, s_key);
 	egg_secure_free (crypted);
 	crypted = NULL;
-		
+
 	/* If unrecognized we assume bad password */
-	if (ret == GCK_DATA_UNRECOGNIZED) 
-		ret = GCK_DATA_LOCKED;
+	if (ret == GKM_DATA_UNRECOGNIZED)
+		ret = GKM_DATA_LOCKED;
 
 done:
 	if (cih)
@@ -643,25 +643,25 @@ done:
 	if (asn)
 		asn1_delete_structure (&asn);
 	egg_secure_free (crypted);
-		
+
 	return ret;
 }
 
-GckDataResult
-gck_data_der_read_private_pkcs8 (const guchar *data, gsize n_data, const gchar *password, 
+GkmDataResult
+gkm_data_der_read_private_pkcs8 (const guchar *data, gsize n_data, const gchar *password,
                                  gsize n_password, gcry_sexp_t *s_key)
 {
-	GckDataResult res;
+	GkmDataResult res;
 
-	res = gck_data_der_read_private_pkcs8_crypted (data, n_data, password, n_password, s_key);
-	if (res == GCK_DATA_UNRECOGNIZED) 
-		res = gck_data_der_read_private_pkcs8_plain (data, n_data, s_key);
+	res = gkm_data_der_read_private_pkcs8_crypted (data, n_data, password, n_password, s_key);
+	if (res == GKM_DATA_UNRECOGNIZED)
+		res = gkm_data_der_read_private_pkcs8_plain (data, n_data, s_key);
 
 	return res;
 }
 
 guchar*
-gck_data_der_write_public_key_rsa (gcry_sexp_t s_key, gsize *len)
+gkm_data_der_write_public_key_rsa (gcry_sexp_t s_key, gsize *len)
 {
 	ASN1_TYPE asn = ASN1_TYPE_EMPTY;
 	gcry_mpi_t n, e;
@@ -670,31 +670,31 @@ gck_data_der_write_public_key_rsa (gcry_sexp_t s_key, gsize *len)
 
 	n = e = NULL;
 
-	res = asn1_create_element (egg_asn1_get_pk_asn1type (), 
+	res = asn1_create_element (egg_asn1_get_pk_asn1type (),
 	                           "PK.RSAPublicKey", &asn);
 	g_return_val_if_fail (res == ASN1_SUCCESS, NULL);
 
-	if (!gck_sexp_extract_mpi (s_key, &n, "rsa", "n", NULL) ||
-	    !gck_sexp_extract_mpi (s_key, &e, "rsa", "e", NULL))
-	    	goto done;
-	
-	if (!gck_data_asn1_write_mpi (asn, "modulus", n) ||
-	    !gck_data_asn1_write_mpi (asn, "publicExponent", e))
-	    	goto done;
+	if (!gkm_sexp_extract_mpi (s_key, &n, "rsa", "n", NULL) ||
+	    !gkm_sexp_extract_mpi (s_key, &e, "rsa", "e", NULL))
+		goto done;
+
+	if (!gkm_data_asn1_write_mpi (asn, "modulus", n) ||
+	    !gkm_data_asn1_write_mpi (asn, "publicExponent", e))
+		goto done;
 
 	result = egg_asn1_encode (asn, "", len, NULL);
-	
+
 done:
 	if (asn)
 		asn1_delete_structure (&asn);
 	gcry_mpi_release (n);
 	gcry_mpi_release (e);
-	
+
 	return result;
 }
 
 guchar*
-gck_data_der_write_private_key_rsa (gcry_sexp_t s_key, gsize *n_key)
+gkm_data_der_write_private_key_rsa (gcry_sexp_t s_key, gsize *n_key)
 {
 	ASN1_TYPE asn = ASN1_TYPE_EMPTY;
 	gcry_mpi_t n, e, d, p, q, u, e1, e2, tmp;
@@ -703,26 +703,26 @@ gck_data_der_write_private_key_rsa (gcry_sexp_t s_key, gsize *n_key)
 
 	n = e = d = p = q = u = e1 = e2 = tmp = NULL;
 
-	res = asn1_create_element (egg_asn1_get_pk_asn1type (), 
+	res = asn1_create_element (egg_asn1_get_pk_asn1type (),
 	                           "PK.RSAPrivateKey", &asn);
 	g_return_val_if_fail (res == ASN1_SUCCESS, NULL);
 
-	if (!gck_sexp_extract_mpi (s_key, &n, "rsa", "n", NULL) ||
-	    !gck_sexp_extract_mpi (s_key, &e, "rsa", "e", NULL) ||
-	    !gck_sexp_extract_mpi (s_key, &d, "rsa", "d", NULL) ||
-	    !gck_sexp_extract_mpi (s_key, &p, "rsa", "p", NULL) ||
-	    !gck_sexp_extract_mpi (s_key, &q, "rsa", "q", NULL) ||
-	    !gck_sexp_extract_mpi (s_key, &u, "rsa", "u", NULL))
+	if (!gkm_sexp_extract_mpi (s_key, &n, "rsa", "n", NULL) ||
+	    !gkm_sexp_extract_mpi (s_key, &e, "rsa", "e", NULL) ||
+	    !gkm_sexp_extract_mpi (s_key, &d, "rsa", "d", NULL) ||
+	    !gkm_sexp_extract_mpi (s_key, &p, "rsa", "p", NULL) ||
+	    !gkm_sexp_extract_mpi (s_key, &q, "rsa", "q", NULL) ||
+	    !gkm_sexp_extract_mpi (s_key, &u, "rsa", "u", NULL))
 		goto done;
-	
-	if (!gck_data_asn1_write_mpi (asn, "modulus", n) ||
-	    !gck_data_asn1_write_mpi (asn, "publicExponent", e) || 
-	    !gck_data_asn1_write_mpi (asn, "privateExponent", d) ||
-	    !gck_data_asn1_write_mpi (asn, "prime1", p) ||
-	    !gck_data_asn1_write_mpi (asn, "prime2", q) ||
-	    !gck_data_asn1_write_mpi (asn, "coefficient", u))
+
+	if (!gkm_data_asn1_write_mpi (asn, "modulus", n) ||
+	    !gkm_data_asn1_write_mpi (asn, "publicExponent", e) ||
+	    !gkm_data_asn1_write_mpi (asn, "privateExponent", d) ||
+	    !gkm_data_asn1_write_mpi (asn, "prime1", p) ||
+	    !gkm_data_asn1_write_mpi (asn, "prime2", q) ||
+	    !gkm_data_asn1_write_mpi (asn, "coefficient", u))
 		goto done;
-	
+
 	/* Have to write out a null to delete OPTIONAL */
 	if (!egg_asn1_write_value (asn, "otherPrimeInfos", NULL, 0))
 		goto done;
@@ -735,10 +735,10 @@ gck_data_der_write_private_key_rsa (gcry_sexp_t s_key, gsize *n_key)
 	gcry_mpi_sub_ui (tmp, q, 1);
 	e2 = gcry_mpi_snew (1024);
 	gcry_mpi_mod (e2, d, tmp);
-	
+
 	/* Write out calculated */
-	if (!gck_data_asn1_write_mpi (asn, "exponent1", e1) ||
-	    !gck_data_asn1_write_mpi (asn, "exponent2", e2))
+	if (!gkm_data_asn1_write_mpi (asn, "exponent1", e1) ||
+	    !gkm_data_asn1_write_mpi (asn, "exponent2", e2))
 		goto done;
 
 	/* Write out the version */
@@ -746,7 +746,7 @@ gck_data_der_write_private_key_rsa (gcry_sexp_t s_key, gsize *n_key)
 		goto done;
 
 	result = egg_asn1_encode (asn, "", n_key, NULL);
-	
+
 done:
 	if (asn)
 		asn1_delete_structure (&asn);
@@ -756,16 +756,16 @@ done:
 	gcry_mpi_release (p);
 	gcry_mpi_release (q);
 	gcry_mpi_release (u);
-	
+
 	gcry_mpi_release (tmp);
 	gcry_mpi_release (e1);
 	gcry_mpi_release (e2);
-	
+
 	return result;
 }
 
 guchar*
-gck_data_der_write_public_key_dsa (gcry_sexp_t s_key, gsize *len)
+gkm_data_der_write_public_key_dsa (gcry_sexp_t s_key, gsize *len)
 {
 	ASN1_TYPE asn = ASN1_TYPE_EMPTY;
 	gcry_mpi_t p, q, g, y;
@@ -774,27 +774,27 @@ gck_data_der_write_public_key_dsa (gcry_sexp_t s_key, gsize *len)
 
 	p = q = g = y = NULL;
 
-	res = asn1_create_element (egg_asn1_get_pk_asn1type (), 
+	res = asn1_create_element (egg_asn1_get_pk_asn1type (),
 	                           "PK.DSAPublicKey", &asn);
 	g_return_val_if_fail (res == ASN1_SUCCESS, NULL);
 
-	if (!gck_sexp_extract_mpi (s_key, &p, "dsa", "p", NULL) ||
-	    !gck_sexp_extract_mpi (s_key, &q, "dsa", "q", NULL) ||
-	    !gck_sexp_extract_mpi (s_key, &g, "dsa", "g", NULL) ||
-	    !gck_sexp_extract_mpi (s_key, &y, "dsa", "y", NULL))
-	    	goto done;
-	
-	if (!gck_data_asn1_write_mpi (asn, "p", p) ||
-	    !gck_data_asn1_write_mpi (asn, "q", q) ||
-	    !gck_data_asn1_write_mpi (asn, "g", g) ||
-	    !gck_data_asn1_write_mpi (asn, "Y", y))
-	    	goto done;
+	if (!gkm_sexp_extract_mpi (s_key, &p, "dsa", "p", NULL) ||
+	    !gkm_sexp_extract_mpi (s_key, &q, "dsa", "q", NULL) ||
+	    !gkm_sexp_extract_mpi (s_key, &g, "dsa", "g", NULL) ||
+	    !gkm_sexp_extract_mpi (s_key, &y, "dsa", "y", NULL))
+		goto done;
+
+	if (!gkm_data_asn1_write_mpi (asn, "p", p) ||
+	    !gkm_data_asn1_write_mpi (asn, "q", q) ||
+	    !gkm_data_asn1_write_mpi (asn, "g", g) ||
+	    !gkm_data_asn1_write_mpi (asn, "Y", y))
+		goto done;
 
 	if (!egg_asn1_write_uint (asn, "version", 0))
-		goto done; 
-		
+		goto done;
+
 	result = egg_asn1_encode (asn, "", len, NULL);
-	
+
 done:
 	if (asn)
 		asn1_delete_structure (&asn);
@@ -802,12 +802,12 @@ done:
 	gcry_mpi_release (q);
 	gcry_mpi_release (g);
 	gcry_mpi_release (y);
-	
+
 	return result;
 }
 
 guchar*
-gck_data_der_write_private_key_dsa_part (gcry_sexp_t skey, gsize *n_key)
+gkm_data_der_write_private_key_dsa_part (gcry_sexp_t skey, gsize *n_key)
 {
 	ASN1_TYPE asn = ASN1_TYPE_EMPTY;
 	gcry_mpi_t x;
@@ -816,28 +816,28 @@ gck_data_der_write_private_key_dsa_part (gcry_sexp_t skey, gsize *n_key)
 
 	x = NULL;
 
-	res = asn1_create_element (egg_asn1_get_pk_asn1type (), 
+	res = asn1_create_element (egg_asn1_get_pk_asn1type (),
 	                           "PK.DSAPrivatePart", &asn);
 	g_return_val_if_fail (res == ASN1_SUCCESS, NULL);
 
-	if (!gck_sexp_extract_mpi (skey, &x, "dsa", "x", NULL))
-	    	goto done;
-	
-	if (!gck_data_asn1_write_mpi (asn, "", x))
-	    	goto done;
+	if (!gkm_sexp_extract_mpi (skey, &x, "dsa", "x", NULL))
+		goto done;
+
+	if (!gkm_data_asn1_write_mpi (asn, "", x))
+		goto done;
 
 	result = egg_asn1_encode (asn, "", n_key, NULL);
-	
+
 done:
 	if (asn)
 		asn1_delete_structure (&asn);
 	gcry_mpi_release (x);
-	
-	return result;		
+
+	return result;
 }
 
 guchar*
-gck_data_der_write_private_key_dsa_params (gcry_sexp_t skey, gsize *n_params)
+gkm_data_der_write_private_key_dsa_params (gcry_sexp_t skey, gsize *n_params)
 {
 	ASN1_TYPE asn = ASN1_TYPE_EMPTY;
 	gcry_mpi_t p, q, g;
@@ -846,34 +846,34 @@ gck_data_der_write_private_key_dsa_params (gcry_sexp_t skey, gsize *n_params)
 
 	p = q = g = NULL;
 
-	res = asn1_create_element (egg_asn1_get_pk_asn1type (), 
+	res = asn1_create_element (egg_asn1_get_pk_asn1type (),
 	                           "PK.DSAParameters", &asn);
 	g_return_val_if_fail (res == ASN1_SUCCESS, NULL);
 
-	if (!gck_sexp_extract_mpi (skey, &p, "dsa", "p", NULL) ||
-	    !gck_sexp_extract_mpi (skey, &q, "dsa", "q", NULL) ||
-	    !gck_sexp_extract_mpi (skey, &g, "dsa", "g", NULL))
-	    	goto done;
-	
-	if (!gck_data_asn1_write_mpi (asn, "p", p) ||
-	    !gck_data_asn1_write_mpi (asn, "q", q) ||
-	    !gck_data_asn1_write_mpi (asn, "g", g))
-	    	goto done;
+	if (!gkm_sexp_extract_mpi (skey, &p, "dsa", "p", NULL) ||
+	    !gkm_sexp_extract_mpi (skey, &q, "dsa", "q", NULL) ||
+	    !gkm_sexp_extract_mpi (skey, &g, "dsa", "g", NULL))
+		goto done;
+
+	if (!gkm_data_asn1_write_mpi (asn, "p", p) ||
+	    !gkm_data_asn1_write_mpi (asn, "q", q) ||
+	    !gkm_data_asn1_write_mpi (asn, "g", g))
+		goto done;
 
 	result = egg_asn1_encode (asn, "", n_params, NULL);
-	
+
 done:
 	if (asn)
 		asn1_delete_structure (&asn);
 	gcry_mpi_release (p);
 	gcry_mpi_release (q);
 	gcry_mpi_release (g);
-	
+
 	return result;
 }
 
 guchar*
-gck_data_der_write_private_key_dsa (gcry_sexp_t s_key, gsize *len)
+gkm_data_der_write_private_key_dsa (gcry_sexp_t s_key, gsize *len)
 {
 	ASN1_TYPE asn = ASN1_TYPE_EMPTY;
 	gcry_mpi_t p, q, g, y, x;
@@ -882,29 +882,29 @@ gck_data_der_write_private_key_dsa (gcry_sexp_t s_key, gsize *len)
 
 	p = q = g = y = x = NULL;
 
-	res = asn1_create_element (egg_asn1_get_pk_asn1type (), 
+	res = asn1_create_element (egg_asn1_get_pk_asn1type (),
 	                           "PK.DSAPrivateKey", &asn);
 	g_return_val_if_fail (res == ASN1_SUCCESS, NULL);
 
-	if (!gck_sexp_extract_mpi (s_key, &p, "dsa", "p", NULL) ||
-	    !gck_sexp_extract_mpi (s_key, &q, "dsa", "q", NULL) ||
-	    !gck_sexp_extract_mpi (s_key, &g, "dsa", "g", NULL) ||
-	    !gck_sexp_extract_mpi (s_key, &y, "dsa", "y", NULL) ||
-	    !gck_sexp_extract_mpi (s_key, &x, "dsa", "x", NULL))
-	    	goto done;
-	
-	if (!gck_data_asn1_write_mpi (asn, "p", p) ||
-	    !gck_data_asn1_write_mpi (asn, "q", q) ||
-	    !gck_data_asn1_write_mpi (asn, "g", g) ||
-	    !gck_data_asn1_write_mpi (asn, "Y", y) ||
-	    !gck_data_asn1_write_mpi (asn, "priv", x))
-	    	goto done;
+	if (!gkm_sexp_extract_mpi (s_key, &p, "dsa", "p", NULL) ||
+	    !gkm_sexp_extract_mpi (s_key, &q, "dsa", "q", NULL) ||
+	    !gkm_sexp_extract_mpi (s_key, &g, "dsa", "g", NULL) ||
+	    !gkm_sexp_extract_mpi (s_key, &y, "dsa", "y", NULL) ||
+	    !gkm_sexp_extract_mpi (s_key, &x, "dsa", "x", NULL))
+		goto done;
+
+	if (!gkm_data_asn1_write_mpi (asn, "p", p) ||
+	    !gkm_data_asn1_write_mpi (asn, "q", q) ||
+	    !gkm_data_asn1_write_mpi (asn, "g", g) ||
+	    !gkm_data_asn1_write_mpi (asn, "Y", y) ||
+	    !gkm_data_asn1_write_mpi (asn, "priv", x))
+		goto done;
 
 	if (!egg_asn1_write_uint (asn, "version", 0))
-		goto done; 
-		
+		goto done;
+
 	result = egg_asn1_encode (asn, "", len, NULL);
-	
+
 done:
 	if (asn)
 		asn1_delete_structure (&asn);
@@ -913,58 +913,58 @@ done:
 	gcry_mpi_release (g);
 	gcry_mpi_release (y);
 	gcry_mpi_release (x);
-	
+
 	return result;
 }
 
 guchar*
-gck_data_der_write_public_key (gcry_sexp_t s_key, gsize *len)
+gkm_data_der_write_public_key (gcry_sexp_t s_key, gsize *len)
 {
 	gboolean is_priv;
 	int algorithm;
-	
+
 	g_return_val_if_fail (s_key != NULL, NULL);
-	
-	if (!gck_sexp_parse_key (s_key, &algorithm, &is_priv, NULL))
+
+	if (!gkm_sexp_parse_key (s_key, &algorithm, &is_priv, NULL))
 		g_return_val_if_reached (NULL);
-	
+
 	g_return_val_if_fail (!is_priv, NULL);
-		
+
 	switch (algorithm) {
 	case GCRY_PK_RSA:
-		return gck_data_der_write_public_key_rsa (s_key, len);
+		return gkm_data_der_write_public_key_rsa (s_key, len);
 	case GCRY_PK_DSA:
-		return gck_data_der_write_public_key_dsa (s_key, len);
+		return gkm_data_der_write_public_key_dsa (s_key, len);
 	default:
 		g_return_val_if_reached (NULL);
 	}
 }
 
 guchar*
-gck_data_der_write_private_key (gcry_sexp_t s_key, gsize *len)
+gkm_data_der_write_private_key (gcry_sexp_t s_key, gsize *len)
 {
 	gboolean is_priv;
 	int algorithm;
-	
+
 	g_return_val_if_fail (s_key != NULL, NULL);
-	
-	if (!gck_sexp_parse_key (s_key, &algorithm, &is_priv, NULL))
+
+	if (!gkm_sexp_parse_key (s_key, &algorithm, &is_priv, NULL))
 		g_return_val_if_reached (NULL);
-	
+
 	g_return_val_if_fail (is_priv, NULL);
-		
+
 	switch (algorithm) {
 	case GCRY_PK_RSA:
-		return gck_data_der_write_private_key_rsa (s_key, len);
+		return gkm_data_der_write_private_key_rsa (s_key, len);
 	case GCRY_PK_DSA:
-		return gck_data_der_write_private_key_dsa (s_key, len);
+		return gkm_data_der_write_private_key_dsa (s_key, len);
 	default:
 		g_return_val_if_reached (NULL);
 	}
 }
 
 static gcry_cipher_hd_t
-prepare_and_encode_pkcs8_cipher (ASN1_TYPE asn, const gchar *password, 
+prepare_and_encode_pkcs8_cipher (ASN1_TYPE asn, const gchar *password,
                                  gsize n_password, gsize *n_block)
 {
 	ASN1_TYPE asn1_params;
@@ -974,17 +974,17 @@ prepare_and_encode_pkcs8_cipher (ASN1_TYPE asn, const gchar *password,
 	guchar *key, *iv, *portion;
 	gsize n_key, n_portion;
 	int iterations, res;
-	
+
 	init_quarks ();
 
 	/* Make sure the encryption algorithm works */
-	g_return_val_if_fail (gcry_cipher_algo_info (OID_PKCS12_PBE_3DES_SHA1, 
+	g_return_val_if_fail (gcry_cipher_algo_info (OID_PKCS12_PBE_3DES_SHA1,
 	                                             GCRYCTL_TEST_ALGO, NULL, 0), NULL);
 
 	/* The encryption algorithm */
-	if(!egg_asn1_write_oid (asn, "encryptionAlgorithm.algorithm", 
+	if(!egg_asn1_write_oid (asn, "encryptionAlgorithm.algorithm",
 	                             OID_PKCS12_PBE_3DES_SHA1))
-		g_return_val_if_reached (NULL); 
+		g_return_val_if_reached (NULL);
 
 	/* Randomize some input for the password based secret */
 	iterations = 1000 + (int) (1000.0 * rand () / (RAND_MAX + 1.0));
@@ -994,13 +994,13 @@ prepare_and_encode_pkcs8_cipher (ASN1_TYPE asn, const gchar *password,
 	n_key = gcry_cipher_get_algo_keylen (GCRY_CIPHER_3DES);
 	*n_block = gcry_cipher_get_algo_blklen (GCRY_MD_SHA1);
 	g_return_val_if_fail (n_key && *n_block, NULL);
-		
-	if (!egg_symkey_generate_pkcs12 (GCRY_CIPHER_3DES, GCRY_MD_SHA1, 
-	                                        password, n_password, salt, 
+
+	if (!egg_symkey_generate_pkcs12 (GCRY_CIPHER_3DES, GCRY_MD_SHA1,
+	                                        password, n_password, salt,
 	                                        sizeof (salt), iterations, &key, &iv))
 		g_return_val_if_reached (NULL);
 
-	/* Now write out the parameters */	
+	/* Now write out the parameters */
 	res = asn1_create_element (egg_asn1_get_pkix_asn1type (),
 	                           "PKIX1.pkcs-12-PbeParams", &asn1_params);
 	g_return_val_if_fail (res == ASN1_SUCCESS, NULL);
@@ -1009,29 +1009,29 @@ prepare_and_encode_pkcs8_cipher (ASN1_TYPE asn, const gchar *password,
 	if (!egg_asn1_write_uint (asn1_params, "iterations", iterations))
 		g_return_val_if_reached (NULL);
 	portion = egg_asn1_encode (asn1_params, "", &n_portion, NULL);
-	g_return_val_if_fail (portion, NULL); 
-	
+	g_return_val_if_fail (portion, NULL);
+
 	if (!egg_asn1_write_value (asn, "encryptionAlgorithm.parameters", portion, n_portion))
 		g_return_val_if_reached (NULL);
 	g_free (portion);
-	
+
 	/* Now make a cipher that matches what we wrote out */
 	gcry = gcry_cipher_open (&cih, GCRY_CIPHER_3DES, GCRY_CIPHER_MODE_CBC, 0);
 	g_return_val_if_fail (gcry == 0, NULL);
 	g_return_val_if_fail (cih, NULL);
-	
+
 	gcry_cipher_setiv (cih, iv, *n_block);
 	gcry_cipher_setkey (cih, key, n_key);
-	
+
 	g_free (iv);
 	egg_secure_free (key);
 	asn1_delete_structure (&asn1_params);
-	
+
 	return cih;
 }
 
 guchar*
-gck_data_der_write_private_pkcs8_plain (gcry_sexp_t skey, gsize *n_data)
+gkm_data_der_write_private_pkcs8_plain (gcry_sexp_t skey, gsize *n_data)
 {
 	ASN1_TYPE asn;
 	int res, algorithm;
@@ -1039,22 +1039,22 @@ gck_data_der_write_private_pkcs8_plain (gcry_sexp_t skey, gsize *n_data)
 	GQuark oid;
 	guchar *params, *key, *data;
 	gsize n_params, n_key;
-	
+
 	init_quarks ();
 
 	/* Parse and check that the key is for real */
-	if (!gck_sexp_parse_key (skey, &algorithm, &is_priv, NULL))
+	if (!gkm_sexp_parse_key (skey, &algorithm, &is_priv, NULL))
 		g_return_val_if_reached (NULL);
 	g_return_val_if_fail (is_priv == TRUE, NULL);
-	
-	res = asn1_create_element (egg_asn1_get_pkix_asn1type (), 
+
+	res = asn1_create_element (egg_asn1_get_pkix_asn1type (),
 	                           "PKIX1.pkcs-8-PrivateKeyInfo", &asn);
 	g_return_val_if_fail (res == ASN1_SUCCESS, NULL);
-	
+
 	/* Write out the version */
 	if (!egg_asn1_write_uint (asn, "version", 0))
 		g_return_val_if_reached (NULL);
-	
+
 	/* Per algorithm differences */
 	switch (algorithm)
 	{
@@ -1063,21 +1063,21 @@ gck_data_der_write_private_pkcs8_plain (gcry_sexp_t skey, gsize *n_data)
 		oid = OID_PKIX1_RSA;
 		params = NULL;
 		n_params = 0;
-		key = gck_data_der_write_private_key_rsa (skey, &n_key);
+		key = gkm_data_der_write_private_key_rsa (skey, &n_key);
 		break;
-		
+
 	/* DSA gets incoded with the params seperate */
 	case GCRY_PK_DSA:
 		oid = OID_PKIX1_DSA;
-		key = gck_data_der_write_private_key_dsa_part (skey, &n_key);
-		params = gck_data_der_write_private_key_dsa_params (skey, &n_params);
+		key = gkm_data_der_write_private_key_dsa_part (skey, &n_key);
+		params = gkm_data_der_write_private_key_dsa_params (skey, &n_params);
 		break;
-		
+
 	default:
 		g_warning ("trying to serialize unsupported private key algorithm: %d", algorithm);
 		return NULL;
 	};
-	
+
 	/* Write out the algorithm */
 	if (!egg_asn1_write_oid (asn, "privateKeyAlgorithm.algorithm", oid))
 		g_return_val_if_reached (NULL);
@@ -1086,51 +1086,51 @@ gck_data_der_write_private_pkcs8_plain (gcry_sexp_t skey, gsize *n_data)
 	if (!egg_asn1_write_value (asn, "privateKeyAlgorithm.parameters", params, n_params))
 		g_return_val_if_reached (NULL);
 	egg_secure_free (params);
-	
+
 	/* Write out the key portion */
 	if (!egg_asn1_write_value (asn, "privateKey", key, n_key))
 		g_return_val_if_reached (NULL);
 	egg_secure_free (key);
-	
+
 	/* Add an empty attributes field */
 	if (!egg_asn1_write_value (asn, "attributes", NULL, 0))
 		g_return_val_if_reached (NULL);
-	
+
 	data = egg_asn1_encode (asn, "", n_data, NULL);
-	g_return_val_if_fail (data, NULL); 
-	
+	g_return_val_if_fail (data, NULL);
+
 	asn1_delete_structure (&asn);
-	
+
 	return data;
 }
 
 guchar*
-gck_data_der_write_private_pkcs8_crypted (gcry_sexp_t skey, const gchar *password,
+gkm_data_der_write_private_pkcs8_crypted (gcry_sexp_t skey, const gchar *password,
                                           gsize n_password, gsize *n_data)
 {
 	gcry_error_t gcry;
 	gcry_cipher_hd_t cih;
 	ASN1_TYPE asn;
 	int res;
-	guchar *key, *data; 
+	guchar *key, *data;
 	gsize n_key, block = 0;
 
 	/* Encode the key in normal pkcs8 fashion */
-	key = gck_data_der_write_private_pkcs8_plain (skey, &n_key);
-	
-	res = asn1_create_element (egg_asn1_get_pkix_asn1type (), 
+	key = gkm_data_der_write_private_pkcs8_plain (skey, &n_key);
+
+	res = asn1_create_element (egg_asn1_get_pkix_asn1type (),
 	                           "PKIX1.pkcs-8-EncryptedPrivateKeyInfo", &asn);
 	g_return_val_if_fail (res == ASN1_SUCCESS, NULL);
-	
+
 	/* Create a and write out a cipher used for encryption */
 	cih = prepare_and_encode_pkcs8_cipher (asn, password, n_password, &block);
 	g_return_val_if_fail (cih, NULL);
-	
+
 	/* Pad the block of data */
 	if(block > 1) {
 		gsize pad;
 		guchar *padded;
-		
+
 		pad = block - (n_key % block);
 		if (pad == 0)
 			pad = block;
@@ -1139,88 +1139,88 @@ gck_data_der_write_private_pkcs8_crypted (gcry_sexp_t skey, const gchar *passwor
 		key = padded;
 		n_key += pad;
 	}
-	
+
 	gcry = gcry_cipher_encrypt (cih, key, n_key, NULL, 0);
 	g_return_val_if_fail (gcry == 0, NULL);
-	
+
 	gcry_cipher_close (cih);
-	
+
 	res = asn1_write_value (asn, "encryptedData", key, n_key);
 	g_return_val_if_fail (res == ASN1_SUCCESS, NULL);
-	
+
 	data = egg_asn1_encode (asn, "", n_data, NULL);
-	g_return_val_if_fail (data, NULL); 
+	g_return_val_if_fail (data, NULL);
 
 	asn1_delete_structure (&asn);
-	
+
 	return data;
 }
 
 /* -----------------------------------------------------------------------------
  * CERTIFICATES
  */
- 
-GckDataResult
-gck_data_der_read_certificate (const guchar *data, gsize n_data, ASN1_TYPE *asn1)
+
+GkmDataResult
+gkm_data_der_read_certificate (const guchar *data, gsize n_data, ASN1_TYPE *asn1)
 {
 	*asn1 = egg_asn1_decode ("PKIX1.Certificate", data, n_data);
 	if (!*asn1)
-		return GCK_DATA_UNRECOGNIZED;
-	
-	return GCK_DATA_SUCCESS;
+		return GKM_DATA_UNRECOGNIZED;
+
+	return GKM_DATA_SUCCESS;
 }
 
-GckDataResult
-gck_data_der_read_basic_constraints (const guchar *data, gsize n_data, 
+GkmDataResult
+gkm_data_der_read_basic_constraints (const guchar *data, gsize n_data,
                                      gboolean *is_ca, gint *path_len)
 {
-	GckDataResult ret = GCK_DATA_UNRECOGNIZED;
+	GkmDataResult ret = GKM_DATA_UNRECOGNIZED;
 	ASN1_TYPE asn;
 	guint value;
 
 	asn = egg_asn1_decode ("PKIX1.BasicConstraints", data, n_data);
 	if (!asn)
 		goto done;
-	
-	ret = GCK_DATA_FAILURE;
-    
-    	if (path_len) {
-    		if (!egg_asn1_read_uint (asn, "pathLenConstraint", &value))
-    			*path_len = -1;
-    		else
-    			*path_len = value;
-    	}
-    	
-    	if (is_ca) {
-    		if (!egg_asn1_read_boolean (asn, "cA", is_ca))
-    			*is_ca = FALSE;
-    	}
-    	
-	ret = GCK_DATA_SUCCESS;
+
+	ret = GKM_DATA_FAILURE;
+
+	if (path_len) {
+		if (!egg_asn1_read_uint (asn, "pathLenConstraint", &value))
+			*path_len = -1;
+		else
+			*path_len = value;
+	}
+
+	if (is_ca) {
+		if (!egg_asn1_read_boolean (asn, "cA", is_ca))
+			*is_ca = FALSE;
+	}
+
+	ret = GKM_DATA_SUCCESS;
 
 done:
 	if (asn)
 		asn1_delete_structure (&asn);
-	
-	if (ret == GCK_DATA_FAILURE) 
+
+	if (ret == GKM_DATA_FAILURE)
 		g_message ("invalid basic constraints");
-		
+
 	return ret;
 }
 
-GckDataResult
-gck_data_der_read_key_usage (const guchar *data, gsize n_data, guint *key_usage)
+GkmDataResult
+gkm_data_der_read_key_usage (const guchar *data, gsize n_data, guint *key_usage)
 {
-	GckDataResult ret = GCK_DATA_UNRECOGNIZED;
+	GkmDataResult ret = GKM_DATA_UNRECOGNIZED;
 	ASN1_TYPE asn;
 	guchar buf[4];
 	int res, len;
-	
+
 	asn = egg_asn1_decode ("PKIX1.KeyUsage", data, n_data);
 	if (!asn)
 		goto done;
-		
-	ret = GCK_DATA_FAILURE;
+
+	ret = GKM_DATA_FAILURE;
 
 	memset (buf, 0, sizeof (buf));
 	len = sizeof (buf);
@@ -1229,45 +1229,45 @@ gck_data_der_read_key_usage (const guchar *data, gsize n_data, guint *key_usage)
 		goto done;
 
 	*key_usage = buf[0] | (buf[1] << 8);
-	ret = GCK_DATA_SUCCESS;
-	
+	ret = GKM_DATA_SUCCESS;
+
 done:
 	if (asn)
-		asn1_delete_structure (&asn);		
+		asn1_delete_structure (&asn);
 	return ret;
 }
 
-GckDataResult
-gck_data_der_read_enhanced_usage (const guchar *data, gsize n_data, GQuark **usage_oids)
+GkmDataResult
+gkm_data_der_read_enhanced_usage (const guchar *data, gsize n_data, GQuark **usage_oids)
 {
-	GckDataResult ret = GCK_DATA_UNRECOGNIZED;
+	GkmDataResult ret = GKM_DATA_UNRECOGNIZED;
 	ASN1_TYPE asn;
 	gchar *part;
 	GArray *array;
 	GQuark oid;
 	int i;
-	
+
 	asn = egg_asn1_decode ("PKIX1.ExtKeyUsageSyntax", data, n_data);
 	if (!asn)
 		goto done;
-		
-	ret = GCK_DATA_FAILURE;
-	
+
+	ret = GKM_DATA_FAILURE;
+
 	array = g_array_new (TRUE, TRUE, sizeof (GQuark));
 	for (i = 0; TRUE; ++i) {
 		part = g_strdup_printf ("?%d", i + 1);
 		oid = egg_asn1_read_oid (asn, part);
 		g_free (part);
-		
-		if (!oid) 
+
+		if (!oid)
 			break;
-		
+
 		g_array_append_val (array, oid);
 	}
-	
+
 	*usage_oids = (GQuark*)g_array_free (array, FALSE);
-	ret = GCK_DATA_SUCCESS;
-	
+	ret = GKM_DATA_SUCCESS;
+
 done:
 	if (asn)
 		asn1_delete_structure (&asn);
@@ -1276,10 +1276,10 @@ done:
 
 
 guchar*
-gck_data_der_write_certificate (ASN1_TYPE asn1, gsize *n_data)
+gkm_data_der_write_certificate (ASN1_TYPE asn1, gsize *n_data)
 {
 	g_return_val_if_fail (asn1, NULL);
 	g_return_val_if_fail (n_data, NULL);
-	
+
 	return egg_asn1_encode (asn1, "", n_data, NULL);
 }
diff --git a/pkcs11/gck/gck-data-der.h b/pkcs11/gkm/gkm-data-der.h
similarity index 58%
rename from pkcs11/gck/gck-data-der.h
rename to pkcs11/gkm/gkm-data-der.h
index 26801e8..f178a95 100644
--- a/pkcs11/gck/gck-data-der.h
+++ b/pkcs11/gkm/gkm-data-der.h
@@ -1,5 +1,5 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* gck-data-der.h - parsing and serializing of common crypto DER structures 
+/* gkm-data-der.h - parsing and serializing of common crypto DER structures
 
    Copyright (C) 2007 Stefan Walter
 
@@ -28,94 +28,94 @@
 #include <gcrypt.h>
 #include <libtasn1.h>
 
-#include "gck-data-types.h"
+#include "gkm-data-types.h"
 
 /* -----------------------------------------------------------------------------
- * PRIVATE KEYS 
+ * PRIVATE KEYS
  */
- 
-GckDataResult      gck_data_der_read_private_key_rsa         (const guchar *data, gsize n_data, 
+
+GkmDataResult      gkm_data_der_read_private_key_rsa         (const guchar *data, gsize n_data,
                                                               gcry_sexp_t *s_key);
 
-GckDataResult      gck_data_der_read_private_key_dsa         (const guchar *data, gsize n_data, 
+GkmDataResult      gkm_data_der_read_private_key_dsa         (const guchar *data, gsize n_data,
                                                               gcry_sexp_t *s_key);
 
-GckDataResult      gck_data_der_read_private_key_dsa_parts   (const guchar *keydata, gsize n_keydata,
-                                                              const guchar *params, gsize n_params, 
+GkmDataResult      gkm_data_der_read_private_key_dsa_parts   (const guchar *keydata, gsize n_keydata,
+                                                              const guchar *params, gsize n_params,
                                                               gcry_sexp_t *s_key);
 
-GckDataResult      gck_data_der_read_private_key             (const guchar *data, gsize n_data, 
+GkmDataResult      gkm_data_der_read_private_key             (const guchar *data, gsize n_data,
                                                               gcry_sexp_t *s_key);
 
-GckDataResult      gck_data_der_read_private_pkcs8           (const guchar *data, gsize n_data,
-                                                              const gchar *password, gsize n_password, 
-                                                              gcry_sexp_t *s_key); 
+GkmDataResult      gkm_data_der_read_private_pkcs8           (const guchar *data, gsize n_data,
+                                                              const gchar *password, gsize n_password,
+                                                              gcry_sexp_t *s_key);
 
-GckDataResult      gck_data_der_read_private_pkcs8_plain     (const guchar *data, gsize n_data,
-                                                              gcry_sexp_t *s_key); 
+GkmDataResult      gkm_data_der_read_private_pkcs8_plain     (const guchar *data, gsize n_data,
+                                                              gcry_sexp_t *s_key);
 
-GckDataResult      gck_data_der_read_private_pkcs8_crypted   (const guchar *data, gsize n_data,
-                                                              const gchar *password, gsize n_password, 
-                                                              gcry_sexp_t *s_key); 
+GkmDataResult      gkm_data_der_read_private_pkcs8_crypted   (const guchar *data, gsize n_data,
+                                                              const gchar *password, gsize n_password,
+                                                              gcry_sexp_t *s_key);
 
-guchar*            gck_data_der_write_private_key_rsa        (gcry_sexp_t s_key, gsize *n_data);
+guchar*            gkm_data_der_write_private_key_rsa        (gcry_sexp_t s_key, gsize *n_data);
 
-guchar*            gck_data_der_write_private_key_dsa        (gcry_sexp_t s_key, gsize *len);
+guchar*            gkm_data_der_write_private_key_dsa        (gcry_sexp_t s_key, gsize *len);
 
-guchar*            gck_data_der_write_private_key_dsa_part   (gcry_sexp_t skey, gsize *n_key);
+guchar*            gkm_data_der_write_private_key_dsa_part   (gcry_sexp_t skey, gsize *n_key);
 
-guchar*            gck_data_der_write_private_key_dsa_params (gcry_sexp_t skey, gsize *n_params);
+guchar*            gkm_data_der_write_private_key_dsa_params (gcry_sexp_t skey, gsize *n_params);
 
-guchar*            gck_data_der_write_private_key            (gcry_sexp_t s_key, gsize *n_data);
+guchar*            gkm_data_der_write_private_key            (gcry_sexp_t s_key, gsize *n_data);
 
-guchar*            gck_data_der_write_private_pkcs8_plain    (gcry_sexp_t skey, gsize *n_data);
+guchar*            gkm_data_der_write_private_pkcs8_plain    (gcry_sexp_t skey, gsize *n_data);
 
-guchar*            gck_data_der_write_private_pkcs8_crypted  (gcry_sexp_t skey, const gchar *password,
+guchar*            gkm_data_der_write_private_pkcs8_crypted  (gcry_sexp_t skey, const gchar *password,
                                                               gsize n_password, gsize *n_data);
 
 /* -----------------------------------------------------------------------------
  * PUBLIC KEYS
  */
 
-GckDataResult      gck_data_der_read_public_key_rsa        (const guchar *data, gsize n_data, 
+GkmDataResult      gkm_data_der_read_public_key_rsa        (const guchar *data, gsize n_data,
                                                             gcry_sexp_t *s_key);
 
-GckDataResult      gck_data_der_read_public_key_dsa        (const guchar *data, gsize n_data, 
+GkmDataResult      gkm_data_der_read_public_key_dsa        (const guchar *data, gsize n_data,
                                                             gcry_sexp_t *s_key);
 
-GckDataResult      gck_data_der_read_public_key_dsa_parts  (const guchar *keydata, gsize n_keydata,
+GkmDataResult      gkm_data_der_read_public_key_dsa_parts  (const guchar *keydata, gsize n_keydata,
                                                             const guchar *params, gsize n_params,
                                                             gcry_sexp_t *s_key);
-                                                         
-GckDataResult      gck_data_der_read_public_key            (const guchar *data, gsize n_data, 
+
+GkmDataResult      gkm_data_der_read_public_key            (const guchar *data, gsize n_data,
                                                             gcry_sexp_t *s_key);
 
-GckDataResult      gck_data_der_read_public_key_info       (const guchar *data, gsize n_data, 
+GkmDataResult      gkm_data_der_read_public_key_info       (const guchar *data, gsize n_data,
                                                             gcry_sexp_t *s_key);
 
-guchar*            gck_data_der_write_public_key_rsa       (gcry_sexp_t s_key, gsize *len);
+guchar*            gkm_data_der_write_public_key_rsa       (gcry_sexp_t s_key, gsize *len);
 
-guchar*            gck_data_der_write_public_key_dsa       (gcry_sexp_t s_key, gsize *len);
+guchar*            gkm_data_der_write_public_key_dsa       (gcry_sexp_t s_key, gsize *len);
 
-guchar*            gck_data_der_write_public_key           (gcry_sexp_t s_key, gsize *len);
+guchar*            gkm_data_der_write_public_key           (gcry_sexp_t s_key, gsize *len);
 
 
 /* -----------------------------------------------------------------------------
  * CERTIFICATES
  */
 
-GckDataResult      gck_data_der_read_certificate           (const guchar *data, gsize n_data, 
+GkmDataResult      gkm_data_der_read_certificate           (const guchar *data, gsize n_data,
                                                             ASN1_TYPE *asn1);
-                                                         
-GckDataResult      gck_data_der_read_basic_constraints     (const guchar *data, gsize n_data, 
+
+GkmDataResult      gkm_data_der_read_basic_constraints     (const guchar *data, gsize n_data,
                                                             gboolean *is_ca, gint *path_len);
 
-GckDataResult      gck_data_der_read_key_usage             (const guchar *data, gsize n_data, 
+GkmDataResult      gkm_data_der_read_key_usage             (const guchar *data, gsize n_data,
                                                             guint *key_usage);
 
-GckDataResult      gck_data_der_read_enhanced_usage        (const guchar *data, gsize n_data, 
+GkmDataResult      gkm_data_der_read_enhanced_usage        (const guchar *data, gsize n_data,
                                                             GQuark **oids);
 
-guchar*            gck_data_der_write_certificate          (ASN1_TYPE asn1, gsize *n_data);
+guchar*            gkm_data_der_write_certificate          (ASN1_TYPE asn1, gsize *n_data);
 
 #endif /*GKRPKIXDER_H_*/
diff --git a/pkcs11/gck/gck-data-file.c b/pkcs11/gkm/gkm-data-file.c
similarity index 75%
rename from pkcs11/gck/gck-data-file.c
rename to pkcs11/gkm/gkm-data-file.c
index 54d794f..1d2f77f 100644
--- a/pkcs11/gck/gck-data-file.c
+++ b/pkcs11/gkm/gkm-data-file.c
@@ -1,32 +1,32 @@
-/* 
+/*
  * 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"
 
-#include "gck-attributes.h"
-#include "gck-crypto.h"
-#include "gck-data-file.h"
-#include "gck-data-types.h"
-#include "gck-marshal.h"
-#include "gck-util.h"
+#include "gkm-attributes.h"
+#include "gkm-crypto.h"
+#include "gkm-data-file.h"
+#include "gkm-data-types.h"
+#include "gkm-marshal.h"
+#include "gkm-util.h"
 
 #include "egg/egg-buffer.h"
 #include "egg/egg-hex.h"
@@ -38,7 +38,7 @@
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h> 
+#include <unistd.h>
 
 #include <gcrypt.h>
 
@@ -51,19 +51,19 @@ enum {
 
 static guint signals[LAST_SIGNAL] = { 0 };
 
-struct _GckDataFile {
+struct _GkmDataFile {
 	GObject parent;
-	
+
 	/* The data itself */
 	GHashTable *identifiers;
 	GHashTable *privates;
 	GHashTable *publics;
 	GList *unknowns;
-	
+
 	/* All the sections seen */
 	guint sections;
 	gboolean incomplete;
-	
+
 	/* Stuff notseen on this read */
 	GHashTable *checks;
 };
@@ -73,12 +73,12 @@ typedef struct _UnknownBlock {
 	EggBuffer buffer;
 } UnknownBlock;
 
-G_DEFINE_TYPE (GckDataFile, gck_data_file, G_TYPE_OBJECT);
+G_DEFINE_TYPE (GkmDataFile, gkm_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, GckSecret *login, gpointer user_data);
+typedef GkmDataResult (*BlockFunc) (guint block, EggBuffer *buffer, GkmSecret *login, gpointer user_data);
 
 #define FILE_HEADER ((const guchar*)"Gnome Keyring Store 2\n\r\0")
 #define FILE_HEADER_LEN 24
@@ -90,7 +90,7 @@ typedef GckDataResult (*BlockFunc) (guint block, EggBuffer *buffer, GckSecret *l
 #define UNUSED_VALUE  GUINT_TO_POINTER (1)
 
 /* -----------------------------------------------------------------------------
- * HELPERS 
+ * HELPERS
  */
 
 static void
@@ -118,7 +118,7 @@ attribute_dup (CK_ATTRIBUTE_PTR attr)
 static GHashTable*
 attributes_new (void)
 {
-	return g_hash_table_new_full (gck_util_ulong_hash, gck_util_ulong_equal, NULL, attribute_free);
+	return g_hash_table_new_full (gkm_util_ulong_hash, gkm_util_ulong_equal, NULL, attribute_free);
 }
 
 static GHashTable*
@@ -159,14 +159,14 @@ write_all_bytes (int fd, const guchar *buf, gsize len)
 {
 	gsize all = len;
 	int res;
-	
+
 	while (len > 0) {
-		
+
 		res = write (fd, buf, len);
 		if (res < 0) {
 			if (errno == EAGAIN || errno == EINTR)
 				continue;
-			g_warning ("couldn't write %u bytes to store file: %s", 
+			g_warning ("couldn't write %u bytes to store file: %s",
 			           (guint)all, g_strerror (errno));
 			return FALSE;
 		} else if (res == 0) {
@@ -177,27 +177,27 @@ write_all_bytes (int fd, const guchar *buf, gsize len)
 			buf += res;
 		}
 	}
-	
+
 	return TRUE;
 }
 
-static GckDataResult
-parse_file_blocks (int file, BlockFunc block_func, GckSecret *login, gpointer user_data)
+static GkmDataResult
+parse_file_blocks (int file, BlockFunc block_func, GkmSecret *login, gpointer user_data)
 {
 	gchar header[FILE_HEADER_LEN];
-	GckDataResult res;
+	GkmDataResult res;
 	EggBuffer buffer;
 	guint32 block;
 	guint32 length;
 	gsize offset;
-	
+
 	g_assert (file != -1);
 	g_assert (block_func);
-	
+
 	/* Zero length file is valid */
 	if (!read_all_bytes (file, (guchar*)header, FILE_HEADER_LEN))
 		return TRUE;
-	
+
 	/* Check the header */
 	if (memcmp (header, FILE_HEADER, FILE_HEADER_LEN) != 0) {
 		g_message ("invalid header in store file");
@@ -206,7 +206,7 @@ parse_file_blocks (int file, BlockFunc block_func, GckSecret *login, gpointer us
 
 	egg_buffer_init_full (&buffer, 1024, (EggBufferAllocator)g_realloc);
 
-	res = GCK_DATA_SUCCESS;
+	res = GKM_DATA_SUCCESS;
 	for (;;) {
 
 		egg_buffer_reset (&buffer);
@@ -215,31 +215,31 @@ parse_file_blocks (int file, BlockFunc block_func, GckSecret *login, gpointer us
 
 		/* Read in a set of bytes */
 		if (!read_all_bytes (file, buffer.buf, 8)) {
-			res = GCK_DATA_SUCCESS; /* end of file */
+			res = GKM_DATA_SUCCESS; /* end of file */
 			break;
 		}
-		
+
 		/* Decode it as the number of bytes in the next section */
 		if (!egg_buffer_get_uint32 (&buffer, offset, &offset, &length) ||
-		    !egg_buffer_get_uint32 (&buffer, offset, &offset, &block) || 
+		    !egg_buffer_get_uint32 (&buffer, offset, &offset, &block) ||
 		    length < 8) {
-			res = GCK_DATA_FAILURE;
+			res = GKM_DATA_FAILURE;
 			g_message ("invalid block size or length in store file");
 			break;
 		}
-		
+
 		/* Read in that amount of bytes */
 		egg_buffer_resize (&buffer, length - 8);
 		if (!read_all_bytes (file, buffer.buf, length - 8)) {
-			res = GCK_DATA_FAILURE;
+			res = GKM_DATA_FAILURE;
 			break;
 		}
 
 		res = (block_func) (block, &buffer, login, user_data);
-		if (res != GCK_DATA_SUCCESS)
+		if (res != GKM_DATA_SUCCESS)
 			break;
 	}
-	
+
 	egg_buffer_uninit (&buffer);
 	return res;
 }
@@ -249,10 +249,10 @@ write_file_block (int file, guint block, EggBuffer *buffer)
 {
 	EggBuffer header;
 	gboolean ret;
-	
+
 	g_assert (file != -1);
 	g_assert (buffer);
-	
+
 	/* Write out the 8 bytes of header */
 	egg_buffer_init_full (&header, 8, (EggBufferAllocator)g_realloc);
 	egg_buffer_add_uint32 (&header, buffer->len + 8);
@@ -261,10 +261,10 @@ write_file_block (int file, guint block, EggBuffer *buffer)
 	g_assert (header.len == 8);
 	ret = write_all_bytes (file, header.buf, header.len);
 	egg_buffer_uninit (&header);
-	
+
 	if (ret != TRUE)
 		return FALSE;
-	
+
 	/* Now write out the remainder of the data */
 	return write_all_bytes (file, buffer->buf, buffer->len);
 }
@@ -277,23 +277,23 @@ hash_buffer (EggBuffer *buffer)
 	guchar *hash;
 	gsize n_hash;
 	int algo;
-	
+
 	/* The length needs to be the first thing in the buffer */
 	g_assert (buffer->len > 4);
 	g_assert (egg_buffer_decode_uint32 (buffer->buf) == buffer->len);
-	
+
 	length = buffer->len;
-	
+
 	algo = GCRY_MD_SHA256;
 	salgo = gcry_md_algo_name (algo);
 	g_return_val_if_fail (salgo, FALSE);
 	n_hash = gcry_md_get_algo_dlen (algo);
 	g_return_val_if_fail (n_hash > 0, FALSE);
-	
+
 	egg_buffer_add_string (buffer, salgo);
 	hash = egg_buffer_add_byte_array_empty (buffer, n_hash);
 	g_return_val_if_fail (hash, FALSE);
-	
+
 	gcry_md_hash_buffer (algo, hash, buffer->buf, length);
 	return TRUE;
 }
@@ -306,16 +306,16 @@ validate_buffer (EggBuffer *buffer, gsize *offset)
 	gsize n_hash, hash_offset;
 	guint32 length;
 	int algo;
-	
+
 	g_assert (buffer);
 	g_assert (offset);
-	
+
 	*offset = 0;
-	
-	if (!egg_buffer_get_uint32 (buffer, *offset, offset, &length) || 
+
+	if (!egg_buffer_get_uint32 (buffer, *offset, offset, &length) ||
 	    !egg_buffer_get_string (buffer, length, &hash_offset, &salgo, PUBLIC_ALLOC))
 		return FALSE;
-	
+
 	algo = gcry_md_map_name (salgo);
 	if (algo == 0) {
 		g_warning ("unsupported hash algorithm: %s", salgo);
@@ -323,25 +323,25 @@ validate_buffer (EggBuffer *buffer, gsize *offset)
 		return FALSE;
 	}
 	g_free (salgo);
-	
+
 	if (!egg_buffer_get_byte_array (buffer, hash_offset, &hash_offset, &hash, &n_hash))
 		return FALSE;
-	
+
 	if (n_hash != gcry_md_get_algo_dlen (algo)) {
 		g_warning ("invalid hash length in store file");
 		return FALSE;
 	}
-	
+
 	check = g_malloc0 (n_hash);
 	gcry_md_hash_buffer (algo, check, buffer->buf, length);
 	if (memcmp (check, hash, n_hash) != 0)
 		return FALSE;
-	
+
 	return TRUE;
 }
 
 static gboolean
-create_cipher (GckSecret *login, int calgo, int halgo, const guchar *salt, 
+create_cipher (GkmSecret *login, int calgo, int halgo, const guchar *salt,
                gsize n_salt, guint iterations, gcry_cipher_hd_t *cipher)
 {
 	gsize n_key, n_block;
@@ -349,7 +349,7 @@ create_cipher (GckSecret *login, int calgo, int halgo, const guchar *salt,
 	gsize n_password;
 	guchar *key, *iv;
 	gcry_error_t gcry;
-	
+
 	g_assert (login);
 	g_assert (salt);
 	g_assert (cipher);
@@ -363,16 +363,16 @@ create_cipher (GckSecret *login, int calgo, int halgo, const guchar *salt,
 	key = gcry_malloc_secure (n_key);
 	g_return_val_if_fail (key, FALSE);
 	iv = g_malloc0 (n_block);
-	
-	password = gck_secret_get_password (login, &n_password);
-	
-	if (!egg_symkey_generate_simple (calgo, halgo, password, n_password, 
+
+	password = gkm_secret_get_password (login, &n_password);
+
+	if (!egg_symkey_generate_simple (calgo, halgo, password, n_password,
 	                                 salt, n_salt, iterations, &key, &iv)) {
 		gcry_free (key);
 		g_free (iv);
 		return FALSE;
 	}
-	
+
 	gcry = gcry_cipher_open (cipher, calgo, GCRY_CIPHER_MODE_CBC, 0);
 	if (gcry) {
 		g_warning ("couldn't create cipher context: %s", gcry_strerror (gcry));
@@ -388,12 +388,12 @@ create_cipher (GckSecret *login, int calgo, int halgo, const guchar *salt,
 	gcry = gcry_cipher_setiv (*cipher, iv, n_block);
 	g_return_val_if_fail (!gcry, FALSE);
 	g_free (iv);
-	
+
 	return TRUE;
 }
 
 static gboolean
-encrypt_buffer (EggBuffer *input, GckSecret *login, EggBuffer *output)
+encrypt_buffer (EggBuffer *input, GkmSecret *login, EggBuffer *output)
 {
 	gcry_cipher_hd_t cipher;
 	gcry_error_t gcry;
@@ -403,63 +403,63 @@ encrypt_buffer (EggBuffer *input, GckSecret *login, EggBuffer *output)
 	const gchar *salgo;
 	guchar *dest;
 	gsize n_block;
-	
+
 	g_assert (input);
 	g_assert (output);
 	g_assert (login);
-	
+
 	/* The algorithms we're going to use */
 	calgo = GCRY_CIPHER_AES128;
 	halgo = GCRY_MD_SHA256;
-	
+
 	/* Prepare us some salt */
 	gcry_create_nonce (salt, sizeof (salt));
-	
+
 	/* Prepare us the iterations */
 	iterations = 1000 + (int) (1000.0 * rand() / (RAND_MAX + 1.0));
-	
+
 	/* Write out crypto algorithm */
 	salgo = gcry_cipher_algo_name (calgo);
 	g_return_val_if_fail (salgo, FALSE);
 	egg_buffer_add_string (output, salgo);
-	
+
 	/* Write out the hash algorithm */
 	salgo = gcry_md_algo_name (halgo);
 	g_return_val_if_fail (halgo, FALSE);
 	egg_buffer_add_string (output, salgo);
-	
+
 	/* Write out the iterations */
 	egg_buffer_add_uint32 (output, iterations);
-	
+
 	/* And write out the salt */
 	egg_buffer_add_byte_array (output, salt, sizeof (salt));
-	
+
 	/* Okay now use the above info to create our cipher context */
 	if (!create_cipher (login, calgo, halgo, salt, sizeof (salt), iterations, &cipher))
 		return FALSE;
-	
+
 	/* Significant block sizes */
 	n_block = gcry_cipher_get_algo_blklen (calgo);
 	g_return_val_if_fail (n_block, FALSE);
-	
+
 	/* Pad the buffer to a multiple of block length */
 	while (input->len % n_block != 0)
 		egg_buffer_add_byte (input, 0);
-	
+
 	/* Now reserve space for it in the output block, and encrypt */
 	dest = egg_buffer_add_byte_array_empty (output, input->len);
 	g_return_val_if_fail (dest, FALSE);
 
 	gcry = gcry_cipher_encrypt (cipher, dest, input->len, input->buf, input->len);
 	g_return_val_if_fail (!gcry, FALSE);
-	
+
 	gcry_cipher_close (cipher);
 
 	return TRUE;
 }
 
 static gboolean
-decrypt_buffer (EggBuffer *input, gsize *offset, GckSecret *login, EggBuffer *output)
+decrypt_buffer (EggBuffer *input, gsize *offset, GkmSecret *login, EggBuffer *output)
 {
 	gcry_cipher_hd_t cipher;
 	gcry_error_t gcry;
@@ -477,14 +477,14 @@ decrypt_buffer (EggBuffer *input, gsize *offset, GckSecret *login, EggBuffer *ou
 	/* Read in and interpret the cipher algorithm */
 	if (!egg_buffer_get_string (input, *offset, offset, &salgo, NULL))
 		return FALSE;
-	calgo = gcry_cipher_map_name (salgo); 
+	calgo = gcry_cipher_map_name (salgo);
 	if (!calgo) {
 		g_warning ("unsupported crypto algorithm: %s", salgo);
 		g_free (salgo);
 		return FALSE;
 	}
 	g_free (salgo);
-		
+
 	/* Read in and interpret the hash algorithm */
 	if (!egg_buffer_get_string (input, *offset, offset, &salgo, NULL))
 		return FALSE;
@@ -495,7 +495,7 @@ decrypt_buffer (EggBuffer *input, gsize *offset, GckSecret *login, EggBuffer *ou
 		return FALSE;
 	}
 	g_free (salgo);
-		
+
 	/* Read in the iterations, salt, and encrypted data */
 	if (!egg_buffer_get_uint32 (input, *offset, offset, &iterations) ||
 	    !egg_buffer_get_byte_array (input, *offset, offset, &salt, &n_salt) ||
@@ -505,7 +505,7 @@ decrypt_buffer (EggBuffer *input, gsize *offset, GckSecret *login, EggBuffer *ou
 	/* Significant block sizes */
 	n_block = gcry_cipher_get_algo_blklen (calgo);
 	g_return_val_if_fail (n_block, FALSE);
-	
+
 	/* Make sure the encrypted data is of a good length */
 	if (n_data % n_block != 0) {
 		g_warning ("encrypted data in file store is of an invalid length for algorithm");
@@ -522,7 +522,7 @@ decrypt_buffer (EggBuffer *input, gsize *offset, GckSecret *login, EggBuffer *ou
 
 	gcry = gcry_cipher_decrypt (cipher, output->buf, output->len, data, n_data);
 	g_return_val_if_fail (!gcry, FALSE);
-	
+
 	gcry_cipher_close (cipher);
 
 	return TRUE;
@@ -532,8 +532,8 @@ decrypt_buffer (EggBuffer *input, gsize *offset, GckSecret *login, EggBuffer *ou
  * INTERNAL
  */
 
-static GckDataResult
-update_entries_from_block (GckDataFile *self, guint section, GHashTable *entries, 
+static GkmDataResult
+update_entries_from_block (GkmDataFile *self, guint section, GHashTable *entries,
                            EggBuffer *buffer, gsize *offset)
 {
 	GHashTable *attributes;
@@ -549,32 +549,32 @@ update_entries_from_block (GckDataFile *self, guint section, GHashTable *entries
 	const guchar *data;
 	gsize n_data;
 	guint64 type;
-	
-	g_assert (GCK_IS_DATA_FILE (self));
+
+	g_assert (GKM_IS_DATA_FILE (self));
 	g_assert (entries);
 	g_assert (buffer);
 	g_assert (offset);
-	
+
 	/* The number of entries */
 	if (!egg_buffer_get_uint32 (buffer, *offset, offset, &n_entries))
-		return GCK_DATA_FAILURE;
+		return GKM_DATA_FAILURE;
 
 	for (i = 0; i < n_entries; ++i) {
-		
+
 		added = FALSE;
-		
+
 		/* The attributes */
 		if (!egg_buffer_get_string (buffer, *offset, offset, &str, (EggBufferAllocator)g_realloc))
-			return GCK_DATA_FAILURE;
-		
+			return GKM_DATA_FAILURE;
+
 		/* Make sure we have this one */
 		sect = GPOINTER_TO_UINT (g_hash_table_lookup (self->identifiers, str));
 		if (sect != section) {
 			g_message ("data file entry in wrong section: %s", str);
 			g_free (str);
-			return GCK_DATA_FAILURE;
+			return GKM_DATA_FAILURE;
 		}
-		
+
 		/* Lookup or create a new table for it */
 		if (!g_hash_table_lookup_extended (entries, str, &key, &value)) {
 			added = TRUE;
@@ -582,27 +582,27 @@ update_entries_from_block (GckDataFile *self, guint section, GHashTable *entries
 			key = g_strdup (str);
 			g_hash_table_replace (entries, key, value);
 		}
-		
+
 		g_free (str);
 		identifier = key;
 		attributes = value;
-		
+
 		if (!egg_buffer_get_uint32 (buffer, *offset, offset, &n_attrs))
-			return GCK_DATA_FAILURE;
-			
+			return GKM_DATA_FAILURE;
+
 		for (j = 0; j < n_attrs; ++j) {
 			if (!egg_buffer_get_uint64 (buffer, *offset, offset, &type) ||
 			    !egg_buffer_get_byte_array (buffer, *offset, offset, &data, &n_data))
-				return GCK_DATA_FAILURE;
-				
+				return GKM_DATA_FAILURE;
+
 			attr.type = type;
 			attr.pValue = (CK_VOID_PTR)data;
 			attr.ulValueLen = n_data;
-				
+
 			at = g_hash_table_lookup (attributes, &attr.type);
-			if (at != NULL && gck_attribute_equal (&attr, at))
+			if (at != NULL && gkm_attribute_equal (&attr, at))
 				continue;
-				
+
 			at = attribute_dup (&attr);
 			g_hash_table_replace (attributes, &(at->type), at);
 
@@ -610,78 +610,78 @@ update_entries_from_block (GckDataFile *self, guint section, GHashTable *entries
 			if (added == FALSE)
 				g_signal_emit (self, signals[ENTRY_CHANGED], 0, identifier, attr.type);
 		}
-		
+
 		/* A new entry was loaded */
 		if (added == TRUE)
 			g_signal_emit (self, signals[ENTRY_ADDED], 0, identifier);
 	}
 
-	return GCK_DATA_SUCCESS;
+	return GKM_DATA_SUCCESS;
 }
 
-static GckDataResult
-update_from_public_block (GckDataFile *self, EggBuffer *buffer)
+static GkmDataResult
+update_from_public_block (GkmDataFile *self, EggBuffer *buffer)
 {
 	gsize offset = 0;
 
-	g_assert (GCK_IS_DATA_FILE (self));
+	g_assert (GKM_IS_DATA_FILE (self));
 	g_assert (buffer);
-	
-	self->sections |= GCK_DATA_FILE_SECTION_PUBLIC;
+
+	self->sections |= GKM_DATA_FILE_SECTION_PUBLIC;
 
 	/* Validate the buffer hash, failure in this case is corruption */
-	if (!validate_buffer (buffer, &offset)) 
-		return GCK_DATA_FAILURE;
-	
-	return update_entries_from_block (self, GCK_DATA_FILE_SECTION_PUBLIC, 
+	if (!validate_buffer (buffer, &offset))
+		return GKM_DATA_FAILURE;
+
+	return update_entries_from_block (self, GKM_DATA_FILE_SECTION_PUBLIC,
 	                                  self->publics, buffer, &offset);
 }
 
-static GckDataResult
-update_from_private_block (GckDataFile *self, EggBuffer *buffer, GckSecret *login)
+static GkmDataResult
+update_from_private_block (GkmDataFile *self, EggBuffer *buffer, GkmSecret *login)
 {
 	EggBuffer custom;
-	GckDataResult res;
+	GkmDataResult res;
 	const gchar *password;
 	gsize n_password;
 	gsize offset;
 
-	g_assert (GCK_IS_DATA_FILE (self));
+	g_assert (GKM_IS_DATA_FILE (self));
 	g_assert (buffer);
 
-	self->sections |= GCK_DATA_FILE_SECTION_PRIVATE;
+	self->sections |= GKM_DATA_FILE_SECTION_PRIVATE;
 
 	/* Skip private blocks when not unlocked */
 	if (login == NULL) {
 		if (self->privates)
 			g_hash_table_destroy (self->privates);
 		self->privates = NULL;
-		return GCK_DATA_UNRECOGNIZED;
+		return GKM_DATA_UNRECOGNIZED;
 	}
-	
+
 	offset = 0;
 	egg_buffer_init_full (&custom, 1024, egg_secure_realloc);
 
 	/* Decrypt the buffer */
-	password = gck_secret_get_password (login, &n_password);
+	password = gkm_secret_get_password (login, &n_password);
 	if (!decrypt_buffer (buffer, &offset, login, &custom)) {
 		egg_buffer_uninit (&custom);
-		return GCK_DATA_FAILURE;
+		return GKM_DATA_FAILURE;
 	}
-	
+
 	offset = 0;
-	
+
 	/* Validate the buffer hash, failure is usually a bad password */
 	if (!validate_buffer (&custom, &offset)) {
 		egg_buffer_uninit (&custom);
-		return GCK_DATA_LOCKED;
+		return GKM_DATA_LOCKED;
 	}
 
 	/* We're loading privates, so fill that in */
 	if (!self->privates)
 		self->privates = entries_new ();
 
-	res = update_entries_from_block (self, GCK_DATA_FILE_SECTION_PRIVATE,
+	res = update_entries_from_block (self, GKM_DATA_FILE_SECTION_PRIVATE,
 	                                 self->privates, &custom, &offset);
 	egg_buffer_uninit (&custom);
 	return res;
@@ -696,92 +696,92 @@ copy_each_identifier (gpointer key, gpointer value, gpointer data)
 static void
 remove_each_identifier (gpointer key, gpointer value, gpointer data)
 {
-	GckDataFile *self = GCK_DATA_FILE (data);
+	GkmDataFile *self = GKM_DATA_FILE (data);
 	GHashTable *entries;
 	guint section;
-	
-	g_assert (GCK_IS_DATA_FILE (self));
+
+	g_assert (GKM_IS_DATA_FILE (self));
 	g_assert (key);
 
-	if (!gck_data_file_lookup_entry (self, key, &section))
+	if (!gkm_data_file_lookup_entry (self, key, &section))
 		g_assert_not_reached ();
-		
-	if (section == GCK_DATA_FILE_SECTION_PRIVATE)
+
+	if (section == GKM_DATA_FILE_SECTION_PRIVATE)
 		entries = self->privates;
 	else
 		entries = self->publics;
 
 	if (!g_hash_table_remove (self->identifiers, key))
 		g_assert_not_reached ();
-	
+
 	if (entries != NULL) {
 		if (!g_hash_table_remove (entries, key))
 			g_return_if_reached ();
-		
-		/* 
-		 * Note that we only fire the removed signal when the identifier 
-		 * was accessible. We don't fire removed for private items in 
+
+		/*
+		 * Note that we only fire the removed signal when the identifier
+		 * was accessible. We don't fire removed for private items in
 		 * a locked file.
 		 */
 		g_signal_emit (self, signals[ENTRY_REMOVED], 0, key);
 	}
 }
 
-static GckDataResult
-update_from_index_block (GckDataFile *self, EggBuffer *buffer)
+static GkmDataResult
+update_from_index_block (GkmDataFile *self, EggBuffer *buffer)
 {
 	gchar *identifier;
 	gsize offset;
 	guint section;
 	guint count, i;
 	guint value;
-	
-	g_assert (GCK_IS_DATA_FILE (self));
+
+	g_assert (GKM_IS_DATA_FILE (self));
 	g_assert (buffer);
-	
+
 	offset = 0;
-	
+
 	/* The number of entries */
 	if (!egg_buffer_get_uint32 (buffer, offset, &offset, &count))
 		return FALSE;
 
 	for (i = 0; i < count; ++i) {
-		
+
 		/* The identifier */
 		if (!egg_buffer_get_string (buffer, offset, &offset, &identifier, (EggBufferAllocator)g_realloc))
 			break;
-		
+
 		/* The section */
 		if (!egg_buffer_get_uint32 (buffer, offset, &offset, &value)) {
 			g_free (identifier);
 			break;
 		}
-		
+
 		section = value;
 		g_hash_table_replace (self->identifiers, identifier, GUINT_TO_POINTER (section));
-		
+
 		/* Track that we've seen this identifier */
 		g_hash_table_remove (self->checks, identifier);
 	}
-	
+
 	/* Completed reading all */
-	if (i == count) 
-		return GCK_DATA_SUCCESS;
-		
+	if (i == count)
+		return GKM_DATA_SUCCESS;
+
 	/* Failed for some reason, data is bad */
-	return GCK_DATA_FAILURE;
+	return GKM_DATA_FAILURE;
 }
 
-static GckDataResult
-update_from_any_block (guint block, EggBuffer *buffer, GckSecret *login, gpointer user_data)
+static GkmDataResult
+update_from_any_block (guint block, EggBuffer *buffer, GkmSecret *login, gpointer user_data)
 {
 	UnknownBlock *unknown;
-	GckDataFile *self;
-	GckDataResult res;
-	
-	g_assert (GCK_IS_DATA_FILE (user_data));
-	self = GCK_DATA_FILE (user_data);
-	
+	GkmDataFile *self;
+	GkmDataResult res;
+
+	g_assert (GKM_IS_DATA_FILE (user_data));
+	self = GKM_DATA_FILE (user_data);
+
 	switch (block) {
 	case FILE_BLOCK_INDEX:
 		res = update_from_index_block (self, buffer);
@@ -793,20 +793,20 @@ update_from_any_block (guint block, EggBuffer *buffer, GckSecret *login, gpointe
 		res = update_from_public_block (self, buffer);
 		break;
 	default:
-		res = GCK_DATA_UNRECOGNIZED;
+		res = GKM_DATA_UNRECOGNIZED;
 		break;
 	};
-	
+
 	/* If unrecognized data block, then stash as unknown */
-	if (res == GCK_DATA_UNRECOGNIZED) {
+	if (res == GKM_DATA_UNRECOGNIZED) {
 		unknown = g_slice_new0 (UnknownBlock);
 		unknown->type = block;
 		egg_buffer_init_full (&unknown->buffer, buffer->len, PUBLIC_ALLOC);
 		egg_buffer_append (&unknown->buffer, buffer->buf, buffer->len);
 		self->unknowns = g_list_prepend (self->unknowns, unknown);
-		res = GCK_DATA_SUCCESS;
+		res = GKM_DATA_SUCCESS;
 	}
-	
+
 	return res;
 }
 
@@ -826,82 +826,82 @@ write_each_entry (gpointer key, gpointer value, gpointer data)
 	EggBuffer *buffer = data;
 	const gchar *unique = key;
 	GHashTable *attributes = value;
-	
+
 	egg_buffer_add_string (buffer, unique);
 	egg_buffer_add_uint32 (buffer, g_hash_table_size (attributes));
 	g_hash_table_foreach (attributes, write_each_attribute, buffer);
 }
 
-static GckDataResult
-write_entries_to_block (GckDataFile *self, GHashTable *entries, EggBuffer *buffer)
+static GkmDataResult
+write_entries_to_block (GkmDataFile *self, GHashTable *entries, EggBuffer *buffer)
 {
 	gsize offset;
-	
-	g_assert (GCK_DATA_FILE (self));
+
+	g_assert (GKM_DATA_FILE (self));
 	g_assert (entries);
 	g_assert (buffer);
-	
+
 	/* Reserve space for the length */
 	offset = buffer->len;
 	egg_buffer_add_uint32 (buffer, 0);
-	
+
 	/* The number of attributes we'll be encountering */
 	egg_buffer_add_uint32 (buffer, g_hash_table_size (entries));
-	
+
 	/* Fill in the attributes */
 	g_hash_table_foreach (entries, write_each_entry, buffer);
-	
-	g_return_val_if_fail (!egg_buffer_has_error (buffer), GCK_DATA_FAILURE);
-	
+
+	g_return_val_if_fail (!egg_buffer_has_error (buffer), GKM_DATA_FAILURE);
+
 	/* Fill in the length */
 	egg_buffer_set_uint32 (buffer, offset, buffer->len);
-	
+
 	/* Hash the entire dealio */
-	if (!hash_buffer (buffer)) 
-		return GCK_DATA_FAILURE;
+	if (!hash_buffer (buffer))
+		return GKM_DATA_FAILURE;
 
-	return GCK_DATA_SUCCESS;
+	return GKM_DATA_SUCCESS;
 }
 
-static GckDataResult
-write_private_to_block (GckDataFile *self, EggBuffer *buffer, GckSecret *login)
+static GkmDataResult
+write_private_to_block (GkmDataFile *self, EggBuffer *buffer, GkmSecret *login)
 {
 	EggBuffer secure;
-	GckDataResult res;
+	GkmDataResult res;
 
-	g_assert (GCK_IS_DATA_FILE (self));
+	g_assert (GKM_IS_DATA_FILE (self));
 	g_assert (buffer);
 
 	if (login == NULL) {
 		/* Must lock the private data in some way */
 		if (self->privates && g_hash_table_size (self->privates))
-			return GCK_DATA_LOCKED;
-		
+			return GKM_DATA_LOCKED;
+
 		/* Not storing privates */
 		else
-			return GCK_DATA_UNRECOGNIZED;
+			return GKM_DATA_UNRECOGNIZED;
 	} else {
 		/* We didn't load the privates, can't store them back */
 		if (self->privates == NULL)
-			return GCK_DATA_LOCKED;
+			return GKM_DATA_LOCKED;
 	}
 
 	egg_buffer_init_full (&secure, 1024, PRIVATE_ALLOC);
 
 	res = write_entries_to_block (self, self->privates, &secure);
-	if (res == GCK_DATA_SUCCESS)
+	if (res == GKM_DATA_SUCCESS)
 		res = encrypt_buffer (&secure, login, buffer);
-	
+
 	egg_buffer_uninit (&secure);
 	return res;
 }
 
-static GckDataResult
-write_public_to_block (GckDataFile *self, EggBuffer *buffer)
+static GkmDataResult
+write_public_to_block (GkmDataFile *self, EggBuffer *buffer)
 {
-	g_assert (GCK_IS_DATA_FILE (self));
+	g_assert (GKM_IS_DATA_FILE (self));
 	g_assert (buffer);
-	
+
 	return write_entries_to_block (self, self->publics, buffer);
 }
 
@@ -912,48 +912,48 @@ write_each_index_identifier (gpointer key, gpointer value, gpointer data)
 	egg_buffer_add_uint32 (data, GPOINTER_TO_UINT (value));
 }
 
-static GckDataResult
-write_index_to_block (GckDataFile *self, EggBuffer *buffer)
+static GkmDataResult
+write_index_to_block (GkmDataFile *self, EggBuffer *buffer)
 {
-	g_assert (GCK_IS_DATA_FILE (self));
+	g_assert (GKM_IS_DATA_FILE (self));
 	g_assert (buffer);
-	
+
 	/* The number of entries */
 	egg_buffer_add_uint32 (buffer, g_hash_table_size (self->identifiers));
-	
+
 	/* Now write out all the entries */
 	g_hash_table_foreach (self->identifiers, write_each_index_identifier, buffer);
-	
-	return egg_buffer_has_error (buffer) ? GCK_DATA_FAILURE : GCK_DATA_SUCCESS;
+
+	return egg_buffer_has_error (buffer) ? GKM_DATA_FAILURE : GKM_DATA_SUCCESS;
 }
 
-static GckDataResult
-identifier_to_attributes (GckDataFile *self, const gchar *identifier, GHashTable **attributes)
+static GkmDataResult
+identifier_to_attributes (GkmDataFile *self, const gchar *identifier, GHashTable **attributes)
 {
 	GHashTable *entries;
 	gpointer value;
 	guint section;
-	
-	g_assert (GCK_IS_DATA_FILE (self));
+
+	g_assert (GKM_IS_DATA_FILE (self));
 	g_assert (identifier);
 	g_assert (attributes);
-	
+
 	if (!g_hash_table_lookup_extended (self->identifiers, identifier, NULL, &value))
-		return GCK_DATA_UNRECOGNIZED;
-	
+		return GKM_DATA_UNRECOGNIZED;
+
 	section = GPOINTER_TO_UINT (value);
-	if (section == GCK_DATA_FILE_SECTION_PRIVATE)
+	if (section == GKM_DATA_FILE_SECTION_PRIVATE)
 		entries = self->privates;
 	else
 		entries = self->publics;
-	
+
 	if (entries == NULL)
-		return GCK_DATA_LOCKED;
-	
+		return GKM_DATA_LOCKED;
+
 	*attributes = g_hash_table_lookup (entries, identifier);
-	g_return_val_if_fail (*attributes, GCK_DATA_UNRECOGNIZED);
-	
-	return GCK_DATA_SUCCESS;
+	g_return_val_if_fail (*attributes, GKM_DATA_UNRECOGNIZED);
+
+	return GKM_DATA_SUCCESS;
 }
 
 static void
@@ -961,14 +961,14 @@ free_unknown_block_list (GList *list)
 {
 	UnknownBlock *unknown;
 	GList *l;
-	
+
 	for (l = list; l; l = g_list_next (l)) {
 		unknown = l->data;
 		g_assert (unknown);
 		egg_buffer_uninit (&unknown->buffer);
 		g_slice_free (UnknownBlock, unknown);
 	}
-	
+
 	g_list_free (list);
 }
 
@@ -977,19 +977,19 @@ sort_unknowns_by_type (gconstpointer a, gconstpointer b)
 {
 	const UnknownBlock *ua = a;
 	const UnknownBlock *ub = b;
-	
+
 	g_assert (ua);
 	g_assert (ub);
-	
+
 	if (ua->type == ub->type)
 		return 0;
-	
+
 	return ua->type > ub->type ? 1 : -1;
 }
 
 typedef struct _ForeachArgs {
-	GckDataFile *self;
-	GckDataFileFunc func;
+	GkmDataFile *self;
+	GkmDataFileFunc func;
 	gpointer user_data;
 } ForeachArgs;
 
@@ -997,7 +997,7 @@ static void
 foreach_identifier (gpointer key, gpointer value, gpointer data)
 {
 	ForeachArgs *args = data;
-	g_assert (GCK_IS_DATA_FILE (args->self));
+	g_assert (GKM_IS_DATA_FILE (args->self));
 	(args->func) (args->self, key, args->user_data);
 }
 
@@ -1007,33 +1007,33 @@ dump_attributes (gpointer key, gpointer value, gpointer user_data)
 	CK_ATTRIBUTE_PTR attr = value;
 	gulong *type = key;
 	gchar *text;
-	
+
 	g_assert (type);
 	g_assert (value);
-	
+
 	if (attr->pValue == NULL)
 		text = g_strdup ("NULL");
 	else
 		text = egg_hex_encode_full (attr->pValue, attr->ulValueLen, TRUE, ' ', 1);
-	
+
 	g_print ("\t0x%08x: %s\n", (guint)*type, text);
 	g_free (text);
 }
 
 static void
-dump_identifier_and_attributes (GckDataFile *self, const gchar *identifier, gpointer user_data)
+dump_identifier_and_attributes (GkmDataFile *self, const gchar *identifier, gpointer user_data)
 {
 	GHashTable *attributes;
 	guint section;
-	
-	g_assert (GCK_IS_DATA_FILE (self));
-	
-	if (!gck_data_file_lookup_entry (self, identifier, &section))
+
+	g_assert (GKM_IS_DATA_FILE (self));
+
+	if (!gkm_data_file_lookup_entry (self, identifier, &section))
 		g_assert_not_reached ();
-	
+
 	if (GPOINTER_TO_UINT (user_data) == section) {
 		g_print ("%s\n", identifier);
-		if (identifier_to_attributes (self, identifier, &attributes) != GCK_DATA_SUCCESS)
+		if (identifier_to_attributes (self, identifier, &attributes) != GKM_DATA_SUCCESS)
 			g_assert_not_reached ();
 		g_hash_table_foreach (attributes, dump_attributes, NULL);
 		g_print ("\n");
@@ -1042,48 +1042,48 @@ dump_identifier_and_attributes (GckDataFile *self, const gchar *identifier, gpoi
 
 
 /* -----------------------------------------------------------------------------
- * OBJECT 
+ * OBJECT
  */
 
 static void
-gck_data_file_init (GckDataFile *self)
+gkm_data_file_init (GkmDataFile *self)
 {
-	self->identifiers = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); 
+	self->identifiers = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
 	self->publics = entries_new ();
 	self->privates = entries_new ();
-	
+
 	self->unknowns = NULL;
-	
+
 	self->checks = NULL;
 }
 
 static void
-gck_data_file_finalize (GObject *obj)
+gkm_data_file_finalize (GObject *obj)
 {
-	GckDataFile *self = GCK_DATA_FILE (obj);
+	GkmDataFile *self = GKM_DATA_FILE (obj);
 
 	g_assert (self->identifiers);
 	g_hash_table_destroy (self->identifiers);
 	self->identifiers = NULL;
-	
+
 	g_assert (self->checks == NULL);
-	
+
 	g_assert (self->publics);
 	g_hash_table_destroy (self->publics);
 	self->publics = NULL;
-	
+
 	if (self->privates)
 		g_hash_table_destroy (self->privates);
 	self->privates = NULL;
-	
+
 	free_unknown_block_list (self->unknowns);
 	self->unknowns = NULL;
-	
-	G_OBJECT_CLASS (gck_data_file_parent_class)->finalize (obj);
+
+	G_OBJECT_CLASS (gkm_data_file_parent_class)->finalize (obj);
 }
 
 static void
-gck_data_file_set_property (GObject *obj, guint prop_id, const GValue *value, 
+gkm_data_file_set_property (GObject *obj, guint prop_id, const GValue *value,
                                 GParamSpec *pspec)
 {
 	switch (prop_id) {
@@ -1094,7 +1094,7 @@ gck_data_file_set_property (GObject *obj, guint prop_id, const GValue *value,
 }
 
 static void
-gck_data_file_get_property (GObject *obj, guint prop_id, GValue *value, 
+gkm_data_file_get_property (GObject *obj, guint prop_id, GValue *value,
                                 GParamSpec *pspec)
 {
 	switch (prop_id) {
@@ -1105,49 +1105,49 @@ gck_data_file_get_property (GObject *obj, guint prop_id, GValue *value,
 }
 
 static void
-gck_data_file_class_init (GckDataFileClass *klass)
+gkm_data_file_class_init (GkmDataFileClass *klass)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-    
-	gobject_class->finalize = gck_data_file_finalize;
-	gobject_class->set_property = gck_data_file_set_property;
-	gobject_class->get_property = gck_data_file_get_property;
-
-	signals[ENTRY_ADDED] = g_signal_new ("entry-added", GCK_TYPE_DATA_FILE, 
-	                                G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GckDataFileClass, entry_added),
-	                                NULL, NULL, g_cclosure_marshal_VOID__STRING, 
+
+	gobject_class->finalize = gkm_data_file_finalize;
+	gobject_class->set_property = gkm_data_file_set_property;
+	gobject_class->get_property = gkm_data_file_get_property;
+
+	signals[ENTRY_ADDED] = g_signal_new ("entry-added", GKM_TYPE_DATA_FILE,
+	                                G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GkmDataFileClass, entry_added),
+	                                NULL, NULL, g_cclosure_marshal_VOID__STRING,
 	                                G_TYPE_NONE, 1, G_TYPE_STRING);
 
-	signals[ENTRY_CHANGED] = g_signal_new ("entry-changed", GCK_TYPE_DATA_FILE, 
-	                                G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GckDataFileClass, entry_changed),
-	                                NULL, NULL, gck_marshal_VOID__STRING_ULONG, 
+	signals[ENTRY_CHANGED] = g_signal_new ("entry-changed", GKM_TYPE_DATA_FILE,
+	                                G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GkmDataFileClass, entry_changed),
+	                                NULL, NULL, gkm_marshal_VOID__STRING_ULONG,
 	                                G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_ULONG);
 
-	signals[ENTRY_REMOVED] = g_signal_new ("entry-removed", GCK_TYPE_DATA_FILE, 
-	                                G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GckDataFileClass, entry_removed),
-	                                NULL, NULL, g_cclosure_marshal_VOID__STRING, 
+	signals[ENTRY_REMOVED] = g_signal_new ("entry-removed", GKM_TYPE_DATA_FILE,
+	                                G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GkmDataFileClass, entry_removed),
+	                                NULL, NULL, g_cclosure_marshal_VOID__STRING,
 	                                G_TYPE_NONE, 1, G_TYPE_STRING);
 }
 
 /* -----------------------------------------------------------------------------
- * PUBLIC 
+ * PUBLIC
  */
 
-GckDataFile*
-gck_data_file_new (void)
+GkmDataFile*
+gkm_data_file_new (void)
 {
-	return g_object_new (GCK_TYPE_DATA_FILE, NULL);
+	return g_object_new (GKM_TYPE_DATA_FILE, NULL);
 }
 
-GckDataResult
-gck_data_file_read_fd (GckDataFile *self, int fd, GckSecret *login)
+GkmDataResult
+gkm_data_file_read_fd (GkmDataFile *self, int fd, GkmSecret *login)
 {
-	GckDataResult res;
-	
-	g_return_val_if_fail (GCK_IS_DATA_FILE (self), GCK_DATA_FAILURE);
+	GkmDataResult res;
+
+	g_return_val_if_fail (GKM_IS_DATA_FILE (self), GKM_DATA_FAILURE);
 
 	/* Reads are not reentrant for a single data file */
-	g_return_val_if_fail (self->checks == NULL, GCK_DATA_FAILURE);
+	g_return_val_if_fail (self->checks == NULL, GKM_DATA_FAILURE);
 
 	self->sections = 0;
 
@@ -1158,81 +1158,81 @@ gck_data_file_read_fd (GckDataFile *self, int fd, GckSecret *login)
 	/* Setup a hash table to monitor the actual data read */
 	self->checks = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
 	g_hash_table_foreach (self->identifiers, copy_each_identifier, self->checks);
-	
+
 	res = parse_file_blocks (fd, update_from_any_block, login, self);
-	if (res == GCK_DATA_SUCCESS) {
-		
+	if (res == GKM_DATA_SUCCESS) {
+
 		/* Our last read was a success, can write */
 		self->incomplete = FALSE;
 
 		/* Remove the ones we didn't see */
 		g_hash_table_foreach (self->checks, remove_each_identifier, self);
 
-		/* 
+		/*
 		 * There's a special where we've read a file without a private section.
-		 * We should be ready to accept privates (and then lock them next 
-		 * time around). 
+		 * We should be ready to accept privates (and then lock them next
+		 * time around).
 		 */
-		
-		if (self->privates == NULL && !(self->sections & GCK_DATA_FILE_SECTION_PRIVATE))
+
+		if (self->privates == NULL && !(self->sections & GKM_DATA_FILE_SECTION_PRIVATE))
 			self->privates = entries_new ();
-		
+
 	/* Note that our last read failed */
 	} else {
 		self->incomplete = TRUE;
 	}
-	
+
 	g_hash_table_destroy (self->checks);
 	self->checks = NULL;
-	
+
 	return res;
 }
 
-GckDataResult
-gck_data_file_write_fd (GckDataFile *self, int fd, GckSecret *login)
+GkmDataResult
+gkm_data_file_write_fd (GkmDataFile *self, int fd, GkmSecret *login)
 {
 	guint types[3] = { FILE_BLOCK_INDEX, FILE_BLOCK_PRIVATE, FILE_BLOCK_PUBLIC };
 	GList *unknowns, *unk;
 	UnknownBlock *block;
-	GckDataResult res;
+	GkmDataResult res;
 	EggBuffer buffer;
 	guint type;
 	gint i;
-	
-	g_return_val_if_fail (GCK_IS_DATA_FILE (self), GCK_DATA_FAILURE);
-	g_return_val_if_fail (!self->incomplete, GCK_DATA_FAILURE);
+
+	g_return_val_if_fail (GKM_IS_DATA_FILE (self), GKM_DATA_FAILURE);
+	g_return_val_if_fail (!self->incomplete, GKM_DATA_FAILURE);
 
 	/* Write out the header */
 	if (!write_all_bytes (fd, FILE_HEADER, FILE_HEADER_LEN))
-		return GCK_DATA_FAILURE;
+		return GKM_DATA_FAILURE;
 
 	unknowns = g_list_copy (self->unknowns);
 	unknowns = g_list_sort (unknowns, sort_unknowns_by_type);
 	egg_buffer_init_full (&buffer, 8192, PUBLIC_ALLOC);
 
-	/* 
+	/*
 	 * All blocks are written in sorted order by their block
-	 * type. This includes unknown blocks. 
+	 * type. This includes unknown blocks.
 	 */
 
 	unk = unknowns;
-	res = GCK_DATA_SUCCESS;
-	
+	res = GKM_DATA_SUCCESS;
+
 	for (i = 0; i < G_N_ELEMENTS(types); ++i) {
 		type = types[i];
-		
+
 		/* Write out all the unknowns before this block */
-		while (unk != NULL && res == GCK_DATA_SUCCESS) {
+		while (unk != NULL && res == GKM_DATA_SUCCESS) {
 			block = (UnknownBlock*)unk->data;
 			if (block->type > type)
 				break;
 			res = write_file_block (fd, block->type, &block->buffer);
 			unk = g_list_next (unk);
 		}
-		
-		if (res != GCK_DATA_SUCCESS)
+
+		if (res != GKM_DATA_SUCCESS)
 			break;
-		
+
 		/* Prepare the block of this type */
 		egg_buffer_reset (&buffer);
 		switch (type) {
@@ -1246,233 +1246,233 @@ gck_data_file_write_fd (GckDataFile *self, int fd, GckSecret *login)
 			res = write_public_to_block (self, &buffer);
 			break;
 		}
-		
+
 		/* Write it out, if we got anything */
-		if (res == GCK_DATA_SUCCESS)
+		if (res == GKM_DATA_SUCCESS)
 			res = write_file_block (fd, type, &buffer);
-		else if (res == GCK_DATA_UNRECOGNIZED)
-			res = GCK_DATA_SUCCESS;
-		
-		if (res != GCK_DATA_SUCCESS)
+		else if (res == GKM_DATA_UNRECOGNIZED)
+			res = GKM_DATA_SUCCESS;
+
+		if (res != GKM_DATA_SUCCESS)
 			break;
 	}
-	
+
 	/* Write out all remaining unknowns */
-	while (unk != NULL && res == GCK_DATA_SUCCESS) {
+	while (unk != NULL && res == GKM_DATA_SUCCESS) {
 		block = (UnknownBlock*)unk->data;
 		res = write_file_block (fd, block->type, &block->buffer);
 		unk = g_list_next (unk);
 	}
-	
+
 	g_list_free (unknowns);
 	egg_buffer_uninit (&buffer);
 	return res;
 }
 
 gboolean
-gck_data_file_lookup_entry (GckDataFile *self, const gchar *identifier, guint *section)
+gkm_data_file_lookup_entry (GkmDataFile *self, const gchar *identifier, guint *section)
 {
 	gpointer value;
-	
-	g_return_val_if_fail (GCK_IS_DATA_FILE (self), FALSE);
+
+	g_return_val_if_fail (GKM_IS_DATA_FILE (self), FALSE);
 	g_return_val_if_fail (identifier, FALSE);
-	
+
 	if (!g_hash_table_lookup_extended (self->identifiers, identifier, NULL, &value))
 		return FALSE;
-	
+
 	if (section != NULL)
 		*section = GPOINTER_TO_UINT (value);
-	
+
 	return TRUE;
 }
 
 void
-gck_data_file_foreach_entry (GckDataFile *self, GckDataFileFunc func, gpointer user_data)
+gkm_data_file_foreach_entry (GkmDataFile *self, GkmDataFileFunc func, gpointer user_data)
 {
 	ForeachArgs args = { self, func, user_data };
-	
-	g_return_if_fail (GCK_IS_DATA_FILE (self));
+
+	g_return_if_fail (GKM_IS_DATA_FILE (self));
 	g_return_if_fail (func);
-	
+
 	g_hash_table_foreach (self->identifiers, foreach_identifier, &args);
 }
 
-GckDataResult
-gck_data_file_unique_entry (GckDataFile *self, gchar **identifier)
+GkmDataResult
+gkm_data_file_unique_entry (GkmDataFile *self, gchar **identifier)
 {
 	gchar *base, *ext;
 	guint seed = 1;
-	
-	g_return_val_if_fail (GCK_IS_DATA_FILE (self), GCK_DATA_FAILURE);
-	g_return_val_if_fail (identifier, GCK_DATA_FAILURE);
+
+	g_return_val_if_fail (GKM_IS_DATA_FILE (self), GKM_DATA_FAILURE);
+	g_return_val_if_fail (identifier, GKM_DATA_FAILURE);
 
 	/* Check if original is unique */
 	if (*identifier != NULL) {
-		if (!gck_data_file_lookup_entry (self, *identifier, NULL))
-			return GCK_DATA_SUCCESS;
+		if (!gkm_data_file_lookup_entry (self, *identifier, NULL))
+			return GKM_DATA_SUCCESS;
 	}
 
 	if (*identifier == NULL)
 		*identifier = g_strdup_printf ("object-%08x", ABS (g_random_int ()));
-	
+
 	/* Take ownership of the identifier, and out an extension */
 	base = *identifier;
 	*identifier = NULL;
 	ext = strrchr (base, '.');
 	if (ext != NULL)
 		*(ext++) = '\0';
-	
+
 	for (seed = 0; TRUE; ++seed) {
 		*identifier = g_strdup_printf ("%s-%d%s%s", base, seed, ext ? "." : "", ext ? ext : "");
-		if (!gck_data_file_lookup_entry (self, *identifier, NULL))
+		if (!gkm_data_file_lookup_entry (self, *identifier, NULL))
 			break;
-		
+
 		if (seed < 1000000) {
 			g_warning ("couldn't find a unique identifier in a %d tries", seed);
 			g_free (base);
-			return GCK_DATA_FAILURE;
+			return GKM_DATA_FAILURE;
 		}
-		
+
 		g_free (*identifier);
 		*identifier = NULL;
 	}
-	
+
 	g_free (base);
-	return GCK_DATA_SUCCESS;
+	return GKM_DATA_SUCCESS;
 }
 
-GckDataResult
-gck_data_file_create_entry (GckDataFile *self, const gchar *identifier, guint section)
+GkmDataResult
+gkm_data_file_create_entry (GkmDataFile *self, const gchar *identifier, guint section)
 {
 	GHashTable *attributes;
 	GHashTable *entries;
-	
-	g_return_val_if_fail (GCK_IS_DATA_FILE (self), GCK_DATA_FAILURE);
-	g_return_val_if_fail (identifier, GCK_DATA_FAILURE);
-	
-	if (section == GCK_DATA_FILE_SECTION_PRIVATE) {
+
+	g_return_val_if_fail (GKM_IS_DATA_FILE (self), GKM_DATA_FAILURE);
+	g_return_val_if_fail (identifier, GKM_DATA_FAILURE);
+
+	if (section == GKM_DATA_FILE_SECTION_PRIVATE) {
 		if (!self->privates)
-			return GCK_DATA_LOCKED;
+			return GKM_DATA_LOCKED;
 		entries = self->privates;
 	} else {
 		entries = self->publics;
 	}
 
 	/* Make sure it's not already here */
-	g_return_val_if_fail (g_hash_table_lookup (entries, identifier) == NULL, GCK_DATA_FAILURE);
-	
+	g_return_val_if_fail (g_hash_table_lookup (entries, identifier) == NULL, GKM_DATA_FAILURE);
+
 	/* Add the new entry to the appropriate table */
 	attributes = attributes_new ();
 	g_hash_table_replace (entries, g_strdup (identifier), attributes);
 	g_hash_table_replace (self->identifiers, g_strdup (identifier), GUINT_TO_POINTER (section));
 
 	g_signal_emit (self, signals[ENTRY_ADDED], 0, identifier);
-	return GCK_DATA_SUCCESS;
+	return GKM_DATA_SUCCESS;
 }
 
-GckDataResult
-gck_data_file_destroy_entry (GckDataFile *self, const gchar *identifier)
+GkmDataResult
+gkm_data_file_destroy_entry (GkmDataFile *self, const gchar *identifier)
 {
 	GHashTable *entries;
 	guint section;
-	
-	g_return_val_if_fail (GCK_IS_DATA_FILE (self), GCK_DATA_FAILURE);
-	g_return_val_if_fail (identifier, GCK_DATA_FAILURE);
-
-	if (!gck_data_file_lookup_entry (self, identifier, &section))
-		return GCK_DATA_UNRECOGNIZED;
-		
-	if (section == GCK_DATA_FILE_SECTION_PRIVATE) {
+
+	g_return_val_if_fail (GKM_IS_DATA_FILE (self), GKM_DATA_FAILURE);
+	g_return_val_if_fail (identifier, GKM_DATA_FAILURE);
+
+	if (!gkm_data_file_lookup_entry (self, identifier, &section))
+		return GKM_DATA_UNRECOGNIZED;
+
+	if (section == GKM_DATA_FILE_SECTION_PRIVATE) {
 		if (!self->privates)
-			return GCK_DATA_LOCKED;
+			return GKM_DATA_LOCKED;
 		entries = self->privates;
 	} else {
 		entries = self->publics;
 	}
 
 	if (!g_hash_table_remove (self->identifiers, identifier))
-		g_return_val_if_reached (GCK_DATA_UNRECOGNIZED);
+		g_return_val_if_reached (GKM_DATA_UNRECOGNIZED);
 	if (!g_hash_table_remove (entries, identifier))
-		g_return_val_if_reached (GCK_DATA_UNRECOGNIZED);
-	
+		g_return_val_if_reached (GKM_DATA_UNRECOGNIZED);
+
 	g_signal_emit (self, signals[ENTRY_REMOVED], 0, identifier);
-	return GCK_DATA_SUCCESS;
+	return GKM_DATA_SUCCESS;
 }
 
-GckDataResult
-gck_data_file_write_value (GckDataFile *self, const gchar *identifier,
+GkmDataResult
+gkm_data_file_write_value (GkmDataFile *self, const gchar *identifier,
                            gulong type, gconstpointer value, gsize n_value)
 {
 	GHashTable *attributes;
 	CK_ATTRIBUTE_PTR at;
 	CK_ATTRIBUTE attr;
-	GckDataResult res;
+	GkmDataResult res;
 
-	g_return_val_if_fail (GCK_IS_DATA_FILE (self), GCK_DATA_FAILURE);
-	g_return_val_if_fail (identifier, GCK_DATA_FAILURE);
-	g_return_val_if_fail (value || !n_value, GCK_DATA_FAILURE);
+	g_return_val_if_fail (GKM_IS_DATA_FILE (self), GKM_DATA_FAILURE);
+	g_return_val_if_fail (identifier, GKM_DATA_FAILURE);
+	g_return_val_if_fail (value || !n_value, GKM_DATA_FAILURE);
 
 	/* Find the right set of attributes */
 	res = identifier_to_attributes (self, identifier, &attributes);
-	if (res != GCK_DATA_SUCCESS)
+	if (res != GKM_DATA_SUCCESS)
 		return res;
 
 	attr.type = type;
 	attr.pValue = (void*)value;
 	attr.ulValueLen = n_value;
-	
+
 	at = g_hash_table_lookup (attributes, &type);
-	if (at != NULL && gck_attribute_equal (at, &attr))
-		return GCK_DATA_SUCCESS;
-	
+	if (at != NULL && gkm_attribute_equal (at, &attr))
+		return GKM_DATA_SUCCESS;
+
 	at = attribute_dup (&attr);
 	g_hash_table_replace (attributes, &(at->type), at);
-	
+
 	g_signal_emit (self, signals[ENTRY_CHANGED], 0, identifier, type);
-	return GCK_DATA_SUCCESS;
+	return GKM_DATA_SUCCESS;
 }
 
-GckDataResult
-gck_data_file_read_value (GckDataFile *self, const gchar *identifier,
+GkmDataResult
+gkm_data_file_read_value (GkmDataFile *self, const gchar *identifier,
                           gulong type, gconstpointer *value, gsize *n_value)
 {
 	CK_ATTRIBUTE_PTR attr;
 	GHashTable *attributes;
-	GckDataResult res;
+	GkmDataResult res;
 
-	g_return_val_if_fail (GCK_IS_DATA_FILE (self), GCK_DATA_FAILURE);
-	g_return_val_if_fail (identifier, GCK_DATA_FAILURE);
-	g_return_val_if_fail (value, GCK_DATA_FAILURE);
-	g_return_val_if_fail (n_value, GCK_DATA_FAILURE);
+	g_return_val_if_fail (GKM_IS_DATA_FILE (self), GKM_DATA_FAILURE);
+	g_return_val_if_fail (identifier, GKM_DATA_FAILURE);
+	g_return_val_if_fail (value, GKM_DATA_FAILURE);
+	g_return_val_if_fail (n_value, GKM_DATA_FAILURE);
 
 	/* Find the right set of attributes */
 	res = identifier_to_attributes (self, identifier, &attributes);
-	if (res != GCK_DATA_SUCCESS)
+	if (res != GKM_DATA_SUCCESS)
 		return res;
-	
+
 	attr = g_hash_table_lookup (attributes, &type);
 	if (attr == NULL)
-		return GCK_DATA_UNRECOGNIZED;
-	
+		return GKM_DATA_UNRECOGNIZED;
+
 	g_assert (attr->type == type);
 	*value = attr->pValue;
 	*n_value = attr->ulValueLen;
-	return GCK_DATA_SUCCESS;	
+	return GKM_DATA_SUCCESS;
 }
 
 gboolean
-gck_data_file_have_section (GckDataFile *self, guint section)
+gkm_data_file_have_section (GkmDataFile *self, guint section)
 {
 	return (self->sections & section) ? TRUE : FALSE;
 }
 
 void
-gck_data_file_dump (GckDataFile *self)
+gkm_data_file_dump (GkmDataFile *self)
 {
 	g_print ("PUBLIC:\n\n");
-	gck_data_file_foreach_entry (self, dump_identifier_and_attributes, 
-	                             GUINT_TO_POINTER (GCK_DATA_FILE_SECTION_PUBLIC));	
+	gkm_data_file_foreach_entry (self, dump_identifier_and_attributes,
+	                             GUINT_TO_POINTER (GKM_DATA_FILE_SECTION_PUBLIC));
 	g_print ("PRIVATE:\n\n");
-	gck_data_file_foreach_entry (self, dump_identifier_and_attributes, 
-	                             GUINT_TO_POINTER (GCK_DATA_FILE_SECTION_PRIVATE));	
+	gkm_data_file_foreach_entry (self, dump_identifier_and_attributes,
+	                             GUINT_TO_POINTER (GKM_DATA_FILE_SECTION_PRIVATE));
 }
diff --git a/pkcs11/gck/gck-data-file.h b/pkcs11/gkm/gkm-data-file.h
similarity index 52%
rename from pkcs11/gck/gck-data-file.h
rename to pkcs11/gkm/gkm-data-file.h
index 40f342e..c55f47b 100644
--- a/pkcs11/gck/gck-data-file.h
+++ b/pkcs11/gkm/gkm-data-file.h
@@ -1,109 +1,109 @@
-/* 
+/*
  * 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.
  */
 
-#ifndef __GCK_DATA_FILE_H__
-#define __GCK_DATA_FILE_H__
+#ifndef __GKM_DATA_FILE_H__
+#define __GKM_DATA_FILE_H__
 
 #include <glib-object.h>
 
-#include "gck-data-types.h"
-#include "gck-secret.h"
+#include "gkm-data-types.h"
+#include "gkm-secret.h"
 
 enum {
-	GCK_DATA_FILE_SECTION_PUBLIC  = 0x01,
-	GCK_DATA_FILE_SECTION_PRIVATE = 0x02,
+	GKM_DATA_FILE_SECTION_PUBLIC  = 0x01,
+	GKM_DATA_FILE_SECTION_PRIVATE = 0x02,
 };
 
-#define GCK_TYPE_DATA_FILE               (gck_data_file_get_type ())
-#define GCK_DATA_FILE(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCK_TYPE_DATA_FILE, GckDataFile))
-#define GCK_DATA_FILE_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GCK_TYPE_DATA_FILE, GckDataFileClass))
-#define GCK_IS_DATA_FILE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCK_TYPE_DATA_FILE))
-#define GCK_IS_DATA_FILE_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GCK_TYPE_DATA_FILE))
-#define GCK_DATA_FILE_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GCK_TYPE_DATA_FILE, GckDataFileClass))
-
-typedef struct _GckDataFile GckDataFile;
-typedef struct _GckDataFileClass GckDataFileClass;
-    
-struct _GckDataFileClass {
+#define GKM_TYPE_DATA_FILE               (gkm_data_file_get_type ())
+#define GKM_DATA_FILE(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_DATA_FILE, GkmDataFile))
+#define GKM_DATA_FILE_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_DATA_FILE, GkmDataFileClass))
+#define GKM_IS_DATA_FILE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_DATA_FILE))
+#define GKM_IS_DATA_FILE_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_DATA_FILE))
+#define GKM_DATA_FILE_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_DATA_FILE, GkmDataFileClass))
+
+typedef struct _GkmDataFile GkmDataFile;
+typedef struct _GkmDataFileClass GkmDataFileClass;
+
+struct _GkmDataFileClass {
 	GObjectClass parent_class;
-	
+
 	/* signals */
-	
-	void (*entry_added) (GckDataFile *store, const gchar *identifier);
-	
-	void (*entry_changed) (GckDataFile *store, const gchar *identifier, CK_ATTRIBUTE_TYPE type);
-	
-	void (*entry_removed) (GckDataFile *store, const gchar *identifier);
+
+	void (*entry_added) (GkmDataFile *store, const gchar *identifier);
+
+	void (*entry_changed) (GkmDataFile *store, const gchar *identifier, CK_ATTRIBUTE_TYPE type);
+
+	void (*entry_removed) (GkmDataFile *store, const gchar *identifier);
 };
 
-typedef void (*GckDataFileFunc) (GckDataFile *file, const gchar *identifier, gpointer user_data);
+typedef void (*GkmDataFileFunc) (GkmDataFile *file, const gchar *identifier, gpointer user_data);
 
-GType                     gck_data_file_get_type               (void);
+GType                     gkm_data_file_get_type               (void);
 
-GckDataFile*              gck_data_file_new                    (void);
+GkmDataFile*              gkm_data_file_new                    (void);
 
-GckDataResult             gck_data_file_read_fd                (GckDataFile *self,
-                                                                int fd, 
-                                                                GckSecret *login);
+GkmDataResult             gkm_data_file_read_fd                (GkmDataFile *self,
+                                                                int fd,
+                                                                GkmSecret *login);
 
-GckDataResult             gck_data_file_write_fd               (GckDataFile *self,
-                                                                int fd, 
-                                                                GckSecret *login);
+GkmDataResult             gkm_data_file_write_fd               (GkmDataFile *self,
+                                                                int fd,
+                                                                GkmSecret *login);
 
-gboolean                  gck_data_file_have_section           (GckDataFile *self,
+gboolean                  gkm_data_file_have_section           (GkmDataFile *self,
                                                                 guint section);
 
-gboolean                  gck_data_file_lookup_entry           (GckDataFile *self,
+gboolean                  gkm_data_file_lookup_entry           (GkmDataFile *self,
                                                                 const gchar *identifier,
                                                                 guint *section);
 
-void                      gck_data_file_foreach_entry          (GckDataFile *self,
-                                                                GckDataFileFunc func,
+void                      gkm_data_file_foreach_entry          (GkmDataFile *self,
+                                                                GkmDataFileFunc func,
                                                                 gpointer user_data);
 
-GckDataResult             gck_data_file_unique_entry           (GckDataFile *self,
+GkmDataResult             gkm_data_file_unique_entry           (GkmDataFile *self,
                                                                 gchar **identifier);
 
-GckDataResult             gck_data_file_create_entry           (GckDataFile *self, 
+GkmDataResult             gkm_data_file_create_entry           (GkmDataFile *self,
                                                                 const gchar *identifier,
                                                                 guint section);
 
-GckDataResult             gck_data_file_destroy_entry          (GckDataFile *self, 
+GkmDataResult             gkm_data_file_destroy_entry          (GkmDataFile *self,
                                                                 const gchar *identifier);
 
-GckDataResult             gck_data_file_write_value            (GckDataFile *self,
+GkmDataResult             gkm_data_file_write_value            (GkmDataFile *self,
                                                                 const gchar *identifier,
                                                                 gulong type,
                                                                 gconstpointer value,
                                                                 gsize n_value);
 
-GckDataResult             gck_data_file_read_value             (GckDataFile *self,
+GkmDataResult             gkm_data_file_read_value             (GkmDataFile *self,
                                                                 const gchar *identifier,
                                                                 gulong type,
                                                                 gconstpointer *value,
                                                                 gsize *n_value);
 
-void                      gck_data_file_foreach_value          (GckDataFile *self,
+void                      gkm_data_file_foreach_value          (GkmDataFile *self,
                                                                 const gchar *identifier);
-     
-void                      gck_data_file_dump                   (GckDataFile *self);
 
-#endif /* __GCK_DATA_FILE_H__ */
+void                      gkm_data_file_dump                   (GkmDataFile *self);
+
+#endif /* __GKM_DATA_FILE_H__ */
diff --git a/pkcs11/gkm/gkm-data-types.h b/pkcs11/gkm/gkm-data-types.h
new file mode 100644
index 0000000..f7f83dd
--- /dev/null
+++ b/pkcs11/gkm/gkm-data-types.h
@@ -0,0 +1,15 @@
+#ifndef GKM_DATA_H_
+#define GKM_DATA_H_
+
+#include <glib.h>
+
+typedef enum _GkmDataResult {
+	GKM_DATA_FAILURE = -2,
+	GKM_DATA_LOCKED = -1,
+	GKM_DATA_UNRECOGNIZED = 0,
+	GKM_DATA_SUCCESS = 1
+} GkmDataResult;
+
+#define  GKM_DATA_ERROR      (g_quark_from_static_string ("gkm-data-error"))
+
+#endif /* GKM_DATA_H_ */
diff --git a/pkcs11/gck/gck-dh-key.c b/pkcs11/gkm/gkm-dh-key.c
similarity index 56%
rename from pkcs11/gck/gck-dh-key.c
rename to pkcs11/gkm/gkm-dh-key.c
index a4e7d86..931b3ba 100644
--- a/pkcs11/gck/gck-dh-key.c
+++ b/pkcs11/gkm/gkm-dh-key.c
@@ -23,21 +23,21 @@
 
 #include "pkcs11/pkcs11.h"
 
-#include "gck-attributes.h"
-#include "gck-crypto.h"
-#include "gck-dh-key.h"
-#include "gck-dh-mechanism.h"
-#include "gck-session.h"
-#include "gck-util.h"
-
-struct _GckDhKeyPrivate {
+#include "gkm-attributes.h"
+#include "gkm-crypto.h"
+#include "gkm-dh-key.h"
+#include "gkm-dh-mechanism.h"
+#include "gkm-session.h"
+#include "gkm-util.h"
+
+struct _GkmDhKeyPrivate {
 	gcry_mpi_t prime;
 	gcry_mpi_t base;
 	gpointer id;
 	gsize n_id;
 };
 
-G_DEFINE_TYPE (GckDhKey, gck_dh_key, GCK_TYPE_OBJECT);
+G_DEFINE_TYPE (GkmDhKey, gkm_dh_key, GKM_TYPE_OBJECT);
 
 /* -----------------------------------------------------------------------------
  * INTERNAL
@@ -48,56 +48,56 @@ G_DEFINE_TYPE (GckDhKey, gck_dh_key, GCK_TYPE_OBJECT);
  */
 
 static CK_RV
-gck_dh_key_real_get_attribute (GckObject *base, GckSession *session, CK_ATTRIBUTE* attr)
+gkm_dh_key_real_get_attribute (GkmObject *base, GkmSession *session, CK_ATTRIBUTE* attr)
 {
-	GckDhKey *self = GCK_DH_KEY (base);
+	GkmDhKey *self = GKM_DH_KEY (base);
 
 	switch (attr->type)
 	{
 
 	case CKA_KEY_TYPE:
-		return gck_attribute_set_ulong (attr, CKK_DH);
+		return gkm_attribute_set_ulong (attr, CKK_DH);
 
 	case CKA_START_DATE:
 	case CKA_END_DATE:
-		return gck_attribute_set_empty (attr);
+		return gkm_attribute_set_empty (attr);
 
 	case CKA_LOCAL:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_KEY_GEN_MECHANISM:
-		return gck_attribute_set_ulong (attr, CK_UNAVAILABLE_INFORMATION);
+		return gkm_attribute_set_ulong (attr, CK_UNAVAILABLE_INFORMATION);
 
 	case CKA_ALLOWED_MECHANISMS:
-		return gck_attribute_set_data (attr, (CK_VOID_PTR)GCK_DH_MECHANISMS,
-		                               sizeof (GCK_DH_MECHANISMS));
+		return gkm_attribute_set_data (attr, (CK_VOID_PTR)GKM_DH_MECHANISMS,
+		                               sizeof (GKM_DH_MECHANISMS));
 
 	case CKA_ID:
-		return gck_attribute_set_data (attr, self->pv->id, self->pv->n_id);
+		return gkm_attribute_set_data (attr, self->pv->id, self->pv->n_id);
 
 	case CKA_SUBJECT:
-		return gck_attribute_set_empty (attr);
+		return gkm_attribute_set_empty (attr);
 
 	case CKA_PRIME:
-		return gck_attribute_set_mpi (attr, self->pv->prime);
+		return gkm_attribute_set_mpi (attr, self->pv->prime);
 
 	case CKA_BASE:
-		return gck_attribute_set_mpi (attr, self->pv->base);
+		return gkm_attribute_set_mpi (attr, self->pv->base);
 	};
 
-	return GCK_OBJECT_CLASS (gck_dh_key_parent_class)->get_attribute (base, session, attr);
+	return GKM_OBJECT_CLASS (gkm_dh_key_parent_class)->get_attribute (base, session, attr);
 }
 
 static void
-gck_dh_key_init (GckDhKey *self)
+gkm_dh_key_init (GkmDhKey *self)
 {
-	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GCK_TYPE_DH_KEY, GckDhKeyPrivate);
+	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GKM_TYPE_DH_KEY, GkmDhKeyPrivate);
 }
 
 static void
-gck_dh_key_finalize (GObject *obj)
+gkm_dh_key_finalize (GObject *obj)
 {
-	GckDhKey *self = GCK_DH_KEY (obj);
+	GkmDhKey *self = GKM_DH_KEY (obj);
 
 	gcry_mpi_release (self->pv->prime);
 	self->pv->prime = NULL;
@@ -109,22 +109,22 @@ gck_dh_key_finalize (GObject *obj)
 	self->pv->id = NULL;
 	self->pv->n_id = 0;
 
-	G_OBJECT_CLASS (gck_dh_key_parent_class)->finalize (obj);
+	G_OBJECT_CLASS (gkm_dh_key_parent_class)->finalize (obj);
 }
 
 static void
-gck_dh_key_class_init (GckDhKeyClass *klass)
+gkm_dh_key_class_init (GkmDhKeyClass *klass)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	GckObjectClass *gck_class = GCK_OBJECT_CLASS (klass);
+	GkmObjectClass *gkm_class = GKM_OBJECT_CLASS (klass);
 
-	gck_dh_key_parent_class = g_type_class_peek_parent (klass);
+	gkm_dh_key_parent_class = g_type_class_peek_parent (klass);
 
-	gobject_class->finalize = gck_dh_key_finalize;
+	gobject_class->finalize = gkm_dh_key_finalize;
 
-	gck_class->get_attribute = gck_dh_key_real_get_attribute;
+	gkm_class->get_attribute = gkm_dh_key_real_get_attribute;
 
-	g_type_class_add_private (klass, sizeof (GckDhKeyPrivate));
+	g_type_class_add_private (klass, sizeof (GkmDhKeyPrivate));
 }
 
 /* -----------------------------------------------------------------------------
@@ -132,10 +132,10 @@ gck_dh_key_class_init (GckDhKeyClass *klass)
  */
 
 void
-gck_dh_key_initialize (GckDhKey *self, gcry_mpi_t prime, gcry_mpi_t base,
+gkm_dh_key_initialize (GkmDhKey *self, gcry_mpi_t prime, gcry_mpi_t base,
                        gpointer id, gsize n_id)
 {
-	g_return_if_fail (GCK_IS_DH_KEY (self));
+	g_return_if_fail (GKM_IS_DH_KEY (self));
 	g_return_if_fail (base);
 	g_return_if_fail (prime);
 	g_return_if_fail (!self->pv->base);
@@ -148,8 +148,8 @@ gck_dh_key_initialize (GckDhKey *self, gcry_mpi_t prime, gcry_mpi_t base,
 }
 
 gcry_mpi_t
-gck_dh_key_get_prime (GckDhKey *self)
+gkm_dh_key_get_prime (GkmDhKey *self)
 {
-	g_return_val_if_fail (GCK_IS_DH_KEY (self), NULL);
+	g_return_val_if_fail (GKM_IS_DH_KEY (self), NULL);
 	return self->pv->prime;
 }
diff --git a/pkcs11/gck/gck-dh-key.h b/pkcs11/gkm/gkm-dh-key.h
similarity index 51%
rename from pkcs11/gck/gck-dh-key.h
rename to pkcs11/gkm/gkm-dh-key.h
index 17c0707..976386b 100644
--- a/pkcs11/gck/gck-dh-key.h
+++ b/pkcs11/gkm/gkm-dh-key.h
@@ -19,41 +19,41 @@
  * 02111-1307, USA.
  */
 
-#ifndef __GCK_DH_KEY_H__
-#define __GCK_DH_KEY_H__
+#ifndef __GKM_DH_KEY_H__
+#define __GKM_DH_KEY_H__
 
 #include <glib-object.h>
 
-#include "gck-object.h"
-#include "gck-types.h"
+#include "gkm-object.h"
+#include "gkm-types.h"
 
-#define GCK_TYPE_DH_KEY               (gck_dh_key_get_type ())
-#define GCK_DH_KEY(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCK_TYPE_DH_KEY, GckDhKey))
-#define GCK_DH_KEY_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GCK_TYPE_DH_KEY, GckDhKeyClass))
-#define GCK_IS_DH_KEY(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCK_TYPE_DH_KEY))
-#define GCK_IS_DH_KEY_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GCK_TYPE_DH_KEY))
-#define GCK_DH_KEY_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GCK_TYPE_DH_KEY, GckDhKeyClass))
+#define GKM_TYPE_DH_KEY               (gkm_dh_key_get_type ())
+#define GKM_DH_KEY(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_DH_KEY, GkmDhKey))
+#define GKM_DH_KEY_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_DH_KEY, GkmDhKeyClass))
+#define GKM_IS_DH_KEY(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_DH_KEY))
+#define GKM_IS_DH_KEY_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_DH_KEY))
+#define GKM_DH_KEY_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_DH_KEY, GkmDhKeyClass))
 
-typedef struct _GckDhKeyClass GckDhKeyClass;
-typedef struct _GckDhKeyPrivate GckDhKeyPrivate;
+typedef struct _GkmDhKeyClass GkmDhKeyClass;
+typedef struct _GkmDhKeyPrivate GkmDhKeyPrivate;
 
-struct _GckDhKey {
-	GckObject parent;
-	GckDhKeyPrivate *pv;
+struct _GkmDhKey {
+	GkmObject parent;
+	GkmDhKeyPrivate *pv;
 };
 
-struct _GckDhKeyClass {
-	GckObjectClass parent_class;
+struct _GkmDhKeyClass {
+	GkmObjectClass parent_class;
 };
 
-GType                     gck_dh_key_get_type           (void);
+GType                     gkm_dh_key_get_type           (void);
 
-void                      gck_dh_key_initialize         (GckDhKey *self,
+void                      gkm_dh_key_initialize         (GkmDhKey *self,
                                                          gcry_mpi_t prime,
                                                          gcry_mpi_t base,
                                                          gpointer id,
                                                          gsize n_id);
 
-gcry_mpi_t                gck_dh_key_get_prime          (GckDhKey *self);
+gcry_mpi_t                gkm_dh_key_get_prime          (GkmDhKey *self);
 
-#endif /* __GCK_DH_KEY_H__ */
+#endif /* __GKM_DH_KEY_H__ */
diff --git a/pkcs11/gck/gck-dh-mechanism.c b/pkcs11/gkm/gkm-dh-mechanism.c
similarity index 76%
rename from pkcs11/gck/gck-dh-mechanism.c
rename to pkcs11/gkm/gkm-dh-mechanism.c
index d2a559a..5b29ac3 100644
--- a/pkcs11/gck/gck-dh-mechanism.c
+++ b/pkcs11/gkm/gkm-dh-mechanism.c
@@ -21,25 +21,25 @@
 
 #include "config.h"
 
-#include "gck-attributes.h"
-#include "gck-crypto.h"
-#include "gck-dh-mechanism.h"
-#include "gck-dh-private-key.h"
-#include "gck-session.h"
-#include "gck-transaction.h"
+#include "gkm-attributes.h"
+#include "gkm-crypto.h"
+#include "gkm-dh-mechanism.h"
+#include "gkm-dh-private-key.h"
+#include "gkm-session.h"
+#include "gkm-transaction.h"
 
 #include "egg/egg-dh.h"
 #include "egg/egg-libgcrypt.h"
 #include "egg/egg-secure-memory.h"
 
-static GckObject*
-create_dh_object (GckSession *session, GckTransaction *transaction, CK_OBJECT_CLASS klass,
+static GkmObject*
+create_dh_object (GkmSession *session, GkmTransaction *transaction, CK_OBJECT_CLASS klass,
                   CK_ATTRIBUTE_PTR value, CK_ATTRIBUTE_PTR prime, CK_ATTRIBUTE_PTR base,
                   CK_ATTRIBUTE_PTR id, CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
 {
 	CK_KEY_TYPE type = CKK_DH;
 	CK_ATTRIBUTE attr;
-	GckObject *object;
+	GkmObject *object;
 	GArray *array;
 
 	array = g_array_new (FALSE, TRUE, sizeof (CK_ATTRIBUTE));
@@ -70,7 +70,7 @@ create_dh_object (GckSession *session, GckTransaction *transaction, CK_OBJECT_CL
 	g_array_append_val (array, *id);
 
 	/* Create the public key object */
-	object = gck_session_create_object_for_attributes (session, transaction,
+	object = gkm_session_create_object_for_attributes (session, transaction,
 	                                                   (CK_ATTRIBUTE_PTR)array->data, array->len);
 
 	g_array_free (array, TRUE);
@@ -78,10 +78,10 @@ create_dh_object (GckSession *session, GckTransaction *transaction, CK_OBJECT_CL
 }
 
 CK_RV
-gck_dh_mechanism_generate (GckSession *session, CK_ATTRIBUTE_PTR pub_atts,
+gkm_dh_mechanism_generate (GkmSession *session, CK_ATTRIBUTE_PTR pub_atts,
                            CK_ULONG n_pub_atts, CK_ATTRIBUTE_PTR priv_atts,
-                           CK_ULONG n_priv_atts, GckObject **pub_key,
-                           GckObject **priv_key)
+                           CK_ULONG n_priv_atts, GkmObject **pub_key,
+                           GkmObject **priv_key)
 {
 	gcry_mpi_t prime = NULL;
 	gcry_mpi_t base = NULL;
@@ -91,37 +91,37 @@ gck_dh_mechanism_generate (GckSession *session, CK_ATTRIBUTE_PTR pub_atts,
 	CK_ATTRIBUTE value, id;
 	CK_ATTRIBUTE_PTR aprime;
 	CK_ATTRIBUTE_PTR abase;
-	GckTransaction *transaction;
+	GkmTransaction *transaction;
 	gboolean ret;
 	gsize length;
 	gulong bits;
 	CK_RV rv;
 
-	g_return_val_if_fail (GCK_IS_SESSION (session), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (GKM_IS_SESSION (session), CKR_GENERAL_ERROR);
 	g_return_val_if_fail (pub_key, CKR_GENERAL_ERROR);
 	g_return_val_if_fail (priv_key, CKR_GENERAL_ERROR);
 
 	*priv_key = NULL;
 	*pub_key = NULL;
 
-	aprime = gck_attributes_find (pub_atts, n_pub_atts, CKA_PRIME);
-	abase = gck_attributes_find (pub_atts, n_pub_atts, CKA_BASE);
+	aprime = gkm_attributes_find (pub_atts, n_pub_atts, CKA_PRIME);
+	abase = gkm_attributes_find (pub_atts, n_pub_atts, CKA_BASE);
 	if (!aprime || !abase)
 		return CKR_TEMPLATE_INCOMPLETE;
 
-	rv = gck_attribute_get_mpi (aprime, &prime);
+	rv = gkm_attribute_get_mpi (aprime, &prime);
 	if (rv != CKR_OK)
 		return rv;
 
-	rv = gck_attribute_get_mpi (abase, &base);
+	rv = gkm_attribute_get_mpi (abase, &base);
 	if (rv != CKR_OK) {
 		gcry_mpi_release (prime);
 		return rv;
 	}
 
-	if (!gck_attributes_find_ulong (priv_atts, n_priv_atts, CKA_VALUE_BITS, &bits))
+	if (!gkm_attributes_find_ulong (priv_atts, n_priv_atts, CKA_VALUE_BITS, &bits))
 		bits = gcry_mpi_get_nbits (prime);
-	gck_attributes_consume (priv_atts, n_priv_atts, CKA_VALUE_BITS, G_MAXULONG);
+	gkm_attributes_consume (priv_atts, n_priv_atts, CKA_VALUE_BITS, G_MAXULONG);
 
 	/* The private key must be less than or equal to prime */
 	if (bits > gcry_mpi_get_nbits (prime)) {
@@ -157,13 +157,13 @@ gck_dh_mechanism_generate (GckSession *session, CK_ATTRIBUTE_PTR pub_atts,
 		id.pValue = g_memdup ((guchar*)value.pValue + (value.ulValueLen - 16), id.ulValueLen);
 	}
 
-	transaction = gck_transaction_new ();
+	transaction = gkm_transaction_new ();
 
 	*pub_key = create_dh_object (session, transaction, CKO_PUBLIC_KEY, &value,
 	                            aprime, abase, &id, pub_atts, n_pub_atts);
 	g_free (value.pValue);
 
-	if (!gck_transaction_get_failed (transaction)) {
+	if (!gkm_transaction_get_failed (transaction)) {
 
 		/* Write the private key out to raw data */
 		value.type = CKA_VALUE;
@@ -182,8 +182,8 @@ gck_dh_mechanism_generate (GckSession *session, CK_ATTRIBUTE_PTR pub_atts,
 
 	g_free (id.pValue);
 
-	gck_transaction_complete (transaction);
-	if (gck_transaction_get_failed (transaction)) {
+	gkm_transaction_complete (transaction);
+	if (gkm_transaction_get_failed (transaction)) {
 		if (*pub_key)
 			g_object_unref (*pub_key);
 		if (*priv_key)
@@ -191,17 +191,17 @@ gck_dh_mechanism_generate (GckSession *session, CK_ATTRIBUTE_PTR pub_atts,
 		*priv_key = *pub_key = NULL;
 	}
 
-	rv = gck_transaction_get_result (transaction);
+	rv = gkm_transaction_get_result (transaction);
 	g_object_unref (transaction);
 
-	gck_attributes_consume (pub_atts, n_pub_atts, CKA_PRIME, CKA_BASE, G_MAXULONG);
+	gkm_attributes_consume (pub_atts, n_pub_atts, CKA_PRIME, CKA_BASE, G_MAXULONG);
 
 	return rv;
 }
 
 CK_RV
-gck_dh_mechanism_derive (GckSession *session, CK_MECHANISM_PTR mech, GckObject *base,
-                         CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, GckObject **derived)
+gkm_dh_mechanism_derive (GkmSession *session, CK_MECHANISM_PTR mech, GkmObject *base,
+                         CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, GkmObject **derived)
 {
 	gcry_mpi_t peer = NULL;
 	gcry_mpi_t prime;
@@ -211,10 +211,10 @@ gck_dh_mechanism_derive (GckSession *session, CK_MECHANISM_PTR mech, GckObject *
 	GArray *array;
 	CK_ULONG n_value = 0;
 	gpointer value;
-	GckTransaction *transaction;
+	GkmTransaction *transaction;
 	CK_KEY_TYPE type;
 
-	g_return_val_if_fail (GCK_IS_DH_PRIVATE_KEY (base), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (GKM_IS_DH_PRIVATE_KEY (base), CKR_GENERAL_ERROR);
 
 	if (mech->ulParameterLen && mech->pParameter) {
 		gcry = gcry_mpi_scan (&peer, GCRYMPI_FMT_USG, mech->pParameter,
@@ -226,13 +226,13 @@ gck_dh_mechanism_derive (GckSession *session, CK_MECHANISM_PTR mech, GckObject *
 	if (peer == NULL)
 		return CKR_MECHANISM_PARAM_INVALID;
 
-	prime = gck_dh_key_get_prime (GCK_DH_KEY (base));
-	priv = gck_dh_private_key_get_value (GCK_DH_PRIVATE_KEY (base));
+	prime = gkm_dh_key_get_prime (GKM_DH_KEY (base));
+	priv = gkm_dh_private_key_get_value (GKM_DH_PRIVATE_KEY (base));
 
 	/* What length should we truncate to? */
-	if (!gck_attributes_find_ulong (attrs, n_attrs, CKA_VALUE_LEN, &n_value)) {
-		if (gck_attributes_find_ulong (attrs, n_attrs, CKA_KEY_TYPE, &type))
-			n_value = gck_crypto_secret_key_length (type);
+	if (!gkm_attributes_find_ulong (attrs, n_attrs, CKA_VALUE_LEN, &n_value)) {
+		if (gkm_attributes_find_ulong (attrs, n_attrs, CKA_KEY_TYPE, &type))
+			n_value = gkm_crypto_secret_key_length (type);
 	}
 
 	/* Default to full length of the DH prime */
@@ -257,14 +257,14 @@ gck_dh_mechanism_derive (GckSession *session, CK_MECHANISM_PTR mech, GckObject *
 	/* Add the remainder of the attributes */
 	g_array_append_vals (array, attrs, n_attrs);
 
-	transaction = gck_transaction_new ();
+	transaction = gkm_transaction_new ();
 
 	/* Now create an object with these attributes */
-	*derived = gck_session_create_object_for_attributes (session, transaction,
+	*derived = gkm_session_create_object_for_attributes (session, transaction,
 	                                                     (CK_ATTRIBUTE_PTR)array->data, array->len);
 
 	egg_secure_free (value);
 	g_array_free (array, TRUE);
 
-	return gck_transaction_complete_and_unref (transaction);
+	return gkm_transaction_complete_and_unref (transaction);
 }
diff --git a/pkcs11/gck/gck-dh-mechanism.h b/pkcs11/gkm/gkm-dh-mechanism.h
similarity index 79%
rename from pkcs11/gck/gck-dh-mechanism.h
rename to pkcs11/gkm/gkm-dh-mechanism.h
index 3a3ea85..eca2bbf 100644
--- a/pkcs11/gck/gck-dh-mechanism.h
+++ b/pkcs11/gkm/gkm-dh-mechanism.h
@@ -19,10 +19,10 @@
  * 02111-1307, USA.
  */
 
-#ifndef GCK_DH_MECHANISM_H_
-#define GCK_DH_MECHANISM_H_
+#ifndef GKM_DH_MECHANISM_H_
+#define GKM_DH_MECHANISM_H_
 
-#include "gck-types.h"
+#include "gkm-types.h"
 
 #include "pkcs11/pkcs11.h"
 
@@ -30,23 +30,23 @@
 
 #include <gcrypt.h>
 
-static const CK_MECHANISM_TYPE GCK_DH_MECHANISMS[] = {
+static const CK_MECHANISM_TYPE GKM_DH_MECHANISMS[] = {
 	CKM_DH_PKCS_DERIVE
 };
 
-CK_RV                    gck_dh_mechanism_generate                     (GckSession *session,
+CK_RV                    gkm_dh_mechanism_generate                     (GkmSession *session,
                                                                         CK_ATTRIBUTE_PTR pub_atts,
                                                                         CK_ULONG n_pub_atts,
                                                                         CK_ATTRIBUTE_PTR priv_atts,
                                                                         CK_ULONG n_priv_atts,
-                                                                        GckObject **pub_key,
-                                                                        GckObject **priv_key);
+                                                                        GkmObject **pub_key,
+                                                                        GkmObject **priv_key);
 
-CK_RV                    gck_dh_mechanism_derive                       (GckSession *session,
+CK_RV                    gkm_dh_mechanism_derive                       (GkmSession *session,
                                                                         CK_MECHANISM_PTR mech,
-                                                                        GckObject *base,
+                                                                        GkmObject *base,
                                                                         CK_ATTRIBUTE_PTR attrs,
                                                                         CK_ULONG n_attrs,
-                                                                        GckObject **derived);
+                                                                        GkmObject **derived);
 
-#endif /* GCK_DH_MECHANISM_H_ */
+#endif /* GKM_DH_MECHANISM_H_ */
diff --git a/pkcs11/gck/gck-dh-private-key.c b/pkcs11/gkm/gkm-dh-private-key.c
similarity index 53%
rename from pkcs11/gck/gck-dh-private-key.c
rename to pkcs11/gkm/gkm-dh-private-key.c
index 278dea0..e1a8218 100644
--- a/pkcs11/gck/gck-dh-private-key.c
+++ b/pkcs11/gkm/gkm-dh-private-key.c
@@ -23,56 +23,56 @@
 
 #include "pkcs11/pkcs11.h"
 
-#include "gck-attributes.h"
-#include "gck-crypto.h"
-#include "gck-factory.h"
-#include "gck-dh-private-key.h"
-#include "gck-session.h"
-#include "gck-transaction.h"
-#include "gck-util.h"
-
-struct _GckDhPrivateKey {
-	GckDhKey parent;
+#include "gkm-attributes.h"
+#include "gkm-crypto.h"
+#include "gkm-factory.h"
+#include "gkm-dh-private-key.h"
+#include "gkm-session.h"
+#include "gkm-transaction.h"
+#include "gkm-util.h"
+
+struct _GkmDhPrivateKey {
+	GkmDhKey parent;
 	gcry_mpi_t value;
 };
 
-G_DEFINE_TYPE (GckDhPrivateKey, gck_dh_private_key, GCK_TYPE_DH_KEY);
+G_DEFINE_TYPE (GkmDhPrivateKey, gkm_dh_private_key, GKM_TYPE_DH_KEY);
 
 /* -----------------------------------------------------------------------------
  * INTERNAL
  */
 
-static GckObject*
-factory_create_dh_private_key (GckSession *session, GckTransaction *transaction,
+static GkmObject*
+factory_create_dh_private_key (GkmSession *session, GkmTransaction *transaction,
                                CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
 {
-	GckManager *manager;
+	GkmManager *manager;
 	gcry_mpi_t prime = NULL;
 	gcry_mpi_t base = NULL;
 	gcry_mpi_t value = NULL;
 	CK_ATTRIBUTE_PTR idattr;
-	GckObject *object;
+	GkmObject *object;
 
-	if (!gck_attributes_find_mpi (attrs, n_attrs, CKA_PRIME, &prime) ||
-	    !gck_attributes_find_mpi (attrs, n_attrs, CKA_BASE, &base) ||
-	    !gck_attributes_find_mpi (attrs, n_attrs, CKA_VALUE, &value)) {
+	if (!gkm_attributes_find_mpi (attrs, n_attrs, CKA_PRIME, &prime) ||
+	    !gkm_attributes_find_mpi (attrs, n_attrs, CKA_BASE, &base) ||
+	    !gkm_attributes_find_mpi (attrs, n_attrs, CKA_VALUE, &value)) {
 		gcry_mpi_release (prime);
 		gcry_mpi_release (base);
 		gcry_mpi_release (value);
-		gck_transaction_fail (transaction, CKR_TEMPLATE_INCOMPLETE);
+		gkm_transaction_fail (transaction, CKR_TEMPLATE_INCOMPLETE);
 		return NULL;
 	}
 
-	manager = gck_manager_for_template (attrs, n_attrs, session);
-	idattr = gck_attributes_find (attrs, n_attrs, CKA_ID);
+	manager = gkm_manager_for_template (attrs, n_attrs, session);
+	idattr = gkm_attributes_find (attrs, n_attrs, CKA_ID);
 
-	object = GCK_OBJECT (gck_dh_private_key_new (gck_session_get_module (session),
+	object = GKM_OBJECT (gkm_dh_private_key_new (gkm_session_get_module (session),
 	                                            manager, prime, base, value,
 	                                            idattr ? g_memdup (idattr->pValue, idattr->ulValueLen) : NULL,
 	                                            idattr ? idattr->ulValueLen : 0));
-	gck_attributes_consume (attrs, n_attrs, CKA_PRIME, CKA_BASE, CKA_VALUE, G_MAXULONG);
+	gkm_attributes_consume (attrs, n_attrs, CKA_PRIME, CKA_BASE, CKA_VALUE, G_MAXULONG);
 
-	gck_session_complete_object_creation (session, transaction, object,
+	gkm_session_complete_object_creation (session, transaction, object,
 	                                      TRUE, attrs, n_attrs);
 	return object;
 }
@@ -82,101 +82,101 @@ factory_create_dh_private_key (GckSession *session, GckTransaction *transaction,
  */
 
 static CK_RV
-gck_dh_private_key_real_get_attribute (GckObject *base, GckSession *session, CK_ATTRIBUTE* attr)
+gkm_dh_private_key_real_get_attribute (GkmObject *base, GkmSession *session, CK_ATTRIBUTE* attr)
 {
-	GckDhPrivateKey *self = GCK_DH_PRIVATE_KEY (base);
+	GkmDhPrivateKey *self = GKM_DH_PRIVATE_KEY (base);
 
 	switch (attr->type)
 	{
 
 	case CKA_CLASS:
-		return gck_attribute_set_ulong (attr, CKO_PRIVATE_KEY);
+		return gkm_attribute_set_ulong (attr, CKO_PRIVATE_KEY);
 
 	case CKA_PRIVATE:
-		return gck_attribute_set_bool (attr, TRUE);
+		return gkm_attribute_set_bool (attr, TRUE);
 
 	case CKA_SENSITIVE:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_DECRYPT:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_SIGN:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_SIGN_RECOVER:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_DERIVE:
-		return gck_attribute_set_bool (attr, TRUE);
+		return gkm_attribute_set_bool (attr, TRUE);
 
 	case CKA_UNWRAP:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_EXTRACTABLE:
-		return gck_attribute_set_bool (attr, TRUE);
+		return gkm_attribute_set_bool (attr, TRUE);
 
 	case CKA_ALWAYS_SENSITIVE:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_NEVER_EXTRACTABLE:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_WRAP_WITH_TRUSTED:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_UNWRAP_TEMPLATE:
 		return CKR_ATTRIBUTE_TYPE_INVALID;
 
 	case CKA_ALWAYS_AUTHENTICATE:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_VALUE:
-		return gck_attribute_set_mpi (attr, self->value);
+		return gkm_attribute_set_mpi (attr, self->value);
 
 	case CKA_VALUE_BITS:
-		return gck_attribute_set_ulong (attr, gcry_mpi_get_nbits (self->value));
+		return gkm_attribute_set_ulong (attr, gcry_mpi_get_nbits (self->value));
 	};
 
-	return GCK_OBJECT_CLASS (gck_dh_private_key_parent_class)->get_attribute (base, session, attr);
+	return GKM_OBJECT_CLASS (gkm_dh_private_key_parent_class)->get_attribute (base, session, attr);
 }
 
 static void
-gck_dh_private_key_init (GckDhPrivateKey *self)
+gkm_dh_private_key_init (GkmDhPrivateKey *self)
 {
 
 }
 
 static void
-gck_dh_private_key_finalize (GObject *obj)
+gkm_dh_private_key_finalize (GObject *obj)
 {
-	GckDhPrivateKey *self = GCK_DH_PRIVATE_KEY (obj);
+	GkmDhPrivateKey *self = GKM_DH_PRIVATE_KEY (obj);
 
 	gcry_mpi_release (self->value);
 	self->value = NULL;
 
-	G_OBJECT_CLASS (gck_dh_private_key_parent_class)->finalize (obj);
+	G_OBJECT_CLASS (gkm_dh_private_key_parent_class)->finalize (obj);
 }
 
 static void
-gck_dh_private_key_class_init (GckDhPrivateKeyClass *klass)
+gkm_dh_private_key_class_init (GkmDhPrivateKeyClass *klass)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	GckObjectClass *gck_class = GCK_OBJECT_CLASS (klass);
+	GkmObjectClass *gkm_class = GKM_OBJECT_CLASS (klass);
 
-	gck_dh_private_key_parent_class = g_type_class_peek_parent (klass);
+	gkm_dh_private_key_parent_class = g_type_class_peek_parent (klass);
 
-	gobject_class->finalize = gck_dh_private_key_finalize;
+	gobject_class->finalize = gkm_dh_private_key_finalize;
 
-	gck_class->get_attribute = gck_dh_private_key_real_get_attribute;
+	gkm_class->get_attribute = gkm_dh_private_key_real_get_attribute;
 }
 
 /* -----------------------------------------------------------------------------
  * PRIVATE
  */
 
-GckFactory*
-gck_dh_private_key_get_factory (void)
+GkmFactory*
+gkm_dh_private_key_get_factory (void)
 {
 	static CK_OBJECT_CLASS klass = CKO_PRIVATE_KEY;
 	static CK_KEY_TYPE type = CKK_DH;
@@ -186,7 +186,7 @@ gck_dh_private_key_get_factory (void)
 		{ CKA_KEY_TYPE, &type, sizeof (type) }
 	};
 
-	static GckFactory factory = {
+	static GkmFactory factory = {
 		attributes,
 		G_N_ELEMENTS (attributes),
 		factory_create_dh_private_key
@@ -195,26 +195,26 @@ gck_dh_private_key_get_factory (void)
 	return &factory;
 }
 
-GckDhPrivateKey*
-gck_dh_private_key_new (GckModule *module, GckManager *manager,
+GkmDhPrivateKey*
+gkm_dh_private_key_new (GkmModule *module, GkmManager *manager,
                         gcry_mpi_t prime, gcry_mpi_t base, gcry_mpi_t value,
                         gpointer id, gsize n_id)
 {
-	GckDhPrivateKey *key;
+	GkmDhPrivateKey *key;
 
-	key = g_object_new (GCK_TYPE_DH_PRIVATE_KEY,
+	key = g_object_new (GKM_TYPE_DH_PRIVATE_KEY,
 	                    "manager", manager,
 	                    "module", module,
 	                    NULL);
 
-	gck_dh_key_initialize (GCK_DH_KEY (key), prime, base, id, n_id);
+	gkm_dh_key_initialize (GKM_DH_KEY (key), prime, base, id, n_id);
 	key->value = value;
 	return key;
 }
 
 gcry_mpi_t
-gck_dh_private_key_get_value (GckDhPrivateKey *self)
+gkm_dh_private_key_get_value (GkmDhPrivateKey *self)
 {
-	g_return_val_if_fail (GCK_IS_DH_PRIVATE_KEY (self), NULL);
+	g_return_val_if_fail (GKM_IS_DH_PRIVATE_KEY (self), NULL);
 	return self->value;
 }
diff --git a/pkcs11/gck/gck-dh-private-key.h b/pkcs11/gkm/gkm-dh-private-key.h
similarity index 50%
rename from pkcs11/gck/gck-dh-private-key.h
rename to pkcs11/gkm/gkm-dh-private-key.h
index bc7911c..06a65ef 100644
--- a/pkcs11/gck/gck-dh-private-key.h
+++ b/pkcs11/gkm/gkm-dh-private-key.h
@@ -19,41 +19,41 @@
  * 02111-1307, USA.
  */
 
-#ifndef __GCK_DH_PRIVATE_KEY_H__
-#define __GCK_DH_PRIVATE_KEY_H__
+#ifndef __GKM_DH_PRIVATE_KEY_H__
+#define __GKM_DH_PRIVATE_KEY_H__
 
 #include <glib-object.h>
 
-#include "gck-dh-key.h"
-#include "gck-types.h"
+#include "gkm-dh-key.h"
+#include "gkm-types.h"
 
-#define GCK_FACTORY_DH_PRIVATE_KEY            (gck_dh_private_key_get_factory ())
+#define GKM_FACTORY_DH_PRIVATE_KEY            (gkm_dh_private_key_get_factory ())
 
-#define GCK_TYPE_DH_PRIVATE_KEY               (gck_dh_private_key_get_type ())
-#define GCK_DH_PRIVATE_KEY(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCK_TYPE_DH_PRIVATE_KEY, GckDhPrivateKey))
-#define GCK_DH_PRIVATE_KEY_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GCK_TYPE_DH_PRIVATE_KEY, GckDhPrivateKeyClass))
-#define GCK_IS_DH_PRIVATE_KEY(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCK_TYPE_DH_PRIVATE_KEY))
-#define GCK_IS_DH_PRIVATE_KEY_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GCK_TYPE_DH_PRIVATE_KEY))
-#define GCK_DH_PRIVATE_KEY_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GCK_TYPE_DH_PRIVATE_KEY, GckDhPrivateKeyClass))
+#define GKM_TYPE_DH_PRIVATE_KEY               (gkm_dh_private_key_get_type ())
+#define GKM_DH_PRIVATE_KEY(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_DH_PRIVATE_KEY, GkmDhPrivateKey))
+#define GKM_DH_PRIVATE_KEY_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_DH_PRIVATE_KEY, GkmDhPrivateKeyClass))
+#define GKM_IS_DH_PRIVATE_KEY(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_DH_PRIVATE_KEY))
+#define GKM_IS_DH_PRIVATE_KEY_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_DH_PRIVATE_KEY))
+#define GKM_DH_PRIVATE_KEY_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_DH_PRIVATE_KEY, GkmDhPrivateKeyClass))
 
-typedef struct _GckDhPrivateKeyClass GckDhPrivateKeyClass;
+typedef struct _GkmDhPrivateKeyClass GkmDhPrivateKeyClass;
 
-struct _GckDhPrivateKeyClass {
-	GckDhKeyClass parent_class;
+struct _GkmDhPrivateKeyClass {
+	GkmDhKeyClass parent_class;
 };
 
-GType                     gck_dh_private_key_get_type          (void);
+GType                     gkm_dh_private_key_get_type          (void);
 
-GckFactory*               gck_dh_private_key_get_factory       (void);
+GkmFactory*               gkm_dh_private_key_get_factory       (void);
 
-GckDhPrivateKey*          gck_dh_private_key_new               (GckModule *module,
-                                                                GckManager *manager,
+GkmDhPrivateKey*          gkm_dh_private_key_new               (GkmModule *module,
+                                                                GkmManager *manager,
                                                                 gcry_mpi_t prime,
                                                                 gcry_mpi_t base,
                                                                 gcry_mpi_t value,
                                                                 gpointer id,
                                                                 gsize n_id);
 
-gcry_mpi_t                gck_dh_private_key_get_value         (GckDhPrivateKey *self);
+gcry_mpi_t                gkm_dh_private_key_get_value         (GkmDhPrivateKey *self);
 
-#endif /* __GCK_DH_PRIVATE_KEY_H__ */
+#endif /* __GKM_DH_PRIVATE_KEY_H__ */
diff --git a/pkcs11/gck/gck-dh-public-key.c b/pkcs11/gkm/gkm-dh-public-key.c
similarity index 55%
rename from pkcs11/gck/gck-dh-public-key.c
rename to pkcs11/gkm/gkm-dh-public-key.c
index be0bb25..0c0ab1f 100644
--- a/pkcs11/gck/gck-dh-public-key.c
+++ b/pkcs11/gkm/gkm-dh-public-key.c
@@ -23,56 +23,56 @@
 
 #include "pkcs11/pkcs11.h"
 
-#include "gck-attributes.h"
-#include "gck-crypto.h"
-#include "gck-factory.h"
-#include "gck-dh-public-key.h"
-#include "gck-session.h"
-#include "gck-transaction.h"
-#include "gck-util.h"
-
-struct _GckDhPublicKey {
-	GckDhKey parent;
+#include "gkm-attributes.h"
+#include "gkm-crypto.h"
+#include "gkm-factory.h"
+#include "gkm-dh-public-key.h"
+#include "gkm-session.h"
+#include "gkm-transaction.h"
+#include "gkm-util.h"
+
+struct _GkmDhPublicKey {
+	GkmDhKey parent;
 	gcry_mpi_t value;
 };
 
-G_DEFINE_TYPE (GckDhPublicKey, gck_dh_public_key, GCK_TYPE_DH_KEY);
+G_DEFINE_TYPE (GkmDhPublicKey, gkm_dh_public_key, GKM_TYPE_DH_KEY);
 
 /* -----------------------------------------------------------------------------
  * INTERNAL
  */
 
-static GckObject*
-factory_create_dh_public_key (GckSession *session, GckTransaction *transaction,
+static GkmObject*
+factory_create_dh_public_key (GkmSession *session, GkmTransaction *transaction,
                               CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
 {
-	GckManager *manager;
+	GkmManager *manager;
 	gcry_mpi_t prime = NULL;
 	gcry_mpi_t base = NULL;
 	gcry_mpi_t value = NULL;
 	CK_ATTRIBUTE_PTR idattr;
-	GckObject *object;
+	GkmObject *object;
 
-	if (!gck_attributes_find_mpi (attrs, n_attrs, CKA_PRIME, &prime) ||
-	    !gck_attributes_find_mpi (attrs, n_attrs, CKA_BASE, &base) ||
-	    !gck_attributes_find_mpi (attrs, n_attrs, CKA_VALUE, &value)) {
+	if (!gkm_attributes_find_mpi (attrs, n_attrs, CKA_PRIME, &prime) ||
+	    !gkm_attributes_find_mpi (attrs, n_attrs, CKA_BASE, &base) ||
+	    !gkm_attributes_find_mpi (attrs, n_attrs, CKA_VALUE, &value)) {
 		gcry_mpi_release (prime);
 		gcry_mpi_release (base);
 		gcry_mpi_release (value);
-		gck_transaction_fail (transaction, CKR_TEMPLATE_INCOMPLETE);
+		gkm_transaction_fail (transaction, CKR_TEMPLATE_INCOMPLETE);
 		return NULL;
 	}
 
-	manager = gck_manager_for_template (attrs, n_attrs, session);
-	idattr = gck_attributes_find (attrs, n_attrs, CKA_ID);
+	manager = gkm_manager_for_template (attrs, n_attrs, session);
+	idattr = gkm_attributes_find (attrs, n_attrs, CKA_ID);
 
-	object = GCK_OBJECT (gck_dh_public_key_new (gck_session_get_module (session),
+	object = GKM_OBJECT (gkm_dh_public_key_new (gkm_session_get_module (session),
 	                                            manager, prime, base, value,
 	                                            idattr ? g_memdup (idattr->pValue, idattr->ulValueLen) : NULL,
 	                                            idattr ? idattr->ulValueLen : 0));
-	gck_attributes_consume (attrs, n_attrs, CKA_PRIME, CKA_BASE, CKA_VALUE, G_MAXULONG);
+	gkm_attributes_consume (attrs, n_attrs, CKA_PRIME, CKA_BASE, CKA_VALUE, G_MAXULONG);
 
-	gck_session_complete_object_creation (session, transaction, object,
+	gkm_session_complete_object_creation (session, transaction, object,
 	                                      TRUE, attrs, n_attrs);
 	return object;
 }
@@ -82,80 +82,80 @@ factory_create_dh_public_key (GckSession *session, GckTransaction *transaction,
  */
 
 static CK_RV
-gck_dh_public_key_real_get_attribute (GckObject *base, GckSession *session, CK_ATTRIBUTE* attr)
+gkm_dh_public_key_real_get_attribute (GkmObject *base, GkmSession *session, CK_ATTRIBUTE* attr)
 {
-	GckDhPublicKey *self = GCK_DH_PUBLIC_KEY (base);
+	GkmDhPublicKey *self = GKM_DH_PUBLIC_KEY (base);
 
 	switch (attr->type)
 	{
 
 	case CKA_CLASS:
-		return gck_attribute_set_ulong (attr, CKO_PUBLIC_KEY);
+		return gkm_attribute_set_ulong (attr, CKO_PUBLIC_KEY);
 
 	case CKA_DERIVE:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_ENCRYPT:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_VERIFY:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_VERIFY_RECOVER:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_WRAP:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_TRUSTED:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_WRAP_TEMPLATE:
 		return CKR_ATTRIBUTE_TYPE_INVALID;
 
 	case CKA_VALUE:
-		return gck_attribute_set_mpi (attr, self->value);
+		return gkm_attribute_set_mpi (attr, self->value);
 	};
 
-	return GCK_OBJECT_CLASS (gck_dh_public_key_parent_class)->get_attribute (base, session, attr);
+	return GKM_OBJECT_CLASS (gkm_dh_public_key_parent_class)->get_attribute (base, session, attr);
 }
 
 static void
-gck_dh_public_key_init (GckDhPublicKey *self)
+gkm_dh_public_key_init (GkmDhPublicKey *self)
 {
 
 }
 
 static void
-gck_dh_public_key_finalize (GObject *obj)
+gkm_dh_public_key_finalize (GObject *obj)
 {
-	GckDhPublicKey *self = GCK_DH_PUBLIC_KEY (obj);
+	GkmDhPublicKey *self = GKM_DH_PUBLIC_KEY (obj);
 
 	gcry_mpi_release (self->value);
 	self->value = NULL;
 
-	G_OBJECT_CLASS (gck_dh_public_key_parent_class)->finalize (obj);
+	G_OBJECT_CLASS (gkm_dh_public_key_parent_class)->finalize (obj);
 }
 
 static void
-gck_dh_public_key_class_init (GckDhPublicKeyClass *klass)
+gkm_dh_public_key_class_init (GkmDhPublicKeyClass *klass)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	GckObjectClass *gck_class = GCK_OBJECT_CLASS (klass);
+	GkmObjectClass *gkm_class = GKM_OBJECT_CLASS (klass);
 
-	gck_dh_public_key_parent_class = g_type_class_peek_parent (klass);
+	gkm_dh_public_key_parent_class = g_type_class_peek_parent (klass);
 
-	gobject_class->finalize = gck_dh_public_key_finalize;
+	gobject_class->finalize = gkm_dh_public_key_finalize;
 
-	gck_class->get_attribute = gck_dh_public_key_real_get_attribute;
+	gkm_class->get_attribute = gkm_dh_public_key_real_get_attribute;
 }
 
 /* -----------------------------------------------------------------------------
  * PUBLIC
  */
 
-GckFactory*
-gck_dh_public_key_get_factory (void)
+GkmFactory*
+gkm_dh_public_key_get_factory (void)
 {
 	static CK_OBJECT_CLASS klass = CKO_PUBLIC_KEY;
 	static CK_KEY_TYPE type = CKK_DH;
@@ -165,7 +165,7 @@ gck_dh_public_key_get_factory (void)
 		{ CKA_KEY_TYPE, &type, sizeof (type) }
 	};
 
-	static GckFactory factory = {
+	static GkmFactory factory = {
 		attributes,
 		G_N_ELEMENTS (attributes),
 		factory_create_dh_public_key
@@ -174,19 +174,19 @@ gck_dh_public_key_get_factory (void)
 	return &factory;
 }
 
-GckDhPublicKey*
-gck_dh_public_key_new (GckModule *module, GckManager *manager,
+GkmDhPublicKey*
+gkm_dh_public_key_new (GkmModule *module, GkmManager *manager,
                        gcry_mpi_t prime, gcry_mpi_t base, gcry_mpi_t value,
                        gpointer id, gsize n_id)
 {
-	GckDhPublicKey *key;
+	GkmDhPublicKey *key;
 
-	key = g_object_new (GCK_TYPE_DH_PUBLIC_KEY,
+	key = g_object_new (GKM_TYPE_DH_PUBLIC_KEY,
 	                    "manager", manager,
 	                    "module", module,
 	                    NULL);
 
 	key->value = value;
-	gck_dh_key_initialize (GCK_DH_KEY (key), prime, base, id, n_id);
+	gkm_dh_key_initialize (GKM_DH_KEY (key), prime, base, id, n_id);
 	return key;
 }
diff --git a/pkcs11/gck/gck-dh-public-key.h b/pkcs11/gkm/gkm-dh-public-key.h
similarity index 52%
rename from pkcs11/gck/gck-dh-public-key.h
rename to pkcs11/gkm/gkm-dh-public-key.h
index fd41136..e92b629 100644
--- a/pkcs11/gck/gck-dh-public-key.h
+++ b/pkcs11/gkm/gkm-dh-public-key.h
@@ -19,39 +19,39 @@
  * 02111-1307, USA.
  */
 
-#ifndef __GCK_DH_PUBLIC_KEY_H__
-#define __GCK_DH_PUBLIC_KEY_H__
+#ifndef __GKM_DH_PUBLIC_KEY_H__
+#define __GKM_DH_PUBLIC_KEY_H__
 
 #include <glib-object.h>
 
-#include "gck-dh-key.h"
-#include "gck-types.h"
+#include "gkm-dh-key.h"
+#include "gkm-types.h"
 
-#define GCK_FACTORY_DH_PUBLIC_KEY            (gck_dh_public_key_get_factory ())
+#define GKM_FACTORY_DH_PUBLIC_KEY            (gkm_dh_public_key_get_factory ())
 
-#define GCK_TYPE_DH_PUBLIC_KEY               (gck_dh_public_key_get_type ())
-#define GCK_DH_PUBLIC_KEY(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCK_TYPE_DH_PUBLIC_KEY, GckDhPublicKey))
-#define GCK_DH_PUBLIC_KEY_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GCK_TYPE_DH_PUBLIC_KEY, GckDhPublicKeyClass))
-#define GCK_IS_DH_PUBLIC_KEY(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCK_TYPE_DH_PUBLIC_KEY))
-#define GCK_IS_DH_PUBLIC_KEY_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GCK_TYPE_DH_PUBLIC_KEY))
-#define GCK_DH_PUBLIC_KEY_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GCK_TYPE_DH_PUBLIC_KEY, GckDhPublicKeyClass))
+#define GKM_TYPE_DH_PUBLIC_KEY               (gkm_dh_public_key_get_type ())
+#define GKM_DH_PUBLIC_KEY(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_DH_PUBLIC_KEY, GkmDhPublicKey))
+#define GKM_DH_PUBLIC_KEY_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_DH_PUBLIC_KEY, GkmDhPublicKeyClass))
+#define GKM_IS_DH_PUBLIC_KEY(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_DH_PUBLIC_KEY))
+#define GKM_IS_DH_PUBLIC_KEY_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_DH_PUBLIC_KEY))
+#define GKM_DH_PUBLIC_KEY_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_DH_PUBLIC_KEY, GkmDhPublicKeyClass))
 
-typedef struct _GckDhPublicKeyClass GckDhPublicKeyClass;
+typedef struct _GkmDhPublicKeyClass GkmDhPublicKeyClass;
 
-struct _GckDhPublicKeyClass {
-	GckDhKeyClass parent_class;
+struct _GkmDhPublicKeyClass {
+	GkmDhKeyClass parent_class;
 };
 
-GType                     gck_dh_public_key_get_type           (void);
+GType                     gkm_dh_public_key_get_type           (void);
 
-GckFactory*               gck_dh_public_key_get_factory        (void);
+GkmFactory*               gkm_dh_public_key_get_factory        (void);
 
-GckDhPublicKey*           gck_dh_public_key_new                (GckModule *module,
-                                                                GckManager *manager,
+GkmDhPublicKey*           gkm_dh_public_key_new                (GkmModule *module,
+                                                                GkmManager *manager,
                                                                 gcry_mpi_t prime,
                                                                 gcry_mpi_t base,
                                                                 gcry_mpi_t value,
                                                                 gpointer id,
                                                                 gsize n_id);
 
-#endif /* __GCK_DH_PUBLIC_KEY_H__ */
+#endif /* __GKM_DH_PUBLIC_KEY_H__ */
diff --git a/pkcs11/gck/gck-factory.c b/pkcs11/gkm/gkm-factory.c
similarity index 90%
rename from pkcs11/gck/gck-factory.c
rename to pkcs11/gkm/gkm-factory.c
index eb96ea4..f5c9b1e 100644
--- a/pkcs11/gck/gck-factory.c
+++ b/pkcs11/gkm/gkm-factory.c
@@ -1,25 +1,24 @@
-/* 
+/*
  * 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"
 
-#include "gck-factory.h"
-
+#include "gkm-factory.h"
diff --git a/pkcs11/gck/gck-factory.h b/pkcs11/gkm/gkm-factory.h
similarity index 78%
rename from pkcs11/gck/gck-factory.h
rename to pkcs11/gkm/gkm-factory.h
index 9570029..f4a0428 100644
--- a/pkcs11/gck/gck-factory.h
+++ b/pkcs11/gkm/gkm-factory.h
@@ -1,40 +1,40 @@
-/* 
+/*
  * 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.
  */
 
-#ifndef __GCK_FACTORY_H__
-#define __GCK_FACTORY_H__
+#ifndef __GKM_FACTORY_H__
+#define __GKM_FACTORY_H__
 
 #include <glib-object.h>
 
 #include "pkcs11/pkcs11.h"
 
-#include "gck-types.h"
+#include "gkm-types.h"
 
-typedef GckObject* (*GckFactoryFunc) (GckSession *session, GckTransaction *transaction,
+typedef GkmObject* (*GkmFactoryFunc) (GkmSession *session, GkmTransaction *transaction,
                                       CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs);
 
-struct _GckFactory {
+struct _GkmFactory {
 	CK_ATTRIBUTE_PTR attrs;
 	CK_ULONG n_attrs;
-	GckFactoryFunc func;
+	GkmFactoryFunc func;
 };
 
-#endif /* __GCK_FACTORY_H__ */
+#endif /* __GKM_FACTORY_H__ */
diff --git a/pkcs11/gck/gck-file-tracker.c b/pkcs11/gkm/gkm-file-tracker.c
similarity index 77%
rename from pkcs11/gck/gck-file-tracker.c
rename to pkcs11/gkm/gkm-file-tracker.c
index 517677d..949dcbe 100644
--- a/pkcs11/gck/gck-file-tracker.c
+++ b/pkcs11/gkm/gkm-file-tracker.c
@@ -1,5 +1,5 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* gck-file-tracker.c - Watch for changes in a directory
+/* gkm-file-tracker.c - Watch for changes in a directory
 
    Copyright (C) 2008 Stefan Walter
 
@@ -23,7 +23,7 @@
 
 #include "config.h"
 
-#include "gck-file-tracker.h"
+#include "gkm-file-tracker.h"
 
 #include "egg/egg-error.h"
 
@@ -35,19 +35,19 @@
 #include <unistd.h>
 
 typedef struct _UpdateDescendants {
-	GckFileTracker *tracker;
+	GkmFileTracker *tracker;
 	GHashTable *checks;
 } UpdateDescendants;
 
-struct _GckFileTracker {
+struct _GkmFileTracker {
 	GObject parent;
-	
+
 	/* Specification */
 	GPatternSpec *include;
 	GPatternSpec *exclude;
 	gchar *directory_path;
 	time_t directory_mtime;
-	
+
 	/* Matched files */
 	GHashTable *files;
 };
@@ -61,7 +61,7 @@ enum {
 
 static guint signals[LAST_SIGNAL] = { 0 };
 
-G_DEFINE_TYPE (GckFileTracker, gck_file_tracker, G_TYPE_OBJECT);
+G_DEFINE_TYPE (GkmFileTracker, gkm_file_tracker, G_TYPE_OBJECT);
 
 /* -----------------------------------------------------------------------------
  * HELPERS
@@ -77,14 +77,14 @@ copy_key_string (gpointer key, gpointer value, gpointer data)
 static void
 remove_files (gpointer key, gpointer value, gpointer data)
 {
-	GckFileTracker *self = GCK_FILE_TRACKER (data);
+	GkmFileTracker *self = GKM_FILE_TRACKER (data);
 
 	g_hash_table_remove (self->files, key);
 	g_signal_emit (self, signals[FILE_REMOVED], 0, key);
-} 
+}
 
 static gboolean
-update_file (GckFileTracker *self, gboolean force_all, const gchar *path)
+update_file (GkmFileTracker *self, gboolean force_all, const gchar *path)
 {
 	time_t old_mtime;
 	struct stat sb;
@@ -104,10 +104,10 @@ update_file (GckFileTracker *self, gboolean force_all, const gchar *path)
 		g_hash_table_insert (self->files, g_strdup (path), GUINT_TO_POINTER (sb.st_mtime));
 		g_signal_emit (self, signals[FILE_CHANGED], 0, path);
 	}
-	
+
 	return TRUE;
 }
-		
+
 static void
 update_each_file (gpointer key, gpointer unused, gpointer data)
 {
@@ -117,7 +117,7 @@ update_each_file (gpointer key, gpointer unused, gpointer data)
 }
 
 static void
-update_directory (GckFileTracker *self, gboolean force_all, GHashTable *checks)
+update_directory (GkmFileTracker *self, gboolean force_all, GHashTable *checks)
 {
 	UpdateDescendants uctx;
 	struct stat sb;
@@ -128,21 +128,21 @@ update_directory (GckFileTracker *self, gboolean force_all, GHashTable *checks)
 	int ret, lasterr;
 
 	g_assert (checks);
-	g_assert (GCK_IS_FILE_TRACKER (self));
-	
+	g_assert (GKM_IS_FILE_TRACKER (self));
+
 	if (!self->directory_path)
 		return;
 
 	if (stat (self->directory_path, &sb) < 0) {
 		if (errno != ENOENT && errno != ENOTDIR && errno != EPERM)
-			g_message ("couldn't stat directory: %s: %s", 
+			g_message ("couldn't stat directory: %s: %s",
 			           self->directory_path, g_strerror (errno));
 		return;
 	}
 
 	/* See if it was updated since last seen or not */
 	if (!force_all && self->directory_mtime == sb.st_mtime) {
-		
+
 		uctx.checks = checks;
 		uctx.tracker = self;
 
@@ -159,10 +159,10 @@ update_directory (GckFileTracker *self, gboolean force_all, GHashTable *checks)
 		if (errno != ENOENT && errno != ENOTDIR && errno != EPERM)
 			g_message ("couldn't list keyrings at: %s: %s", self->directory_path,
 			           egg_error_message (err));
-		g_error_free (err);  
+		g_error_free (err);
 		return;
 	}
-	
+
 	while ((filename = g_dir_read_name (dir)) != NULL) {
 		if (filename[0] == '.')
 			continue;
@@ -175,17 +175,17 @@ update_directory (GckFileTracker *self, gboolean force_all, GHashTable *checks)
 
 		/* If we hadn't yet seen this, then add it */
 		if (!g_hash_table_remove (checks, file)) {
-			
+
 			/* Get the last modified time for this one */
 			ret = g_stat (file, &sb);
 			lasterr = errno;
-			
+
 			/* Couldn't access the file */
 			if (ret < 0) {
 				g_message ("couldn't stat file: %s: %s", file, g_strerror (lasterr));
-				
+
 			} else {
-			
+
 				/* We don't do directories */
 				if (!(sb.st_mode & S_IFDIR)) {
 					g_hash_table_replace (self->files, g_strdup (file), GINT_TO_POINTER (sb.st_mtime));
@@ -197,7 +197,7 @@ update_directory (GckFileTracker *self, gboolean force_all, GHashTable *checks)
 		} else {
 			update_file (self, force_all, file);
 		}
-		
+
 		g_free (file);
 	}
 
@@ -209,96 +209,96 @@ update_directory (GckFileTracker *self, gboolean force_all, GHashTable *checks)
  */
 
 static void
-gck_file_tracker_init (GckFileTracker *self)
+gkm_file_tracker_init (GkmFileTracker *self)
 {
 	self->files = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
 }
 
 static void
-gck_file_tracker_finalize (GObject *obj)
+gkm_file_tracker_finalize (GObject *obj)
 {
-	GckFileTracker *self = GCK_FILE_TRACKER (obj);
-	 
+	GkmFileTracker *self = GKM_FILE_TRACKER (obj);
+
 	if (self->include)
 		g_pattern_spec_free (self->include);
 	if (self->exclude)
 		g_pattern_spec_free (self->exclude);
 	g_free (self->directory_path);
-	
+
 	g_hash_table_destroy (self->files);
-	
-	G_OBJECT_CLASS (gck_file_tracker_parent_class)->finalize (obj);
+
+	G_OBJECT_CLASS (gkm_file_tracker_parent_class)->finalize (obj);
 }
 
 static void
-gck_file_tracker_class_init (GckFileTrackerClass *klass)
+gkm_file_tracker_class_init (GkmFileTrackerClass *klass)
 {
 	GObjectClass *gobject_class;
 	gobject_class = (GObjectClass*) klass;
 
-	gck_file_tracker_parent_class = g_type_class_peek_parent (klass);
-	gobject_class->finalize = gck_file_tracker_finalize;
+	gkm_file_tracker_parent_class = g_type_class_peek_parent (klass);
+	gobject_class->finalize = gkm_file_tracker_finalize;
 
-	signals[FILE_ADDED] = g_signal_new ("file-added", GCK_TYPE_FILE_TRACKER, 
-			G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GckFileTrackerClass, file_added),
-			NULL, NULL, g_cclosure_marshal_VOID__STRING, 
+	signals[FILE_ADDED] = g_signal_new ("file-added", GKM_TYPE_FILE_TRACKER,
+			G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GkmFileTrackerClass, file_added),
+			NULL, NULL, g_cclosure_marshal_VOID__STRING,
 			G_TYPE_NONE, 1, G_TYPE_STRING);
-			
-	signals[FILE_CHANGED] = g_signal_new ("file-changed", GCK_TYPE_FILE_TRACKER, 
-			G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GckFileTrackerClass, file_changed),
-			NULL, NULL, g_cclosure_marshal_VOID__STRING, 
+
+	signals[FILE_CHANGED] = g_signal_new ("file-changed", GKM_TYPE_FILE_TRACKER,
+			G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GkmFileTrackerClass, file_changed),
+			NULL, NULL, g_cclosure_marshal_VOID__STRING,
 			G_TYPE_NONE, 1, G_TYPE_STRING);
 
-	signals[FILE_REMOVED] = g_signal_new ("file-removed", GCK_TYPE_FILE_TRACKER, 
-			G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GckFileTrackerClass, file_removed),
-			NULL, NULL, g_cclosure_marshal_VOID__STRING, 
+	signals[FILE_REMOVED] = g_signal_new ("file-removed", GKM_TYPE_FILE_TRACKER,
+			G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GkmFileTrackerClass, file_removed),
+			NULL, NULL, g_cclosure_marshal_VOID__STRING,
 			G_TYPE_NONE, 1, G_TYPE_STRING);
 }
 
-GckFileTracker* 
-gck_file_tracker_new (const gchar *directory, const gchar *include, const gchar *exclude)
+GkmFileTracker*
+gkm_file_tracker_new (const gchar *directory, const gchar *include, const gchar *exclude)
 {
-	GckFileTracker *self;
+	GkmFileTracker *self;
 	const gchar *homedir;
-	
+
 	g_return_val_if_fail (directory, NULL);
-	
-	self = g_object_new (GCK_TYPE_FILE_TRACKER, NULL);
-	
-	/* TODO: Use properties */	
-	
+
+	self = g_object_new (GKM_TYPE_FILE_TRACKER, NULL);
+
+	/* TODO: Use properties */
+
 	if (directory[0] == '~' && directory[1] == '/') {
 		homedir = g_getenv ("HOME");
 		if (!homedir)
 			homedir = g_get_home_dir ();
 		self->directory_path = g_build_filename (homedir, directory + 2, NULL);
-		
+
 	/* A relative or absolute path */
 	} else {
 		self->directory_path = g_strdup (directory);
 	}
-	
+
 	self->include = include ? g_pattern_spec_new (include) : NULL;
 	self->exclude = exclude ? g_pattern_spec_new (exclude) : NULL;
-	
+
 	return self;
 }
 
 void
-gck_file_tracker_refresh (GckFileTracker *self, gboolean force_all)
+gkm_file_tracker_refresh (GkmFileTracker *self, gboolean force_all)
 {
 	GHashTable *checks;
-	
-	g_return_if_fail (GCK_IS_FILE_TRACKER (self));
-	
+
+	g_return_if_fail (GKM_IS_FILE_TRACKER (self));
+
 	/* Copy into our check set */
 	checks = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
 	g_hash_table_foreach (self->files, copy_key_string, checks);
-	
+
 	/* If only one volume, then just try and access it directly */
 	update_directory (self, force_all, checks);
-		
+
 	/* Find any keyrings whose paths we didn't see */
-	g_hash_table_foreach (checks, remove_files, self); 
+	g_hash_table_foreach (checks, remove_files, self);
 	g_hash_table_destroy (checks);
 }
diff --git a/pkcs11/gck/gck-file-tracker.h b/pkcs11/gkm/gkm-file-tracker.h
similarity index 50%
rename from pkcs11/gck/gck-file-tracker.h
rename to pkcs11/gkm/gkm-file-tracker.h
index 94e3a9f..9013fbc 100644
--- a/pkcs11/gck/gck-file-tracker.h
+++ b/pkcs11/gkm/gkm-file-tracker.h
@@ -1,5 +1,5 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* gck-file-tracker.h - Watch for changes in a directory
+/* gkm-file-tracker.h - Watch for changes in a directory
 
    Copyright (C) 2008, Stefan Walter
 
@@ -21,43 +21,42 @@
    Author: Stef Walter <stef memberwebs com>
 */
 
-#ifndef __GCK_FILE_TRACKER_H__
-#define __GCK_FILE_TRACKER_H__
+#ifndef __GKM_FILE_TRACKER_H__
+#define __GKM_FILE_TRACKER_H__
 
 #include <glib-object.h>
 
-#include "gck-file-tracker.h"
+#include "gkm-file-tracker.h"
 
 G_BEGIN_DECLS
 
-#define GCK_TYPE_FILE_TRACKER             (gck_file_tracker_get_type ())
-#define GCK_FILE_TRACKER(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCK_TYPE_FILE_TRACKER, GckFileTracker))
-#define GCK_FILE_TRACKER_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), GCK_TYPE_FILE_TRACKER, GObject))
-#define GCK_IS_FILE_TRACKER(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCK_TYPE_FILE_TRACKER))
-#define GCK_IS_FILE_TRACKER_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), GCK_TYPE_FILE_TRACKER))
-#define GCK_FILE_TRACKER_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GCK_TYPE_FILE_TRACKER, GckFileTrackerClass))
+#define GKM_TYPE_FILE_TRACKER             (gkm_file_tracker_get_type ())
+#define GKM_FILE_TRACKER(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_FILE_TRACKER, GkmFileTracker))
+#define GKM_FILE_TRACKER_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_FILE_TRACKER, GObject))
+#define GKM_IS_FILE_TRACKER(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_FILE_TRACKER))
+#define GKM_IS_FILE_TRACKER_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_FILE_TRACKER))
+#define GKM_FILE_TRACKER_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_FILE_TRACKER, GkmFileTrackerClass))
 
-typedef struct _GckFileTracker GckFileTracker;
-typedef struct _GckFileTrackerClass GckFileTrackerClass;
+typedef struct _GkmFileTracker GkmFileTracker;
+typedef struct _GkmFileTrackerClass GkmFileTrackerClass;
 
-struct _GckFileTrackerClass {
+struct _GkmFileTrackerClass {
 	GObjectClass parent_class;
 
-	void (*file_added) (GckFileTracker *locmgr, const gchar *path);
-	void (*file_changed) (GckFileTracker *locmgr, const gchar *path);
-	void (*file_removed) (GckFileTracker *locmgr, const gchar *path);
+	void (*file_added) (GkmFileTracker *locmgr, const gchar *path);
+	void (*file_changed) (GkmFileTracker *locmgr, const gchar *path);
+	void (*file_removed) (GkmFileTracker *locmgr, const gchar *path);
 };
 
-GType                    gck_file_tracker_get_type             (void) G_GNUC_CONST;
+GType                    gkm_file_tracker_get_type             (void) G_GNUC_CONST;
 
-GckFileTracker*          gck_file_tracker_new                  (const gchar *directory,
+GkmFileTracker*          gkm_file_tracker_new                  (const gchar *directory,
                                                                 const gchar *include_pattern,
                                                                 const gchar *exclude_pattern);
 
-void                     gck_file_tracker_refresh              (GckFileTracker *self, 
+void                     gkm_file_tracker_refresh              (GkmFileTracker *self,
                                                                 gboolean force_all);
 
 G_END_DECLS
 
-#endif /* __GCK_FILE_TRACKER_H__ */
-
+#endif /* __GKM_FILE_TRACKER_H__ */
diff --git a/pkcs11/gck/gck-manager.c b/pkcs11/gkm/gkm-manager.c
similarity index 68%
rename from pkcs11/gck/gck-manager.c
rename to pkcs11/gkm/gkm-manager.c
index cd18e59..d1769e7 100644
--- a/pkcs11/gck/gck-manager.c
+++ b/pkcs11/gkm/gkm-manager.c
@@ -1,32 +1,32 @@
-/* 
+/*
  * 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  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  License for more details.
- *  
- * You should have received a copy of the GNU Lesser General 
+ *
+ * You should have received a copy of the GNU Lesser General
  * 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"
 
-#include "gck-attributes.h"
-#include "gck-manager.h"
-#include "gck-marshal.h"
-#include "gck-module.h"
-#include "gck-session.h"
-#include "gck-util.h"
+#include "gkm-attributes.h"
+#include "gkm-manager.h"
+#include "gkm-marshal.h"
+#include "gkm-module.h"
+#include "gkm-session.h"
+#include "gkm-util.h"
 
 #include <glib.h>
 #include <glib/gi18n.h>
@@ -47,7 +47,7 @@ enum {
 
 static guint signals[LAST_SIGNAL] = { 0 };
 
-struct _GckManagerPrivate {
+struct _GkmManagerPrivate {
 	gboolean for_token;
 	GList *objects;
 	GHashTable *index_by_attribute;
@@ -63,18 +63,18 @@ typedef struct _Index {
 } Index;
 
 typedef struct _Finder {
-	GckManager *manager;
-	void (*accumulator) (struct _Finder *ctx, GckObject *found);
+	GkmManager *manager;
+	void (*accumulator) (struct _Finder *ctx, GkmObject *found);
 	gpointer results;
 	CK_ATTRIBUTE_PTR attrs;
 	CK_ULONG n_attrs;
 } Finder;
 
-G_DEFINE_TYPE(GckManager, gck_manager, G_TYPE_OBJECT);
+G_DEFINE_TYPE(GkmManager, gkm_manager, G_TYPE_OBJECT);
 
-/* Friend functions for GckObject */
-void  _gck_manager_register_object    (GckManager *self, GckObject *object);
-void  _gck_manager_unregister_object  (GckManager *self, GckObject *object);
+/* Friend functions for GkmObject */
+void  _gkm_manager_register_object    (GkmManager *self, GkmObject *object);
+void  _gkm_manager_unregister_object  (GkmManager *self, GkmObject *object);
 
 /* -----------------------------------------------------------------------------
  * HELPERS
@@ -95,15 +95,15 @@ index_new (gboolean unique)
 {
 	Index *index = g_slice_new0 (Index);
 	index->unique = unique;
-	
+
 	if (unique)
-		index->values = g_hash_table_new_full (gck_attribute_hash, gck_attribute_equal, attribute_free, NULL);
+		index->values = g_hash_table_new_full (gkm_attribute_hash, gkm_attribute_equal, attribute_free, NULL);
 	else
-		index->values = g_hash_table_new_full (gck_attribute_hash, gck_attribute_equal, attribute_free,
+		index->values = g_hash_table_new_full (gkm_attribute_hash, gkm_attribute_equal, attribute_free,
 		                                       (GDestroyNotify)g_hash_table_destroy);
-	
+
 	index->objects = g_hash_table_new (g_direct_hash, g_direct_equal);
-	
+
 	return index;
 }
 
@@ -120,38 +120,38 @@ index_free (gpointer data)
 }
 
 static gboolean
-read_attribute(GckObject *object, CK_ATTRIBUTE_TYPE type, CK_ATTRIBUTE_PTR *result)
+read_attribute(GkmObject *object, CK_ATTRIBUTE_TYPE type, CK_ATTRIBUTE_PTR *result)
 {
 	CK_ATTRIBUTE attr;
 	CK_RV rv;
-	
-	g_assert (GCK_IS_OBJECT (object));
+
+	g_assert (GKM_IS_OBJECT (object));
 	g_assert (result);
-	
+
 	*result = NULL;
-	
+
 	attr.type = type;
 	attr.pValue = NULL;
 	attr.ulValueLen = 0;
-		
+
 	/* Figure out memory length */
-	rv = gck_object_get_attribute (object, NULL, &attr);
-	
+	rv = gkm_object_get_attribute (object, NULL, &attr);
+
 	/* Not an error, just not present */
 	if (rv == CKR_ATTRIBUTE_TYPE_INVALID) {
 		*result = NULL;
 		return TRUE;
 	}
-		
+
 	if (rv != CKR_OK) {
 		g_warning ("accessing indexed attribute failed");
 		return FALSE;
 	}
-		
+
 	/* Allocate memory length */
 	if (attr.ulValueLen) {
 		attr.pValue = g_malloc0 (attr.ulValueLen);
-		rv = gck_object_get_attribute (object, NULL, &attr);
+		rv = gkm_object_get_attribute (object, NULL, &attr);
 		if (rv != CKR_OK) {
 			g_warning ("accessing indexed attribute failed");
 			g_free (attr.pValue);
@@ -165,27 +165,27 @@ read_attribute(GckObject *object, CK_ATTRIBUTE_TYPE type, CK_ATTRIBUTE_PTR *resu
 }
 
 static gboolean
-read_value (GckObject *object, const gchar *property, CK_ATTRIBUTE_PTR *result)
+read_value (GkmObject *object, const gchar *property, CK_ATTRIBUTE_PTR *result)
 {
 	CK_ATTRIBUTE attr;
 	GParamSpec *spec;
 	GValue value = { 0, };
 	CK_ULONG number;
 	CK_BBOOL boolean;
-	
-	g_assert (GCK_IS_OBJECT (object));
+
+	g_assert (GKM_IS_OBJECT (object));
 	g_assert (property);
 	g_assert (result);
-	
-	spec = g_object_class_find_property (G_OBJECT_GET_CLASS (object), 
+
+	spec = g_object_class_find_property (G_OBJECT_GET_CLASS (object),
 	                                     property);
-		
-	/* Not an error, just no such property on object */ 
+
+	/* Not an error, just no such property on object */
 	if (spec == NULL) {
 		*result = NULL;
 		return TRUE;
 	}
-	
+
 	g_value_init(&value, spec->value_type);
 	g_object_get_property (G_OBJECT (object), property, &value);
 
@@ -226,19 +226,19 @@ read_value (GckObject *object, const gchar *property, CK_ATTRIBUTE_PTR *result)
 		attr.pValue = g_memdup (&boolean, attr.ulValueLen);
 		break;
 	default:
-		g_warning ("couldn't convert value from type %s into attribute", 
+		g_warning ("couldn't convert value from type %s into attribute",
 		           g_type_name (spec->value_type));
 		g_value_unset (&value);
 		return FALSE;
 	};
-	
+
 	if (attr.pValue) {
 		*result = g_slice_new (CK_ATTRIBUTE);
 		memcpy (*result, &attr, sizeof (CK_ATTRIBUTE));
 	} else {
 		*result = NULL;
 	}
-	
+
 	g_value_unset (&value);
 	return TRUE;
 }
@@ -251,7 +251,7 @@ index_remove_attr (Index *index, gpointer object, CK_ATTRIBUTE_PTR attr)
 	g_assert (index);
 	g_assert (object);
 	g_assert (attr);
-	
+
 	if (index->unique) {
 		if (!g_hash_table_remove (index->values, attr))
 			g_assert_not_reached ();
@@ -271,68 +271,68 @@ index_remove (Index *index, gpointer object)
 {
 	CK_ATTRIBUTE_PTR attr;
 
-	/* 
-	 * We don't actually access the object. We want to be able to 
+	/*
+	 * We don't actually access the object. We want to be able to
 	 * handle objects that have been destroyed as well.
 	 */
-	
+
 	g_assert (object);
 	g_assert (index);
-	
+
 	attr = g_hash_table_lookup (index->objects, object);
-	
+
 	/* Object not in this index */
-	if (attr == NULL) 
+	if (attr == NULL)
 		return;
 
 	/* Remove the actual value */
 	index_remove_attr (index, object, attr);
-	
+
 	if (!g_hash_table_remove (index->objects, object))
 		g_assert_not_reached ();
 }
 
 static void
-index_update (Index *index, GckObject *object)
+index_update (Index *index, GkmObject *object)
 {
 	CK_ATTRIBUTE_PTR attr = NULL;
 	CK_ATTRIBUTE_PTR prev;
 	GHashTable *objects;
 	gboolean ret;
 
-	g_assert (GCK_IS_OBJECT (object));
+	g_assert (GKM_IS_OBJECT (object));
 	g_assert (index);
-	
+
 	/* Get the value for this index */
 	if (index->property_name)
 		ret = read_value (object, index->property_name, &attr);
-	else 
+	else
 		ret = read_attribute (object, index->attribute_type, &attr);
 	g_return_if_fail (ret);
-	
+
 	/* No such attribute/property on object */
 	if (attr == NULL)
 		return;
 
 	prev = g_hash_table_lookup (index->objects, object);
 	if (prev != NULL) {
-		
+
 		/* The previous one is same, ignore */
-		if (gck_attribute_equal (prev, attr)) {
+		if (gkm_attribute_equal (prev, attr)) {
 			attribute_free (attr);
 			return;
 		}
-		
+
 		/* Remove the previous one */
 		index_remove_attr (index, object, prev);
-	} 
+	}
 
 	/* In this case values is a direct pointer to the object */
 	if (index->unique) {
 		g_return_if_fail (g_hash_table_lookup (index->values, attr) == NULL);
 		g_hash_table_replace (index->values, attr, object);
 		g_hash_table_replace (index->objects, object, attr);
-		
+
 	/* In this case values is a pointer to a hash set of objects */
 	} else {
 		gpointer key, value;
@@ -351,14 +351,14 @@ index_update (Index *index, GckObject *object)
 }
 
 static gboolean
-index_contains (Index *index, GckObject *object, CK_ATTRIBUTE_PTR attr)
+index_contains (Index *index, GkmObject *object, CK_ATTRIBUTE_PTR attr)
 {
 	GHashTable *objects;
-	
+
 	g_assert (index);
-	g_assert (GCK_IS_OBJECT (object));
+	g_assert (GKM_IS_OBJECT (object));
 	g_assert (attr);
-	
+
 	if (index->unique) {
 		return (g_hash_table_lookup (index->values, attr) == object);
 	} else {
@@ -380,16 +380,16 @@ index_remove_each (gpointer key, gpointer value, gpointer user_data)
 }
 
 static void
-notify_attribute (GckObject *object, CK_ATTRIBUTE_TYPE attr_type, GckManager *self)
+notify_attribute (GkmObject *object, CK_ATTRIBUTE_TYPE attr_type, GkmManager *self)
 {
 	Index *index;
-	
-	g_return_if_fail (GCK_IS_OBJECT (object));
-	g_return_if_fail (GCK_IS_MANAGER (self));
-	g_return_if_fail (gck_object_get_manager (object) == self);
-	
+
+	g_return_if_fail (GKM_IS_OBJECT (object));
+	g_return_if_fail (GKM_IS_MANAGER (self));
+	g_return_if_fail (gkm_object_get_manager (object) == self);
+
 	index = g_hash_table_lookup (self->pv->index_by_attribute, &attr_type);
-	if (index != NULL) 
+	if (index != NULL)
 		index_update (index, object);
 
 	/* Tell everyone that this attribute changed on this object */
@@ -397,43 +397,43 @@ notify_attribute (GckObject *object, CK_ATTRIBUTE_TYPE attr_type, GckManager *se
 }
 
 static void
-notify_property (GckObject *object, GParamSpec *spec, GckManager *self)
+notify_property (GkmObject *object, GParamSpec *spec, GkmManager *self)
 {
 	Index *index;
-	
-	g_return_if_fail (GCK_IS_OBJECT (object));
-	g_return_if_fail (GCK_IS_MANAGER (self));
-	g_return_if_fail (gck_object_get_manager (object) == self);
-	
+
+	g_return_if_fail (GKM_IS_OBJECT (object));
+	g_return_if_fail (GKM_IS_MANAGER (self));
+	g_return_if_fail (gkm_object_get_manager (object) == self);
+
 	index = g_hash_table_lookup (self->pv->index_by_property, spec->name);
 	if (index != NULL)
 		index_update (index, object);
 }
 
 static void
-add_object (GckManager *self, GckObject *object)
+add_object (GkmManager *self, GkmObject *object)
 {
 	CK_OBJECT_HANDLE handle;
-	
-	g_assert (GCK_IS_MANAGER (self));
-	g_assert (GCK_IS_OBJECT (object));
-	g_assert (gck_object_get_manager (object) == self);
-	
-	handle = gck_object_get_handle (object);
+
+	g_assert (GKM_IS_MANAGER (self));
+	g_assert (GKM_IS_OBJECT (object));
+	g_assert (gkm_object_get_manager (object) == self);
+
+	handle = gkm_object_get_handle (object);
 	if (!handle) {
 		/* Make a new handle */
-		handle = gck_util_next_handle ();
-		gck_object_set_handle (object, handle);
+		handle = gkm_util_next_handle ();
+		gkm_object_set_handle (object, handle);
 	}
 
-	/* 
-	 * We don't ref the objects or anything. They're expected to 
-	 * unregister upon dispose.   
+	/*
+	 * We don't ref the objects or anything. They're expected to
+	 * unregister upon dispose.
 	 */
-	
+
 	/* Note objects is being managed */
 	self->pv->objects = g_list_prepend (self->pv->objects, object);
-	
+
 	/* Now index the object properly */
 	g_hash_table_foreach (self->pv->index_by_attribute, index_object_each, object);
 	g_hash_table_foreach (self->pv->index_by_property, index_object_each, object);
@@ -445,24 +445,24 @@ add_object (GckManager *self, GckObject *object)
 }
 
 static void
-remove_object (GckManager *self, GckObject *object)
+remove_object (GkmManager *self, GkmObject *object)
 {
 	CK_OBJECT_HANDLE handle;
-	
-	g_assert (GCK_IS_MANAGER (self));
-	g_assert (GCK_IS_OBJECT (object));
-	g_assert (gck_object_get_manager (object) == self);
-	
-	handle = gck_object_get_handle (object);
+
+	g_assert (GKM_IS_MANAGER (self));
+	g_assert (GKM_IS_OBJECT (object));
+	g_assert (gkm_object_get_manager (object) == self);
+
+	handle = gkm_object_get_handle (object);
 	g_assert (handle);
-	
+
 	/* Remove from all indexes */
 	g_signal_handlers_disconnect_by_func (object, G_CALLBACK (notify_attribute), self);
 	g_signal_handlers_disconnect_by_func (object, G_CALLBACK (notify_property), self);
 	g_hash_table_foreach (self->pv->index_by_attribute, index_remove_each, object);
 	g_hash_table_foreach (self->pv->index_by_property, index_remove_each, object);
-	
-	/* Release object management */		
+
+	/* Release object management */
 	self->pv->objects = g_list_remove (self->pv->objects, object);
 
 	/* Tell everyone this object is gone */
@@ -476,10 +476,10 @@ find_each_object (gpointer unused, gpointer object, gpointer user_data)
 	CK_ATTRIBUTE_PTR attr;
 	Index *index;
 	CK_ULONG i;
-	
+
 	g_assert (finder);
-	g_assert (GCK_IS_MANAGER (finder->manager));
-	
+	g_assert (GKM_IS_MANAGER (finder->manager));
+
 	/* Match the object against all the other attributes */
 	for (i = 0; i < finder->n_attrs; ++i) {
 		attr = &(finder->attrs[i]);
@@ -488,11 +488,11 @@ find_each_object (gpointer unused, gpointer object, gpointer user_data)
 			if (!index_contains (index, object, attr))
 				return;
 		} else {
-			if (!gck_object_match (object, NULL, attr))
+			if (!gkm_object_match (object, NULL, attr))
 				return;
 		}
 	}
-	
+
 	(finder->accumulator) (finder, object);
 }
 
@@ -501,17 +501,17 @@ find_for_attributes (Finder *finder)
 {
 	GHashTable *objects;
 	CK_ATTRIBUTE_PTR first;
-	GckObject *object;
+	GkmObject *object;
 	Index *index;
 	GList *l;
-	
+
 	g_assert (finder);
-	g_assert (GCK_IS_MANAGER (finder->manager));
+	g_assert (GKM_IS_MANAGER (finder->manager));
 	g_assert (!finder->n_attrs || finder->attrs);
-	
+
 	/* All the objects */
 	if (!finder->n_attrs) {
-		for (l = finder->manager->pv->objects; l; l = g_list_next (l)) 
+		for (l = finder->manager->pv->objects; l; l = g_list_next (l))
 			(finder->accumulator) (finder, l->data);
 		return;
 	}
@@ -520,21 +520,21 @@ find_for_attributes (Finder *finder)
 	finder->attrs = finder->attrs + 1;
 	finder->n_attrs = finder->n_attrs - 1;
 
-	index = g_hash_table_lookup (finder->manager->pv->index_by_attribute, 
+	index = g_hash_table_lookup (finder->manager->pv->index_by_attribute,
 	                             &first->type);
 
-	
+
 	/* No indexes, have to manually match */
 	if (!index) {
-		
+
 		for (l = finder->manager->pv->objects; l; l = g_list_next (l)) {
-			if (gck_object_match (l->data, NULL, first))
+			if (gkm_object_match (l->data, NULL, first))
 				find_each_object (NULL, l->data, finder);
 		}
-		
+
 		return;
 	}
-	
+
 	/* Yay, an index */
 	if (index->unique) {
 		object = g_hash_table_lookup (index->values, first);
@@ -548,31 +548,31 @@ find_for_attributes (Finder *finder)
 }
 
 static void
-accumulate_list (Finder *finder, GckObject *object)
+accumulate_list (Finder *finder, GkmObject *object)
 {
 	finder->results = g_list_prepend (finder->results, object);
 }
 
 static void
-accumulate_one (Finder *finder, GckObject *object)
+accumulate_one (Finder *finder, GkmObject *object)
 {
 	if (!finder->results)
 		finder->results = object;
 }
 
 static void
-accumulate_handles (Finder *finder, GckObject *object)
+accumulate_handles (Finder *finder, GkmObject *object)
 {
-	CK_OBJECT_HANDLE handle = gck_object_get_handle (object);
+	CK_OBJECT_HANDLE handle = gkm_object_get_handle (object);
 	g_return_if_fail (handle);
 	g_array_append_val (finder->results, handle);
 }
 
 static void
-accumulate_public_handles (Finder *finder, GckObject *object)
+accumulate_public_handles (Finder *finder, GkmObject *object)
 {
 	gboolean is_private;
-	if (gck_object_get_attribute_boolean (object, NULL, CKA_PRIVATE, &is_private) && is_private)
+	if (gkm_object_get_attribute_boolean (object, NULL, CKA_PRIVATE, &is_private) && is_private)
 		return;
 	accumulate_handles (finder, object);
 }
@@ -585,20 +585,20 @@ values_to_list (gpointer key, gpointer value, gpointer user_data)
 }
 
 static GList*
-find_all_for_property (GckManager *self, const gchar *property, CK_ATTRIBUTE_PTR attr)
+find_all_for_property (GkmManager *self, const gchar *property, CK_ATTRIBUTE_PTR attr)
 {
-	GckObject *object;
+	GkmObject *object;
 	GHashTable *objects;
 	GList *results = NULL;
 	Index *index;
-	
-	g_assert (GCK_IS_MANAGER (self));
+
+	g_assert (GKM_IS_MANAGER (self));
 	g_assert (property);
 	g_assert (attr);
-	
+
 	index = g_hash_table_lookup (self->pv->index_by_property, property);
 	g_return_val_if_fail (index, NULL);
-	
+
 	if (index->unique) {
 		object = g_hash_table_lookup (index->values, attr);
 		return object ? g_list_prepend (NULL, object) : NULL;
@@ -608,24 +608,24 @@ find_all_for_property (GckManager *self, const gchar *property, CK_ATTRIBUTE_PTR
 			return NULL;
 		g_hash_table_foreach (objects, values_to_list, &results);
 		return results;
-	}	
+	}
 }
 
-static GckObject*
-find_one_for_property (GckManager *self, const gchar *property, CK_ATTRIBUTE_PTR attr)
+static GkmObject*
+find_one_for_property (GkmManager *self, const gchar *property, CK_ATTRIBUTE_PTR attr)
 {
-	GckObject *object;
+	GkmObject *object;
 	GHashTable *objects;
 	GList *results = NULL;
 	Index *index;
-	
-	g_assert (GCK_IS_MANAGER (self));
+
+	g_assert (GKM_IS_MANAGER (self));
 	g_assert (property);
 	g_assert (attr);
-	
+
 	index = g_hash_table_lookup (self->pv->index_by_property, property);
 	g_return_val_if_fail (index, NULL);
-	
+
 	if (index->unique) {
 		return g_hash_table_lookup (index->values, attr);
 	} else {
@@ -636,7 +636,7 @@ find_one_for_property (GckManager *self, const gchar *property, CK_ATTRIBUTE_PTR
 		object = results ? results->data : NULL;
 		g_list_free (results);
 		return object;
-	}	
+	}
 }
 
 /* -----------------------------------------------------------------------------
@@ -644,24 +644,24 @@ find_one_for_property (GckManager *self, const gchar *property, CK_ATTRIBUTE_PTR
  */
 
 static void
-gck_manager_init (GckManager *self)
+gkm_manager_init (GkmManager *self)
 {
-	self->pv = G_TYPE_INSTANCE_GET_PRIVATE(self, GCK_TYPE_MANAGER, GckManagerPrivate);
-	self->pv->index_by_attribute = g_hash_table_new_full (gck_util_ulong_hash, gck_util_ulong_equal,
-	                                                      gck_util_ulong_free, index_free);
+	self->pv = G_TYPE_INSTANCE_GET_PRIVATE(self, GKM_TYPE_MANAGER, GkmManagerPrivate);
+	self->pv->index_by_attribute = g_hash_table_new_full (gkm_util_ulong_hash, gkm_util_ulong_equal,
+	                                                      gkm_util_ulong_free, index_free);
 	self->pv->index_by_property = g_hash_table_new_full (g_str_hash, g_str_equal,
 	                                                     g_free, index_free);
-	gck_manager_add_property_index (self, "handle", TRUE);
-	gck_manager_add_attribute_index (self, CKA_ID, FALSE);
-	gck_manager_add_attribute_index (self, CKA_CLASS, FALSE);
+	gkm_manager_add_property_index (self, "handle", TRUE);
+	gkm_manager_add_attribute_index (self, CKA_ID, FALSE);
+	gkm_manager_add_attribute_index (self, CKA_CLASS, FALSE);
 }
 
 static void
-gck_manager_set_property (GObject *obj, guint prop_id, const GValue *value, 
+gkm_manager_set_property (GObject *obj, guint prop_id, const GValue *value,
                           GParamSpec *pspec)
 {
-	GckManager *self = GCK_MANAGER (obj);
-	
+	GkmManager *self = GKM_MANAGER (obj);
+
 	switch (prop_id) {
 	case PROP_FOR_TOKEN:
 		self->pv->for_token = g_value_get_boolean (value);
@@ -673,14 +673,14 @@ gck_manager_set_property (GObject *obj, guint prop_id, const GValue *value,
 }
 
 static void
-gck_manager_get_property (GObject *obj, guint prop_id, GValue *value, 
+gkm_manager_get_property (GObject *obj, guint prop_id, GValue *value,
                           GParamSpec *pspec)
 {
-	GckManager *self = GCK_MANAGER (obj);
-	
+	GkmManager *self = GKM_MANAGER (obj);
+
 	switch (prop_id) {
 	case PROP_FOR_TOKEN:
-		g_value_set_boolean (value, gck_manager_get_for_token (self));
+		g_value_set_boolean (value, gkm_manager_get_for_token (self));
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -690,66 +690,66 @@ gck_manager_get_property (GObject *obj, guint prop_id, GValue *value,
 
 
 static void
-gck_manager_dispose (GObject *obj)
+gkm_manager_dispose (GObject *obj)
 {
-	GckManager *self = GCK_MANAGER (obj);
- 	GList *objects, *l;
+	GkmManager *self = GKM_MANAGER (obj);
+	GList *objects, *l;
 
 	/* Unregister all objects */
 	objects = g_list_copy (self->pv->objects);
 	for (l = objects; l; l = g_list_next (l))
-		remove_object (self, GCK_OBJECT (l->data));
+		remove_object (self, GKM_OBJECT (l->data));
 	g_list_free (objects);
-	
+
 	g_return_if_fail (self->pv->objects == NULL);
 
-	G_OBJECT_CLASS (gck_manager_parent_class)->dispose (obj);
+	G_OBJECT_CLASS (gkm_manager_parent_class)->dispose (obj);
 }
 
 static void
-gck_manager_finalize (GObject *obj)
+gkm_manager_finalize (GObject *obj)
 {
-	GckManager *self = GCK_MANAGER (obj);
- 	
+	GkmManager *self = GKM_MANAGER (obj);
+
 	g_assert (!self->pv->objects);
 	g_hash_table_destroy (self->pv->index_by_attribute);
 	g_hash_table_destroy (self->pv->index_by_property);
 
-	G_OBJECT_CLASS (gck_manager_parent_class)->finalize (obj);
+	G_OBJECT_CLASS (gkm_manager_parent_class)->finalize (obj);
 }
 
 static void
-gck_manager_class_init (GckManagerClass *klass)
+gkm_manager_class_init (GkmManagerClass *klass)
 {
 	GObjectClass *gobject_class;
 	gobject_class = (GObjectClass*)klass;
 
-	gck_manager_parent_class = g_type_class_peek_parent (klass);
-	gobject_class->dispose = gck_manager_dispose;
-	gobject_class->get_property = gck_manager_get_property;
-	gobject_class->set_property = gck_manager_set_property;
-	gobject_class->finalize = gck_manager_finalize;
+	gkm_manager_parent_class = g_type_class_peek_parent (klass);
+	gobject_class->dispose = gkm_manager_dispose;
+	gobject_class->get_property = gkm_manager_get_property;
+	gobject_class->set_property = gkm_manager_set_property;
+	gobject_class->finalize = gkm_manager_finalize;
+
+	g_type_class_add_private (gobject_class, sizeof (GkmManagerPrivate));
 
-	g_type_class_add_private (gobject_class, sizeof (GckManagerPrivate));
-	
 	g_object_class_install_property (gobject_class, PROP_FOR_TOKEN,
-	         g_param_spec_boolean ("for-token", "For Token", "Whether this manager is for token objects or not", 
+	         g_param_spec_boolean ("for-token", "For Token", "Whether this manager is for token objects or not",
 	                               FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
 
-	signals[OBJECT_ADDED] = g_signal_new ("object-added", GCK_TYPE_MANAGER,
-	                                      G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GckManagerClass, object_added),
+	signals[OBJECT_ADDED] = g_signal_new ("object-added", GKM_TYPE_MANAGER,
+	                                      G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GkmManagerClass, object_added),
 	                                      NULL, NULL, g_cclosure_marshal_VOID__OBJECT,
-	                                      G_TYPE_NONE, 1, GCK_TYPE_OBJECT);
+	                                      G_TYPE_NONE, 1, GKM_TYPE_OBJECT);
 
-	signals[OBJECT_REMOVED] = g_signal_new ("object-removed", GCK_TYPE_MANAGER,
-	                                        G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GckManagerClass, object_removed),
+	signals[OBJECT_REMOVED] = g_signal_new ("object-removed", GKM_TYPE_MANAGER,
+	                                        G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GkmManagerClass, object_removed),
 	                                        NULL, NULL, g_cclosure_marshal_VOID__OBJECT,
-	                                        G_TYPE_NONE, 1, GCK_TYPE_OBJECT);
+	                                        G_TYPE_NONE, 1, GKM_TYPE_OBJECT);
 
-	signals[ATTRIBUTE_CHANGED] = g_signal_new ("attribute-changed", GCK_TYPE_MANAGER,
-	                                           G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GckManagerClass, attribute_changed),
-	                                           NULL, NULL, gck_marshal_VOID__OBJECT_ULONG,
-	                                           G_TYPE_NONE, 2, GCK_TYPE_OBJECT, G_TYPE_ULONG);
+	signals[ATTRIBUTE_CHANGED] = g_signal_new ("attribute-changed", GKM_TYPE_MANAGER,
+	                                           G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GkmManagerClass, attribute_changed),
+	                                           NULL, NULL, gkm_marshal_VOID__OBJECT_ULONG,
+	                                           G_TYPE_NONE, 2, GKM_TYPE_OBJECT, G_TYPE_ULONG);
 }
 
 /* ------------------------------------------------------------------------
@@ -757,132 +757,132 @@ gck_manager_class_init (GckManagerClass *klass)
  */
 
 gboolean
-gck_manager_get_for_token (GckManager *self)
+gkm_manager_get_for_token (GkmManager *self)
 {
-	g_return_val_if_fail (GCK_IS_MANAGER (self), FALSE);
+	g_return_val_if_fail (GKM_IS_MANAGER (self), FALSE);
 	return self->pv->for_token;
 }
 
 void
-gck_manager_add_attribute_index (GckManager *self, CK_ATTRIBUTE_TYPE attr, gboolean unique)
+gkm_manager_add_attribute_index (GkmManager *self, CK_ATTRIBUTE_TYPE attr, gboolean unique)
 {
 	Index *index;
 	GList *l;
-	
-	g_return_if_fail (GCK_IS_MANAGER (self));
+
+	g_return_if_fail (GKM_IS_MANAGER (self));
 	g_return_if_fail (!g_hash_table_lookup (self->pv->index_by_attribute, &attr));
 
 	index = index_new (unique);
 	index->attribute_type = attr;
-	g_hash_table_replace (self->pv->index_by_attribute, gck_util_ulong_alloc (attr), index);
-	
+	g_hash_table_replace (self->pv->index_by_attribute, gkm_util_ulong_alloc (attr), index);
+
 	for (l = self->pv->objects; l; l = g_list_next (l))
 		index_update (index, l->data);
 }
 
 void
-gck_manager_add_property_index (GckManager *self, const gchar *property, gboolean unique)
+gkm_manager_add_property_index (GkmManager *self, const gchar *property, gboolean unique)
 {
 	Index *index;
 	GList *l;
-	
-	g_return_if_fail (GCK_IS_MANAGER (self));
+
+	g_return_if_fail (GKM_IS_MANAGER (self));
 	g_return_if_fail (property);
 	g_return_if_fail (!g_hash_table_lookup (self->pv->index_by_property, property));
 
 	index = index_new (unique);
 	index->property_name = g_strdup (property);
 	g_hash_table_replace (self->pv->index_by_property, g_strdup (property), index);
-	
+
 	for (l = self->pv->objects; l; l = g_list_next (l))
 		index_update (index, l->data);
 }
 
 void
-_gck_manager_register_object (GckManager *self, GckObject *object)
+_gkm_manager_register_object (GkmManager *self, GkmObject *object)
 {
-	g_return_if_fail (GCK_IS_MANAGER (self));
-	g_return_if_fail (GCK_IS_OBJECT (object));
-	g_return_if_fail (gck_object_get_manager (object) == self);
+	g_return_if_fail (GKM_IS_MANAGER (self));
+	g_return_if_fail (GKM_IS_OBJECT (object));
+	g_return_if_fail (gkm_object_get_manager (object) == self);
 
 	add_object (self, object);
 }
 
 void
-_gck_manager_unregister_object (GckManager *self, GckObject *object)
+_gkm_manager_unregister_object (GkmManager *self, GkmObject *object)
 {
-	g_return_if_fail (GCK_IS_MANAGER (self));
-	g_return_if_fail (GCK_IS_OBJECT (object));
-	g_return_if_fail (gck_object_get_manager (object) == self);
+	g_return_if_fail (GKM_IS_MANAGER (self));
+	g_return_if_fail (GKM_IS_OBJECT (object));
+	g_return_if_fail (gkm_object_get_manager (object) == self);
 
 	remove_object (self, object);
 }
 
-GckObject*
-gck_manager_find_by_handle (GckManager *self, CK_OBJECT_HANDLE handle)
+GkmObject*
+gkm_manager_find_by_handle (GkmManager *self, CK_OBJECT_HANDLE handle)
 {
-	g_return_val_if_fail (GCK_IS_MANAGER (self), NULL);
+	g_return_val_if_fail (GKM_IS_MANAGER (self), NULL);
 	g_return_val_if_fail (handle != 0, NULL);
-	
-	return gck_manager_find_one_by_number_property (self, "handle", handle);
+
+	return gkm_manager_find_one_by_number_property (self, "handle", handle);
 }
 
 GList*
-gck_manager_find_by_number_property (GckManager *self, const gchar *property, gulong value)
+gkm_manager_find_by_number_property (GkmManager *self, const gchar *property, gulong value)
 {
 	CK_ATTRIBUTE attr;
 	CK_ULONG number = value;
-	
+
 	attr.type = (CK_ATTRIBUTE_TYPE)-1;
 	attr.pValue = &number;
 	attr.ulValueLen = sizeof (number);
-	
-	return find_all_for_property (self, property, &attr);	
+
+	return find_all_for_property (self, property, &attr);
 }
 
-GckObject*
-gck_manager_find_one_by_number_property (GckManager *self, const gchar *property, gulong value)
+GkmObject*
+gkm_manager_find_one_by_number_property (GkmManager *self, const gchar *property, gulong value)
 {
 	CK_ATTRIBUTE attr;
 	CK_ULONG number = value;
-	
+
 	attr.type = (CK_ATTRIBUTE_TYPE)-1;
 	attr.pValue = &number;
 	attr.ulValueLen = sizeof (number);
-	
+
 	return find_one_for_property (self, property, &attr);
 }
 
 GList*
-gck_manager_find_by_string_property (GckManager *self, const gchar *property, const gchar *value)
+gkm_manager_find_by_string_property (GkmManager *self, const gchar *property, const gchar *value)
 {
 	CK_ATTRIBUTE attr;
-	
+
 	attr.type = (CK_ATTRIBUTE_TYPE)-1;
 	attr.pValue = (void*)value;
 	attr.ulValueLen = value ? strlen (value) : 0;
-	
-	return find_all_for_property (self, property, &attr);		
+
+	return find_all_for_property (self, property, &attr);
 }
 
-GckObject*
-gck_manager_find_one_by_string_property (GckManager *self, const gchar *property, const gchar *value)
+GkmObject*
+gkm_manager_find_one_by_string_property (GkmManager *self, const gchar *property, const gchar *value)
 {
 	CK_ATTRIBUTE attr;
-	
+
 	attr.type = (CK_ATTRIBUTE_TYPE)-1;
 	attr.pValue = (void*)value;
 	attr.ulValueLen = value ? strlen (value) : 0;
-	
+
 	return find_one_for_property (self, property, &attr);
 }
-                           
-GckObject*
-gck_manager_find_one_by_attributes (GckManager *self, CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
+
+GkmObject*
+gkm_manager_find_one_by_attributes (GkmManager *self, CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
 {
 	Finder finder;
-	
-	g_return_val_if_fail (GCK_IS_MANAGER (self), NULL);
+
+	g_return_val_if_fail (GKM_IS_MANAGER (self), NULL);
 	g_return_val_if_fail (attrs || !n_attrs, NULL);
 
 	finder.accumulator = accumulate_one;
@@ -890,18 +890,18 @@ gck_manager_find_one_by_attributes (GckManager *self, CK_ATTRIBUTE_PTR attrs, CK
 	finder.manager = self;
 	finder.attrs = attrs;
 	finder.n_attrs = n_attrs;
-	
+
 	find_for_attributes (&finder);
 
 	return finder.results;
 }
 
 GList*
-gck_manager_find_by_attributes (GckManager *self, CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
+gkm_manager_find_by_attributes (GkmManager *self, CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
 {
 	Finder finder;
-	
-	g_return_val_if_fail (GCK_IS_MANAGER (self), NULL);
+
+	g_return_val_if_fail (GKM_IS_MANAGER (self), NULL);
 	g_return_val_if_fail (attrs || !n_attrs, NULL);
 
 	finder.accumulator = accumulate_list;
@@ -909,63 +909,63 @@ gck_manager_find_by_attributes (GckManager *self, CK_ATTRIBUTE_PTR attrs, CK_ULO
 	finder.manager = self;
 	finder.attrs = attrs;
 	finder.n_attrs = n_attrs;
-	
+
 	find_for_attributes (&finder);
 
 	return finder.results;
 }
 
 GList*
-gck_manager_find_by_class (GckManager *self, CK_OBJECT_CLASS klass)
+gkm_manager_find_by_class (GkmManager *self, CK_OBJECT_CLASS klass)
 {
 	CK_ATTRIBUTE attr;
 
-	g_return_val_if_fail (GCK_IS_MANAGER (self), NULL);
+	g_return_val_if_fail (GKM_IS_MANAGER (self), NULL);
 
 	attr.type = CKA_CLASS;
 	attr.ulValueLen = sizeof (klass);
 	attr.pValue = &klass;
 
-	return gck_manager_find_by_attributes (self, &attr, 1);
+	return gkm_manager_find_by_attributes (self, &attr, 1);
 }
 
-GckObject*
-gck_manager_find_related (GckManager *self, CK_OBJECT_CLASS klass, GckObject *related_to)
+GkmObject*
+gkm_manager_find_related (GkmManager *self, CK_OBJECT_CLASS klass, GkmObject *related_to)
 {
 	CK_ATTRIBUTE attrs[2];
-	GckObject *object;
+	GkmObject *object;
 	guchar *id;
 	gsize n_id;
-	
-	g_return_val_if_fail (GCK_IS_MANAGER (self), NULL);
-	g_return_val_if_fail (GCK_IS_OBJECT (related_to), NULL);
-	
-	id = gck_object_get_attribute_data (related_to, NULL, CKA_ID, &n_id);
+
+	g_return_val_if_fail (GKM_IS_MANAGER (self), NULL);
+	g_return_val_if_fail (GKM_IS_OBJECT (related_to), NULL);
+
+	id = gkm_object_get_attribute_data (related_to, NULL, CKA_ID, &n_id);
 	if (id == NULL)
 		return NULL;
-	
+
 	attrs[0].type = CKA_ID;
 	attrs[0].pValue = id;
 	attrs[0].ulValueLen = n_id;
-	
+
 	attrs[1].type = CKA_CLASS;
 	attrs[1].pValue = &klass;
 	attrs[1].ulValueLen = sizeof (klass);
-	
-	object = gck_manager_find_one_by_attributes (self, attrs, 2);
+
+	object = gkm_manager_find_one_by_attributes (self, attrs, 2);
 	g_free (id);
-	
+
 	return object;
 }
 
 CK_RV
-gck_manager_find_handles (GckManager *self, gboolean also_private, 
-                          CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, 
+gkm_manager_find_handles (GkmManager *self, gboolean also_private,
+                          CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs,
                           GArray *found)
 {
 	Finder finder;
-	
-	g_return_val_if_fail (GCK_IS_MANAGER (self), CKR_GENERAL_ERROR);
+
+	g_return_val_if_fail (GKM_IS_MANAGER (self), CKR_GENERAL_ERROR);
 	g_return_val_if_fail (attrs || !n_attrs, CKR_GENERAL_ERROR);
 
 	finder.accumulator = also_private ? accumulate_handles : accumulate_public_handles;
@@ -973,7 +973,7 @@ gck_manager_find_handles (GckManager *self, gboolean also_private,
 	finder.manager = self;
 	finder.attrs = attrs;
 	finder.n_attrs = n_attrs;
-	
+
 	find_for_attributes (&finder);
 
 	return CKR_OK;
@@ -981,12 +981,12 @@ gck_manager_find_handles (GckManager *self, gboolean also_private,
 
 /* Odd place for this function */
 
-GckManager*
-gck_manager_for_template (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, GckSession *session)
+GkmManager*
+gkm_manager_for_template (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, GkmSession *session)
 {
 	gboolean is_token;
-	if (!gck_attributes_find_boolean (attrs, n_attrs, CKA_TOKEN, &is_token) || !is_token)
-		return gck_session_get_manager (session);
+	if (!gkm_attributes_find_boolean (attrs, n_attrs, CKA_TOKEN, &is_token) || !is_token)
+		return gkm_session_get_manager (session);
 	else
-		return gck_module_get_manager (gck_session_get_module (session));
+		return gkm_module_get_manager (gkm_session_get_module (session));
 }
diff --git a/pkcs11/gck/gck-manager.h b/pkcs11/gkm/gkm-manager.h
similarity index 54%
rename from pkcs11/gck/gck-manager.h
rename to pkcs11/gkm/gkm-manager.h
index 0b7c954..5f07611 100644
--- a/pkcs11/gck/gck-manager.h
+++ b/pkcs11/gkm/gkm-manager.h
@@ -1,48 +1,48 @@
-/* 
+/*
  * 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  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  License for more details.
- *  
- * You should have received a copy of the GNU Lesser General 
+ *
+ * You should have received a copy of the GNU Lesser General
  * 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.
  */
 
-#ifndef __GCK_MANAGER_H__
-#define __GCK_MANAGER_H__
+#ifndef __GKM_MANAGER_H__
+#define __GKM_MANAGER_H__
 
 #include <gcrypt.h>
 #include <glib-object.h>
 
-#include "gck-object.h"
-
-/* 
- * GckManager
- * 
- * A GckManager tracks a set of GckObject objects. It does not own 
- * those objects. Once an object is registered with the manager it gets 
- * an identifier.  
- * 
- * An object will unregister itself from the manager when it is destroyed or 
- * it can be done explicitely.  
- * 
- * A singleton GckManager exists for token objects, those stored in 
+#include "gkm-object.h"
+
+/*
+ * GkmManager
+ *
+ * A GkmManager tracks a set of GkmObject objects. It does not own
+ * those objects. Once an object is registered with the manager it gets
+ * an identifier.
+ *
+ * An object will unregister itself from the manager when it is destroyed or
+ * it can be done explicitely.
+ *
+ * A singleton GkmManager exists for token objects, those stored in
  * persistent storage. This manager lasts for the lifetime of the daemon.
- * 
- * Other GckManager objects can exist per client for session or 
+ *
+ * Other GkmManager objects can exist per client for session or
  * temporary objects. Multiple requests for a manager for the same client
- * will return the same manager. Once all references dissappear this 
+ * will return the same manager. Once all references dissappear this
  * manager will go away.
  */
 
@@ -50,88 +50,88 @@ G_BEGIN_DECLS
 
 #include <glib-object.h>
 
-#include "gck-types.h"
+#include "gkm-types.h"
 
 #include "pkcs11/pkcs11.h"
 
-#define GCK_TYPE_MANAGER             (gck_manager_get_type ())
-#define GCK_MANAGER(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCK_TYPE_MANAGER, GckManager))
-#define GCK_MANAGER_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), GCK_TYPE_MANAGER, GckManager))
-#define GCK_IS_MANAGER(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCK_TYPE_MANAGER))
-#define GCK_IS_MANAGER_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), GCK_TYPE_MANAGER))
-#define GCK_MANAGER_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GCK_TYPE_MANAGER, GckManagerClass))
+#define GKM_TYPE_MANAGER             (gkm_manager_get_type ())
+#define GKM_MANAGER(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_MANAGER, GkmManager))
+#define GKM_MANAGER_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_MANAGER, GkmManager))
+#define GKM_IS_MANAGER(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_MANAGER))
+#define GKM_IS_MANAGER_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_MANAGER))
+#define GKM_MANAGER_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_MANAGER, GkmManagerClass))
 
-typedef struct _GckManagerClass GckManagerClass;
-typedef struct _GckManagerPrivate GckManagerPrivate;
+typedef struct _GkmManagerClass GkmManagerClass;
+typedef struct _GkmManagerPrivate GkmManagerPrivate;
 
-struct _GckManager {
+struct _GkmManager {
 	 GObject parent;
-	 GckManagerPrivate *pv;
+	 GkmManagerPrivate *pv;
 };
 
-struct _GckManagerClass {
+struct _GkmManagerClass {
 	GObjectClass parent_class;
 
 	/* signals */
 
-	void (*object_added) (GckManager *self, GckObject *object);
+	void (*object_added) (GkmManager *self, GkmObject *object);
 
-	void (*object_removed) (GckManager *self, GckObject *object);
+	void (*object_removed) (GkmManager *self, GkmObject *object);
 
-	void (*attribute_changed) (GckManager *self, GckObject *object, CK_ATTRIBUTE_TYPE type);
+	void (*attribute_changed) (GkmManager *self, GkmObject *object, CK_ATTRIBUTE_TYPE type);
 };
 
-GType                   gck_manager_get_type                    (void) G_GNUC_CONST;
+GType                   gkm_manager_get_type                    (void) G_GNUC_CONST;
 
-GckManager*             gck_manager_for_template                (CK_ATTRIBUTE_PTR attrs,
+GkmManager*             gkm_manager_for_template                (CK_ATTRIBUTE_PTR attrs,
                                                                  CK_ULONG n_attrs,
-                                                                 GckSession *session);
+                                                                 GkmSession *session);
 
-gboolean                gck_manager_get_for_token               (GckManager *self);
+gboolean                gkm_manager_get_for_token               (GkmManager *self);
 
-void                    gck_manager_add_attribute_index         (GckManager *self,
+void                    gkm_manager_add_attribute_index         (GkmManager *self,
                                                                  CK_ATTRIBUTE_TYPE attr,
                                                                  gboolean unique);
 
-void                    gck_manager_add_property_index          (GckManager *self,
+void                    gkm_manager_add_property_index          (GkmManager *self,
                                                                  const gchar *property,
                                                                  gboolean unique);
 
-GckObject*              gck_manager_find_by_handle              (GckManager *self,
+GkmObject*              gkm_manager_find_by_handle              (GkmManager *self,
                                                                  CK_OBJECT_HANDLE obj);
 
-GList*                  gck_manager_find_by_number_property     (GckManager *self, 
+GList*                  gkm_manager_find_by_number_property     (GkmManager *self,
                                                                  const gchar *property,
                                                                  gulong value);
 
-GckObject*              gck_manager_find_one_by_number_property (GckManager *self, 
+GkmObject*              gkm_manager_find_one_by_number_property (GkmManager *self,
                                                                  const gchar *property,
                                                                  gulong value);
 
-GList*                  gck_manager_find_by_string_property     (GckManager *self, 
+GList*                  gkm_manager_find_by_string_property     (GkmManager *self,
                                                                  const gchar *property,
                                                                  const gchar *value);
 
-GckObject*              gck_manager_find_one_by_string_property (GckManager *self, 
+GkmObject*              gkm_manager_find_one_by_string_property (GkmManager *self,
                                                                  const gchar *property,
                                                                  const gchar *value);
 
-GList*                  gck_manager_find_by_attributes          (GckManager *self, 
-                                                                 CK_ATTRIBUTE_PTR template, 
+GList*                  gkm_manager_find_by_attributes          (GkmManager *self,
+                                                                 CK_ATTRIBUTE_PTR template,
                                                                  CK_ULONG n_attrs);
 
-GList*                  gck_manager_find_by_class               (GckManager *self,
+GList*                  gkm_manager_find_by_class               (GkmManager *self,
                                                                  CK_OBJECT_CLASS klass);
 
-GckObject*              gck_manager_find_one_by_attributes      (GckManager *self, 
-                                                                 CK_ATTRIBUTE_PTR template, 
+GkmObject*              gkm_manager_find_one_by_attributes      (GkmManager *self,
+                                                                 CK_ATTRIBUTE_PTR template,
                                                                  CK_ULONG n_attrs);
 
-GckObject*              gck_manager_find_related                (GckManager *self,
-                                                     	         CK_OBJECT_CLASS klass,
-                                                     	         GckObject *related_to);
+GkmObject*              gkm_manager_find_related                (GkmManager *self,
+                                                                 CK_OBJECT_CLASS klass,
+                                                                 GkmObject *related_to);
 
-CK_RV                   gck_manager_find_handles                (GckManager *self,
+CK_RV                   gkm_manager_find_handles                (GkmManager *self,
                                                                  gboolean include_private,
                                                                  CK_ATTRIBUTE_PTR template,
                                                                  CK_ULONG count,
@@ -139,5 +139,4 @@ CK_RV                   gck_manager_find_handles                (GckManager *sel
 
 G_END_DECLS
 
-#endif /* __GCK_MANAGER_H__ */
-
+#endif /* __GKM_MANAGER_H__ */
diff --git a/pkcs11/gck/gck-marshal.list b/pkcs11/gkm/gkm-marshal.list
similarity index 100%
rename from pkcs11/gck/gck-marshal.list
rename to pkcs11/gkm/gkm-marshal.list
diff --git a/pkcs11/gck/gck-mechanism-dsa.c b/pkcs11/gkm/gkm-mechanism-dsa.c
similarity index 91%
rename from pkcs11/gck/gck-mechanism-dsa.c
rename to pkcs11/gkm/gkm-mechanism-dsa.c
index 8b75a67..832bf9b 100644
--- a/pkcs11/gck/gck-mechanism-dsa.c
+++ b/pkcs11/gkm/gkm-mechanism-dsa.c
@@ -21,11 +21,11 @@
 
 #include "config.h"
 
-#include "gck-crypto.h"
-#include "gck-mechanism-dsa.h"
-#include "gck-session.h"
-#include "gck-sexp.h"
-#include "gck-sexp-key.h"
+#include "gkm-crypto.h"
+#include "gkm-mechanism-dsa.h"
+#include "gkm-session.h"
+#include "gkm-sexp.h"
+#include "gkm-sexp-key.h"
 
 #include "egg/egg-libgcrypt.h"
 #include "egg/egg-secure-memory.h"
@@ -35,7 +35,7 @@
  */
 
 CK_RV
-gck_mechanism_dsa_sign (gcry_sexp_t sexp, CK_BYTE_PTR data, CK_ULONG n_data,
+gkm_mechanism_dsa_sign (gcry_sexp_t sexp, CK_BYTE_PTR data, CK_ULONG n_data,
                         CK_BYTE_PTR signature, CK_ULONG_PTR n_signature)
 {
 	gcry_sexp_t ssig, splain;
@@ -80,10 +80,10 @@ gck_mechanism_dsa_sign (gcry_sexp_t sexp, CK_BYTE_PTR data, CK_ULONG n_data,
 	g_assert (*n_signature >= 40);
 
 	size = 20;
-	rv = gck_crypto_sexp_to_data (ssig, 20 * 8, signature, &size, NULL, "dsa", "r", NULL);
+	rv = gkm_crypto_sexp_to_data (ssig, 20 * 8, signature, &size, NULL, "dsa", "r", NULL);
 	if (rv == CKR_OK) {
 		g_return_val_if_fail (size == 20, CKR_GENERAL_ERROR);
-		rv = gck_crypto_sexp_to_data (ssig, 20 * 8, signature + 20, &size, NULL, "dsa", "s", NULL);
+		rv = gkm_crypto_sexp_to_data (ssig, 20 * 8, signature + 20, &size, NULL, "dsa", "s", NULL);
 		if (rv == CKR_OK) {
 			g_return_val_if_fail (size == 20, CKR_GENERAL_ERROR);
 			*n_signature = 40;
@@ -95,7 +95,7 @@ gck_mechanism_dsa_sign (gcry_sexp_t sexp, CK_BYTE_PTR data, CK_ULONG n_data,
 }
 
 CK_RV
-gck_mechanism_dsa_verify (gcry_sexp_t sexp, CK_BYTE_PTR data, CK_ULONG n_data,
+gkm_mechanism_dsa_verify (gcry_sexp_t sexp, CK_BYTE_PTR data, CK_ULONG n_data,
                           CK_BYTE_PTR signature, CK_ULONG n_signature)
 {
 	gcry_sexp_t ssig, splain;
diff --git a/pkcs11/gck/gck-mechanism-dsa.h b/pkcs11/gkm/gkm-mechanism-dsa.h
similarity index 84%
rename from pkcs11/gck/gck-mechanism-dsa.h
rename to pkcs11/gkm/gkm-mechanism-dsa.h
index 2434a5c..5a8afe5 100644
--- a/pkcs11/gck/gck-mechanism-dsa.h
+++ b/pkcs11/gkm/gkm-mechanism-dsa.h
@@ -19,10 +19,10 @@
  * 02111-1307, USA.
  */
 
-#ifndef GCK_MECHANISM_DSA_H_
-#define GCK_MECHANISM_DSA_H_
+#ifndef GKM_MECHANISM_DSA_H_
+#define GKM_MECHANISM_DSA_H_
 
-#include "gck-types.h"
+#include "gkm-types.h"
 
 #include "pkcs11/pkcs11.h"
 
@@ -30,20 +30,20 @@
 
 #include <gcrypt.h>
 
-static const CK_MECHANISM_TYPE GCK_CRYPTO_DSA_MECHANISMS[] = {
+static const CK_MECHANISM_TYPE GKM_CRYPTO_DSA_MECHANISMS[] = {
 	CKM_DSA
 };
 
-CK_RV                    gck_mechanism_dsa_sign                        (gcry_sexp_t sexp,
+CK_RV                    gkm_mechanism_dsa_sign                        (gcry_sexp_t sexp,
                                                                         CK_BYTE_PTR data,
                                                                         CK_ULONG n_data,
                                                                         CK_BYTE_PTR signature,
                                                                         CK_ULONG_PTR n_signature);
 
-CK_RV                    gck_mechanism_dsa_verify                      (gcry_sexp_t sexp,
+CK_RV                    gkm_mechanism_dsa_verify                      (gcry_sexp_t sexp,
                                                                         CK_BYTE_PTR data,
                                                                         CK_ULONG n_data,
                                                                         CK_BYTE_PTR signature,
                                                                         CK_ULONG n_signature);
 
-#endif /* GCK_MECHANISM_DSA_H_ */
+#endif /* GKM_MECHANISM_DSA_H_ */
diff --git a/pkcs11/gck/gck-mechanism-rsa.c b/pkcs11/gkm/gkm-mechanism-rsa.c
similarity index 87%
rename from pkcs11/gck/gck-mechanism-rsa.c
rename to pkcs11/gkm/gkm-mechanism-rsa.c
index 8210258..372eb1f 100644
--- a/pkcs11/gck/gck-mechanism-rsa.c
+++ b/pkcs11/gkm/gkm-mechanism-rsa.c
@@ -21,8 +21,8 @@
 
 #include "config.h"
 
-#include "gck-mechanism-rsa.h"
-#include "gck-sexp.h"
+#include "gkm-mechanism-rsa.h"
+#include "gkm-sexp.h"
 
 #include "egg/egg-libgcrypt.h"
 #include "egg/egg-secure-memory.h"
@@ -32,7 +32,7 @@
  */
 
 CK_RV
-gck_mechanism_rsa_encrypt (gcry_sexp_t sexp, EggPadding padding, CK_BYTE_PTR data,
+gkm_mechanism_rsa_encrypt (gcry_sexp_t sexp, EggPadding padding, CK_BYTE_PTR data,
                            CK_ULONG n_data, CK_BYTE_PTR encrypted, CK_ULONG_PTR n_encrypted)
 {
 	gcry_sexp_t splain, sdata;
@@ -54,7 +54,7 @@ gck_mechanism_rsa_encrypt (gcry_sexp_t sexp, EggPadding padding, CK_BYTE_PTR dat
 	}
 
 	/* Prepare the input s expression */
-	rv = gck_crypto_data_to_sexp ("(data (flags raw) (value %m))",
+	rv = gkm_crypto_data_to_sexp ("(data (flags raw) (value %m))",
 	                              nbits, padding, data, n_data, &splain);
 	if (rv != CKR_OK)
 		return rv;
@@ -70,7 +70,7 @@ gck_mechanism_rsa_encrypt (gcry_sexp_t sexp, EggPadding padding, CK_BYTE_PTR dat
 	}
 
 	/* Now extract and send it back out */
-	rv = gck_crypto_sexp_to_data (sdata, nbits, encrypted, n_encrypted, NULL,
+	rv = gkm_crypto_sexp_to_data (sdata, nbits, encrypted, n_encrypted, NULL,
 	                              "enc-val", "rsa", "a", NULL);
 	gcry_sexp_release (sdata);
 
@@ -78,7 +78,7 @@ gck_mechanism_rsa_encrypt (gcry_sexp_t sexp, EggPadding padding, CK_BYTE_PTR dat
 }
 
 CK_RV
-gck_mechanism_rsa_decrypt (gcry_sexp_t sexp, EggPadding padding, CK_BYTE_PTR encrypted,
+gkm_mechanism_rsa_decrypt (gcry_sexp_t sexp, EggPadding padding, CK_BYTE_PTR encrypted,
                            CK_ULONG n_encrypted, CK_BYTE_PTR data, CK_ULONG_PTR n_data)
 {
 	gcry_sexp_t splain, sdata;
@@ -103,7 +103,7 @@ gck_mechanism_rsa_decrypt (gcry_sexp_t sexp, EggPadding padding, CK_BYTE_PTR enc
 		return CKR_DATA_LEN_RANGE;
 
 	/* Prepare the input s expression */
-	rv = gck_crypto_data_to_sexp ("(enc-val (flags) (rsa (a %m)))",
+	rv = gkm_crypto_data_to_sexp ("(enc-val (flags) (rsa (a %m)))",
 	                              nbits, NULL, encrypted, n_encrypted, &sdata);
 	if (rv != CKR_OK)
 		return rv;
@@ -119,14 +119,14 @@ gck_mechanism_rsa_decrypt (gcry_sexp_t sexp, EggPadding padding, CK_BYTE_PTR enc
 	}
 
 	/* Now extract and send it back out */
-	rv = gck_crypto_sexp_to_data (splain, nbits, data, n_data, padding, "value", NULL);
+	rv = gkm_crypto_sexp_to_data (splain, nbits, data, n_data, padding, "value", NULL);
 	gcry_sexp_release (splain);
 
 	return rv;
 }
 
 CK_RV
-gck_mechanism_rsa_sign (gcry_sexp_t sexp, EggPadding padding, CK_BYTE_PTR data,
+gkm_mechanism_rsa_sign (gcry_sexp_t sexp, EggPadding padding, CK_BYTE_PTR data,
                         CK_ULONG n_data, CK_BYTE_PTR signature, CK_ULONG_PTR n_signature)
 {
 	gcry_sexp_t ssig, sdata;
@@ -148,7 +148,7 @@ gck_mechanism_rsa_sign (gcry_sexp_t sexp, EggPadding padding, CK_BYTE_PTR data,
 	}
 
 	/* Prepare the input sexp */
-	rv = gck_crypto_data_to_sexp ("(data (flags raw) (value %m))",
+	rv = gkm_crypto_data_to_sexp ("(data (flags raw) (value %m))",
 	                              nbits, padding, data, n_data, &sdata);
 	if (rv != CKR_OK)
 		return rv;
@@ -164,14 +164,14 @@ gck_mechanism_rsa_sign (gcry_sexp_t sexp, EggPadding padding, CK_BYTE_PTR data,
 	}
 
 	/* Now extract and send it back out */
-	rv = gck_crypto_sexp_to_data (ssig, nbits, signature, n_signature, NULL, "rsa", "s", NULL);
+	rv = gkm_crypto_sexp_to_data (ssig, nbits, signature, n_signature, NULL, "rsa", "s", NULL);
 	gcry_sexp_release (ssig);
 
 	return rv;
 }
 
 CK_RV
-gck_mechanism_rsa_verify (gcry_sexp_t sexp, EggPadding padding, CK_BYTE_PTR data,
+gkm_mechanism_rsa_verify (gcry_sexp_t sexp, EggPadding padding, CK_BYTE_PTR data,
                           CK_ULONG n_data, CK_BYTE_PTR signature, CK_ULONG n_signature)
 {
 	gcry_sexp_t ssig, sdata;
@@ -191,12 +191,12 @@ gck_mechanism_rsa_verify (gcry_sexp_t sexp, EggPadding padding, CK_BYTE_PTR data
 		return CKR_SIGNATURE_LEN_RANGE;
 
 	/* Prepare the input s expressions */
-	rv = gck_crypto_data_to_sexp ("(data (flags raw) (value %m))",
+	rv = gkm_crypto_data_to_sexp ("(data (flags raw) (value %m))",
 	                   nbits, padding, data, n_data, &sdata);
 	if (rv != CKR_OK)
 		return rv;
 
-	rv = gck_crypto_data_to_sexp ("(sig-val (rsa (s %m)))",
+	rv = gkm_crypto_data_to_sexp ("(sig-val (rsa (s %m)))",
 	                   nbits, NULL, signature, n_signature, &ssig);
 	if (rv != CKR_OK) {
 		gcry_sexp_release (sdata);
diff --git a/pkcs11/gck/gck-mechanism-rsa.h b/pkcs11/gkm/gkm-mechanism-rsa.h
similarity index 86%
rename from pkcs11/gck/gck-mechanism-rsa.h
rename to pkcs11/gkm/gkm-mechanism-rsa.h
index b0ede3c..dd89aa3 100644
--- a/pkcs11/gck/gck-mechanism-rsa.h
+++ b/pkcs11/gkm/gkm-mechanism-rsa.h
@@ -19,11 +19,11 @@
  * 02111-1307, USA.
  */
 
-#ifndef GCK_MECHANISM_RSA_H_
-#define GCK_MECHANISM_RSA_H_
+#ifndef GKM_MECHANISM_RSA_H_
+#define GKM_MECHANISM_RSA_H_
 
-#include "gck-crypto.h"
-#include "gck-types.h"
+#include "gkm-crypto.h"
+#include "gkm-types.h"
 
 #include "pkcs11/pkcs11.h"
 
@@ -31,37 +31,37 @@
 
 #include <gcrypt.h>
 
-static const CK_MECHANISM_TYPE GCK_CRYPTO_RSA_MECHANISMS[] = {
+static const CK_MECHANISM_TYPE GKM_CRYPTO_RSA_MECHANISMS[] = {
 	CKM_RSA_PKCS,
 	CKM_RSA_X_509
 };
 
-CK_RV                    gck_mechanism_rsa_encrypt                     (gcry_sexp_t sexp,
+CK_RV                    gkm_mechanism_rsa_encrypt                     (gcry_sexp_t sexp,
                                                                         EggPadding padding,
                                                                         CK_BYTE_PTR data,
                                                                         CK_ULONG n_data,
                                                                         CK_BYTE_PTR encrypted,
                                                                         CK_ULONG_PTR n_encrypted);
 
-CK_RV                    gck_mechanism_rsa_decrypt                     (gcry_sexp_t sexp,
+CK_RV                    gkm_mechanism_rsa_decrypt                     (gcry_sexp_t sexp,
                                                                         EggPadding padding,
                                                                         CK_BYTE_PTR encrypted,
                                                                         CK_ULONG n_encrypted,
                                                                         CK_BYTE_PTR data,
                                                                         CK_ULONG_PTR n_data);
 
-CK_RV                    gck_mechanism_rsa_sign                        (gcry_sexp_t sexp,
+CK_RV                    gkm_mechanism_rsa_sign                        (gcry_sexp_t sexp,
                                                                         EggPadding padding,
                                                                         CK_BYTE_PTR data,
                                                                         CK_ULONG n_data,
                                                                         CK_BYTE_PTR signature,
                                                                         CK_ULONG_PTR n_signature);
 
-CK_RV                    gck_mechanism_rsa_verify                      (gcry_sexp_t sexp,
+CK_RV                    gkm_mechanism_rsa_verify                      (gcry_sexp_t sexp,
                                                                         EggPadding padding,
                                                                         CK_BYTE_PTR data,
                                                                         CK_ULONG n_data,
                                                                         CK_BYTE_PTR signature,
                                                                         CK_ULONG n_signature);
 
-#endif /* GCK_MECHANISM_RSA_H_ */
+#endif /* GKM_MECHANISM_RSA_H_ */
diff --git a/pkcs11/gck/gck-memory-store.c b/pkcs11/gkm/gkm-memory-store.c
similarity index 62%
rename from pkcs11/gck/gck-memory-store.c
rename to pkcs11/gkm/gkm-memory-store.c
index 49ab5fb..66240ec 100644
--- a/pkcs11/gck/gck-memory-store.c
+++ b/pkcs11/gkm/gkm-memory-store.c
@@ -1,34 +1,34 @@
-/* 
+/*
  * 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"
 
-#include "gck-attributes.h"
-#include "gck-object.h"
-#include "gck-memory-store.h"
-#include "gck-transaction.h"
-#include "gck-util.h"
+#include "gkm-attributes.h"
+#include "gkm-object.h"
+#include "gkm-memory-store.h"
+#include "gkm-transaction.h"
+#include "gkm-util.h"
 
-struct _GckMemoryStore {
-	GckStore parent;
+struct _GkmMemoryStore {
+	GkmStore parent;
 	GHashTable *entries;
 };
 
@@ -38,10 +38,10 @@ typedef struct _Revert {
 	CK_ATTRIBUTE_PTR attr;
 } Revert;
 
-G_DEFINE_TYPE (GckMemoryStore, gck_memory_store, GCK_TYPE_STORE);
+G_DEFINE_TYPE (GkmMemoryStore, gkm_memory_store, GKM_TYPE_STORE);
 
 /* -----------------------------------------------------------------------------
- * INTERNAL 
+ * INTERNAL
  */
 
 static void
@@ -69,11 +69,11 @@ attribute_dup (CK_ATTRIBUTE_PTR attr)
 static void
 object_gone (gpointer data, GObject *was_object)
 {
-	GckMemoryStore *self;
-	
-	g_assert (GCK_IS_MEMORY_STORE (data));
-	self = GCK_MEMORY_STORE (data);
-	
+	GkmMemoryStore *self;
+
+	g_assert (GKM_IS_MEMORY_STORE (data));
+	self = GKM_MEMORY_STORE (data);
+
 	if (!g_hash_table_remove (self->entries, was_object))
 		g_return_if_reached ();
 }
@@ -81,30 +81,30 @@ object_gone (gpointer data, GObject *was_object)
 static gboolean
 remove_each_object (gpointer key, gpointer value, gpointer user_data)
 {
-	g_assert (GCK_IS_OBJECT (key));
-	g_assert (GCK_IS_MEMORY_STORE (user_data));
-	
+	g_assert (GKM_IS_OBJECT (key));
+	g_assert (GKM_IS_MEMORY_STORE (user_data));
+
 	g_object_weak_unref (key, object_gone, user_data);
 	return TRUE;
 }
 
 static gboolean
-complete_set (GckTransaction *transaction, GckObject *object, Revert *revert)
+complete_set (GkmTransaction *transaction, GkmObject *object, Revert *revert)
 {
-	g_assert (GCK_IS_OBJECT (object));
+	g_assert (GKM_IS_OBJECT (object));
 
-	if (gck_transaction_get_failed (transaction)) {
+	if (gkm_transaction_get_failed (transaction)) {
 		if (revert->attr)
 			g_hash_table_replace (revert->attributes, &(revert->attr->type), revert->attr);
 		else
 			g_hash_table_remove (revert->attributes, &(revert->type));
-		
-		gck_object_notify_attribute (object, revert->type);
+
+		gkm_object_notify_attribute (object, revert->type);
 
 		revert->attr = NULL;
 		revert->type = 0;
 	}
-		
+
 	g_hash_table_unref (revert->attributes);
 	attribute_free (revert->attr);
 	g_slice_free (Revert, revert);
@@ -112,55 +112,55 @@ complete_set (GckTransaction *transaction, GckObject *object, Revert *revert)
 }
 
 /* -----------------------------------------------------------------------------
- * OBJECT 
+ * OBJECT
  */
 
 static CK_RV
-gck_memory_store_real_read_value (GckStore *base, GckObject *object, CK_ATTRIBUTE_PTR attr)
+gkm_memory_store_real_read_value (GkmStore *base, GkmObject *object, CK_ATTRIBUTE_PTR attr)
 {
-	GckMemoryStore *self = GCK_MEMORY_STORE (base);
+	GkmMemoryStore *self = GKM_MEMORY_STORE (base);
 	GHashTable *attributes;
 	CK_ATTRIBUTE_PTR at;
-	
+
 	attributes = g_hash_table_lookup (self->entries, object);
 	if (attributes == NULL)
 		return CKR_ATTRIBUTE_TYPE_INVALID;
-	
+
 	at = g_hash_table_lookup (attributes, &(attr->type));
 	if (at == NULL)
 		return CKR_ATTRIBUTE_TYPE_INVALID;
-	
+
 	g_assert (at->type == attr->type);
-	
+
 	/* Yes, we don't fill a buffer, just return pointer */
 	attr->pValue = at->pValue;
 	attr->ulValueLen = at->ulValueLen;
-	
+
 	return CKR_OK;
 }
 
 static void
-gck_memory_store_real_write_value (GckStore *base, GckTransaction *transaction,
-                                   GckObject *object, CK_ATTRIBUTE_PTR attr)
+gkm_memory_store_real_write_value (GkmStore *base, GkmTransaction *transaction,
+                                   GkmObject *object, CK_ATTRIBUTE_PTR attr)
 {
-	GckMemoryStore *self = GCK_MEMORY_STORE (base);
+	GkmMemoryStore *self = GKM_MEMORY_STORE (base);
 	GHashTable *attributes;
 	CK_ATTRIBUTE_PTR at;
 	Revert *revert;
-	
-	g_return_if_fail (!gck_transaction_get_failed (transaction));
-	
+
+	g_return_if_fail (!gkm_transaction_get_failed (transaction));
+
 	attributes = g_hash_table_lookup (self->entries, object);
 	if (attributes == NULL) {
 		g_object_weak_ref (G_OBJECT (object), object_gone, self);
-		attributes = g_hash_table_new_full (gck_util_ulong_hash, gck_util_ulong_equal, 
+		attributes = g_hash_table_new_full (gkm_util_ulong_hash, gkm_util_ulong_equal,
 		                                    NULL, attribute_free);
 		g_hash_table_replace (self->entries, object, attributes);
 	}
-	
+
 	/* No need to go any further if no change */
 	at = g_hash_table_lookup (attributes, &(attr->type));
-	if (at != NULL && gck_attribute_equal (at, attr))
+	if (at != NULL && gkm_attribute_equal (at, attr))
 		return;
 
 	revert = g_slice_new0 (Revert);
@@ -168,52 +168,52 @@ gck_memory_store_real_write_value (GckStore *base, GckTransaction *transaction,
 	revert->type = attr->type;
 	revert->attr = at;
 	g_hash_table_steal (attributes, &(attr->type));
-	gck_transaction_add (transaction, object, (GckTransactionFunc)complete_set, revert);
+	gkm_transaction_add (transaction, object, (GkmTransactionFunc)complete_set, revert);
 
 	attr = attribute_dup (attr);
 	g_hash_table_replace (attributes, &(attr->type), attr);
-	gck_object_notify_attribute (object, attr->type);
+	gkm_object_notify_attribute (object, attr->type);
 }
 
-static GObject* 
-gck_memory_store_constructor (GType type, guint n_props, GObjectConstructParam *props) 
+static GObject*
+gkm_memory_store_constructor (GType type, guint n_props, GObjectConstructParam *props)
 {
-	GckMemoryStore *self = GCK_MEMORY_STORE (G_OBJECT_CLASS (gck_memory_store_parent_class)->constructor(type, n_props, props));
-	g_return_val_if_fail (self, NULL);	
+	GkmMemoryStore *self = GKM_MEMORY_STORE (G_OBJECT_CLASS (gkm_memory_store_parent_class)->constructor(type, n_props, props));
+	g_return_val_if_fail (self, NULL);
 
 	return G_OBJECT (self);
 }
 
 static void
-gck_memory_store_init (GckMemoryStore *self)
+gkm_memory_store_init (GkmMemoryStore *self)
 {
 	self->entries = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, (GDestroyNotify)g_hash_table_unref);
 }
 
 static void
-gck_memory_store_dispose (GObject *obj)
+gkm_memory_store_dispose (GObject *obj)
 {
-	GckMemoryStore *self = GCK_MEMORY_STORE (obj);
-	
+	GkmMemoryStore *self = GKM_MEMORY_STORE (obj);
+
 	g_hash_table_foreach_remove (self->entries, remove_each_object, self);
-    
-	G_OBJECT_CLASS (gck_memory_store_parent_class)->dispose (obj);
+
+	G_OBJECT_CLASS (gkm_memory_store_parent_class)->dispose (obj);
 }
 
 static void
-gck_memory_store_finalize (GObject *obj)
+gkm_memory_store_finalize (GObject *obj)
 {
-	GckMemoryStore *self = GCK_MEMORY_STORE (obj);
+	GkmMemoryStore *self = GKM_MEMORY_STORE (obj);
 
 	g_assert (g_hash_table_size (self->entries) == 0);
 	g_hash_table_destroy (self->entries);
 	self->entries = NULL;
 
-	G_OBJECT_CLASS (gck_memory_store_parent_class)->finalize (obj);
+	G_OBJECT_CLASS (gkm_memory_store_parent_class)->finalize (obj);
 }
 
 static void
-gck_memory_store_set_property (GObject *obj, guint prop_id, const GValue *value, 
+gkm_memory_store_set_property (GObject *obj, guint prop_id, const GValue *value,
                                GParamSpec *pspec)
 {
 	switch (prop_id) {
@@ -224,7 +224,7 @@ gck_memory_store_set_property (GObject *obj, guint prop_id, const GValue *value,
 }
 
 static void
-gck_memory_store_get_property (GObject *obj, guint prop_id, GValue *value, 
+gkm_memory_store_get_property (GObject *obj, guint prop_id, GValue *value,
                                GParamSpec *pspec)
 {
 	switch (prop_id) {
@@ -235,27 +235,27 @@ gck_memory_store_get_property (GObject *obj, guint prop_id, GValue *value,
 }
 
 static void
-gck_memory_store_class_init (GckMemoryStoreClass *klass)
+gkm_memory_store_class_init (GkmMemoryStoreClass *klass)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	GckStoreClass *store_class = GCK_STORE_CLASS (klass);
-    
-	gobject_class->constructor = gck_memory_store_constructor;
-	gobject_class->dispose = gck_memory_store_dispose;
-	gobject_class->finalize = gck_memory_store_finalize;
-	gobject_class->set_property = gck_memory_store_set_property;
-	gobject_class->get_property = gck_memory_store_get_property;
-	
-	store_class->read_value = gck_memory_store_real_read_value;
-	store_class->write_value = gck_memory_store_real_write_value;
+	GkmStoreClass *store_class = GKM_STORE_CLASS (klass);
+
+	gobject_class->constructor = gkm_memory_store_constructor;
+	gobject_class->dispose = gkm_memory_store_dispose;
+	gobject_class->finalize = gkm_memory_store_finalize;
+	gobject_class->set_property = gkm_memory_store_set_property;
+	gobject_class->get_property = gkm_memory_store_get_property;
+
+	store_class->read_value = gkm_memory_store_real_read_value;
+	store_class->write_value = gkm_memory_store_real_write_value;
 }
 
 /* -----------------------------------------------------------------------------
- * PUBLIC 
+ * PUBLIC
  */
 
-GckMemoryStore*
-gck_memory_store_new (void)
+GkmMemoryStore*
+gkm_memory_store_new (void)
 {
-	return g_object_new (GCK_TYPE_MEMORY_STORE, NULL);
+	return g_object_new (GKM_TYPE_MEMORY_STORE, NULL);
 }
diff --git a/pkcs11/gkm/gkm-memory-store.h b/pkcs11/gkm/gkm-memory-store.h
new file mode 100644
index 0000000..f91ac98
--- /dev/null
+++ b/pkcs11/gkm/gkm-memory-store.h
@@ -0,0 +1,48 @@
+/*
+ * 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 __GKM_MEMORY_STORE_H__
+#define __GKM_MEMORY_STORE_H__
+
+#include <glib-object.h>
+
+#include "gkm-store.h"
+#include "gkm-types.h"
+
+#define GKM_TYPE_MEMORY_STORE               (gkm_memory_store_get_type ())
+#define GKM_MEMORY_STORE(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_MEMORY_STORE, GkmMemoryStore))
+#define GKM_MEMORY_STORE_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_MEMORY_STORE, GkmMemoryStoreClass))
+#define GKM_IS_MEMORY_STORE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_MEMORY_STORE))
+#define GKM_IS_MEMORY_STORE_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_MEMORY_STORE))
+#define GKM_MEMORY_STORE_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_MEMORY_STORE, GkmMemoryStoreClass))
+
+typedef struct _GkmMemoryStore GkmMemoryStore;
+typedef struct _GkmMemoryStoreClass GkmMemoryStoreClass;
+
+struct _GkmMemoryStoreClass {
+	GkmStoreClass parent_class;
+};
+
+GType                 gkm_memory_store_get_type               (void);
+
+GkmMemoryStore*       gkm_memory_store_new                    (void);
+
+#endif /* __GKM_MEMORY_STORE_H__ */
diff --git a/pkcs11/gck/gck-module-ep.h b/pkcs11/gkm/gkm-module-ep.h
similarity index 62%
rename from pkcs11/gck/gck-module-ep.h
rename to pkcs11/gkm/gkm-module-ep.h
index d3df265..cfa0aee 100644
--- a/pkcs11/gck/gck-module-ep.h
+++ b/pkcs11/gkm/gkm-module-ep.h
@@ -1,79 +1,79 @@
-/* 
+/*
  * 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  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  License for more details.
- *  
- * You should have received a copy of the GNU Lesser General 
+ *
+ * You should have received a copy of the GNU Lesser General
  * 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 "gck-crypto.h"
-#include "gck-module.h"
-#include "gck-session.h"
+#include "gkm-crypto.h"
+#include "gkm-module.h"
+#include "gkm-session.h"
 
 #include "pkcs11/pkcs11.h"
 
 #include <unistd.h>
 
-/* Forward declaration, this must be defined manually or using GCK_DEFINE_MODULE */
-static GckModule* gck_module_instantiate (CK_C_INITIALIZE_ARGS_PTR args, GMutex *mutex);
+/* Forward declaration, this must be defined manually or using GKM_DEFINE_MODULE */
+static GkmModule* gkm_module_instantiate (CK_C_INITIALIZE_ARGS_PTR args, GMutex *mutex);
 
-static GckModule *pkcs11_module = NULL;
+static GkmModule *pkcs11_module = NULL;
 static pid_t pkcs11_module_pid = 0;
 static GStaticMutex pkcs11_module_mutex = G_STATIC_MUTEX_INIT;
 
-static CK_FUNCTION_LIST gck_module_function_list;
+static CK_FUNCTION_LIST gkm_module_function_list;
 
 static CK_RV
-gck_C_Initialize (CK_VOID_PTR init_args)
+gkm_C_Initialize (CK_VOID_PTR init_args)
 {
 	CK_C_INITIALIZE_ARGS_PTR args = (CK_C_INITIALIZE_ARGS_PTR)init_args;
 	CK_RV rv = CKR_OK;
 	pid_t pid = getpid ();
 	gboolean supplied_ok;
-	
+
 	if (args) {
-		
+
 		/* ALL supplied function pointers need to have the value either NULL or non-NULL. */
 		supplied_ok = (args->CreateMutex == NULL && args->DestroyMutex == NULL &&
 		               args->LockMutex == NULL && args->UnlockMutex == NULL) ||
 		              (args->CreateMutex != NULL && args->DestroyMutex != NULL &&
 		               args->LockMutex != NULL && args->UnlockMutex != NULL);
-		
+
 		if (!supplied_ok) {
 			g_message ("invalid set of mutex calls supplied");
 			return CKR_ARGUMENTS_BAD;
 		}
-		
+
 		if (!(args->flags & CKF_OS_LOCKING_OK)) {
 			g_message ("must be able to use our own locking and multi-thread primitives");
 			return CKR_CANT_LOCK;
 		}
 	}
 
-	gck_crypto_initialize ();
-	
+	gkm_crypto_initialize ();
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			if (pkcs11_module_pid == pid) 
+			if (pkcs11_module_pid == pid)
 				rv = CKR_CRYPTOKI_ALREADY_INITIALIZED;
-			else 
+			else
 				pkcs11_module_pid = pid;
 		} else {
-			pkcs11_module = gck_module_instantiate (args, g_static_mutex_get_mutex (&pkcs11_module_mutex));
+			pkcs11_module = gkm_module_instantiate (args, g_static_mutex_get_mutex (&pkcs11_module_mutex));
 			if (!pkcs11_module) {
 				g_warning ("module could not be instantiated");
 				rv = CKR_GENERAL_ERROR;
@@ -88,15 +88,15 @@ gck_C_Initialize (CK_VOID_PTR init_args)
 }
 
 static CK_RV
-gck_C_Finalize (CK_VOID_PTR reserved)
+gkm_C_Finalize (CK_VOID_PTR reserved)
 {
 	CK_RV rv = CKR_OK;
-	
+
 	if (reserved)
 		return CKR_ARGUMENTS_BAD;
-	
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module == NULL) {
 			rv = CKR_CRYPTOKI_NOT_INITIALIZED;
 		} else {
@@ -107,398 +107,398 @@ gck_C_Finalize (CK_VOID_PTR reserved)
 		}
 
 	g_static_mutex_unlock (&pkcs11_module_mutex);
-	
+
 	return rv;
 }
 
 static CK_RV
-gck_C_GetInfo (CK_INFO_PTR info)
+gkm_C_GetInfo (CK_INFO_PTR info)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL)
-			rv = gck_module_C_GetInfo (pkcs11_module, info);
-			
+			rv = gkm_module_C_GetInfo (pkcs11_module, info);
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
-	
+
 	return rv;
 }
 
 static CK_RV
-gck_C_GetFunctionList (CK_FUNCTION_LIST_PTR_PTR list)
+gkm_C_GetFunctionList (CK_FUNCTION_LIST_PTR_PTR list)
 {
 	if (!list)
 		return CKR_ARGUMENTS_BAD;
-	*list = &gck_module_function_list;
+	*list = &gkm_module_function_list;
 	return CKR_OK;
 }
 
 static CK_RV
-gck_C_GetSlotList (CK_BBOOL token_present, CK_SLOT_ID_PTR slot_list, CK_ULONG_PTR count)
+gkm_C_GetSlotList (CK_BBOOL token_present, CK_SLOT_ID_PTR slot_list, CK_ULONG_PTR count)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL)
-			rv = gck_module_C_GetSlotList (pkcs11_module, token_present, slot_list, count);
-			
+			rv = gkm_module_C_GetSlotList (pkcs11_module, token_present, slot_list, count);
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
-	
+
 	return rv;
 }
 
 static CK_RV
-gck_C_GetSlotInfo (CK_SLOT_ID id, CK_SLOT_INFO_PTR info)
+gkm_C_GetSlotInfo (CK_SLOT_ID id, CK_SLOT_INFO_PTR info)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL)
-			rv = gck_module_C_GetSlotInfo (pkcs11_module, id, info);
-			
+			rv = gkm_module_C_GetSlotInfo (pkcs11_module, id, info);
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
-	
+
 	return rv;
 }
 
 static CK_RV
-gck_C_GetTokenInfo (CK_SLOT_ID id, CK_TOKEN_INFO_PTR info)
+gkm_C_GetTokenInfo (CK_SLOT_ID id, CK_TOKEN_INFO_PTR info)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL)
-			rv = gck_module_C_GetTokenInfo (pkcs11_module, id, info);
-			
+			rv = gkm_module_C_GetTokenInfo (pkcs11_module, id, info);
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
-	
+
 	return rv;
 }
 
 static CK_RV
-gck_C_GetMechanismList (CK_SLOT_ID id, CK_MECHANISM_TYPE_PTR mechanism_list, CK_ULONG_PTR count)
+gkm_C_GetMechanismList (CK_SLOT_ID id, CK_MECHANISM_TYPE_PTR mechanism_list, CK_ULONG_PTR count)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL)
-			rv = gck_module_C_GetMechanismList (pkcs11_module, id, mechanism_list, count);
-			
+			rv = gkm_module_C_GetMechanismList (pkcs11_module, id, mechanism_list, count);
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
-	
+
 	return rv;
 }
 
 static CK_RV
-gck_C_GetMechanismInfo (CK_SLOT_ID id, CK_MECHANISM_TYPE type, CK_MECHANISM_INFO_PTR info)
+gkm_C_GetMechanismInfo (CK_SLOT_ID id, CK_MECHANISM_TYPE type, CK_MECHANISM_INFO_PTR info)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL)
-			rv = gck_module_C_GetMechanismInfo (pkcs11_module, id, type, info);
-			
+			rv = gkm_module_C_GetMechanismInfo (pkcs11_module, id, type, info);
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
-	
+
 	return rv;
 }
 
 static CK_RV
-gck_C_InitToken (CK_SLOT_ID id, CK_UTF8CHAR_PTR pin, CK_ULONG pin_len, CK_UTF8CHAR_PTR label)
+gkm_C_InitToken (CK_SLOT_ID id, CK_UTF8CHAR_PTR pin, CK_ULONG pin_len, CK_UTF8CHAR_PTR label)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL)
-			rv = gck_module_C_InitToken (pkcs11_module, id, pin, pin_len, label);
-			
+			rv = gkm_module_C_InitToken (pkcs11_module, id, pin, pin_len, label);
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
-	
+
 	return rv;
 }
 
 static CK_RV
-gck_C_WaitForSlotEvent (CK_FLAGS flags, CK_SLOT_ID_PTR slot, CK_VOID_PTR reserved)
+gkm_C_WaitForSlotEvent (CK_FLAGS flags, CK_SLOT_ID_PTR slot, CK_VOID_PTR reserved)
 {
-	/* 
-	 * PKCS#11 GRAY AREA: What happens when we know we'll *never* 
+	/*
+	 * PKCS#11 GRAY AREA: What happens when we know we'll *never*
 	 * have any slot events, and someone calls us without CKR_DONT_BLOCK?
-	 * In case there's a thread dedicated to calling this function in a 
+	 * In case there's a thread dedicated to calling this function in a
 	 * loop, we wait 5 seconds when called without CKR_DONT_BLOCK.
 	 */
-	
+
 	if (!(flags & CKF_DONT_BLOCK))
 		sleep (5);
-	
+
 	return CKR_NO_EVENT;
 }
 
 static CK_RV
-gck_C_OpenSession (CK_SLOT_ID id, CK_FLAGS flags, CK_VOID_PTR user_data, CK_NOTIFY callback, CK_SESSION_HANDLE_PTR handle)
+gkm_C_OpenSession (CK_SLOT_ID id, CK_FLAGS flags, CK_VOID_PTR user_data, CK_NOTIFY callback, CK_SESSION_HANDLE_PTR handle)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL)
-			rv = gck_module_C_OpenSession (pkcs11_module, id, flags, user_data, callback, handle);
-			
+			rv = gkm_module_C_OpenSession (pkcs11_module, id, flags, user_data, callback, handle);
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
-	
+
 	return rv;
 }
 
 static CK_RV
-gck_C_CloseSession (CK_SESSION_HANDLE handle)
+gkm_C_CloseSession (CK_SESSION_HANDLE handle)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL)
-			rv = gck_module_C_CloseSession (pkcs11_module, handle);
-			
+			rv = gkm_module_C_CloseSession (pkcs11_module, handle);
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
-	
+
 	return rv;
 }
 
 static CK_RV
-gck_C_CloseAllSessions (CK_SLOT_ID id)
+gkm_C_CloseAllSessions (CK_SLOT_ID id)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL)
-			rv = gck_module_C_CloseAllSessions (pkcs11_module, id);
-			
+			rv = gkm_module_C_CloseAllSessions (pkcs11_module, id);
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
-	
+
 	return rv;
 }
 
 static CK_RV
-gck_C_GetFunctionStatus (CK_SESSION_HANDLE handle)
+gkm_C_GetFunctionStatus (CK_SESSION_HANDLE handle)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-	
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_GetFunctionStatus (session);
+				rv = gkm_session_C_GetFunctionStatus (session);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-			
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_CancelFunction (CK_SESSION_HANDLE handle)
+gkm_C_CancelFunction (CK_SESSION_HANDLE handle)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-	
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_CancelFunction (session);
+				rv = gkm_session_C_CancelFunction (session);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-			
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_GetSessionInfo (CK_SESSION_HANDLE handle, CK_SESSION_INFO_PTR info)
+gkm_C_GetSessionInfo (CK_SESSION_HANDLE handle, CK_SESSION_INFO_PTR info)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-	
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_GetSessionInfo (session,
+				rv = gkm_session_C_GetSessionInfo (session,
 				                                   info);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-			
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_InitPIN (CK_SESSION_HANDLE handle, CK_UTF8CHAR_PTR pin, CK_ULONG pin_len)
+gkm_C_InitPIN (CK_SESSION_HANDLE handle, CK_UTF8CHAR_PTR pin, CK_ULONG pin_len)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL)
-			rv = gck_module_C_InitPIN (pkcs11_module, handle, pin, pin_len);
-			
+			rv = gkm_module_C_InitPIN (pkcs11_module, handle, pin, pin_len);
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_SetPIN (CK_SESSION_HANDLE handle, CK_UTF8CHAR_PTR old_pin, CK_ULONG old_pin_len, CK_UTF8CHAR_PTR new_pin, CK_ULONG new_pin_len)
+gkm_C_SetPIN (CK_SESSION_HANDLE handle, CK_UTF8CHAR_PTR old_pin, CK_ULONG old_pin_len, CK_UTF8CHAR_PTR new_pin, CK_ULONG new_pin_len)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL)
-			rv = gck_module_C_SetPIN (pkcs11_module, handle, old_pin, old_pin_len, new_pin, new_pin_len);
-			
+			rv = gkm_module_C_SetPIN (pkcs11_module, handle, old_pin, old_pin_len, new_pin, new_pin_len);
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_GetOperationState (CK_SESSION_HANDLE handle, CK_BYTE_PTR operation_state, CK_ULONG_PTR operation_state_len)
+gkm_C_GetOperationState (CK_SESSION_HANDLE handle, CK_BYTE_PTR operation_state, CK_ULONG_PTR operation_state_len)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-	
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_GetOperationState (session,
+				rv = gkm_session_C_GetOperationState (session,
 				                                      operation_state, operation_state_len);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-			
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_SetOperationState (CK_SESSION_HANDLE handle, CK_BYTE_PTR operation_state,
+gkm_C_SetOperationState (CK_SESSION_HANDLE handle, CK_BYTE_PTR operation_state,
                          CK_ULONG operation_state_len, CK_OBJECT_HANDLE encryption_key,
                          CK_OBJECT_HANDLE authentication_key)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-	
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_SetOperationState (session,
+				rv = gkm_session_C_SetOperationState (session,
 				                                      operation_state, operation_state_len, encryption_key, authentication_key);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-			
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_Login (CK_SESSION_HANDLE handle, CK_USER_TYPE user_type,
+gkm_C_Login (CK_SESSION_HANDLE handle, CK_USER_TYPE user_type,
              CK_UTF8CHAR_PTR pin, CK_ULONG pin_len)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL)
-			rv = gck_module_C_Login (pkcs11_module, handle, user_type, pin, pin_len);
-			
+			rv = gkm_module_C_Login (pkcs11_module, handle, user_type, pin, pin_len);
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_Logout (CK_SESSION_HANDLE handle)
+gkm_C_Logout (CK_SESSION_HANDLE handle)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL)
-			rv = gck_module_C_Logout (pkcs11_module, handle);
-			
+			rv = gkm_module_C_Logout (pkcs11_module, handle);
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_CreateObject (CK_SESSION_HANDLE handle, CK_ATTRIBUTE_PTR template,
+gkm_C_CreateObject (CK_SESSION_HANDLE handle, CK_ATTRIBUTE_PTR template,
                     CK_ULONG count, CK_OBJECT_HANDLE_PTR new_object)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-		
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_CreateObject (session,
+				rv = gkm_session_C_CreateObject (session,
 				                                 template, count, new_object);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_CopyObject (CK_SESSION_HANDLE handle, CK_OBJECT_HANDLE object,
+gkm_C_CopyObject (CK_SESSION_HANDLE handle, CK_OBJECT_HANDLE object,
                   CK_ATTRIBUTE_PTR template, CK_ULONG count,
                   CK_OBJECT_HANDLE_PTR new_object)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-		
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_CopyObject (session,
+				rv = gkm_session_C_CopyObject (session,
 				                               object, template, count, new_object);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
@@ -506,952 +506,952 @@ gck_C_CopyObject (CK_SESSION_HANDLE handle, CK_OBJECT_HANDLE object,
 
 
 static CK_RV
-gck_C_DestroyObject (CK_SESSION_HANDLE handle, CK_OBJECT_HANDLE object)
+gkm_C_DestroyObject (CK_SESSION_HANDLE handle, CK_OBJECT_HANDLE object)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-		
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_DestroyObject (session, object);
+				rv = gkm_session_C_DestroyObject (session, object);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_GetObjectSize (CK_SESSION_HANDLE handle, CK_OBJECT_HANDLE object,
+gkm_C_GetObjectSize (CK_SESSION_HANDLE handle, CK_OBJECT_HANDLE object,
                      CK_ULONG_PTR size)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-		
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_GetObjectSize (session, object, size);
+				rv = gkm_session_C_GetObjectSize (session, object, size);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_GetAttributeValue (CK_SESSION_HANDLE handle, CK_OBJECT_HANDLE object,
+gkm_C_GetAttributeValue (CK_SESSION_HANDLE handle, CK_OBJECT_HANDLE object,
                          CK_ATTRIBUTE_PTR template, CK_ULONG count)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-		
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_GetAttributeValue (session, object, template, count);
+				rv = gkm_session_C_GetAttributeValue (session, object, template, count);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_SetAttributeValue (CK_SESSION_HANDLE handle, CK_OBJECT_HANDLE object,
+gkm_C_SetAttributeValue (CK_SESSION_HANDLE handle, CK_OBJECT_HANDLE object,
                          CK_ATTRIBUTE_PTR template, CK_ULONG count)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-		
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_SetAttributeValue (session, object, template, count);
+				rv = gkm_session_C_SetAttributeValue (session, object, template, count);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_FindObjectsInit (CK_SESSION_HANDLE handle, CK_ATTRIBUTE_PTR template,
+gkm_C_FindObjectsInit (CK_SESSION_HANDLE handle, CK_ATTRIBUTE_PTR template,
                        CK_ULONG count)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-		
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_FindObjectsInit (session, template, count);
+				rv = gkm_session_C_FindObjectsInit (session, template, count);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-	
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_FindObjects (CK_SESSION_HANDLE handle, CK_OBJECT_HANDLE_PTR objects,
+gkm_C_FindObjects (CK_SESSION_HANDLE handle, CK_OBJECT_HANDLE_PTR objects,
                    CK_ULONG max_count, CK_ULONG_PTR count)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-		
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_FindObjects (session, objects, max_count, count);
+				rv = gkm_session_C_FindObjects (session, objects, max_count, count);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_FindObjectsFinal (CK_SESSION_HANDLE handle)
+gkm_C_FindObjectsFinal (CK_SESSION_HANDLE handle)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-		
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_FindObjectsFinal (session);
+				rv = gkm_session_C_FindObjectsFinal (session);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_EncryptInit (CK_SESSION_HANDLE handle, CK_MECHANISM_PTR mechanism,
+gkm_C_EncryptInit (CK_SESSION_HANDLE handle, CK_MECHANISM_PTR mechanism,
                    CK_OBJECT_HANDLE key)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-		
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_EncryptInit (session, mechanism, key);
+				rv = gkm_session_C_EncryptInit (session, mechanism, key);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_Encrypt (CK_SESSION_HANDLE handle, CK_BYTE_PTR data, CK_ULONG data_len,
+gkm_C_Encrypt (CK_SESSION_HANDLE handle, CK_BYTE_PTR data, CK_ULONG data_len,
                CK_BYTE_PTR encrypted_data, CK_ULONG_PTR encrypted_data_len)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-		
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_Encrypt (session, data, data_len, encrypted_data, encrypted_data_len);
+				rv = gkm_session_C_Encrypt (session, data, data_len, encrypted_data, encrypted_data_len);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_EncryptUpdate (CK_SESSION_HANDLE handle, CK_BYTE_PTR part,
+gkm_C_EncryptUpdate (CK_SESSION_HANDLE handle, CK_BYTE_PTR part,
                      CK_ULONG part_len, CK_BYTE_PTR encrypted_part,
                      CK_ULONG_PTR encrypted_part_len)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-		
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_EncryptUpdate (session, part, part_len, encrypted_part, encrypted_part_len);
+				rv = gkm_session_C_EncryptUpdate (session, part, part_len, encrypted_part, encrypted_part_len);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_EncryptFinal (CK_SESSION_HANDLE handle, CK_BYTE_PTR last_part,
+gkm_C_EncryptFinal (CK_SESSION_HANDLE handle, CK_BYTE_PTR last_part,
                     CK_ULONG_PTR last_part_len)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-		
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_EncryptFinal (session, last_part, last_part_len);
+				rv = gkm_session_C_EncryptFinal (session, last_part, last_part_len);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_DecryptInit (CK_SESSION_HANDLE handle, CK_MECHANISM_PTR mechanism,
+gkm_C_DecryptInit (CK_SESSION_HANDLE handle, CK_MECHANISM_PTR mechanism,
                    CK_OBJECT_HANDLE key)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-		
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_DecryptInit (session, mechanism, key);
+				rv = gkm_session_C_DecryptInit (session, mechanism, key);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_Decrypt (CK_SESSION_HANDLE handle, CK_BYTE_PTR enc_data,
+gkm_C_Decrypt (CK_SESSION_HANDLE handle, CK_BYTE_PTR enc_data,
                CK_ULONG enc_data_len, CK_BYTE_PTR data, CK_ULONG_PTR data_len)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-		
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_Decrypt (session, enc_data, enc_data_len, data, data_len);
+				rv = gkm_session_C_Decrypt (session, enc_data, enc_data_len, data, data_len);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_DecryptUpdate (CK_SESSION_HANDLE handle, CK_BYTE_PTR enc_part,
+gkm_C_DecryptUpdate (CK_SESSION_HANDLE handle, CK_BYTE_PTR enc_part,
                      CK_ULONG enc_part_len, CK_BYTE_PTR part, CK_ULONG_PTR part_len)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-		
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_DecryptUpdate (session, enc_part, enc_part_len, part, part_len);
+				rv = gkm_session_C_DecryptUpdate (session, enc_part, enc_part_len, part, part_len);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_DecryptFinal (CK_SESSION_HANDLE handle, CK_BYTE_PTR last_part,
+gkm_C_DecryptFinal (CK_SESSION_HANDLE handle, CK_BYTE_PTR last_part,
                     CK_ULONG_PTR last_part_len)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-		
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_DecryptFinal (session, last_part, last_part_len);
+				rv = gkm_session_C_DecryptFinal (session, last_part, last_part_len);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_DigestInit (CK_SESSION_HANDLE handle, CK_MECHANISM_PTR mechanism)
+gkm_C_DigestInit (CK_SESSION_HANDLE handle, CK_MECHANISM_PTR mechanism)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-	
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_DigestInit (session, mechanism);
+				rv = gkm_session_C_DigestInit (session, mechanism);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_Digest (CK_SESSION_HANDLE handle, CK_BYTE_PTR data, CK_ULONG data_len,
+gkm_C_Digest (CK_SESSION_HANDLE handle, CK_BYTE_PTR data, CK_ULONG data_len,
               CK_BYTE_PTR digest, CK_ULONG_PTR digest_len)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-		
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_Digest (session, data, data_len, digest, digest_len);
+				rv = gkm_session_C_Digest (session, data, data_len, digest, digest_len);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_DigestUpdate (CK_SESSION_HANDLE handle, CK_BYTE_PTR part, CK_ULONG part_len)
+gkm_C_DigestUpdate (CK_SESSION_HANDLE handle, CK_BYTE_PTR part, CK_ULONG part_len)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-		
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_DigestUpdate (session, part, part_len);
+				rv = gkm_session_C_DigestUpdate (session, part, part_len);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_DigestKey (CK_SESSION_HANDLE handle, CK_OBJECT_HANDLE key)
+gkm_C_DigestKey (CK_SESSION_HANDLE handle, CK_OBJECT_HANDLE key)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-		
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_DigestKey (session, key);
+				rv = gkm_session_C_DigestKey (session, key);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_DigestFinal (CK_SESSION_HANDLE handle, CK_BYTE_PTR digest,
+gkm_C_DigestFinal (CK_SESSION_HANDLE handle, CK_BYTE_PTR digest,
                    CK_ULONG_PTR digest_len)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-		
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_DigestFinal (session, digest, digest_len);
+				rv = gkm_session_C_DigestFinal (session, digest, digest_len);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_SignInit (CK_SESSION_HANDLE handle, CK_MECHANISM_PTR mechanism,
+gkm_C_SignInit (CK_SESSION_HANDLE handle, CK_MECHANISM_PTR mechanism,
                 CK_OBJECT_HANDLE key)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-		
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_SignInit (session, mechanism, key);
+				rv = gkm_session_C_SignInit (session, mechanism, key);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_Sign (CK_SESSION_HANDLE handle, CK_BYTE_PTR data, CK_ULONG data_len,
+gkm_C_Sign (CK_SESSION_HANDLE handle, CK_BYTE_PTR data, CK_ULONG data_len,
             CK_BYTE_PTR signature, CK_ULONG_PTR signature_len)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-		
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_Sign (session, data, data_len, signature, signature_len);
+				rv = gkm_session_C_Sign (session, data, data_len, signature, signature_len);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_SignUpdate (CK_SESSION_HANDLE handle, CK_BYTE_PTR part, CK_ULONG part_len)
+gkm_C_SignUpdate (CK_SESSION_HANDLE handle, CK_BYTE_PTR part, CK_ULONG part_len)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-		
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_SignUpdate (session, part, part_len);
+				rv = gkm_session_C_SignUpdate (session, part, part_len);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
-	
+
 	return rv;
 }
 
 static CK_RV
-gck_C_SignFinal (CK_SESSION_HANDLE handle, CK_BYTE_PTR signature,
+gkm_C_SignFinal (CK_SESSION_HANDLE handle, CK_BYTE_PTR signature,
                  CK_ULONG_PTR signature_len)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-	
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_SignFinal (session, signature, signature_len);
+				rv = gkm_session_C_SignFinal (session, signature, signature_len);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_SignRecoverInit (CK_SESSION_HANDLE handle, CK_MECHANISM_PTR mechanism,
+gkm_C_SignRecoverInit (CK_SESSION_HANDLE handle, CK_MECHANISM_PTR mechanism,
                        CK_OBJECT_HANDLE key)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-	
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_SignRecoverInit (session, mechanism, key);
+				rv = gkm_session_C_SignRecoverInit (session, mechanism, key);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_SignRecover (CK_SESSION_HANDLE handle, CK_BYTE_PTR data, CK_ULONG data_len, 
+gkm_C_SignRecover (CK_SESSION_HANDLE handle, CK_BYTE_PTR data, CK_ULONG data_len,
                    CK_BYTE_PTR signature, CK_ULONG_PTR signature_len)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-	
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_SignRecover (session, data, data_len, signature, signature_len);
+				rv = gkm_session_C_SignRecover (session, data, data_len, signature, signature_len);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_VerifyInit (CK_SESSION_HANDLE handle, CK_MECHANISM_PTR mechanism,
+gkm_C_VerifyInit (CK_SESSION_HANDLE handle, CK_MECHANISM_PTR mechanism,
                   CK_OBJECT_HANDLE key)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
+	GkmSession *session;
 
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_VerifyInit (session, mechanism, key);
+				rv = gkm_session_C_VerifyInit (session, mechanism, key);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_Verify (CK_SESSION_HANDLE handle, CK_BYTE_PTR data, CK_ULONG data_len,
+gkm_C_Verify (CK_SESSION_HANDLE handle, CK_BYTE_PTR data, CK_ULONG data_len,
               CK_BYTE_PTR signature, CK_ULONG signature_len)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
+	GkmSession *session;
 
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_Verify (session, data, data_len, signature, signature_len);
+				rv = gkm_session_C_Verify (session, data, data_len, signature, signature_len);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_VerifyUpdate (CK_SESSION_HANDLE handle, CK_BYTE_PTR part, CK_ULONG part_len)
+gkm_C_VerifyUpdate (CK_SESSION_HANDLE handle, CK_BYTE_PTR part, CK_ULONG part_len)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
+	GkmSession *session;
 
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_VerifyUpdate (session, part, part_len);
+				rv = gkm_session_C_VerifyUpdate (session, part, part_len);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_VerifyFinal (CK_SESSION_HANDLE handle, CK_BYTE_PTR signature,
+gkm_C_VerifyFinal (CK_SESSION_HANDLE handle, CK_BYTE_PTR signature,
                    CK_ULONG signature_len)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-	
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_VerifyFinal (session, signature, signature_len);
+				rv = gkm_session_C_VerifyFinal (session, signature, signature_len);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_VerifyRecoverInit (CK_SESSION_HANDLE handle, CK_MECHANISM_PTR mechanism,
+gkm_C_VerifyRecoverInit (CK_SESSION_HANDLE handle, CK_MECHANISM_PTR mechanism,
                          CK_OBJECT_HANDLE key)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
+	GkmSession *session;
 
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_VerifyRecoverInit (session, mechanism, key);
+				rv = gkm_session_C_VerifyRecoverInit (session, mechanism, key);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_VerifyRecover (CK_SESSION_HANDLE handle, CK_BYTE_PTR signature,
+gkm_C_VerifyRecover (CK_SESSION_HANDLE handle, CK_BYTE_PTR signature,
                      CK_ULONG signature_len, CK_BYTE_PTR data, CK_ULONG_PTR data_len)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
+	GkmSession *session;
 
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_VerifyRecover (session, signature, signature_len, data, data_len);
+				rv = gkm_session_C_VerifyRecover (session, signature, signature_len, data, data_len);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_DigestEncryptUpdate (CK_SESSION_HANDLE handle, CK_BYTE_PTR part,
+gkm_C_DigestEncryptUpdate (CK_SESSION_HANDLE handle, CK_BYTE_PTR part,
                            CK_ULONG part_len, CK_BYTE_PTR enc_part,
                            CK_ULONG_PTR enc_part_len)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
+	GkmSession *session;
 
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_DigestEncryptUpdate (session, part, part_len, enc_part, enc_part_len);
+				rv = gkm_session_C_DigestEncryptUpdate (session, part, part_len, enc_part, enc_part_len);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_DecryptDigestUpdate (CK_SESSION_HANDLE handle, CK_BYTE_PTR enc_part,
-                           CK_ULONG enc_part_len, CK_BYTE_PTR part, 
+gkm_C_DecryptDigestUpdate (CK_SESSION_HANDLE handle, CK_BYTE_PTR enc_part,
+                           CK_ULONG enc_part_len, CK_BYTE_PTR part,
                            CK_ULONG_PTR part_len)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
+	GkmSession *session;
 
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_DecryptDigestUpdate (session, enc_part, enc_part_len, part, part_len);
+				rv = gkm_session_C_DecryptDigestUpdate (session, enc_part, enc_part_len, part, part_len);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_SignEncryptUpdate (CK_SESSION_HANDLE handle, CK_BYTE_PTR part,
+gkm_C_SignEncryptUpdate (CK_SESSION_HANDLE handle, CK_BYTE_PTR part,
                          CK_ULONG part_len, CK_BYTE_PTR enc_part,
                          CK_ULONG_PTR enc_part_len)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-	
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_SignEncryptUpdate (session, part, part_len, enc_part, enc_part_len);
+				rv = gkm_session_C_SignEncryptUpdate (session, part, part_len, enc_part, enc_part_len);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_DecryptVerifyUpdate (CK_SESSION_HANDLE handle, CK_BYTE_PTR enc_part,
-                           CK_ULONG enc_part_len, CK_BYTE_PTR part, 
+gkm_C_DecryptVerifyUpdate (CK_SESSION_HANDLE handle, CK_BYTE_PTR enc_part,
+                           CK_ULONG enc_part_len, CK_BYTE_PTR part,
                            CK_ULONG_PTR part_len)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
+	GkmSession *session;
 
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_DecryptVerifyUpdate (session, enc_part, enc_part_len, part, part_len);
+				rv = gkm_session_C_DecryptVerifyUpdate (session, enc_part, enc_part_len, part, part_len);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_GenerateKey (CK_SESSION_HANDLE handle, CK_MECHANISM_PTR mechanism,
-                   CK_ATTRIBUTE_PTR template, CK_ULONG count, 
+gkm_C_GenerateKey (CK_SESSION_HANDLE handle, CK_MECHANISM_PTR mechanism,
+                   CK_ATTRIBUTE_PTR template, CK_ULONG count,
                    CK_OBJECT_HANDLE_PTR key)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-	
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_GenerateKey (session, mechanism, template, count, key);
+				rv = gkm_session_C_GenerateKey (session, mechanism, template, count, key);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_GenerateKeyPair (CK_SESSION_HANDLE handle, CK_MECHANISM_PTR mechanism,
+gkm_C_GenerateKeyPair (CK_SESSION_HANDLE handle, CK_MECHANISM_PTR mechanism,
                        CK_ATTRIBUTE_PTR pub_template, CK_ULONG pub_count,
                        CK_ATTRIBUTE_PTR priv_template, CK_ULONG priv_count,
                        CK_OBJECT_HANDLE_PTR pub_key, CK_OBJECT_HANDLE_PTR priv_key)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-	
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_GenerateKeyPair (session, mechanism, pub_template, pub_count, priv_template, priv_count, pub_key, priv_key);
+				rv = gkm_session_C_GenerateKeyPair (session, mechanism, pub_template, pub_count, priv_template, priv_count, pub_key, priv_key);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_WrapKey (CK_SESSION_HANDLE handle, CK_MECHANISM_PTR mechanism,
+gkm_C_WrapKey (CK_SESSION_HANDLE handle, CK_MECHANISM_PTR mechanism,
                CK_OBJECT_HANDLE wrapping_key, CK_OBJECT_HANDLE key,
                CK_BYTE_PTR wrapped_key, CK_ULONG_PTR wrapped_key_len)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
+	GkmSession *session;
 
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_WrapKey (session, mechanism, wrapping_key, key, wrapped_key, wrapped_key_len);
+				rv = gkm_session_C_WrapKey (session, mechanism, wrapping_key, key, wrapped_key, wrapped_key_len);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_UnwrapKey (CK_SESSION_HANDLE handle, CK_MECHANISM_PTR mechanism,
+gkm_C_UnwrapKey (CK_SESSION_HANDLE handle, CK_MECHANISM_PTR mechanism,
                  CK_OBJECT_HANDLE unwrapping_key, CK_BYTE_PTR wrapped_key,
                  CK_ULONG wrapped_key_len, CK_ATTRIBUTE_PTR template,
                  CK_ULONG count, CK_OBJECT_HANDLE_PTR key)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
+	GkmSession *session;
 
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_UnwrapKey (session, mechanism, unwrapping_key, wrapped_key, wrapped_key_len, template, count, key);
+				rv = gkm_session_C_UnwrapKey (session, mechanism, unwrapping_key, wrapped_key, wrapped_key_len, template, count, key);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_DeriveKey (CK_SESSION_HANDLE handle, CK_MECHANISM_PTR mechanism,
+gkm_C_DeriveKey (CK_SESSION_HANDLE handle, CK_MECHANISM_PTR mechanism,
                  CK_OBJECT_HANDLE base_key, CK_ATTRIBUTE_PTR template,
                  CK_ULONG count, CK_OBJECT_HANDLE_PTR key)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
+	GkmSession *session;
 
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_DeriveKey (session, mechanism, base_key, template, count, key);
+				rv = gkm_session_C_DeriveKey (session, mechanism, base_key, template, count, key);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_SeedRandom (CK_SESSION_HANDLE handle, CK_BYTE_PTR seed, CK_ULONG seed_len)
+gkm_C_SeedRandom (CK_SESSION_HANDLE handle, CK_BYTE_PTR seed, CK_ULONG seed_len)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
+	GkmSession *session;
 
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_SeedRandom (session, seed, seed_len);
+				rv = gkm_session_C_SeedRandom (session, seed, seed_len);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
 
 	return rv;
 }
 
 static CK_RV
-gck_C_GenerateRandom (CK_SESSION_HANDLE handle, CK_BYTE_PTR random_data,
+gkm_C_GenerateRandom (CK_SESSION_HANDLE handle, CK_BYTE_PTR random_data,
                       CK_ULONG random_len)
 {
 	CK_RV rv = CKR_CRYPTOKI_NOT_INITIALIZED;
-	GckSession *session;
-		
+	GkmSession *session;
+
 	g_static_mutex_lock (&pkcs11_module_mutex);
-	
+
 		if (pkcs11_module != NULL) {
-			session = gck_module_lookup_session (pkcs11_module, handle);
+			session = gkm_module_lookup_session (pkcs11_module, handle);
 			if (session != NULL)
-				rv = gck_session_C_GenerateRandom (session, random_data, random_len);
+				rv = gkm_session_C_GenerateRandom (session, random_data, random_len);
 			else
 				rv = CKR_SESSION_HANDLE_INVALID;
 		}
-				
+
 	g_static_mutex_unlock (&pkcs11_module_mutex);
-	
+
 	return rv;
 }
 
@@ -1459,83 +1459,83 @@ gck_C_GenerateRandom (CK_SESSION_HANDLE handle, CK_BYTE_PTR random_data,
  * MODULE ENTRY POINT
  */
 
-/* 
- * PKCS#11 is broken here. It states that Unix compilers automatically byte 
- * pack structures. This is wrong. GCC on Linux aligns to 4 by default. 
- * 
+/*
+ * PKCS#11 is broken here. It states that Unix compilers automatically byte
+ * pack structures. This is wrong. GCC on Linux aligns to 4 by default.
+ *
  * This results in incompatibilities. Where this structure's first version
  * members take up too much or too little space depending on how this module
  * is compiled.
  */
 
-static CK_FUNCTION_LIST gck_module_function_list = {
+static CK_FUNCTION_LIST gkm_module_function_list = {
 	{ CRYPTOKI_VERSION_MAJOR, CRYPTOKI_VERSION_MINOR },  /* version */
-	gck_C_Initialize,
-	gck_C_Finalize,
-	gck_C_GetInfo,
-	gck_C_GetFunctionList,
-	gck_C_GetSlotList,
-	gck_C_GetSlotInfo,
-	gck_C_GetTokenInfo,
-	gck_C_GetMechanismList,
-	gck_C_GetMechanismInfo,
-	gck_C_InitToken,
-	gck_C_InitPIN,
-	gck_C_SetPIN,
-	gck_C_OpenSession,
-	gck_C_CloseSession,
-	gck_C_CloseAllSessions,
-	gck_C_GetSessionInfo,
-	gck_C_GetOperationState,
-	gck_C_SetOperationState,
-	gck_C_Login,
-	gck_C_Logout,
-	gck_C_CreateObject,
-	gck_C_CopyObject,
-	gck_C_DestroyObject,
-	gck_C_GetObjectSize,
-	gck_C_GetAttributeValue,
-	gck_C_SetAttributeValue,
-	gck_C_FindObjectsInit,
-	gck_C_FindObjects,
-	gck_C_FindObjectsFinal,
-	gck_C_EncryptInit,
-	gck_C_Encrypt,
-	gck_C_EncryptUpdate,
-	gck_C_EncryptFinal,
-	gck_C_DecryptInit,
-	gck_C_Decrypt,
-	gck_C_DecryptUpdate,
-	gck_C_DecryptFinal,
-	gck_C_DigestInit,
-	gck_C_Digest,
-	gck_C_DigestUpdate,
-	gck_C_DigestKey,
-	gck_C_DigestFinal,
-	gck_C_SignInit,
-	gck_C_Sign,
-	gck_C_SignUpdate,
-	gck_C_SignFinal,
-	gck_C_SignRecoverInit,
-	gck_C_SignRecover,
-	gck_C_VerifyInit,
-	gck_C_Verify,
-	gck_C_VerifyUpdate,
-	gck_C_VerifyFinal,
-	gck_C_VerifyRecoverInit,
-	gck_C_VerifyRecover,
-	gck_C_DigestEncryptUpdate,
-	gck_C_DecryptDigestUpdate,
-	gck_C_SignEncryptUpdate,
-	gck_C_DecryptVerifyUpdate,
-	gck_C_GenerateKey,
-	gck_C_GenerateKeyPair,
-	gck_C_WrapKey,
-	gck_C_UnwrapKey,
-	gck_C_DeriveKey,
-	gck_C_SeedRandom,
-	gck_C_GenerateRandom,
-	gck_C_GetFunctionStatus,
-	gck_C_CancelFunction,
-	gck_C_WaitForSlotEvent
+	gkm_C_Initialize,
+	gkm_C_Finalize,
+	gkm_C_GetInfo,
+	gkm_C_GetFunctionList,
+	gkm_C_GetSlotList,
+	gkm_C_GetSlotInfo,
+	gkm_C_GetTokenInfo,
+	gkm_C_GetMechanismList,
+	gkm_C_GetMechanismInfo,
+	gkm_C_InitToken,
+	gkm_C_InitPIN,
+	gkm_C_SetPIN,
+	gkm_C_OpenSession,
+	gkm_C_CloseSession,
+	gkm_C_CloseAllSessions,
+	gkm_C_GetSessionInfo,
+	gkm_C_GetOperationState,
+	gkm_C_SetOperationState,
+	gkm_C_Login,
+	gkm_C_Logout,
+	gkm_C_CreateObject,
+	gkm_C_CopyObject,
+	gkm_C_DestroyObject,
+	gkm_C_GetObjectSize,
+	gkm_C_GetAttributeValue,
+	gkm_C_SetAttributeValue,
+	gkm_C_FindObjectsInit,
+	gkm_C_FindObjects,
+	gkm_C_FindObjectsFinal,
+	gkm_C_EncryptInit,
+	gkm_C_Encrypt,
+	gkm_C_EncryptUpdate,
+	gkm_C_EncryptFinal,
+	gkm_C_DecryptInit,
+	gkm_C_Decrypt,
+	gkm_C_DecryptUpdate,
+	gkm_C_DecryptFinal,
+	gkm_C_DigestInit,
+	gkm_C_Digest,
+	gkm_C_DigestUpdate,
+	gkm_C_DigestKey,
+	gkm_C_DigestFinal,
+	gkm_C_SignInit,
+	gkm_C_Sign,
+	gkm_C_SignUpdate,
+	gkm_C_SignFinal,
+	gkm_C_SignRecoverInit,
+	gkm_C_SignRecover,
+	gkm_C_VerifyInit,
+	gkm_C_Verify,
+	gkm_C_VerifyUpdate,
+	gkm_C_VerifyFinal,
+	gkm_C_VerifyRecoverInit,
+	gkm_C_VerifyRecover,
+	gkm_C_DigestEncryptUpdate,
+	gkm_C_DecryptDigestUpdate,
+	gkm_C_SignEncryptUpdate,
+	gkm_C_DecryptVerifyUpdate,
+	gkm_C_GenerateKey,
+	gkm_C_GenerateKeyPair,
+	gkm_C_WrapKey,
+	gkm_C_UnwrapKey,
+	gkm_C_DeriveKey,
+	gkm_C_SeedRandom,
+	gkm_C_GenerateRandom,
+	gkm_C_GetFunctionStatus,
+	gkm_C_CancelFunction,
+	gkm_C_WaitForSlotEvent
 };
diff --git a/pkcs11/gck/gck-module.c b/pkcs11/gkm/gkm-module.c
similarity index 59%
rename from pkcs11/gck/gck-module.c
rename to pkcs11/gkm/gkm-module.c
index 4fe9eb0..0ce3289 100644
--- a/pkcs11/gck/gck-module.c
+++ b/pkcs11/gkm/gkm-module.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"
@@ -25,26 +25,26 @@
 #include "pkcs11/pkcs11g.h"
 #include "pkcs11/pkcs11i.h"
 
-#include "gck-aes-key.h"
-#include "gck-aes-mechanism.h"
-#include "gck-attributes.h"
-#include "gck-certificate.h"
-#include "gck-credential.h"
-#include "gck-factory.h"
-#include "gck-manager.h"
-#include "gck-memory-store.h"
-#include "gck-module.h"
-#include "gck-null-key.h"
-#include "gck-null-mechanism.h"
-#include "gck-dh-private-key.h"
-#include "gck-private-xsa-key.h"
-#include "gck-dh-public-key.h"
-#include "gck-public-xsa-key.h"
-#include "gck-session.h"
-#include "gck-store.h"
-#include "gck-timer.h"
-#include "gck-transaction.h"
-#include "gck-util.h"
+#include "gkm-aes-key.h"
+#include "gkm-aes-mechanism.h"
+#include "gkm-attributes.h"
+#include "gkm-certificate.h"
+#include "gkm-credential.h"
+#include "gkm-factory.h"
+#include "gkm-manager.h"
+#include "gkm-memory-store.h"
+#include "gkm-module.h"
+#include "gkm-null-key.h"
+#include "gkm-null-mechanism.h"
+#include "gkm-dh-private-key.h"
+#include "gkm-private-xsa-key.h"
+#include "gkm-dh-public-key.h"
+#include "gkm-public-xsa-key.h"
+#include "gkm-session.h"
+#include "gkm-store.h"
+#include "gkm-timer.h"
+#include "gkm-transaction.h"
+#include "gkm-util.h"
 
 enum {
 	PROP_0,
@@ -61,10 +61,10 @@ enum {
 #define APARTMENT_ID(slot, app) \
 	(((slot) & CK_GNOME_MAX_SLOT) | ((app) & ~CK_GNOME_MAX_SLOT))
 
-struct _GckModulePrivate {
+struct _GkmModulePrivate {
 	GMutex *mutex;                          /* The mutex controlling entry to this module */
 
-	GckManager *token_manager;
+	GkmManager *token_manager;
 	GHashTable *apartments_by_id;           /* Apartment (slot + application) by their id */
 	GHashTable *sessions_by_handle;         /* Mapping of handle to all open sessions */
 	gulong handle_counter;                  /* Constantly incrementing counter for handles and the like */
@@ -72,7 +72,7 @@ struct _GckModulePrivate {
 	gboolean factories_sorted;              /* Whether we need to sort the object factories */
 
 	GHashTable *transient_objects;          /* Token objects that are not stored permanently. */
-	GckStore *transient_store;              /* Store for trantsient objects. */
+	GkmStore *transient_store;              /* Store for trantsient objects. */
 };
 
 typedef struct _Apartment {
@@ -80,15 +80,15 @@ typedef struct _Apartment {
 	CK_SLOT_ID slot_id;
 	CK_G_APPLICATION_ID app_id;
 	CK_G_APPLICATION_PTR app_ptr;
-	GckManager *session_manager;
+	GkmManager *session_manager;
 	GList *sessions;
 	CK_USER_TYPE logged_in;
 } Apartment;
 
 /* Our slot identifier is 1 */
-#define GCK_SLOT_ID  1
+#define GKM_SLOT_ID  1
 
-G_DEFINE_TYPE (GckModule, gck_module, G_TYPE_OBJECT);
+G_DEFINE_TYPE (GkmModule, gkm_module, G_TYPE_OBJECT);
 
 /* These info blocks are used unless derived class overrides */
 
@@ -135,18 +135,18 @@ typedef struct _MechanismAndInfo {
 } MechanismAndInfo;
 
 static const MechanismAndInfo mechanism_list[] = {
-	/*  
+	/*
 	 * CKM_RSA_PKCS
 	 * For RSA, min and max are the minimum and maximum modulus in bits
 	 */
 	{ CKM_RSA_PKCS, { 256, 32768, CKF_ENCRYPT | CKF_DECRYPT | CKF_SIGN | CKF_VERIFY } },
 
-	/* 
+	/*
 	 * CKM_RSA_X509
 	 * For RSA, min and max are the minimum and maximum modulus in bits
 	 */
 	{ CKM_RSA_X_509, { 256, 32768, CKF_ENCRYPT | CKF_DECRYPT | CKF_SIGN | CKF_VERIFY } },
-	
+
 	/*
 	 * CKM_DSA
 	 * For DSA, min and max are the minimum and maximum modulus in bits
@@ -169,35 +169,35 @@ static const MechanismAndInfo mechanism_list[] = {
 	 * CKM_AES_CBC_PAD
 	 * For AES the min and max are sizes of key in bytes.
 	 */
-	{ CKM_AES_CBC_PAD, { GCK_AES_MECHANISM_MIN_LENGTH, GCK_AES_MECHANISM_MAX_LENGTH, CKF_WRAP | CKF_UNWRAP } },
+	{ CKM_AES_CBC_PAD, { GKM_AES_MECHANISM_MIN_LENGTH, GKM_AES_MECHANISM_MAX_LENGTH, CKF_WRAP | CKF_UNWRAP } },
 
 	/*
 	 * CKM_G_NULL
 	 * For NULL min and max are zero
 	 */
-	{ CKM_G_NULL, { GCK_NULL_MECHANISM_MIN_LENGTH, GCK_NULL_MECHANISM_MAX_LENGTH, CKF_WRAP | CKF_UNWRAP } },
+	{ CKM_G_NULL, { GKM_NULL_MECHANISM_MIN_LENGTH, GKM_NULL_MECHANISM_MAX_LENGTH, CKF_WRAP | CKF_UNWRAP } },
 };
 
 /* Hidden function that you should not use */
-GMutex* _gck_module_get_scary_mutex_that_you_should_not_touch (GckModule *self);
+GMutex* _gkm_module_get_scary_mutex_that_you_should_not_touch (GkmModule *self);
 
-static void  remove_transient_object (GckModule *self, GckTransaction *transaction, GckObject *object);
+static void  remove_transient_object (GkmModule *self, GkmTransaction *transaction, GkmObject *object);
 
-static void  add_transient_object    (GckModule *self, GckTransaction *transaction, GckObject *object);
+static void  add_transient_object    (GkmModule *self, GkmTransaction *transaction, GkmObject *object);
 
 /* -----------------------------------------------------------------------------
- * INTERNAL 
+ * INTERNAL
  */
 
 static gint
 sort_factory_by_n_attrs (gconstpointer a, gconstpointer b)
 {
-	const GckFactory *fa = a;
-	const GckFactory *fb = b;
-	
+	const GkmFactory *fa = a;
+	const GkmFactory *fb = b;
+
 	g_assert (a);
 	g_assert (b);
-	
+
 	/* Note we're sorting in reverse order */
 	if (fa->n_attrs < fb->n_attrs)
 		return 1;
@@ -208,11 +208,11 @@ static void
 extend_space_string (CK_UTF8CHAR_PTR string, gsize length)
 {
 	CK_UTF8CHAR_PTR at;
-	
+
 	/* Find a null pointer in the string */
 	at = memchr (string, 0, length);
 	g_assert (at != NULL && at < string + length);
-	for (; at < string + length; ++at) 
+	for (; at < string + length; ++at)
 		*at = ' ';
 }
 
@@ -225,16 +225,16 @@ apartment_free (gpointer data)
 	g_assert (data != NULL);
 	apt = (Apartment*)data;
 
-	g_return_if_fail (GCK_IS_MANAGER (apt->session_manager));
+	g_return_if_fail (GKM_IS_MANAGER (apt->session_manager));
 
 	/* Unreference all the sessions */
 	for (l = apt->sessions; l; l = g_list_next (l)) {
 
 		/* Some sanity checks to make sure things have remained as expected */
-		g_return_if_fail (GCK_IS_SESSION (l->data));
-		g_return_if_fail (gck_session_get_apartment (l->data) == apt->apt_id);
-		g_return_if_fail (gck_session_get_manager (l->data) == apt->session_manager);
-		g_return_if_fail (gck_session_get_logged_in (l->data) == apt->logged_in);
+		g_return_if_fail (GKM_IS_SESSION (l->data));
+		g_return_if_fail (gkm_session_get_apartment (l->data) == apt->apt_id);
+		g_return_if_fail (gkm_session_get_manager (l->data) == apt->session_manager);
+		g_return_if_fail (gkm_session_get_logged_in (l->data) == apt->logged_in);
 
 		g_object_unref (l->data);
 	}
@@ -246,19 +246,19 @@ apartment_free (gpointer data)
 }
 
 static Apartment*
-apartment_new (GckModuleClass *klass, CK_SLOT_ID slot_id, CK_G_APPLICATION_PTR app)
+apartment_new (GkmModuleClass *klass, CK_SLOT_ID slot_id, CK_G_APPLICATION_PTR app)
 {
 	Apartment *apt;
 
 	apt = g_slice_new0 (Apartment);
-	apt->session_manager = g_object_new (GCK_TYPE_MANAGER, "for-token", FALSE, NULL);
+	apt->session_manager = g_object_new (GKM_TYPE_MANAGER, "for-token", FALSE, NULL);
 	apt->logged_in = CKU_NONE;
 	apt->sessions = NULL;
 	apt->slot_id = slot_id;
 
 	if (app) {
 		if (!app->applicationId)
-			app->applicationId = gck_util_next_handle () << 8;
+			app->applicationId = gkm_util_next_handle () << 8;
 		apt->app_id = app->applicationId;
 		apt->app_ptr = app;
 	} else {
@@ -272,88 +272,88 @@ apartment_new (GckModuleClass *klass, CK_SLOT_ID slot_id, CK_G_APPLICATION_PTR a
 }
 
 static Apartment*
-lookup_apartment (GckModule *self, CK_ULONG apartment)
+lookup_apartment (GkmModule *self, CK_ULONG apartment)
 {
-	g_assert (GCK_IS_MODULE (self));
+	g_assert (GKM_IS_MODULE (self));
 	return g_hash_table_lookup (self->pv->apartments_by_id, &apartment);
 }
 
 static void
-register_apartment (GckModule *self, Apartment *apt)
+register_apartment (GkmModule *self, Apartment *apt)
 {
 	g_assert (apt);
-	g_assert (GCK_IS_MODULE (self));
+	g_assert (GKM_IS_MODULE (self));
 	g_assert (!g_hash_table_lookup (self->pv->apartments_by_id, &(apt->apt_id)));
 
 	g_hash_table_insert (self->pv->apartments_by_id,
-	                     gck_util_ulong_alloc (apt->apt_id), apt);
+	                     gkm_util_ulong_alloc (apt->apt_id), apt);
 }
 
 static void
-unregister_apartment (GckModule *self, Apartment *apt)
+unregister_apartment (GkmModule *self, Apartment *apt)
 {
 	g_assert (apt);
-	g_assert (GCK_IS_MODULE (self));
+	g_assert (GKM_IS_MODULE (self));
 
 	if (!g_hash_table_remove (self->pv->apartments_by_id, &(apt->apt_id)))
 		g_assert_not_reached ();
 }
 
 static void
-mark_login_apartment (GckModule *self, Apartment *apt, CK_USER_TYPE user)
+mark_login_apartment (GkmModule *self, Apartment *apt, CK_USER_TYPE user)
 {
 	GList *l;
 
 	g_assert (apt);
-	g_assert (GCK_IS_MODULE (self));
+	g_assert (GKM_IS_MODULE (self));
 
 	/* Mark all sessions in the partition as logged in */
 	for (l = apt->sessions; l; l = g_list_next (l))
-		gck_session_set_logged_in (l->data, user);
+		gkm_session_set_logged_in (l->data, user);
 	apt->logged_in = user;
 }
 
 static void
-parse_argument (GckModule *self, char *arg)
+parse_argument (GkmModule *self, char *arg)
 {
 	gchar *value;
 
-	g_assert (GCK_IS_MODULE (self));
+	g_assert (GKM_IS_MODULE (self));
 
 	value = arg + strcspn (arg, ":=");
 	if (!*value)
 		value = NULL;
-	else 
+	else
 		*(value++) = 0;
 
 	g_strstrip (arg);
 	if (value)
 		g_strstrip (value);
 
-	g_return_if_fail (GCK_MODULE_GET_CLASS (self)->parse_argument);
-	GCK_MODULE_GET_CLASS (self)->parse_argument (self, arg, value);
+	g_return_if_fail (GKM_MODULE_GET_CLASS (self)->parse_argument);
+	GKM_MODULE_GET_CLASS (self)->parse_argument (self, arg, value);
 }
 
 static void
-parse_arguments (GckModule *self, const gchar *string)
+parse_arguments (GkmModule *self, const gchar *string)
 {
 	gchar quote = '\0';
 	gchar *src, *dup, *at, *arg;
-	
-	g_assert (GCK_IS_MODULE (self));
-	
+
+	g_assert (GKM_IS_MODULE (self));
+
 	if (!string)
 		return;
-	
+
 	src = dup = g_strdup (string);
 
 	arg = at = src;
 	for (src = dup; *src; src++) {
-		
+
 		/* Matching quote */
 		if (quote == *src) {
 			quote = '\0';
-			
+
 		/* Inside of quotes */
 		} else if (quote != '\0') {
 			if (*src == '\\') {
@@ -362,17 +362,17 @@ parse_arguments (GckModule *self, const gchar *string)
 					g_warning ("couldn't parse module argument string");
 					goto done;
 				}
-				if (*src != quote) 
+				if (*src != quote)
 					*at++ = '\\';
 			}
 			*at++ = *src;
-			
+
 		/* Space, not inside of quotes */
 		} else if (g_ascii_isspace(*src)) {
 			*at = 0;
 			parse_argument (self, arg);
 			arg = at;
-			
+
 		/* Other character outside of quotes */
 		} else {
 			switch (*src) {
@@ -394,42 +394,42 @@ parse_arguments (GckModule *self, const gchar *string)
 		}
 	}
 
-	
+
 	if (at != arg) {
 		*at = 0;
 		parse_argument (self, arg);
 	}
-	
+
 done:
 	g_free (dup);
 }
 
 
 static gboolean
-complete_transient_remove (GckTransaction *transaction, GckModule *self, GckObject *object)
+complete_transient_remove (GkmTransaction *transaction, GkmModule *self, GkmObject *object)
 {
-	if (gck_transaction_get_failed (transaction))
+	if (gkm_transaction_get_failed (transaction))
 		add_transient_object (self, NULL, object);
 	g_object_unref (object);
 	return TRUE;
 }
 
 static void
-remove_transient_object (GckModule *self, GckTransaction *transaction, GckObject *object)
+remove_transient_object (GkmModule *self, GkmTransaction *transaction, GkmObject *object)
 {
-	g_assert (GCK_IS_MODULE (self));
-	g_assert (GCK_IS_OBJECT (object));
+	g_assert (GKM_IS_MODULE (self));
+	g_assert (GKM_IS_OBJECT (object));
 
 	g_object_ref (object);
 
-	gck_object_expose (object, FALSE);
+	gkm_object_expose (object, FALSE);
 	if (!g_hash_table_remove (self->pv->transient_objects, object))
 		g_return_if_reached ();
 	g_object_set (object, "store", NULL, NULL);
 
 	if (transaction) {
-		gck_transaction_add (transaction, self,
-		                     (GckTransactionFunc)complete_transient_remove, 
+		gkm_transaction_add (transaction, self,
+		                     (GkmTransactionFunc)complete_transient_remove,
 		                     g_object_ref (object));
 	}
 
@@ -437,93 +437,93 @@ remove_transient_object (GckModule *self, GckTransaction *transaction, GckObject
 }
 
 static gboolean
-complete_transient_add (GckTransaction *transaction, GckModule *self, GckObject *object)
+complete_transient_add (GkmTransaction *transaction, GkmModule *self, GkmObject *object)
 {
-	if (gck_transaction_get_failed (transaction))
+	if (gkm_transaction_get_failed (transaction))
 		remove_transient_object (self, NULL, object);
 	g_object_unref (object);
 	return TRUE;
 }
 
 static void
-add_transient_object (GckModule *self, GckTransaction *transaction, GckObject *object)
+add_transient_object (GkmModule *self, GkmTransaction *transaction, GkmObject *object)
 {
-	g_assert (GCK_IS_MODULE (self));
-	g_assert (GCK_IS_OBJECT (object));
+	g_assert (GKM_IS_MODULE (self));
+	g_assert (GKM_IS_OBJECT (object));
 
 	/* Must not already be associated with a session or manager */
-	g_return_if_fail (gck_object_get_manager (object) == self->pv->token_manager);
+	g_return_if_fail (gkm_object_get_manager (object) == self->pv->token_manager);
 	g_return_if_fail (g_hash_table_lookup (self->pv->transient_objects, object) == NULL);
 
 	g_hash_table_insert (self->pv->transient_objects, object, g_object_ref (object));
 	g_object_set (object, "store", self->pv->transient_store, NULL);
-	gck_object_expose (object, TRUE);
+	gkm_object_expose (object, TRUE);
 
 	if (transaction) {
-		gck_transaction_add (transaction, self,
-		                     (GckTransactionFunc)complete_transient_add, 
+		gkm_transaction_add (transaction, self,
+		                     (GkmTransactionFunc)complete_transient_add,
 		                     g_object_ref (object));
 	}
 }
 
 /* -----------------------------------------------------------------------------
- * OBJECT 
+ * OBJECT
  */
 
-static const CK_SLOT_INFO* 
-gck_module_real_get_slot_info (GckModule *self)
+static const CK_SLOT_INFO*
+gkm_module_real_get_slot_info (GkmModule *self)
 {
 	return &default_slot_info;
 }
 
 static const CK_TOKEN_INFO*
-gck_module_real_get_token_info (GckModule *self)
+gkm_module_real_get_token_info (GkmModule *self)
 {
 	return &default_token_info;
 }
 
-static void 
-gck_module_real_parse_argument (GckModule *self, const gchar *name, const gchar *value)
+static void
+gkm_module_real_parse_argument (GkmModule *self, const gchar *name, const gchar *value)
 {
 	/* Derived classes should do something interesting */
 }
 
 static CK_RV
-gck_module_real_refresh_token (GckModule *self)
+gkm_module_real_refresh_token (GkmModule *self)
 {
 	/* Derived classes should do something interesting */
 	return CKR_OK;
 }
 
 static void
-gck_module_real_add_token_object (GckModule *self, GckTransaction *transaction, GckObject *object)
+gkm_module_real_add_token_object (GkmModule *self, GkmTransaction *transaction, GkmObject *object)
 {
 	/* Derived class should override, default does nothing */
 }
 
 static void
-gck_module_real_store_token_object (GckModule *self, GckTransaction *transaction, GckObject *object)
+gkm_module_real_store_token_object (GkmModule *self, GkmTransaction *transaction, GkmObject *object)
 {
 	/* Derived classes should do something interesting */
-	gck_transaction_fail (transaction, CKR_FUNCTION_NOT_SUPPORTED);
+	gkm_transaction_fail (transaction, CKR_FUNCTION_NOT_SUPPORTED);
 }
 
 static void
-gck_module_real_remove_token_object (GckModule *self, GckTransaction *transaction, GckObject *object)
+gkm_module_real_remove_token_object (GkmModule *self, GkmTransaction *transaction, GkmObject *object)
 {
 	/* Derived classes should do something interesting */
-	gck_transaction_fail (transaction, CKR_FUNCTION_NOT_SUPPORTED);
+	gkm_transaction_fail (transaction, CKR_FUNCTION_NOT_SUPPORTED);
 }
 
 static CK_RV
-gck_module_real_login_change (GckModule *self, CK_SLOT_ID slot_id, CK_UTF8CHAR_PTR old_pin, 
+gkm_module_real_login_change (GkmModule *self, CK_SLOT_ID slot_id, CK_UTF8CHAR_PTR old_pin,
                               CK_ULONG n_old_pin, CK_UTF8CHAR_PTR new_pin, CK_ULONG n_new_pin)
 {
 	return CKR_FUNCTION_NOT_SUPPORTED;
 }
 
 static CK_RV
-gck_module_real_login_user (GckModule *self, CK_ULONG apartment, CK_UTF8CHAR_PTR pin, CK_ULONG n_pin)
+gkm_module_real_login_user (GkmModule *self, CK_ULONG apartment, CK_UTF8CHAR_PTR pin, CK_ULONG n_pin)
 {
 	Apartment *apt;
 
@@ -535,7 +535,7 @@ gck_module_real_login_user (GckModule *self, CK_ULONG apartment, CK_UTF8CHAR_PTR
 }
 
 static CK_RV
-gck_module_real_login_so (GckModule *self, CK_ULONG apartment, CK_UTF8CHAR_PTR pin, CK_ULONG n_pin)
+gkm_module_real_login_so (GkmModule *self, CK_ULONG apartment, CK_UTF8CHAR_PTR pin, CK_ULONG n_pin)
 {
 	Apartment *apt;
 
@@ -547,7 +547,7 @@ gck_module_real_login_so (GckModule *self, CK_ULONG apartment, CK_UTF8CHAR_PTR p
 }
 
 static CK_RV
-gck_module_real_logout_any (GckModule *self, CK_ULONG apartment)
+gkm_module_real_logout_any (GkmModule *self, CK_ULONG apartment)
 {
 	Apartment *apt;
 
@@ -560,56 +560,56 @@ gck_module_real_logout_any (GckModule *self, CK_ULONG apartment)
 }
 
 static GObject*
-gck_module_constructor (GType type, guint n_props, GObjectConstructParam *props) 
+gkm_module_constructor (GType type, guint n_props, GObjectConstructParam *props)
 {
-	GckModule *self = GCK_MODULE (G_OBJECT_CLASS (gck_module_parent_class)->constructor(type, n_props, props));
+	GkmModule *self = GKM_MODULE (G_OBJECT_CLASS (gkm_module_parent_class)->constructor(type, n_props, props));
 	CK_ATTRIBUTE attr;
 
-	g_return_val_if_fail (self, NULL);	
+	g_return_val_if_fail (self, NULL);
 
 	/* Register store attributes */
 	attr.type = CKA_LABEL;
 	attr.pValue = "";
 	attr.ulValueLen = 0;
-	gck_store_register_schema (self->pv->transient_store, &attr, NULL, 0);
+	gkm_store_register_schema (self->pv->transient_store, &attr, NULL, 0);
 
 	return G_OBJECT (self);
 }
 
 static void
-gck_module_init (GckModule *self)
+gkm_module_init (GkmModule *self)
 {
-	gck_timer_initialize ();
+	gkm_timer_initialize ();
 
-	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GCK_TYPE_MODULE, GckModulePrivate);
-	self->pv->token_manager = g_object_new (GCK_TYPE_MANAGER, "for-token", TRUE, NULL);
-	self->pv->sessions_by_handle = g_hash_table_new_full (gck_util_ulong_hash, gck_util_ulong_equal,
-	                                                      gck_util_ulong_free, g_object_unref);
-	self->pv->apartments_by_id = g_hash_table_new_full (gck_util_ulong_hash, gck_util_ulong_equal,
-	                                                    gck_util_ulong_free, apartment_free);
-	self->pv->factories = g_array_new (FALSE, TRUE, sizeof (GckFactory));
+	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GKM_TYPE_MODULE, GkmModulePrivate);
+	self->pv->token_manager = g_object_new (GKM_TYPE_MANAGER, "for-token", TRUE, NULL);
+	self->pv->sessions_by_handle = g_hash_table_new_full (gkm_util_ulong_hash, gkm_util_ulong_equal,
+	                                                      gkm_util_ulong_free, g_object_unref);
+	self->pv->apartments_by_id = g_hash_table_new_full (gkm_util_ulong_hash, gkm_util_ulong_equal,
+	                                                    gkm_util_ulong_free, apartment_free);
+	self->pv->factories = g_array_new (FALSE, TRUE, sizeof (GkmFactory));
 
 	self->pv->handle_counter = 1;
 
 	/* Create the store for transient objects */
-	self->pv->transient_store = GCK_STORE (gck_memory_store_new ());
-	self->pv->transient_objects = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, gck_util_dispose_unref);
+	self->pv->transient_store = GKM_STORE (gkm_memory_store_new ());
+	self->pv->transient_objects = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, gkm_util_dispose_unref);
 
 	/* Register session object factories */
-	gck_module_register_factory (self, GCK_FACTORY_AES_KEY);
-	gck_module_register_factory (self, GCK_FACTORY_CERTIFICATE);
-	gck_module_register_factory (self, GCK_FACTORY_CREDENTIAL);
-	gck_module_register_factory (self, GCK_FACTORY_NULL_KEY);
-	gck_module_register_factory (self, GCK_FACTORY_DH_PRIVATE_KEY);
-	gck_module_register_factory (self, GCK_FACTORY_PRIVATE_XSA_KEY);
-	gck_module_register_factory (self, GCK_FACTORY_DH_PUBLIC_KEY);
-	gck_module_register_factory (self, GCK_FACTORY_PUBLIC_XSA_KEY);
+	gkm_module_register_factory (self, GKM_FACTORY_AES_KEY);
+	gkm_module_register_factory (self, GKM_FACTORY_CERTIFICATE);
+	gkm_module_register_factory (self, GKM_FACTORY_CREDENTIAL);
+	gkm_module_register_factory (self, GKM_FACTORY_NULL_KEY);
+	gkm_module_register_factory (self, GKM_FACTORY_DH_PRIVATE_KEY);
+	gkm_module_register_factory (self, GKM_FACTORY_PRIVATE_XSA_KEY);
+	gkm_module_register_factory (self, GKM_FACTORY_DH_PUBLIC_KEY);
+	gkm_module_register_factory (self, GKM_FACTORY_PUBLIC_XSA_KEY);
 }
 
 static void
-gck_module_dispose (GObject *obj)
+gkm_module_dispose (GObject *obj)
 {
-	GckModule *self = GCK_MODULE (obj);
+	GkmModule *self = GKM_MODULE (obj);
 
 	g_hash_table_remove_all (self->pv->transient_objects);
 	g_hash_table_remove_all (self->pv->sessions_by_handle);
@@ -621,17 +621,17 @@ gck_module_dispose (GObject *obj)
 
 	g_array_set_size (self->pv->factories, 0);
 
-	G_OBJECT_CLASS (gck_module_parent_class)->dispose (obj);
+	G_OBJECT_CLASS (gkm_module_parent_class)->dispose (obj);
 }
 
 static void
-gck_module_finalize (GObject *obj)
+gkm_module_finalize (GObject *obj)
 {
-	GckModule *self = GCK_MODULE (obj);
+	GkmModule *self = GKM_MODULE (obj);
 
 	g_hash_table_destroy (self->pv->transient_objects);
 	self->pv->transient_objects = NULL;
-	
+
 	g_object_unref (self->pv->transient_store);
 	self->pv->transient_store = NULL;
 
@@ -644,26 +644,26 @@ gck_module_finalize (GObject *obj)
 	g_assert (g_hash_table_size (self->pv->sessions_by_handle) == 0);
 	g_hash_table_destroy (self->pv->sessions_by_handle);
 	self->pv->sessions_by_handle = NULL;
-	
+
 	g_array_free (self->pv->factories, TRUE);
 	self->pv->factories = NULL;
 
-	gck_timer_shutdown ();
+	gkm_timer_shutdown ();
 
-	G_OBJECT_CLASS (gck_module_parent_class)->finalize (obj);
+	G_OBJECT_CLASS (gkm_module_parent_class)->finalize (obj);
 }
 
 static void
-gck_module_set_property (GObject *obj, guint prop_id, const GValue *value, 
+gkm_module_set_property (GObject *obj, guint prop_id, const GValue *value,
                          GParamSpec *pspec)
 {
-	GckModule *self = GCK_MODULE (obj);
+	GkmModule *self = GKM_MODULE (obj);
 	CK_C_INITIALIZE_ARGS_PTR args;
-	
+
 	switch (prop_id) {
 	case PROP_INITIALIZE_ARGS:
 		args = g_value_get_pointer (value);
-		if (args != NULL && args->pReserved != NULL) 
+		if (args != NULL && args->pReserved != NULL)
 			parse_arguments (self, args->pReserved);
 		break;
 	case PROP_MUTEX:
@@ -677,17 +677,17 @@ gck_module_set_property (GObject *obj, guint prop_id, const GValue *value,
 }
 
 static void
-gck_module_get_property (GObject *obj, guint prop_id, GValue *value, 
+gkm_module_get_property (GObject *obj, guint prop_id, GValue *value,
                          GParamSpec *pspec)
 {
-	GckModule *self = GCK_MODULE (obj);
-	
+	GkmModule *self = GKM_MODULE (obj);
+
 	switch (prop_id) {
 	case PROP_MANAGER:
-		g_value_set_object (value, gck_module_get_manager (self));
+		g_value_set_object (value, gkm_module_get_manager (self));
 		break;
 	case PROP_WRITE_PROTECTED:
-		g_value_set_boolean (value, gck_module_get_write_protected (self));
+		g_value_set_boolean (value, gkm_module_get_write_protected (self));
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -696,42 +696,42 @@ gck_module_get_property (GObject *obj, guint prop_id, GValue *value,
 }
 
 static void
-gck_module_class_init (GckModuleClass *klass)
+gkm_module_class_init (GkmModuleClass *klass)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-    
-	gck_module_parent_class = g_type_class_peek_parent (klass);
-	g_type_class_add_private (klass, sizeof (GckModulePrivate));
-
-	gobject_class->constructor = gck_module_constructor;
-	gobject_class->dispose = gck_module_dispose;
-	gobject_class->finalize = gck_module_finalize;
-	gobject_class->set_property = gck_module_set_property;
-	gobject_class->get_property = gck_module_get_property;
-    
-	klass->get_slot_info = gck_module_real_get_slot_info;
-	klass->get_token_info = gck_module_real_get_token_info;
-	klass->parse_argument = gck_module_real_parse_argument;
-	klass->refresh_token = gck_module_real_refresh_token;
-	klass->add_token_object = gck_module_real_add_token_object;
-	klass->store_token_object = gck_module_real_store_token_object;
-	klass->remove_token_object = gck_module_real_remove_token_object;
-	klass->login_change = gck_module_real_login_change;
-	klass->login_user = gck_module_real_login_user;
-	klass->logout_user = gck_module_real_logout_any;
-	klass->login_so = gck_module_real_login_so;
-	klass->logout_so = gck_module_real_logout_any;
-	
+
+	gkm_module_parent_class = g_type_class_peek_parent (klass);
+	g_type_class_add_private (klass, sizeof (GkmModulePrivate));
+
+	gobject_class->constructor = gkm_module_constructor;
+	gobject_class->dispose = gkm_module_dispose;
+	gobject_class->finalize = gkm_module_finalize;
+	gobject_class->set_property = gkm_module_set_property;
+	gobject_class->get_property = gkm_module_get_property;
+
+	klass->get_slot_info = gkm_module_real_get_slot_info;
+	klass->get_token_info = gkm_module_real_get_token_info;
+	klass->parse_argument = gkm_module_real_parse_argument;
+	klass->refresh_token = gkm_module_real_refresh_token;
+	klass->add_token_object = gkm_module_real_add_token_object;
+	klass->store_token_object = gkm_module_real_store_token_object;
+	klass->remove_token_object = gkm_module_real_remove_token_object;
+	klass->login_change = gkm_module_real_login_change;
+	klass->login_user = gkm_module_real_login_user;
+	klass->logout_user = gkm_module_real_logout_any;
+	klass->login_so = gkm_module_real_login_so;
+	klass->logout_so = gkm_module_real_logout_any;
+
 	g_object_class_install_property (gobject_class, PROP_MANAGER,
-	           g_param_spec_object ("manager", "Manager", "Token object manager", 
-	                                GCK_TYPE_MANAGER, G_PARAM_READABLE));
-	
+	           g_param_spec_object ("manager", "Manager", "Token object manager",
+	                                GKM_TYPE_MANAGER, G_PARAM_READABLE));
+
 	g_object_class_install_property (gobject_class, PROP_WRITE_PROTECTED,
-	           g_param_spec_boolean ("write-protected", "Write Protected", "Token is write protected", 
+	           g_param_spec_boolean ("write-protected", "Write Protected", "Token is write protected",
 	                                 TRUE, G_PARAM_READABLE));
-	
+
 	g_object_class_install_property (gobject_class, PROP_INITIALIZE_ARGS,
-	           g_param_spec_pointer ("initialize-args", "Initialize Args", "Arguments passed to C_Initialize", 
+	           g_param_spec_pointer ("initialize-args", "Initialize Args", "Arguments passed to C_Initialize",
 	                                 G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
 
 	g_object_class_install_property (gobject_class, PROP_MUTEX,
@@ -740,91 +740,91 @@ gck_module_class_init (GckModuleClass *klass)
 }
 
 /* -----------------------------------------------------------------------------
- * PUBLIC 
+ * PUBLIC
  */
 
-GckManager*
-gck_module_get_manager (GckModule *self)
+GkmManager*
+gkm_module_get_manager (GkmModule *self)
 {
-	g_return_val_if_fail (GCK_IS_MODULE (self), NULL);
-	g_return_val_if_fail (GCK_IS_MANAGER (self->pv->token_manager), NULL);
+	g_return_val_if_fail (GKM_IS_MODULE (self), NULL);
+	g_return_val_if_fail (GKM_IS_MANAGER (self->pv->token_manager), NULL);
 	return self->pv->token_manager;
 }
 
 gboolean
-gck_module_get_write_protected (GckModule *self)
+gkm_module_get_write_protected (GkmModule *self)
 {
 	const CK_TOKEN_INFO* info;
-	
-	g_return_val_if_fail (GCK_IS_MODULE (self), TRUE);
-	g_return_val_if_fail (GCK_MODULE_GET_CLASS (self)->get_token_info, TRUE);
-	
-	info = (GCK_MODULE_GET_CLASS (self)->get_token_info) (self);
+
+	g_return_val_if_fail (GKM_IS_MODULE (self), TRUE);
+	g_return_val_if_fail (GKM_MODULE_GET_CLASS (self)->get_token_info, TRUE);
+
+	info = (GKM_MODULE_GET_CLASS (self)->get_token_info) (self);
 	g_return_val_if_fail (info, TRUE);
-	
+
 	return info->flags & CKF_WRITE_PROTECTED;
 }
 
-GckSession*
-gck_module_lookup_session (GckModule *self, CK_SESSION_HANDLE handle)
+GkmSession*
+gkm_module_lookup_session (GkmModule *self, CK_SESSION_HANDLE handle)
 {
-	GckSession *session;
-	
-	g_return_val_if_fail (GCK_IS_MODULE (self), NULL);
-	
+	GkmSession *session;
+
+	g_return_val_if_fail (GKM_IS_MODULE (self), NULL);
+
 	session = g_hash_table_lookup (self->pv->sessions_by_handle, &handle);
 	if (!session)
 		return NULL;
-	
-	g_return_val_if_fail (GCK_IS_SESSION (session), NULL);
+
+	g_return_val_if_fail (GKM_IS_SESSION (session), NULL);
 	return session;
 }
 
 CK_RV
-gck_module_login_change (GckModule *self, CK_SLOT_ID slot_id, CK_UTF8CHAR_PTR old_pin, 
+gkm_module_login_change (GkmModule *self, CK_SLOT_ID slot_id, CK_UTF8CHAR_PTR old_pin,
                          CK_ULONG n_old_pin, CK_UTF8CHAR_PTR new_pin, CK_ULONG n_new_pin)
 {
-	g_return_val_if_fail (GCK_IS_MODULE (self), CKR_GENERAL_ERROR);
-	g_assert (GCK_MODULE_GET_CLASS (self)->login_change);
-	return GCK_MODULE_GET_CLASS (self)->login_change (self, slot_id, old_pin, n_old_pin, new_pin, n_new_pin);
+	g_return_val_if_fail (GKM_IS_MODULE (self), CKR_GENERAL_ERROR);
+	g_assert (GKM_MODULE_GET_CLASS (self)->login_change);
+	return GKM_MODULE_GET_CLASS (self)->login_change (self, slot_id, old_pin, n_old_pin, new_pin, n_new_pin);
 }
 
 CK_RV
-gck_module_login_user (GckModule *self, CK_SLOT_ID slot_id, CK_UTF8CHAR_PTR pin, CK_ULONG n_pin)
+gkm_module_login_user (GkmModule *self, CK_SLOT_ID slot_id, CK_UTF8CHAR_PTR pin, CK_ULONG n_pin)
 {
-	g_return_val_if_fail (GCK_IS_MODULE (self), CKR_GENERAL_ERROR);
-	g_assert (GCK_MODULE_GET_CLASS (self)->login_user);
-	return GCK_MODULE_GET_CLASS (self)->login_user (self, slot_id, pin, n_pin);
+	g_return_val_if_fail (GKM_IS_MODULE (self), CKR_GENERAL_ERROR);
+	g_assert (GKM_MODULE_GET_CLASS (self)->login_user);
+	return GKM_MODULE_GET_CLASS (self)->login_user (self, slot_id, pin, n_pin);
 }
 
 CK_RV
-gck_module_logout_user (GckModule *self, CK_SLOT_ID slot_id)
+gkm_module_logout_user (GkmModule *self, CK_SLOT_ID slot_id)
 {
-	g_return_val_if_fail (GCK_IS_MODULE (self), CKR_GENERAL_ERROR);
-	g_assert (GCK_MODULE_GET_CLASS (self)->logout_user);
-	return GCK_MODULE_GET_CLASS (self)->logout_user (self, slot_id);	
+	g_return_val_if_fail (GKM_IS_MODULE (self), CKR_GENERAL_ERROR);
+	g_assert (GKM_MODULE_GET_CLASS (self)->logout_user);
+	return GKM_MODULE_GET_CLASS (self)->logout_user (self, slot_id);
 }
 
 CK_RV
-gck_module_login_so (GckModule *self, CK_SLOT_ID slot_id, CK_UTF8CHAR_PTR pin, CK_ULONG n_pin)
+gkm_module_login_so (GkmModule *self, CK_SLOT_ID slot_id, CK_UTF8CHAR_PTR pin, CK_ULONG n_pin)
 {
-	g_return_val_if_fail (GCK_IS_MODULE (self), CKR_GENERAL_ERROR);
-	g_assert (GCK_MODULE_GET_CLASS (self)->login_so);
-	return GCK_MODULE_GET_CLASS (self)->login_so (self, slot_id, pin, n_pin);
+	g_return_val_if_fail (GKM_IS_MODULE (self), CKR_GENERAL_ERROR);
+	g_assert (GKM_MODULE_GET_CLASS (self)->login_so);
+	return GKM_MODULE_GET_CLASS (self)->login_so (self, slot_id, pin, n_pin);
 }
 
 CK_RV
-gck_module_logout_so (GckModule *self, CK_SLOT_ID slot_id)
+gkm_module_logout_so (GkmModule *self, CK_SLOT_ID slot_id)
 {
-	g_return_val_if_fail (GCK_IS_MODULE (self), CKR_GENERAL_ERROR);
-	g_assert (GCK_MODULE_GET_CLASS (self)->logout_so);
-	return GCK_MODULE_GET_CLASS (self)->logout_so (self, slot_id);	
+	g_return_val_if_fail (GKM_IS_MODULE (self), CKR_GENERAL_ERROR);
+	g_assert (GKM_MODULE_GET_CLASS (self)->logout_so);
+	return GKM_MODULE_GET_CLASS (self)->logout_so (self, slot_id);
 }
 
 CK_ULONG
-gck_module_next_handle (GckModule *self)
+gkm_module_next_handle (GkmModule *self)
 {
-	g_return_val_if_fail (GCK_IS_MODULE (self), 0);
+	g_return_val_if_fail (GKM_IS_MODULE (self), 0);
 	if (self->pv->handle_counter == CK_GNOME_MAX_HANDLE) {
 		g_warning ("handle counter wrapped");
 		self->pv->handle_counter = 0;
@@ -833,95 +833,95 @@ gck_module_next_handle (GckModule *self)
 }
 
 CK_RV
-gck_module_refresh_token (GckModule *self)
+gkm_module_refresh_token (GkmModule *self)
 {
-	g_return_val_if_fail (GCK_IS_MODULE (self), CKR_GENERAL_ERROR);
-	g_assert (GCK_MODULE_GET_CLASS (self)->refresh_token);
-	return GCK_MODULE_GET_CLASS (self)->refresh_token (self);	
+	g_return_val_if_fail (GKM_IS_MODULE (self), CKR_GENERAL_ERROR);
+	g_assert (GKM_MODULE_GET_CLASS (self)->refresh_token);
+	return GKM_MODULE_GET_CLASS (self)->refresh_token (self);
 }
 
 void
-gck_module_add_token_object (GckModule *self, GckTransaction *transaction, GckObject *object)
+gkm_module_add_token_object (GkmModule *self, GkmTransaction *transaction, GkmObject *object)
 {
-	g_return_if_fail (GCK_IS_MODULE (self));
-	g_return_if_fail (GCK_IS_OBJECT (object));
-	g_assert (GCK_MODULE_GET_CLASS (self)->add_token_object);
+	g_return_if_fail (GKM_IS_MODULE (self));
+	g_return_if_fail (GKM_IS_OBJECT (object));
+	g_assert (GKM_MODULE_GET_CLASS (self)->add_token_object);
 
-	if (gck_object_is_transient (object)) {
+	if (gkm_object_is_transient (object)) {
 		if (g_hash_table_lookup (self->pv->transient_objects, object) == NULL)
 			add_transient_object (self, transaction, object);
 	} else {
-		GCK_MODULE_GET_CLASS (self)->add_token_object (self, transaction, object);
+		GKM_MODULE_GET_CLASS (self)->add_token_object (self, transaction, object);
 	}
 }
 
 void
-gck_module_store_token_object (GckModule *self, GckTransaction *transaction, GckObject *object)
+gkm_module_store_token_object (GkmModule *self, GkmTransaction *transaction, GkmObject *object)
 {
-	g_return_if_fail (GCK_IS_MODULE (self));
-	g_return_if_fail (GCK_IS_OBJECT (object));
-	g_assert (GCK_MODULE_GET_CLASS (self)->store_token_object);
+	g_return_if_fail (GKM_IS_MODULE (self));
+	g_return_if_fail (GKM_IS_OBJECT (object));
+	g_assert (GKM_MODULE_GET_CLASS (self)->store_token_object);
 
-	if (!gck_object_is_transient (object))
-		GCK_MODULE_GET_CLASS (self)->store_token_object (self, transaction, object);
+	if (!gkm_object_is_transient (object))
+		GKM_MODULE_GET_CLASS (self)->store_token_object (self, transaction, object);
 }
 
 void
-gck_module_remove_token_object (GckModule *self, GckTransaction *transaction, GckObject *object)
+gkm_module_remove_token_object (GkmModule *self, GkmTransaction *transaction, GkmObject *object)
 {
-	g_return_if_fail (GCK_IS_MODULE (self));
-	g_return_if_fail (GCK_IS_OBJECT (object));
-	g_assert (GCK_MODULE_GET_CLASS (self)->remove_token_object);
+	g_return_if_fail (GKM_IS_MODULE (self));
+	g_return_if_fail (GKM_IS_OBJECT (object));
+	g_assert (GKM_MODULE_GET_CLASS (self)->remove_token_object);
 
-	if (gck_object_is_transient (object))
+	if (gkm_object_is_transient (object))
 		remove_transient_object (self, transaction, object);
 	else
-		GCK_MODULE_GET_CLASS (self)->remove_token_object (self, transaction, object);
+		GKM_MODULE_GET_CLASS (self)->remove_token_object (self, transaction, object);
 }
 
 void
-gck_module_register_factory (GckModule *self, GckFactory *factory)
+gkm_module_register_factory (GkmModule *self, GkmFactory *factory)
 {
-	g_return_if_fail (GCK_IS_MODULE (self));
+	g_return_if_fail (GKM_IS_MODULE (self));
 	g_return_if_fail (factory);
 	g_return_if_fail (factory->attrs || !factory->n_attrs);
 	g_return_if_fail (factory->func);
-	
+
 	g_array_append_val (self->pv->factories, *factory);
 	self->pv->factories_sorted = FALSE;
 }
 
-GckFactory*
-gck_module_find_factory (GckModule *self, CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
+GkmFactory*
+gkm_module_find_factory (GkmModule *self, CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
 {
-	GckFactory *factory;
+	GkmFactory *factory;
 	gboolean matched;
 	gulong j;
 	gsize i;
-	
-	g_return_val_if_fail (GCK_IS_MODULE (self), NULL);
+
+	g_return_val_if_fail (GKM_IS_MODULE (self), NULL);
 	g_return_val_if_fail (attrs || !n_attrs, NULL);
-	
+
 	if (!self->pv->factories_sorted) {
 		g_array_sort (self->pv->factories, sort_factory_by_n_attrs);
 		self->pv->factories_sorted = TRUE;
 	}
-	
+
 	for (i = 0; i < self->pv->factories->len; ++i) {
-		factory = &(g_array_index (self->pv->factories, GckFactory, i));
-		
+		factory = &(g_array_index (self->pv->factories, GkmFactory, i));
+
 		matched = TRUE;
 		for (j = 0; j < factory->n_attrs; ++j) {
-			if (!gck_attributes_contains (attrs, n_attrs, &factory->attrs[j])) {
+			if (!gkm_attributes_contains (attrs, n_attrs, &factory->attrs[j])) {
 				matched = FALSE;
 				break;
 			}
 		}
-		
+
 		if (matched)
 			return factory;
 	}
-	
+
 	return NULL;
 }
 
@@ -931,9 +931,9 @@ gck_module_find_factory (GckModule *self, CK_ATTRIBUTE_PTR attrs, CK_ULONG n_att
  */
 
 GMutex*
-_gck_module_get_scary_mutex_that_you_should_not_touch (GckModule *self)
+_gkm_module_get_scary_mutex_that_you_should_not_touch (GkmModule *self)
 {
-	g_return_val_if_fail (GCK_IS_MODULE (self), NULL);
+	g_return_val_if_fail (GKM_IS_MODULE (self), NULL);
 	return self->pv->mutex;
 }
 
@@ -942,108 +942,108 @@ _gck_module_get_scary_mutex_that_you_should_not_touch (GckModule *self)
  */
 
 CK_RV
-gck_module_C_GetInfo (GckModule *self, CK_INFO_PTR info)
+gkm_module_C_GetInfo (GkmModule *self, CK_INFO_PTR info)
 {
-	GckModuleClass *klass;
-	
-	g_return_val_if_fail (GCK_IS_MODULE (self), CKR_CRYPTOKI_NOT_INITIALIZED);
-	
+	GkmModuleClass *klass;
+
+	g_return_val_if_fail (GKM_IS_MODULE (self), CKR_CRYPTOKI_NOT_INITIALIZED);
+
 	if (!info)
 		return CKR_ARGUMENTS_BAD;
-	
-	klass = GCK_MODULE_GET_CLASS (self);
+
+	klass = GKM_MODULE_GET_CLASS (self);
 	g_return_val_if_fail (klass, CKR_GENERAL_ERROR);
-	
+
 	memcpy (info, &default_module_info, sizeof (CK_INFO));
-	
+
 	/* Extend all the strings appropriately */
 	extend_space_string (info->libraryDescription, sizeof (info->libraryDescription));
 	extend_space_string (info->manufacturerID, sizeof (info->manufacturerID));
-	
+
 	return CKR_OK;
 }
 
 CK_RV
-gck_module_C_GetSlotList (GckModule *self, CK_BBOOL token_present, CK_SLOT_ID_PTR slot_list, CK_ULONG_PTR count)
+gkm_module_C_GetSlotList (GkmModule *self, CK_BBOOL token_present, CK_SLOT_ID_PTR slot_list, CK_ULONG_PTR count)
 {
-	g_return_val_if_fail (GCK_IS_MODULE (self), CKR_CRYPTOKI_NOT_INITIALIZED);
-	
+	g_return_val_if_fail (GKM_IS_MODULE (self), CKR_CRYPTOKI_NOT_INITIALIZED);
+
 	if (!count)
 		return CKR_ARGUMENTS_BAD;
-	
+
 	/* Just want to get the count */
 	if (slot_list == NULL) {
 		*count = 1;
 		return CKR_OK;
 	}
-	
+
 	/* Buffer too small? */
 	if (*count == 0) {
 		*count = 1;
 		return CKR_BUFFER_TOO_SMALL;
 	}
-	
+
 	g_return_val_if_fail (slot_list, CKR_ARGUMENTS_BAD);
 
 	/* Answer C_GetSlotList with 0 for app */
-	slot_list[0] = GCK_SLOT_ID;
+	slot_list[0] = GKM_SLOT_ID;
 	*count = 1;
 	return CKR_OK;
 }
 
 CK_RV
-gck_module_C_GetSlotInfo (GckModule *self, CK_SLOT_ID id, CK_SLOT_INFO_PTR info)
+gkm_module_C_GetSlotInfo (GkmModule *self, CK_SLOT_ID id, CK_SLOT_INFO_PTR info)
 {
 	const CK_SLOT_INFO *original;
-	GckModuleClass *klass;
-	
-	g_return_val_if_fail (GCK_IS_MODULE (self), CKR_CRYPTOKI_NOT_INITIALIZED);
+	GkmModuleClass *klass;
 
-	if (id != GCK_SLOT_ID)
+	g_return_val_if_fail (GKM_IS_MODULE (self), CKR_CRYPTOKI_NOT_INITIALIZED);
+
+	if (id != GKM_SLOT_ID)
 		return CKR_SLOT_ID_INVALID;
 	if (info == NULL)
 		return CKR_ARGUMENTS_BAD;
 
 	/* Any slot ID is valid for partitioned module */
-	
-	klass = GCK_MODULE_GET_CLASS (self);
+
+	klass = GKM_MODULE_GET_CLASS (self);
 	g_return_val_if_fail (klass, CKR_GENERAL_ERROR);
 	g_return_val_if_fail (klass->get_slot_info, CKR_GENERAL_ERROR);
-	
+
 	original = (klass->get_slot_info) (self);
 	g_return_val_if_fail (original, CKR_GENERAL_ERROR);
-	
+
 	memcpy (info, original, sizeof (CK_SLOT_INFO));
-	
+
 	/* Extend all the strings appropriately */
 	extend_space_string (info->manufacturerID, sizeof (info->manufacturerID));
 	extend_space_string (info->slotDescription, sizeof (info->slotDescription));
-	
+
 	return CKR_OK;
 }
 
 CK_RV
-gck_module_C_GetTokenInfo (GckModule *self, CK_SLOT_ID id, CK_TOKEN_INFO_PTR info)
+gkm_module_C_GetTokenInfo (GkmModule *self, CK_SLOT_ID id, CK_TOKEN_INFO_PTR info)
 {
 	const CK_TOKEN_INFO *original;
-	GckModuleClass *klass;
-	
-	g_return_val_if_fail (GCK_IS_MODULE (self), CKR_CRYPTOKI_NOT_INITIALIZED);
+	GkmModuleClass *klass;
 
-	if (id != GCK_SLOT_ID)
+	g_return_val_if_fail (GKM_IS_MODULE (self), CKR_CRYPTOKI_NOT_INITIALIZED);
+
+	if (id != GKM_SLOT_ID)
 		return CKR_SLOT_ID_INVALID;
 	if (info == NULL)
 		return CKR_ARGUMENTS_BAD;
 
 	/* Any slot ID is valid for partitioned module */
-	
-	klass = GCK_MODULE_GET_CLASS (self);
+
+	klass = GKM_MODULE_GET_CLASS (self);
 	g_return_val_if_fail (klass, CKR_GENERAL_ERROR);
 	g_return_val_if_fail (klass->get_token_info, CKR_GENERAL_ERROR);
-	
+
 	original = (klass->get_token_info) (self);
 	g_return_val_if_fail (original, CKR_GENERAL_ERROR);
-	
+
 	memcpy (info, original, sizeof (CK_TOKEN_INFO));
 
 	/* Extend all the strings appropriately */
@@ -1056,15 +1056,15 @@ gck_module_C_GetTokenInfo (GckModule *self, CK_SLOT_ID id, CK_TOKEN_INFO_PTR inf
 }
 
 CK_RV
-gck_module_C_GetMechanismList (GckModule *self, CK_SLOT_ID id, 
+gkm_module_C_GetMechanismList (GkmModule *self, CK_SLOT_ID id,
                                CK_MECHANISM_TYPE_PTR mech_list, CK_ULONG_PTR count)
 {
-	const guint n_mechanisms = G_N_ELEMENTS (mechanism_list); 
+	const guint n_mechanisms = G_N_ELEMENTS (mechanism_list);
 	guint i;
-	
-	g_return_val_if_fail (GCK_IS_MODULE (self), CKR_CRYPTOKI_NOT_INITIALIZED);
 
-	if (id != GCK_SLOT_ID)
+	g_return_val_if_fail (GKM_IS_MODULE (self), CKR_CRYPTOKI_NOT_INITIALIZED);
+
+	if (id != GKM_SLOT_ID)
 		return CKR_SLOT_ID_INVALID;
 	if (count == NULL)
 		return CKR_ARGUMENTS_BAD;
@@ -1074,13 +1074,13 @@ gck_module_C_GetMechanismList (GckModule *self, CK_SLOT_ID id,
 		*count = n_mechanisms;
 		return CKR_OK;
 	}
-	
+
 	/* Buffer too small? */
 	if (*count < n_mechanisms) {
 		*count = n_mechanisms;
 		return CKR_BUFFER_TOO_SMALL;
 	}
-	
+
 	*count = n_mechanisms;
 	for (i = 0; i < n_mechanisms; ++i)
 		mech_list[i] = mechanism_list[i].mechanism;
@@ -1089,15 +1089,15 @@ gck_module_C_GetMechanismList (GckModule *self, CK_SLOT_ID id,
 }
 
 CK_RV
-gck_module_C_GetMechanismInfo (GckModule *self, CK_SLOT_ID id, 
+gkm_module_C_GetMechanismInfo (GkmModule *self, CK_SLOT_ID id,
                                CK_MECHANISM_TYPE type, CK_MECHANISM_INFO_PTR info)
 {
-	const guint n_mechanisms = G_N_ELEMENTS (mechanism_list); 
+	const guint n_mechanisms = G_N_ELEMENTS (mechanism_list);
 	guint index;
-	
-	g_return_val_if_fail (GCK_IS_MODULE (self), CKR_CRYPTOKI_NOT_INITIALIZED);
 
-	if (id != GCK_SLOT_ID)
+	g_return_val_if_fail (GKM_IS_MODULE (self), CKR_CRYPTOKI_NOT_INITIALIZED);
+
+	if (id != GKM_SLOT_ID)
 		return CKR_SLOT_ID_INVALID;
 	if (info == NULL)
 		return CKR_ARGUMENTS_BAD;
@@ -1106,7 +1106,7 @@ gck_module_C_GetMechanismInfo (GckModule *self, CK_SLOT_ID id,
 		if (mechanism_list[index].mechanism == type)
 			break;
 	}
-	
+
 	if (index == n_mechanisms)
 		return CKR_MECHANISM_INVALID;
 
@@ -1115,25 +1115,25 @@ gck_module_C_GetMechanismInfo (GckModule *self, CK_SLOT_ID id,
 }
 
 CK_RV
-gck_module_C_InitToken (GckModule *self, CK_SLOT_ID id, CK_UTF8CHAR_PTR pin, 
+gkm_module_C_InitToken (GkmModule *self, CK_SLOT_ID id, CK_UTF8CHAR_PTR pin,
                         CK_ULONG pin_len, CK_UTF8CHAR_PTR label)
 {
 	return CKR_FUNCTION_NOT_SUPPORTED;
 }
 
 CK_RV
-gck_module_C_OpenSession (GckModule *self, CK_SLOT_ID id, CK_FLAGS flags, CK_VOID_PTR user_data, 
+gkm_module_C_OpenSession (GkmModule *self, CK_SLOT_ID id, CK_FLAGS flags, CK_VOID_PTR user_data,
                           CK_NOTIFY callback, CK_SESSION_HANDLE_PTR result)
 {
 	CK_G_APPLICATION_PTR app;
 	CK_SESSION_HANDLE handle;
 	gboolean read_only;
-	GckSession *session;
+	GkmSession *session;
 	Apartment *apt = NULL;
 
-	g_return_val_if_fail (GCK_IS_MODULE (self), CKR_CRYPTOKI_NOT_INITIALIZED);
+	g_return_val_if_fail (GKM_IS_MODULE (self), CKR_CRYPTOKI_NOT_INITIALIZED);
 
-	if (APARTMENT_SLOT (id) != GCK_SLOT_ID)
+	if (APARTMENT_SLOT (id) != GKM_SLOT_ID)
 		return CKR_SLOT_ID_INVALID;
 	if (!result)
 		return CKR_ARGUMENTS_BAD;
@@ -1158,7 +1158,7 @@ gck_module_C_OpenSession (GckModule *self, CK_SLOT_ID id, CK_FLAGS flags, CK_VOI
 
 	/* The first time this application is accessing, or closed all sessions, allocate new */
 	if (apt == NULL) {
-		apt = apartment_new (GCK_MODULE_GET_CLASS (self), id, app);
+		apt = apartment_new (GKM_MODULE_GET_CLASS (self), id, app);
 		register_apartment (self, apt);
 	}
 
@@ -1167,38 +1167,38 @@ gck_module_C_OpenSession (GckModule *self, CK_SLOT_ID id, CK_FLAGS flags, CK_VOI
 		return CKR_SESSION_READ_WRITE_SO_EXISTS;
 
 	/* Make and register a new session */
-	handle = gck_module_next_handle (self);
+	handle = gkm_module_next_handle (self);
 	read_only = !(flags & CKF_RW_SESSION);
-	session = g_object_new (GCK_TYPE_SESSION, "slot-id", apt->slot_id, "apartment", apt->apt_id,
+	session = g_object_new (GKM_TYPE_SESSION, "slot-id", apt->slot_id, "apartment", apt->apt_id,
 	                        "read-only", read_only, "handle", handle, "module", self,
 	                        "manager", apt->session_manager, "logged-in", apt->logged_in, NULL);
 	apt->sessions = g_list_prepend (apt->sessions, session);
 
 	/* Track the session by handle */
 	g_hash_table_insert (self->pv->sessions_by_handle,
-	                     gck_util_ulong_alloc (handle),
+	                     gkm_util_ulong_alloc (handle),
 	                     g_object_ref (session));
-	
+
 	*result = handle;
 	return CKR_OK;
 }
 
 CK_RV
-gck_module_C_CloseSession (GckModule *self, CK_SESSION_HANDLE handle)
+gkm_module_C_CloseSession (GkmModule *self, CK_SESSION_HANDLE handle)
 {
-	GckSession *session;
+	GkmSession *session;
 	CK_ULONG apt_id;
 	Apartment *apt;
 	GList *link;
 
-	g_return_val_if_fail (GCK_IS_MODULE (self), CKR_CRYPTOKI_NOT_INITIALIZED);
+	g_return_val_if_fail (GKM_IS_MODULE (self), CKR_CRYPTOKI_NOT_INITIALIZED);
 
-	session = gck_module_lookup_session (self, handle);
+	session = gkm_module_lookup_session (self, handle);
 	if (session == NULL)
 		return CKR_SESSION_HANDLE_INVALID;
 
 	/* Calculate the virtual slot */
-	apt_id = gck_session_get_apartment (session);
+	apt_id = gkm_session_get_apartment (session);
 	apt = lookup_apartment (self, apt_id);
 	g_return_val_if_fail (apt, CKR_GENERAL_ERROR);
 
@@ -1216,15 +1216,15 @@ gck_module_C_CloseSession (GckModule *self, CK_SESSION_HANDLE handle)
 }
 
 CK_RV
-gck_module_C_CloseAllSessions (GckModule *self, CK_SLOT_ID id)
+gkm_module_C_CloseAllSessions (GkmModule *self, CK_SLOT_ID id)
 {
 	Apartment *apt;
 	CK_SESSION_HANDLE handle;
 	GList *l;
 
-	g_return_val_if_fail (GCK_IS_MODULE (self), CKR_CRYPTOKI_NOT_INITIALIZED);
+	g_return_val_if_fail (GKM_IS_MODULE (self), CKR_CRYPTOKI_NOT_INITIALIZED);
 
-	if (APARTMENT_SLOT (id) != GCK_SLOT_ID)
+	if (APARTMENT_SLOT (id) != GKM_SLOT_ID)
 		return CKR_SLOT_ID_INVALID;
 
 	apt = lookup_apartment (self, id);
@@ -1233,7 +1233,7 @@ gck_module_C_CloseAllSessions (GckModule *self, CK_SLOT_ID id)
 
 	/* Unregister all its sessions */
 	for (l = apt->sessions; l; l = g_list_next (l)) {
-		handle = gck_session_get_handle (l->data);
+		handle = gkm_session_get_handle (l->data);
 		if (!g_hash_table_remove (self->pv->sessions_by_handle, &handle))
 			g_assert_not_reached ();
 	}
@@ -1243,21 +1243,21 @@ gck_module_C_CloseAllSessions (GckModule *self, CK_SLOT_ID id)
 }
 
 CK_RV
-gck_module_C_InitPIN (GckModule* self, CK_SESSION_HANDLE handle, 
+gkm_module_C_InitPIN (GkmModule* self, CK_SESSION_HANDLE handle,
                       CK_UTF8CHAR_PTR pin, CK_ULONG n_pin)
 {
-	GckSession *session;
+	GkmSession *session;
 	Apartment *apt;
 	CK_ULONG apt_id;
 
-	g_return_val_if_fail (GCK_IS_MODULE (self), CKR_CRYPTOKI_NOT_INITIALIZED);
+	g_return_val_if_fail (GKM_IS_MODULE (self), CKR_CRYPTOKI_NOT_INITIALIZED);
 
-	session = gck_module_lookup_session (self, handle);
+	session = gkm_module_lookup_session (self, handle);
 	if (session == NULL)
 		return CKR_SESSION_HANDLE_INVALID;
 
 	/* Calculate the virtual slot */
-	apt_id = gck_session_get_apartment (session);
+	apt_id = gkm_session_get_apartment (session);
 	apt = lookup_apartment (self, apt_id);
 	g_return_val_if_fail (apt, CKR_GENERAL_ERROR);
 
@@ -1265,56 +1265,56 @@ gck_module_C_InitPIN (GckModule* self, CK_SESSION_HANDLE handle,
 		return CKR_USER_NOT_LOGGED_IN;
 
 	/* Our InitPIN assumes an uninitialized PIN */
-	return gck_module_login_change (self, apt_id, NULL, 0, pin, n_pin);
+	return gkm_module_login_change (self, apt_id, NULL, 0, pin, n_pin);
 }
 
 CK_RV
-gck_module_C_SetPIN (GckModule* self, CK_SESSION_HANDLE handle, CK_UTF8CHAR_PTR old_pin,
+gkm_module_C_SetPIN (GkmModule* self, CK_SESSION_HANDLE handle, CK_UTF8CHAR_PTR old_pin,
                      CK_ULONG old_pin_len, CK_UTF8CHAR_PTR new_pin, CK_ULONG new_pin_len)
 {
-	GckSession *session;
+	GkmSession *session;
 	Apartment *apt;
 	CK_ULONG apt_id;
 
-	g_return_val_if_fail (GCK_IS_MODULE (self), CKR_CRYPTOKI_NOT_INITIALIZED);
+	g_return_val_if_fail (GKM_IS_MODULE (self), CKR_CRYPTOKI_NOT_INITIALIZED);
 
-	session = gck_module_lookup_session (self, handle);
+	session = gkm_module_lookup_session (self, handle);
 	if (session == NULL)
 		return CKR_SESSION_HANDLE_INVALID;
 
 	/* Calculate the virtual slot */
-	apt_id = gck_session_get_apartment (session);
+	apt_id = gkm_session_get_apartment (session);
 	apt = lookup_apartment (self, apt_id);
 	g_return_val_if_fail (apt, CKR_GENERAL_ERROR);
 
-	return gck_module_login_change (self, apt_id, old_pin, old_pin_len, new_pin, new_pin_len);
+	return gkm_module_login_change (self, apt_id, old_pin, old_pin_len, new_pin, new_pin_len);
 }
 
 CK_RV
-gck_module_C_Login (GckModule *self, CK_SESSION_HANDLE handle, CK_USER_TYPE user_type,
+gkm_module_C_Login (GkmModule *self, CK_SESSION_HANDLE handle, CK_USER_TYPE user_type,
                     CK_UTF8CHAR_PTR pin, CK_ULONG pin_len)
 {
 	CK_ULONG apt_id;
-	GckSession *session;
+	GkmSession *session;
 	Apartment *apt;
 	GList *l;
 
-	g_return_val_if_fail (GCK_IS_MODULE (self), CKR_CRYPTOKI_NOT_INITIALIZED);
+	g_return_val_if_fail (GKM_IS_MODULE (self), CKR_CRYPTOKI_NOT_INITIALIZED);
 
-	session = gck_module_lookup_session (self, handle);
+	session = gkm_module_lookup_session (self, handle);
 	if (session == NULL)
 		return CKR_SESSION_HANDLE_INVALID;
 
 	/* Pass off context specifc logins to appropriate place */
 	if (user_type == CKU_CONTEXT_SPECIFIC)
-		return gck_session_login_context_specific (session, pin, pin_len);
+		return gkm_session_login_context_specific (session, pin, pin_len);
 
 	/* Some random crap... */
 	if (user_type != CKU_USER && user_type != CKU_SO)
 		return CKR_USER_TYPE_INVALID;
 
 	/* Calculate the virtual slot */
-	apt_id = gck_session_get_apartment (session);
+	apt_id = gkm_session_get_apartment (session);
 	apt = lookup_apartment (self, apt_id);
 	g_return_val_if_fail (apt, CKR_GENERAL_ERROR);
 
@@ -1325,14 +1325,14 @@ gck_module_C_Login (GckModule *self, CK_SESSION_HANDLE handle, CK_USER_TYPE user
 
 		/* Can't login as SO if read-only sessions exist */
 		for (l = apt->sessions; l; l = g_list_next (l)) {
-			if (gck_session_get_read_only (l->data))
+			if (gkm_session_get_read_only (l->data))
 				return CKR_SESSION_READ_ONLY_EXISTS;
 		}
 
-		return gck_module_login_so (self, apt_id, pin, pin_len);
+		return gkm_module_login_so (self, apt_id, pin, pin_len);
 
 	} else if (user_type == CKU_USER) {
-		return gck_module_login_user (self, apt_id, pin, pin_len);
+		return gkm_module_login_user (self, apt_id, pin, pin_len);
 
 	} else {
 		return CKR_USER_TYPE_INVALID;
@@ -1340,19 +1340,19 @@ gck_module_C_Login (GckModule *self, CK_SESSION_HANDLE handle, CK_USER_TYPE user
 }
 
 CK_RV
-gck_module_C_Logout (GckModule *self, CK_SESSION_HANDLE handle)
+gkm_module_C_Logout (GkmModule *self, CK_SESSION_HANDLE handle)
 {
 	CK_ULONG apt_id;
 	Apartment *apt;
-	GckSession *session;
+	GkmSession *session;
 
-	g_return_val_if_fail (GCK_IS_MODULE (self), CKR_CRYPTOKI_NOT_INITIALIZED);
+	g_return_val_if_fail (GKM_IS_MODULE (self), CKR_CRYPTOKI_NOT_INITIALIZED);
 
-	session = gck_module_lookup_session (self, handle);
+	session = gkm_module_lookup_session (self, handle);
 	if (session == NULL)
 		return CKR_SESSION_HANDLE_INVALID;
 
-	apt_id = gck_session_get_apartment (session);
+	apt_id = gkm_session_get_apartment (session);
 	apt = lookup_apartment (self, apt_id);
 	g_return_val_if_fail (apt, CKR_GENERAL_ERROR);
 
@@ -1360,10 +1360,10 @@ gck_module_C_Logout (GckModule *self, CK_SESSION_HANDLE handle)
 		return CKR_USER_NOT_LOGGED_IN;
 
 	else if (apt->logged_in == CKU_USER)
-		return gck_module_logout_user (self, apt_id);
+		return gkm_module_logout_user (self, apt_id);
 
 	else if (apt->logged_in == CKU_SO)
-		return gck_module_logout_so (self, apt_id);
+		return gkm_module_logout_so (self, apt_id);
 
 	else
 		g_return_val_if_reached (CKR_GENERAL_ERROR);
diff --git a/pkcs11/gck/gck-module.h b/pkcs11/gkm/gkm-module.h
similarity index 53%
rename from pkcs11/gck/gck-module.h
rename to pkcs11/gkm/gkm-module.h
index a6f4304..e806d7c 100644
--- a/pkcs11/gck/gck-module.h
+++ b/pkcs11/gkm/gkm-module.h
@@ -1,224 +1,224 @@
-/* 
+/*
  * 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.
  */
 
-#ifndef __GCK_MODULE_H__
-#define __GCK_MODULE_H__
+#ifndef __GKM_MODULE_H__
+#define __GKM_MODULE_H__
 
 #include <glib-object.h>
 
 #include "pkcs11/pkcs11.h"
 
-#include "gck-factory.h"
-#include "gck-types.h"
+#include "gkm-factory.h"
+#include "gkm-types.h"
 
-#define GCK_TYPE_MODULE               (gck_module_get_type ())
-#define GCK_MODULE(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCK_TYPE_MODULE, GckModule))
-#define GCK_MODULE_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GCK_TYPE_MODULE, GckModuleClass))
-#define GCK_IS_MODULE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCK_TYPE_MODULE))
-#define GCK_IS_MODULE_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GCK_TYPE_MODULE))
-#define GCK_MODULE_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GCK_TYPE_MODULE, GckModuleClass))
+#define GKM_TYPE_MODULE               (gkm_module_get_type ())
+#define GKM_MODULE(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_MODULE, GkmModule))
+#define GKM_MODULE_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_MODULE, GkmModuleClass))
+#define GKM_IS_MODULE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_MODULE))
+#define GKM_IS_MODULE_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_MODULE))
+#define GKM_MODULE_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_MODULE, GkmModuleClass))
 
-typedef struct _GckModuleClass GckModuleClass;
-typedef struct _GckModulePrivate GckModulePrivate;
-    
-struct _GckModule {
+typedef struct _GkmModuleClass GkmModuleClass;
+typedef struct _GkmModulePrivate GkmModulePrivate;
+
+struct _GkmModule {
 	GObject parent;
 	CK_FUNCTION_LIST pkcs11_funcs;
-	GckModulePrivate *pv;
+	GkmModulePrivate *pv;
 };
 
-struct _GckModuleClass {
+struct _GkmModuleClass {
 	GObjectClass parent_class;
-	
+
 	/* virtual methods */
 
-	void (*parse_argument) (GckModule *self, const gchar *name, const gchar *value);
-	
-	const CK_SLOT_INFO* (*get_slot_info) (GckModule *self);
+	void (*parse_argument) (GkmModule *self, const gchar *name, const gchar *value);
 
-	const CK_TOKEN_INFO* (*get_token_info) (GckModule *self);
+	const CK_SLOT_INFO* (*get_slot_info) (GkmModule *self);
 
-	CK_RV (*refresh_token) (GckModule *self);
+	const CK_TOKEN_INFO* (*get_token_info) (GkmModule *self);
 
-	void (*add_token_object) (GckModule *self, GckTransaction *transaction, GckObject *object);
+	CK_RV (*refresh_token) (GkmModule *self);
 
-	void (*store_token_object) (GckModule *self, GckTransaction *transaction, GckObject *object);
+	void (*add_token_object) (GkmModule *self, GkmTransaction *transaction, GkmObject *object);
 
-	void (*remove_token_object) (GckModule *self, GckTransaction *transaction, GckObject *object);
+	void (*store_token_object) (GkmModule *self, GkmTransaction *transaction, GkmObject *object);
 
-	CK_RV (*login_change) (GckModule *self, CK_SLOT_ID slot_id, 
+	void (*remove_token_object) (GkmModule *self, GkmTransaction *transaction, GkmObject *object);
+
+	CK_RV (*login_change) (GkmModule *self, CK_SLOT_ID slot_id,
 	                       CK_UTF8CHAR_PTR old_pin, CK_ULONG n_old_pin,
 	                       CK_UTF8CHAR_PTR new_pin, CK_ULONG n_new_pin);
 
-	CK_RV (*login_user) (GckModule *self, CK_SLOT_ID slot_id, 
+	CK_RV (*login_user) (GkmModule *self, CK_SLOT_ID slot_id,
 	                     CK_UTF8CHAR_PTR pin, CK_ULONG n_pin);
 
-	CK_RV (*logout_user) (GckModule *self, CK_SLOT_ID slot_id);
+	CK_RV (*logout_user) (GkmModule *self, CK_SLOT_ID slot_id);
 
-	CK_RV (*login_so) (GckModule *self, CK_SLOT_ID slot_id, 
+	CK_RV (*login_so) (GkmModule *self, CK_SLOT_ID slot_id,
 	                   CK_UTF8CHAR_PTR pin, CK_ULONG n_pin);
 
-	CK_RV (*logout_so) (GckModule *self, CK_SLOT_ID slot_id);
+	CK_RV (*logout_so) (GkmModule *self, CK_SLOT_ID slot_id);
 };
 
-/* 
+/*
  * The PKCS#11 module is created by the following code in a header file:
- * 
- *     #include "gck-module.h"
- *     GCK_DECLARE_MODULE(my_module);
- * 
+ *
+ *     #include "gkm-module.h"
+ *     GKM_DECLARE_MODULE(my_module);
+ *
  * And the following code in a source file:
- * 
- *     #include "gck-module-ep.h"
- *     GCK_DEFINE_MODULE(my_module, MY_TYPE_MODULE)
- *     
+ *
+ *     #include "gkm-module-ep.h"
+ *     GKM_DEFINE_MODULE(my_module, MY_TYPE_MODULE)
+ *
  */
 
-#define GCK_DECLARE_MODULE(prefix) \
+#define GKM_DECLARE_MODULE(prefix) \
 	extern const CK_FUNCTION_LIST_PTR prefix ## _function_list
 
-#define GCK_DEFINE_MODULE(prefix, type) \
-	static GckModule* gck_module_instantiate (CK_C_INITIALIZE_ARGS_PTR args, GMutex* mutex) \
+#define GKM_DEFINE_MODULE(prefix, type) \
+	static GkmModule* gkm_module_instantiate (CK_C_INITIALIZE_ARGS_PTR args, GMutex* mutex) \
 		{ return g_object_new ((type), "initialize-args", args, "mutex", mutex, NULL); } \
-	const CK_FUNCTION_LIST_PTR prefix ## _function_list = &gck_module_function_list;
+	const CK_FUNCTION_LIST_PTR prefix ## _function_list = &gkm_module_function_list;
 
-GType                  gck_module_get_type                        (void);
+GType                  gkm_module_get_type                        (void);
 
-GckManager*            gck_module_get_manager                     (GckModule *self);
+GkmManager*            gkm_module_get_manager                     (GkmModule *self);
 
-gboolean               gck_module_get_write_protected             (GckModule *self);
+gboolean               gkm_module_get_write_protected             (GkmModule *self);
 
-CK_ULONG               gck_module_next_handle                     (GckModule *self);
+CK_ULONG               gkm_module_next_handle                     (GkmModule *self);
 
-GckSession*            gck_module_lookup_session                  (GckModule *self,
+GkmSession*            gkm_module_lookup_session                  (GkmModule *self,
                                                                    CK_SESSION_HANDLE handle);
 
-CK_RV                  gck_module_login_change                    (GckModule *self, 
-                                                                   CK_SLOT_ID slot_id, 
-                                                                   CK_UTF8CHAR_PTR old_pin, 
+CK_RV                  gkm_module_login_change                    (GkmModule *self,
+                                                                   CK_SLOT_ID slot_id,
+                                                                   CK_UTF8CHAR_PTR old_pin,
                                                                    CK_ULONG n_old_pin,
-                                                                   CK_UTF8CHAR_PTR new_pin, 
+                                                                   CK_UTF8CHAR_PTR new_pin,
                                                                    CK_ULONG n_new_pin);
 
-CK_RV                  gck_module_login_user                      (GckModule *self,
+CK_RV                  gkm_module_login_user                      (GkmModule *self,
                                                                    CK_SLOT_ID slot_id,
                                                                    CK_UTF8CHAR_PTR pin,
                                                                    CK_ULONG n_pin);
 
-CK_RV                  gck_module_logout_user                     (GckModule *self,
+CK_RV                  gkm_module_logout_user                     (GkmModule *self,
                                                                    CK_SLOT_ID slot_id);
 
-CK_RV                  gck_module_login_so                        (GckModule *self,
+CK_RV                  gkm_module_login_so                        (GkmModule *self,
                                                                    CK_SLOT_ID slot_id,
                                                                    CK_UTF8CHAR_PTR pin,
                                                                    CK_ULONG n_pin);
 
-CK_RV                  gck_module_logout_so                       (GckModule *self,
+CK_RV                  gkm_module_logout_so                       (GkmModule *self,
                                                                    CK_SLOT_ID slot_id);
 
-CK_RV                  gck_module_refresh_token                   (GckModule *self);
+CK_RV                  gkm_module_refresh_token                   (GkmModule *self);
 
-void                   gck_module_add_token_object                (GckModule *self,
-                                                                   GckTransaction *transaction,
-                                                                   GckObject *object);
+void                   gkm_module_add_token_object                (GkmModule *self,
+                                                                   GkmTransaction *transaction,
+                                                                   GkmObject *object);
 
-void                   gck_module_store_token_object              (GckModule *self,
-                                                                   GckTransaction *transaction,
-                                                                   GckObject *object);
+void                   gkm_module_store_token_object              (GkmModule *self,
+                                                                   GkmTransaction *transaction,
+                                                                   GkmObject *object);
 
-void                   gck_module_remove_token_object             (GckModule *self,
-                                                                   GckTransaction *transaction,
-                                                                   GckObject *object);
+void                   gkm_module_remove_token_object             (GkmModule *self,
+                                                                   GkmTransaction *transaction,
+                                                                   GkmObject *object);
 
-GckFactory*            gck_module_find_factory                    (GckModule *self,
+GkmFactory*            gkm_module_find_factory                    (GkmModule *self,
                                                                    CK_ATTRIBUTE_PTR attrs,
                                                                    CK_ULONG n_attrs);
 
-void                   gck_module_register_factory                (GckModule *self, 
-                                                                   GckFactory *factory);
+void                   gkm_module_register_factory                (GkmModule *self,
+                                                                   GkmFactory *factory);
 
-CK_RV                  gck_module_C_GetInfo                       (GckModule *self, 
+CK_RV                  gkm_module_C_GetInfo                       (GkmModule *self,
                                                                    CK_INFO_PTR info);
 
-CK_RV                  gck_module_C_GetSlotList                   (GckModule *self, 
-                                                                   CK_BBOOL token_present, 
-                                                                   CK_SLOT_ID_PTR slot_list, 
+CK_RV                  gkm_module_C_GetSlotList                   (GkmModule *self,
+                                                                   CK_BBOOL token_present,
+                                                                   CK_SLOT_ID_PTR slot_list,
                                                                    CK_ULONG_PTR count);
 
-CK_RV                  gck_module_C_GetSlotInfo                   (GckModule *self, 
-                                                                   CK_SLOT_ID id, 
+CK_RV                  gkm_module_C_GetSlotInfo                   (GkmModule *self,
+                                                                   CK_SLOT_ID id,
                                                                    CK_SLOT_INFO_PTR info);
 
-CK_RV                  gck_module_C_GetTokenInfo                  (GckModule *self, 
-                                                                   CK_SLOT_ID id, 
+CK_RV                  gkm_module_C_GetTokenInfo                  (GkmModule *self,
+                                                                   CK_SLOT_ID id,
                                                                    CK_TOKEN_INFO_PTR info);
 
-CK_RV                  gck_module_C_GetMechanismList              (GckModule *self, 
-                                                                   CK_SLOT_ID id, 
-                                                                   CK_MECHANISM_TYPE_PTR mech_list, 
+CK_RV                  gkm_module_C_GetMechanismList              (GkmModule *self,
+                                                                   CK_SLOT_ID id,
+                                                                   CK_MECHANISM_TYPE_PTR mech_list,
                                                                    CK_ULONG_PTR count);
 
-CK_RV                  gck_module_C_GetMechanismInfo              (GckModule *self, 
-                                                                   CK_SLOT_ID id, 
-                                                                   CK_MECHANISM_TYPE type, 
+CK_RV                  gkm_module_C_GetMechanismInfo              (GkmModule *self,
+                                                                   CK_SLOT_ID id,
+                                                                   CK_MECHANISM_TYPE type,
                                                                    CK_MECHANISM_INFO_PTR info);
 
-CK_RV                  gck_module_C_InitToken                     (GckModule *self,
-                                                                   CK_SLOT_ID id, 
-                                                                   CK_UTF8CHAR_PTR pin, 
-                                                                   CK_ULONG pin_len, 
+CK_RV                  gkm_module_C_InitToken                     (GkmModule *self,
+                                                                   CK_SLOT_ID id,
+                                                                   CK_UTF8CHAR_PTR pin,
+                                                                   CK_ULONG pin_len,
                                                                    CK_UTF8CHAR_PTR label);
 
-CK_RV                  gck_module_C_OpenSession                   (GckModule *self, 
-                                                                   CK_SLOT_ID id, 
-                                                                   CK_FLAGS flags, 
-                                                                   CK_VOID_PTR user_data, 
-                                                                   CK_NOTIFY callback, 
+CK_RV                  gkm_module_C_OpenSession                   (GkmModule *self,
+                                                                   CK_SLOT_ID id,
+                                                                   CK_FLAGS flags,
+                                                                   CK_VOID_PTR user_data,
+                                                                   CK_NOTIFY callback,
                                                                    CK_SESSION_HANDLE_PTR session);
 
-CK_RV                  gck_module_C_CloseSession                  (GckModule *self,
+CK_RV                  gkm_module_C_CloseSession                  (GkmModule *self,
                                                                    CK_SESSION_HANDLE session);
 
-CK_RV                  gck_module_C_CloseAllSessions              (GckModule *self, 
+CK_RV                  gkm_module_C_CloseAllSessions              (GkmModule *self,
                                                                    CK_SLOT_ID id);
 
-CK_RV                  gck_module_C_InitPIN                       (GckModule* self, 
+CK_RV                  gkm_module_C_InitPIN                       (GkmModule* self,
                                                                    CK_SESSION_HANDLE session,
                                                                    CK_UTF8CHAR_PTR pin,
                                                                    CK_ULONG pin_len);
 
-CK_RV                  gck_module_C_SetPIN                        (GckModule* self,
+CK_RV                  gkm_module_C_SetPIN                        (GkmModule* self,
                                                                    CK_SESSION_HANDLE session,
                                                                    CK_UTF8CHAR_PTR old_pin,
-                                                                   CK_ULONG old_pin_len, 
-                                                                   CK_UTF8CHAR_PTR new_pin, 
+                                                                   CK_ULONG old_pin_len,
+                                                                   CK_UTF8CHAR_PTR new_pin,
                                                                    CK_ULONG new_pin_len);
 
-CK_RV                  gck_module_C_Login                         (GckModule *self, 
-                                                                   CK_SESSION_HANDLE session, 
+CK_RV                  gkm_module_C_Login                         (GkmModule *self,
+                                                                   CK_SESSION_HANDLE session,
                                                                    CK_USER_TYPE user_type,
-                                                                   CK_UTF8CHAR_PTR pin, 
+                                                                   CK_UTF8CHAR_PTR pin,
                                                                    CK_ULONG pin_len);
 
-CK_RV                  gck_module_C_Logout                        (GckModule *self, 
+CK_RV                  gkm_module_C_Logout                        (GkmModule *self,
                                                                    CK_SESSION_HANDLE session);
 
-#endif /* __GCK_MODULE_H__ */
+#endif /* __GKM_MODULE_H__ */
diff --git a/pkcs11/gck/gck-null-key.c b/pkcs11/gkm/gkm-null-key.c
similarity index 59%
rename from pkcs11/gck/gck-null-key.c
rename to pkcs11/gkm/gkm-null-key.c
index 75d8b76..d38911b 100644
--- a/pkcs11/gck/gck-null-key.c
+++ b/pkcs11/gkm/gkm-null-key.c
@@ -21,41 +21,41 @@
 
 #include "config.h"
 
-#include "gck-attributes.h"
-#include "gck-null-mechanism.h"
-#include "gck-null-key.h"
-#include "gck-session.h"
-#include "gck-util.h"
+#include "gkm-attributes.h"
+#include "gkm-null-mechanism.h"
+#include "gkm-null-key.h"
+#include "gkm-session.h"
+#include "gkm-util.h"
 
 #include "pkcs11/pkcs11.h"
 #include "pkcs11/pkcs11i.h"
 
-struct _GckNullKey {
-	GckSecretKey parent;
+struct _GkmNullKey {
+	GkmSecretKey parent;
 };
 
-G_DEFINE_TYPE (GckNullKey, gck_null_key, GCK_TYPE_SECRET_KEY);
+G_DEFINE_TYPE (GkmNullKey, gkm_null_key, GKM_TYPE_SECRET_KEY);
 
 /* -----------------------------------------------------------------------------
  * INTERNAL
  */
 
-static GckObject*
-factory_create_null_key (GckSession *session, GckTransaction *transaction,
+static GkmObject*
+factory_create_null_key (GkmSession *session, GkmTransaction *transaction,
                          CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
 {
-	GckNullKey *key;
-	GckManager *manager;
+	GkmNullKey *key;
+	GkmManager *manager;
 
-	manager = gck_manager_for_template (attrs, n_attrs, session);
-	key = g_object_new (GCK_TYPE_NULL_KEY,
-	                    "module", gck_session_get_module (session),
+	manager = gkm_manager_for_template (attrs, n_attrs, session);
+	key = g_object_new (GKM_TYPE_NULL_KEY,
+	                    "module", gkm_session_get_module (session),
 	                    "manager", manager,
 	                    NULL);
 
-	gck_session_complete_object_creation (session, transaction, GCK_OBJECT (key),
+	gkm_session_complete_object_creation (session, transaction, GKM_OBJECT (key),
 	                                      TRUE, attrs, n_attrs);
-	return GCK_OBJECT (key);
+	return GKM_OBJECT (key);
 }
 
 /* -----------------------------------------------------------------------------
@@ -63,55 +63,55 @@ factory_create_null_key (GckSession *session, GckTransaction *transaction,
  */
 
 static CK_RV
-gck_null_key_real_get_attribute (GckObject *base, GckSession *session, CK_ATTRIBUTE *attr)
+gkm_null_key_real_get_attribute (GkmObject *base, GkmSession *session, CK_ATTRIBUTE *attr)
 {
 	switch (attr->type)
 	{
 	case CKA_KEY_TYPE:
-		return gck_attribute_set_ulong (attr, CKK_G_NULL);
+		return gkm_attribute_set_ulong (attr, CKK_G_NULL);
 
 	case CKA_UNWRAP:
 	case CKA_WRAP:
-		return gck_attribute_set_bool (attr, CK_TRUE);
+		return gkm_attribute_set_bool (attr, CK_TRUE);
 
 	case CKA_VALUE:
-		return gck_attribute_set_empty (attr);
+		return gkm_attribute_set_empty (attr);
 
 	case CKA_VALUE_LEN:
-		return gck_attribute_set_ulong (attr, 0);
+		return gkm_attribute_set_ulong (attr, 0);
 
 	case CKA_CHECK_VALUE:
-		return gck_attribute_set_data (attr, "\0\0\0", 3);
+		return gkm_attribute_set_data (attr, "\0\0\0", 3);
 
 	case CKA_ALLOWED_MECHANISMS:
-		return gck_attribute_set_data (attr, (CK_VOID_PTR)GCK_NULL_MECHANISMS,
-		                               sizeof (GCK_NULL_MECHANISMS));
+		return gkm_attribute_set_data (attr, (CK_VOID_PTR)GKM_NULL_MECHANISMS,
+		                               sizeof (GKM_NULL_MECHANISMS));
 	};
 
-	return GCK_OBJECT_CLASS (gck_null_key_parent_class)->get_attribute (base, session, attr);
+	return GKM_OBJECT_CLASS (gkm_null_key_parent_class)->get_attribute (base, session, attr);
 }
 
 static void
-gck_null_key_init (GckNullKey *self)
+gkm_null_key_init (GkmNullKey *self)
 {
 
 }
 
 static void
-gck_null_key_class_init (GckNullKeyClass *klass)
+gkm_null_key_class_init (GkmNullKeyClass *klass)
 {
-	GckObjectClass *gck_class = GCK_OBJECT_CLASS (klass);
+	GkmObjectClass *gkm_class = GKM_OBJECT_CLASS (klass);
 
-	gck_null_key_parent_class = g_type_class_peek_parent (klass);
-	gck_class->get_attribute = gck_null_key_real_get_attribute;
+	gkm_null_key_parent_class = g_type_class_peek_parent (klass);
+	gkm_class->get_attribute = gkm_null_key_real_get_attribute;
 }
 
 /* -----------------------------------------------------------------------------
  * PUBLIC
  */
 
-GckFactory*
-gck_null_key_get_factory (void)
+GkmFactory*
+gkm_null_key_get_factory (void)
 {
 	static CK_OBJECT_CLASS klass = CKO_SECRET_KEY;
 	static CK_KEY_TYPE type = CKK_G_NULL;
@@ -121,7 +121,7 @@ gck_null_key_get_factory (void)
 		{ CKA_KEY_TYPE, &type, sizeof (type) }
 	};
 
-	static GckFactory factory = {
+	static GkmFactory factory = {
 		attributes,
 		G_N_ELEMENTS (attributes),
 		factory_create_null_key
diff --git a/pkcs11/gkm/gkm-null-key.h b/pkcs11/gkm/gkm-null-key.h
new file mode 100644
index 0000000..4f7390b
--- /dev/null
+++ b/pkcs11/gkm/gkm-null-key.h
@@ -0,0 +1,52 @@
+/*
+ * 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 __GKM_NULL_KEY_H__
+#define __GKM_NULL_KEY_H__
+
+#include <glib-object.h>
+
+#include "gkm-secret-key.h"
+#include "gkm-types.h"
+
+#include <gcrypt.h>
+
+#define GKM_FACTORY_NULL_KEY            (gkm_null_key_get_factory ())
+
+#define GKM_TYPE_NULL_KEY               (gkm_null_key_get_type ())
+#define GKM_NULL_KEY(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_NULL_KEY, GkmNullKey))
+#define GKM_NULL_KEY_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_NULL_KEY, GkmNullKeyClass))
+#define GKM_IS_NULL_KEY(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_NULL_KEY))
+#define GKM_IS_NULL_KEY_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_NULL_KEY))
+#define GKM_NULL_KEY_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_NULL_KEY, GkmNullKeyClass))
+
+typedef struct _GkmNullKeyClass GkmNullKeyClass;
+typedef struct _GkmNullKeyPrivate GkmNullKeyPrivate;
+
+struct _GkmNullKeyClass {
+	GkmSecretKeyClass parent_class;
+};
+
+GType                     gkm_null_key_get_type           (void);
+
+GkmFactory*               gkm_null_key_get_factory        (void);
+
+#endif /* __GKM_NULL_KEY_H__ */
diff --git a/pkcs11/gck/gck-null-mechanism.c b/pkcs11/gkm/gkm-null-mechanism.c
similarity index 69%
rename from pkcs11/gck/gck-null-mechanism.c
rename to pkcs11/gkm/gkm-null-mechanism.c
index 03f0862..8eeb42a 100644
--- a/pkcs11/gck/gck-null-mechanism.c
+++ b/pkcs11/gkm/gkm-null-mechanism.c
@@ -21,17 +21,17 @@
 
 #include "config.h"
 
-#include "gck-null-key.h"
-#include "gck-null-mechanism.h"
-#include "gck-session.h"
-#include "gck-transaction.h"
-#include "gck-util.h"
+#include "gkm-null-key.h"
+#include "gkm-null-mechanism.h"
+#include "gkm-session.h"
+#include "gkm-transaction.h"
+#include "gkm-util.h"
 
 #include "egg/egg-libgcrypt.h"
 #include "egg/egg-secure-memory.h"
 
 static CK_RV
-retrieve_length (GckSession *session, GckObject *wrapped, gsize *length)
+retrieve_length (GkmSession *session, GkmObject *wrapped, gsize *length)
 {
 	CK_ATTRIBUTE attr;
 	CK_RV rv;
@@ -40,14 +40,14 @@ retrieve_length (GckSession *session, GckObject *wrapped, gsize *length)
 	attr.pValue = NULL;
 	attr.ulValueLen = 0;
 
-	rv = gck_object_get_attribute (wrapped, session, &attr);
+	rv = gkm_object_get_attribute (wrapped, session, &attr);
 	if (rv == CKR_OK)
 		*length = attr.ulValueLen;
 	return rv;
 }
 
 static CK_RV
-retrieve_value (GckSession *session, GckObject *wrapped,
+retrieve_value (GkmSession *session, GkmObject *wrapped,
                 gpointer *value, gsize *n_value)
 {
 	CK_ATTRIBUTE attr;
@@ -61,7 +61,7 @@ retrieve_value (GckSession *session, GckObject *wrapped,
 	attr.pValue = egg_secure_alloc (*n_value);
 	attr.ulValueLen = *n_value;
 
-	rv = gck_object_get_attribute (wrapped, session, &attr);
+	rv = gkm_object_get_attribute (wrapped, session, &attr);
 	if (rv == CKR_OK)
 		*value = attr.pValue;
 	else
@@ -71,24 +71,24 @@ retrieve_value (GckSession *session, GckObject *wrapped,
 }
 
 CK_RV
-gck_null_mechanism_wrap (GckSession *session, CK_MECHANISM_PTR mech,
-                        GckObject *wrapper, GckObject *wrapped,
+gkm_null_mechanism_wrap (GkmSession *session, CK_MECHANISM_PTR mech,
+                        GkmObject *wrapper, GkmObject *wrapped,
                         CK_BYTE_PTR output, CK_ULONG_PTR n_output)
 {
-	GckNullKey *key;
+	GkmNullKey *key;
 	gpointer value;
 	gsize n_value;
 	CK_RV rv;
 
-	g_return_val_if_fail (GCK_IS_SESSION (session), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (GKM_IS_SESSION (session), CKR_GENERAL_ERROR);
 	g_return_val_if_fail (mech, CKR_GENERAL_ERROR);
 	g_return_val_if_fail (mech->mechanism == CKM_G_NULL, CKR_GENERAL_ERROR);
-	g_return_val_if_fail (GCK_IS_OBJECT (wrapped), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (GKM_IS_OBJECT (wrapped), CKR_GENERAL_ERROR);
 	g_return_val_if_fail (n_output, CKR_GENERAL_ERROR);
 
-	if (!GCK_IS_NULL_KEY (wrapper))
+	if (!GKM_IS_NULL_KEY (wrapper))
 		return CKR_WRAPPING_KEY_TYPE_INCONSISTENT;
-	key = GCK_NULL_KEY (wrapper);
+	key = GKM_NULL_KEY (wrapper);
 
 	/* They just want the length */
 	if (!output) {
@@ -105,30 +105,30 @@ gck_null_mechanism_wrap (GckSession *session, CK_MECHANISM_PTR mech,
 	if (rv != CKR_OK)
 		return rv;
 
-	rv = gck_util_return_data (output, n_output, value, n_value);
+	rv = gkm_util_return_data (output, n_output, value, n_value);
 	egg_secure_free (value);
 	return rv;
 }
 
 CK_RV
-gck_null_mechanism_unwrap (GckSession *session, CK_MECHANISM_PTR mech,
-                          GckObject *wrapper, CK_VOID_PTR input, CK_ULONG n_input,
+gkm_null_mechanism_unwrap (GkmSession *session, CK_MECHANISM_PTR mech,
+                          GkmObject *wrapper, CK_VOID_PTR input, CK_ULONG n_input,
                           CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs,
-                          GckObject **unwrapped)
+                          GkmObject **unwrapped)
 {
 	CK_ATTRIBUTE attr;
 	GArray *array;
-	GckNullKey *key;
-	GckTransaction *transaction;
+	GkmNullKey *key;
+	GkmTransaction *transaction;
 
-	g_return_val_if_fail (GCK_IS_SESSION (session), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (GKM_IS_SESSION (session), CKR_GENERAL_ERROR);
 	g_return_val_if_fail (mech, CKR_GENERAL_ERROR);
 	g_return_val_if_fail (mech->mechanism == CKM_G_NULL, CKR_GENERAL_ERROR);
-	g_return_val_if_fail (GCK_IS_OBJECT (wrapper), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (GKM_IS_OBJECT (wrapper), CKR_GENERAL_ERROR);
 
-	if (!GCK_IS_NULL_KEY (wrapper))
+	if (!GKM_IS_NULL_KEY (wrapper))
 		return CKR_WRAPPING_KEY_TYPE_INCONSISTENT;
-	key = GCK_NULL_KEY (wrapper);
+	key = GKM_NULL_KEY (wrapper);
 
 	if (mech->ulParameterLen)
 		return CKR_MECHANISM_PARAM_INVALID;
@@ -145,13 +145,13 @@ gck_null_mechanism_unwrap (GckSession *session, CK_MECHANISM_PTR mech,
 	/* Add the remainder of the attributes */
 	g_array_append_vals (array, attrs, n_attrs);
 
-	transaction = gck_transaction_new ();
+	transaction = gkm_transaction_new ();
 
 	/* Now create an object with these attributes */
-	*unwrapped = gck_session_create_object_for_attributes (session, transaction,
+	*unwrapped = gkm_session_create_object_for_attributes (session, transaction,
 	                                                       (CK_ATTRIBUTE_PTR)array->data, array->len);
 
 	g_array_free (array, TRUE);
 
-	return gck_transaction_complete_and_unref (transaction);
+	return gkm_transaction_complete_and_unref (transaction);
 }
diff --git a/pkcs11/gck/gck-null-mechanism.h b/pkcs11/gkm/gkm-null-mechanism.h
similarity index 77%
rename from pkcs11/gck/gck-null-mechanism.h
rename to pkcs11/gkm/gkm-null-mechanism.h
index c32f72f..697a297 100644
--- a/pkcs11/gck/gck-null-mechanism.h
+++ b/pkcs11/gkm/gkm-null-mechanism.h
@@ -19,37 +19,37 @@
  * 02111-1307, USA.
  */
 
-#ifndef GCK_NULL_MECHANISM_H_
-#define GCK_NULL_MECHANISM_H_
+#ifndef GKM_NULL_MECHANISM_H_
+#define GKM_NULL_MECHANISM_H_
 
-#include "gck-types.h"
+#include "gkm-types.h"
 
 #include "pkcs11/pkcs11.h"
 #include "pkcs11/pkcs11i.h"
 
 #include <glib.h>
 
-#define GCK_NULL_MECHANISM_MIN_LENGTH     0
-#define GCK_NULL_MECHANISM_MAX_LENGTH     0
+#define GKM_NULL_MECHANISM_MIN_LENGTH     0
+#define GKM_NULL_MECHANISM_MAX_LENGTH     0
 
-static const CK_MECHANISM_TYPE GCK_NULL_MECHANISMS[] = {
+static const CK_MECHANISM_TYPE GKM_NULL_MECHANISMS[] = {
 	CKM_G_NULL
 };
 
-CK_RV                   gck_null_mechanism_wrap                (GckSession *session,
+CK_RV                   gkm_null_mechanism_wrap                (GkmSession *session,
                                                                 CK_MECHANISM_PTR mech,
-                                                                GckObject *wrapper,
-                                                                GckObject *wrapped,
+                                                                GkmObject *wrapper,
+                                                                GkmObject *wrapped,
                                                                 CK_BYTE_PTR output,
                                                                 CK_ULONG_PTR n_output);
 
-CK_RV                   gck_null_mechanism_unwrap              (GckSession *session,
+CK_RV                   gkm_null_mechanism_unwrap              (GkmSession *session,
                                                                 CK_MECHANISM_PTR mech,
-                                                                GckObject *wrapper,
+                                                                GkmObject *wrapper,
                                                                 CK_VOID_PTR input,
                                                                 CK_ULONG n_input,
                                                                 CK_ATTRIBUTE_PTR attrs,
                                                                 CK_ULONG n_attrs,
-                                                                GckObject **unwrapped);
+                                                                GkmObject **unwrapped);
 
-#endif /* GCK_NULL_MECHANISM_H_ */
+#endif /* GKM_NULL_MECHANISM_H_ */
diff --git a/pkcs11/gck/gck-object.c b/pkcs11/gkm/gkm-object.c
similarity index 54%
rename from pkcs11/gck/gck-object.c
rename to pkcs11/gkm/gkm-object.c
index a2d03e2..8f39867 100644
--- a/pkcs11/gck/gck-object.c
+++ b/pkcs11/gkm/gkm-object.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"
@@ -25,15 +25,15 @@
 #include "pkcs11/pkcs11g.h"
 #include "pkcs11/pkcs11i.h"
 
-#include "gck-attributes.h"
-#include "gck-credential.h"
-#include "gck-manager.h"
-#include "gck-object.h"
-#include "gck-transaction.h"
-#include "gck-session.h"
-#include "gck-store.h"
-#include "gck-timer.h"
-#include "gck-util.h"
+#include "gkm-attributes.h"
+#include "gkm-credential.h"
+#include "gkm-manager.h"
+#include "gkm-object.h"
+#include "gkm-transaction.h"
+#include "gkm-session.h"
+#include "gkm-store.h"
+#include "gkm-timer.h"
+#include "gkm-util.h"
 
 enum {
 	PROP_0,
@@ -53,61 +53,61 @@ enum {
 
 static guint signals[LAST_SIGNAL] = { 0 };
 
-typedef struct _GckObjectTransient {
-	GckTimer *timer;
+typedef struct _GkmObjectTransient {
+	GkmTimer *timer;
 	gulong timed_after;
 	gulong timed_idle;
 	glong stamp_used;
 	glong stamp_created;
 	gulong uses_remaining;
-} GckObjectTransient;
+} GkmObjectTransient;
 
-struct _GckObjectPrivate {
+struct _GkmObjectPrivate {
 	CK_OBJECT_HANDLE handle;
-	GckModule *module;
-	GckManager *manager;
-	GckStore *store;
+	GkmModule *module;
+	GkmManager *manager;
+	GkmStore *store;
 	gchar *unique;
 	gboolean exposed;
-	GckObjectTransient *transient;
+	GkmObjectTransient *transient;
 };
 
-G_DEFINE_TYPE (GckObject, gck_object, G_TYPE_OBJECT);
+G_DEFINE_TYPE (GkmObject, gkm_object, G_TYPE_OBJECT);
 
 /* Private friend functions from the manager */
-void  _gck_manager_register_object   (GckManager *self, GckObject *object);
-void  _gck_manager_unregister_object (GckManager *self, GckObject *object);
+void  _gkm_manager_register_object   (GkmManager *self, GkmObject *object);
+void  _gkm_manager_unregister_object (GkmManager *self, GkmObject *object);
 
 /* -----------------------------------------------------------------------------
- * INTERNAL 
+ * INTERNAL
  */
 
 static void
-self_destruct (GckObject *self)
+self_destruct (GkmObject *self)
 {
-	GckTransaction *transaction;
+	GkmTransaction *transaction;
 	CK_RV rv;
 
-	transaction = gck_transaction_new ();
+	transaction = gkm_transaction_new ();
 
-	gck_object_destroy (self, transaction);
+	gkm_object_destroy (self, transaction);
 
-	gck_transaction_complete (transaction);
-	rv = gck_transaction_get_result (transaction);
+	gkm_transaction_complete (transaction);
+	rv = gkm_transaction_get_result (transaction);
 	g_object_unref (transaction);
 	if (rv != CKR_OK)
 		g_warning ("Unexpected failure to auto destruct object (code: %lu)", (gulong)rv);
 }
 
 static void
-timer_callback (GckTimer *timer, gpointer user_data)
+timer_callback (GkmTimer *timer, gpointer user_data)
 {
-	GckObject *self = user_data;
+	GkmObject *self = user_data;
 	glong after, idle, offset;
-	GckObjectTransient *transient;
+	GkmObjectTransient *transient;
 	GTimeVal tv;
 
-	g_return_if_fail (GCK_IS_OBJECT (self));
+	g_return_if_fail (GKM_IS_OBJECT (self));
 
 	g_object_ref (self);
 
@@ -138,19 +138,19 @@ timer_callback (GckTimer *timer, gpointer user_data)
 
 	/* Setup the next timer */
 	else
-		transient->timer = gck_timer_start (self->pv->module, offset, timer_callback, self);
+		transient->timer = gkm_timer_start (self->pv->module, offset, timer_callback, self);
 
 	g_object_unref (self);
 }
 
 static gboolean
-start_callback (GckTransaction *transaction, GObject *obj, gpointer user_data)
+start_callback (GkmTransaction *transaction, GObject *obj, gpointer user_data)
 {
-	GckObject *self = GCK_OBJECT (obj);
-	GckObjectTransient *transient;
+	GkmObject *self = GKM_OBJECT (obj);
+	GkmObjectTransient *transient;
 	GTimeVal tv;
 
-	g_return_val_if_fail (GCK_IS_OBJECT (self), FALSE);
+	g_return_val_if_fail (GKM_IS_OBJECT (self), FALSE);
 	g_return_val_if_fail (self->pv->transient, FALSE);
 	transient = self->pv->transient;
 	g_return_val_if_fail (!transient->timer, FALSE);
@@ -167,7 +167,7 @@ start_callback (GckTransaction *transaction, GObject *obj, gpointer user_data)
 static void
 module_went_away (gpointer data, GObject *old_module)
 {
-	GckObject *self = GCK_OBJECT (data);
+	GkmObject *self = GKM_OBJECT (data);
 	g_return_if_fail (self->pv->module);
 	g_warning ("module destroyed before %s that module contained",
 	           G_OBJECT_TYPE_NAME (self));
@@ -175,46 +175,46 @@ module_went_away (gpointer data, GObject *old_module)
 }
 
 static gboolean
-complete_destroy (GckTransaction *transaction, GObject *unused, gpointer user_data)
+complete_destroy (GkmTransaction *transaction, GObject *unused, gpointer user_data)
 {
-	gck_util_dispose_unref (user_data);
+	gkm_util_dispose_unref (user_data);
 	return TRUE;
 }
 
 static gboolean
-complete_expose (GckTransaction *transaction, GObject *obj, gpointer user_data)
+complete_expose (GkmTransaction *transaction, GObject *obj, gpointer user_data)
 {
-	GckObject *self = GCK_OBJECT (obj);
+	GkmObject *self = GKM_OBJECT (obj);
 	gboolean expose = GPOINTER_TO_UINT (user_data);
 
-	if (gck_transaction_get_failed (transaction))
-		gck_object_expose (self, !expose);
+	if (gkm_transaction_get_failed (transaction))
+		gkm_object_expose (self, !expose);
 
 	return TRUE;
 }
 
 static gboolean
-find_credential (GckCredential *cred, GckObject *object, gpointer user_data)
+find_credential (GkmCredential *cred, GkmObject *object, gpointer user_data)
 {
 	CK_OBJECT_HANDLE *result = user_data;
 	g_return_val_if_fail (!*result, FALSE);
-	*result = gck_object_get_handle (GCK_OBJECT (cred));
+	*result = gkm_object_get_handle (GKM_OBJECT (cred));
 	return TRUE;
 }
 
 static void
-mark_object_transient (GckObject *self)
+mark_object_transient (GkmObject *self)
 {
 	if (!self->pv->transient)
-		self->pv->transient = g_slice_new0 (GckObjectTransient);
+		self->pv->transient = g_slice_new0 (GkmObjectTransient);
 }
 
 /* -----------------------------------------------------------------------------
- * OBJECT 
+ * OBJECT
  */
 
-static CK_RV 
-gck_object_real_get_attribute (GckObject *self, GckSession *session, CK_ATTRIBUTE* attr)
+static CK_RV
+gkm_object_real_get_attribute (GkmObject *self, GkmSession *session, CK_ATTRIBUTE* attr)
 {
 	CK_OBJECT_HANDLE handle = 0;
 	CK_RV rv;
@@ -225,34 +225,34 @@ gck_object_real_get_attribute (GckObject *self, GckSession *session, CK_ATTRIBUT
 		g_warning ("Derived class should have overridden CKA_CLASS");
 		return CKR_GENERAL_ERROR;
 	case CKA_MODIFIABLE:
-		return gck_attribute_set_bool (attr, self->pv->store ? TRUE : FALSE);
+		return gkm_attribute_set_bool (attr, self->pv->store ? TRUE : FALSE);
 	case CKA_PRIVATE:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 	case CKA_TOKEN:
-		return gck_attribute_set_bool (attr, gck_object_is_token (self));
+		return gkm_attribute_set_bool (attr, gkm_object_is_token (self));
 	case CKA_G_CREDENTIAL:
-		gck_credential_for_each (session, GCK_OBJECT (self), find_credential, &handle);
-		return gck_attribute_set_ulong (attr, handle);
+		gkm_credential_for_each (session, GKM_OBJECT (self), find_credential, &handle);
+		return gkm_attribute_set_ulong (attr, handle);
 	case CKA_GNOME_UNIQUE:
 		if (self->pv->unique)
-			return gck_attribute_set_string (attr, self->pv->unique);
+			return gkm_attribute_set_string (attr, self->pv->unique);
 		return CKR_ATTRIBUTE_TYPE_INVALID;
 	case CKA_GNOME_TRANSIENT:
-		return gck_attribute_set_bool (attr, self->pv->transient ? TRUE : FALSE);
+		return gkm_attribute_set_bool (attr, self->pv->transient ? TRUE : FALSE);
 	case CKA_G_DESTRUCT_AFTER:
-		return gck_attribute_set_ulong (attr, self->pv->transient ?
+		return gkm_attribute_set_ulong (attr, self->pv->transient ?
 		                                      self->pv->transient->timed_after : 0);
 	case CKA_G_DESTRUCT_IDLE:
-		return gck_attribute_set_ulong (attr, self->pv->transient ?
+		return gkm_attribute_set_ulong (attr, self->pv->transient ?
 		                                      self->pv->transient->timed_idle : 0);
 	case CKA_G_DESTRUCT_USES:
-		return gck_attribute_set_ulong (attr, self->pv->transient ?
+		return gkm_attribute_set_ulong (attr, self->pv->transient ?
 		                                      self->pv->transient->uses_remaining : 0);
 	};
 
 	/* Give store a shot */
 	if (self->pv->store) {
-		rv = gck_store_get_attribute (self->pv->store, self, attr);
+		rv = gkm_store_get_attribute (self->pv->store, self, attr);
 		if (rv != CKR_ATTRIBUTE_TYPE_INVALID)
 			return rv;
 	}
@@ -260,15 +260,15 @@ gck_object_real_get_attribute (GckObject *self, GckSession *session, CK_ATTRIBUT
 	/* Now some more defaults */
 	switch (attr->type) {
 	case CKA_LABEL:
-		return gck_attribute_set_data (attr, "", 0);
+		return gkm_attribute_set_data (attr, "", 0);
 	}
-	
+
 	return CKR_ATTRIBUTE_TYPE_INVALID;
 }
 
-static void 
-gck_object_real_set_attribute (GckObject *self, GckSession *session,
-                               GckTransaction* transaction, CK_ATTRIBUTE* attr)
+static void
+gkm_object_real_set_attribute (GkmObject *self, GkmSession *session,
+                               GkmTransaction* transaction, CK_ATTRIBUTE* attr)
 {
 	CK_ATTRIBUTE check;
 	CK_RV rv;
@@ -278,42 +278,42 @@ gck_object_real_set_attribute (GckObject *self, GckSession *session,
 	case CKA_PRIVATE:
 	case CKA_MODIFIABLE:
 	case CKA_CLASS:
-		gck_transaction_fail (transaction, CKR_ATTRIBUTE_READ_ONLY);
+		gkm_transaction_fail (transaction, CKR_ATTRIBUTE_READ_ONLY);
 		return;
 	case CKA_GNOME_UNIQUE:
-		gck_transaction_fail (transaction, self->pv->unique ? 
-		                                       CKR_ATTRIBUTE_READ_ONLY : 
+		gkm_transaction_fail (transaction, self->pv->unique ?
+		                                       CKR_ATTRIBUTE_READ_ONLY :
 		                                       CKR_ATTRIBUTE_TYPE_INVALID);
 		return;
 	};
 
 	/* Give store a shot */
 	if (self->pv->store) {
-		gck_store_set_attribute (self->pv->store, transaction, self, attr);
+		gkm_store_set_attribute (self->pv->store, transaction, self, attr);
 		return;
 	}
 
 	/* Now some more defaults */
 	switch (attr->type) {
 	case CKA_LABEL:
-		gck_transaction_fail (transaction, CKR_ATTRIBUTE_READ_ONLY);
+		gkm_transaction_fail (transaction, CKR_ATTRIBUTE_READ_ONLY);
 		return;
-	}	
+	}
 
 	/* Check if this attribute exists */
 	check.type = attr->type;
 	check.pValue = 0;
 	check.ulValueLen = 0;
-	rv = gck_object_get_attribute (self, session, &check);
+	rv = gkm_object_get_attribute (self, session, &check);
 	if (rv == CKR_ATTRIBUTE_TYPE_INVALID)
-		gck_transaction_fail (transaction, CKR_ATTRIBUTE_TYPE_INVALID);
+		gkm_transaction_fail (transaction, CKR_ATTRIBUTE_TYPE_INVALID);
 	else
-		gck_transaction_fail (transaction, CKR_ATTRIBUTE_READ_ONLY);
+		gkm_transaction_fail (transaction, CKR_ATTRIBUTE_READ_ONLY);
 }
 
 static void
-gck_object_real_create_attributes (GckObject *self, GckSession *session,
-                                   GckTransaction *transaction, CK_ATTRIBUTE *attrs, CK_ULONG n_attrs)
+gkm_object_real_create_attributes (GkmObject *self, GkmSession *session,
+                                   GkmTransaction *transaction, CK_ATTRIBUTE *attrs, CK_ULONG n_attrs)
 {
 	CK_ATTRIBUTE_PTR transient_attr;
 	gboolean transient = FALSE;
@@ -322,26 +322,26 @@ gck_object_real_create_attributes (GckObject *self, GckSession *session,
 	CK_RV rv;
 
 	/* Parse the transient attribute */
-	transient_attr = gck_attributes_find (attrs, n_attrs, CKA_GNOME_TRANSIENT);
+	transient_attr = gkm_attributes_find (attrs, n_attrs, CKA_GNOME_TRANSIENT);
 	if (transient_attr) {
-		rv = gck_attribute_get_bool (transient_attr, &transient);
+		rv = gkm_attribute_get_bool (transient_attr, &transient);
 		if (rv != CKR_OK) {
-			gck_transaction_fail (transaction, rv);
+			gkm_transaction_fail (transaction, rv);
 			return;
 		}
 	}
 
 	/* Parse the auto destruct attribute */
-	if (!gck_attributes_find_ulong (attrs, n_attrs, CKA_G_DESTRUCT_AFTER, &after))
+	if (!gkm_attributes_find_ulong (attrs, n_attrs, CKA_G_DESTRUCT_AFTER, &after))
 		after = 0;
-	if (!gck_attributes_find_ulong (attrs, n_attrs, CKA_G_DESTRUCT_IDLE, &idle))
+	if (!gkm_attributes_find_ulong (attrs, n_attrs, CKA_G_DESTRUCT_IDLE, &idle))
 		idle = 0;
 	/* Default for the transient attribute */
 	if (!transient_attr && (idle || after))
 		transient = TRUE;
 
 	/* Used up these attributes */
-	gck_attributes_consume (attrs, n_attrs, CKA_G_DESTRUCT_AFTER,
+	gkm_attributes_consume (attrs, n_attrs, CKA_G_DESTRUCT_AFTER,
 	                        CKA_G_DESTRUCT_IDLE, CKA_GNOME_TRANSIENT, G_MAXULONG);
 
 	if (transient) {
@@ -352,61 +352,61 @@ gck_object_real_create_attributes (GckObject *self, GckSession *session,
 
 	if (after || idle) {
 		if (!self->pv->transient) {
-			gck_transaction_fail (transaction, CKR_TEMPLATE_INCONSISTENT);
+			gkm_transaction_fail (transaction, CKR_TEMPLATE_INCONSISTENT);
 			return;
 		}
 
-		gck_transaction_add (transaction, self, start_callback, NULL);
+		gkm_transaction_add (transaction, self, start_callback, NULL);
 	}
 }
 
 static CK_RV
-gck_object_real_unlock (GckObject *self, GckCredential *cred)
+gkm_object_real_unlock (GkmObject *self, GkmCredential *cred)
 {
 	/* A derived class should have overridden this */
 	return CKR_FUNCTION_FAILED;
 }
 
 static void
-gck_object_real_expose_object (GckObject *self, gboolean expose)
+gkm_object_real_expose_object (GkmObject *self, gboolean expose)
 {
 	g_return_if_fail (expose != self->pv->exposed);
 	g_return_if_fail (self->pv->manager);
 
 	self->pv->exposed = expose;
 	if (expose)
-		_gck_manager_register_object (self->pv->manager, self);
+		_gkm_manager_register_object (self->pv->manager, self);
 	else
-		_gck_manager_unregister_object (self->pv->manager, self);
+		_gkm_manager_unregister_object (self->pv->manager, self);
 }
 
-static GObject* 
-gck_object_constructor (GType type, guint n_props, GObjectConstructParam *props) 
+static GObject*
+gkm_object_constructor (GType type, guint n_props, GObjectConstructParam *props)
 {
-	GckObject *self = GCK_OBJECT (G_OBJECT_CLASS (gck_object_parent_class)->constructor(type, n_props, props));
+	GkmObject *self = GKM_OBJECT (G_OBJECT_CLASS (gkm_object_parent_class)->constructor(type, n_props, props));
+
+	g_return_val_if_fail (self, NULL);
+	g_return_val_if_fail (GKM_IS_MODULE (self->pv->module), NULL);
 
-	g_return_val_if_fail (self, NULL);	
-	g_return_val_if_fail (GCK_IS_MODULE (self->pv->module), NULL);
-	
 	return G_OBJECT (self);
 }
 
 static void
-gck_object_init (GckObject *self)
+gkm_object_init (GkmObject *self)
 {
-	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GCK_TYPE_OBJECT, GckObjectPrivate);
+	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GKM_TYPE_OBJECT, GkmObjectPrivate);
 
 }
 
 static void
-gck_object_dispose (GObject *obj)
+gkm_object_dispose (GObject *obj)
 {
-	GckObject *self = GCK_OBJECT (obj);
-	GckObjectTransient *transient;
-	
+	GkmObject *self = GKM_OBJECT (obj);
+	GkmObjectTransient *transient;
+
 	if (self->pv->manager) {
 		if (self->pv->exposed)
-			gck_object_expose (self, FALSE);
+			gkm_object_expose (self, FALSE);
 		g_return_if_fail (!self->pv->exposed);
 		g_object_remove_weak_pointer (G_OBJECT (self->pv->manager),
 		                              (gpointer*)&(self->pv->manager));
@@ -419,55 +419,55 @@ gck_object_dispose (GObject *obj)
 	if (self->pv->transient) {
 		transient = self->pv->transient;
 		if (transient->timer)
-			gck_timer_cancel (transient->timer);
+			gkm_timer_cancel (transient->timer);
 		transient->timer = NULL;
 	}
 
-	G_OBJECT_CLASS (gck_object_parent_class)->dispose (obj);
+	G_OBJECT_CLASS (gkm_object_parent_class)->dispose (obj);
 }
 
 static void
-gck_object_finalize (GObject *obj)
+gkm_object_finalize (GObject *obj)
 {
-	GckObject *self = GCK_OBJECT (obj);
-	
+	GkmObject *self = GKM_OBJECT (obj);
+
 	g_assert (self->pv->manager == NULL);
 	g_free (self->pv->unique);
-	
+
 	/* This is done here, as an object must have a module even after dispose */
 	g_object_weak_unref (G_OBJECT (self->pv->module), module_went_away, self);
 	self->pv->module = NULL;
 
 	if (self->pv->transient) {
-		g_slice_free (GckObjectTransient, self->pv->transient);
+		g_slice_free (GkmObjectTransient, self->pv->transient);
 		self->pv->transient = NULL;
 	}
 
-	G_OBJECT_CLASS (gck_object_parent_class)->finalize (obj);
+	G_OBJECT_CLASS (gkm_object_parent_class)->finalize (obj);
 }
 
 static void
-gck_object_set_property (GObject *obj, guint prop_id, const GValue *value, 
+gkm_object_set_property (GObject *obj, guint prop_id, const GValue *value,
                            GParamSpec *pspec)
 {
-	GckObject *self = GCK_OBJECT (obj);
-	GckStore *store;
-	
+	GkmObject *self = GKM_OBJECT (obj);
+	GkmStore *store;
+
 	switch (prop_id) {
 	case PROP_HANDLE:
-		gck_object_set_handle (self, g_value_get_ulong (value));
+		gkm_object_set_handle (self, g_value_get_ulong (value));
 		break;
 	case PROP_MODULE:
 		g_return_if_fail (!self->pv->module);
 		self->pv->module = g_value_get_object (value);
-		g_return_if_fail (GCK_IS_MODULE (self->pv->module));
+		g_return_if_fail (GKM_IS_MODULE (self->pv->module));
 		g_object_weak_ref (G_OBJECT (self->pv->module), module_went_away, self);
 		break;
 	case PROP_MANAGER:
 		g_return_if_fail (!self->pv->manager);
 		self->pv->manager = g_value_get_object (value);
 		if (self->pv->manager) {
-			g_object_add_weak_pointer (G_OBJECT (self->pv->manager), 
+			g_object_add_weak_pointer (G_OBJECT (self->pv->manager),
 			                           (gpointer*)&(self->pv->manager));
 		}
 		break;
@@ -475,14 +475,14 @@ gck_object_set_property (GObject *obj, guint prop_id, const GValue *value,
 		store = g_value_get_object (value);
 		if (self->pv->store) {
 			g_return_if_fail (!store);
-			g_object_remove_weak_pointer (G_OBJECT (self->pv->store), 
+			g_object_remove_weak_pointer (G_OBJECT (self->pv->store),
 			                              (gpointer*)&(self->pv->store));
 		}
 		self->pv->store = store;
 		if (self->pv->store)
-			g_object_add_weak_pointer (G_OBJECT (self->pv->store), 
+			g_object_add_weak_pointer (G_OBJECT (self->pv->store),
 			                           (gpointer*)&(self->pv->store));
-		
+
 		g_object_notify (G_OBJECT (self), "store");
 		break;
 	case PROP_UNIQUE:
@@ -501,30 +501,30 @@ gck_object_set_property (GObject *obj, guint prop_id, const GValue *value,
 }
 
 static void
-gck_object_get_property (GObject *obj, guint prop_id, GValue *value, 
+gkm_object_get_property (GObject *obj, guint prop_id, GValue *value,
                            GParamSpec *pspec)
 {
-	GckObject *self = GCK_OBJECT (obj);
-	
+	GkmObject *self = GKM_OBJECT (obj);
+
 	switch (prop_id) {
 	case PROP_HANDLE:
-		g_value_set_ulong (value, gck_object_get_handle (self));
+		g_value_set_ulong (value, gkm_object_get_handle (self));
 		break;
 	case PROP_MODULE:
-		g_return_if_fail (GCK_IS_MODULE (self->pv->module));
-		g_value_set_object (value, gck_object_get_module (self));
+		g_return_if_fail (GKM_IS_MODULE (self->pv->module));
+		g_value_set_object (value, gkm_object_get_module (self));
 		break;
 	case PROP_MANAGER:
-		g_value_set_object (value, gck_object_get_manager (self));
+		g_value_set_object (value, gkm_object_get_manager (self));
 		break;
 	case PROP_STORE:
 		g_value_set_object (value, self->pv->store);
 		break;
 	case PROP_UNIQUE:
-		g_value_set_string (value, gck_object_get_unique (self));
+		g_value_set_string (value, gkm_object_get_unique (self));
 		break;
 	case PROP_TRANSIENT:
-		g_value_set_boolean (value, gck_object_is_transient (self));
+		g_value_set_boolean (value, gkm_object_is_transient (self));
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -533,219 +533,219 @@ gck_object_get_property (GObject *obj, guint prop_id, GValue *value,
 }
 
 static void
-gck_object_class_init (GckObjectClass *klass)
+gkm_object_class_init (GkmObjectClass *klass)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-    
-	gck_object_parent_class = g_type_class_peek_parent (klass);
-	g_type_class_add_private (klass, sizeof (GckObjectPrivate));
-
-	gobject_class->constructor = gck_object_constructor;
-	gobject_class->dispose = gck_object_dispose;
-	gobject_class->finalize = gck_object_finalize;
-	gobject_class->set_property = gck_object_set_property;
-	gobject_class->get_property = gck_object_get_property;
-	
-	klass->unlock = gck_object_real_unlock;
-	klass->get_attribute = gck_object_real_get_attribute;
-	klass->set_attribute = gck_object_real_set_attribute;
-	klass->create_attributes = gck_object_real_create_attributes;
-	
-	klass->expose_object = gck_object_real_expose_object;
+
+	gkm_object_parent_class = g_type_class_peek_parent (klass);
+	g_type_class_add_private (klass, sizeof (GkmObjectPrivate));
+
+	gobject_class->constructor = gkm_object_constructor;
+	gobject_class->dispose = gkm_object_dispose;
+	gobject_class->finalize = gkm_object_finalize;
+	gobject_class->set_property = gkm_object_set_property;
+	gobject_class->get_property = gkm_object_get_property;
+
+	klass->unlock = gkm_object_real_unlock;
+	klass->get_attribute = gkm_object_real_get_attribute;
+	klass->set_attribute = gkm_object_real_set_attribute;
+	klass->create_attributes = gkm_object_real_create_attributes;
+
+	klass->expose_object = gkm_object_real_expose_object;
 
 	g_object_class_install_property (gobject_class, PROP_HANDLE,
 	           g_param_spec_ulong ("handle", "Handle", "Object handle",
 	                               0, G_MAXULONG, 0, G_PARAM_READWRITE));
 
 	g_object_class_install_property (gobject_class, PROP_MODULE,
-	           g_param_spec_object ("module", "Module", "Object module", 
-	                                GCK_TYPE_MODULE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-	
+	           g_param_spec_object ("module", "Module", "Object module",
+	                                GKM_TYPE_MODULE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
 	g_object_class_install_property (gobject_class, PROP_MANAGER,
-	           g_param_spec_object ("manager", "Manager", "Object manager", 
-	                                GCK_TYPE_MANAGER, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-	
+	           g_param_spec_object ("manager", "Manager", "Object manager",
+	                                GKM_TYPE_MANAGER, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
 	g_object_class_install_property (gobject_class, PROP_STORE,
-	           g_param_spec_object ("store", "Store", "Object store", 
-	                                GCK_TYPE_STORE, G_PARAM_READWRITE));
-	
+	           g_param_spec_object ("store", "Store", "Object store",
+	                                GKM_TYPE_STORE, G_PARAM_READWRITE));
+
 	g_object_class_install_property (gobject_class, PROP_UNIQUE,
-	           g_param_spec_string ("unique", "Unique Identifer", "Machine unique identifier", 
+	           g_param_spec_string ("unique", "Unique Identifer", "Machine unique identifier",
 	                                NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
 
 	g_object_class_install_property (gobject_class, PROP_TRANSIENT,
 	           g_param_spec_boolean ("transient", "Transient Object", "Transient Object",
 	                                 FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
 
-	signals[EXPOSE_OBJECT] = g_signal_new ("expose-object", GCK_TYPE_OBJECT,
-	                                       G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GckObjectClass, expose_object),
-		                               NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, 
+	signals[EXPOSE_OBJECT] = g_signal_new ("expose-object", GKM_TYPE_OBJECT,
+	                                       G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GkmObjectClass, expose_object),
+		                               NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN,
 		                               G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
 
-	signals[NOTIFY_ATTRIBUTE] = g_signal_new ("notify-attribute", GCK_TYPE_OBJECT, 
-	                                G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GckObjectClass, notify_attribute),
-	                                NULL, NULL, g_cclosure_marshal_VOID__ULONG, 
+	signals[NOTIFY_ATTRIBUTE] = g_signal_new ("notify-attribute", GKM_TYPE_OBJECT,
+	                                G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GkmObjectClass, notify_attribute),
+	                                NULL, NULL, g_cclosure_marshal_VOID__ULONG,
 	                                G_TYPE_NONE, 1, G_TYPE_ULONG);
 }
 
 /* -----------------------------------------------------------------------------
- * PUBLIC 
+ * PUBLIC
  */
 
 CK_RV
-gck_object_get_attribute (GckObject *self, GckSession *session, CK_ATTRIBUTE_PTR attr)
+gkm_object_get_attribute (GkmObject *self, GkmSession *session, CK_ATTRIBUTE_PTR attr)
 {
-	g_return_val_if_fail (GCK_IS_OBJECT (self), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (GKM_IS_OBJECT (self), CKR_GENERAL_ERROR);
 	g_return_val_if_fail (attr, CKR_GENERAL_ERROR);
-	g_assert (GCK_OBJECT_GET_CLASS (self)->get_attribute);
-	return GCK_OBJECT_GET_CLASS (self)->get_attribute (self, session, attr);
+	g_assert (GKM_OBJECT_GET_CLASS (self)->get_attribute);
+	return GKM_OBJECT_GET_CLASS (self)->get_attribute (self, session, attr);
 }
 
 void
-gck_object_set_attribute (GckObject *self, GckSession *session,
-                          GckTransaction *transaction, CK_ATTRIBUTE_PTR attr)
+gkm_object_set_attribute (GkmObject *self, GkmSession *session,
+                          GkmTransaction *transaction, CK_ATTRIBUTE_PTR attr)
 {
-	g_return_if_fail (GCK_IS_OBJECT (self));
-	g_return_if_fail (GCK_IS_TRANSACTION (transaction));
-	g_return_if_fail (!gck_transaction_get_failed (transaction));
+	g_return_if_fail (GKM_IS_OBJECT (self));
+	g_return_if_fail (GKM_IS_TRANSACTION (transaction));
+	g_return_if_fail (!gkm_transaction_get_failed (transaction));
 	g_return_if_fail (attr);
 
-	g_assert (GCK_OBJECT_GET_CLASS (self)->set_attribute);
+	g_assert (GKM_OBJECT_GET_CLASS (self)->set_attribute);
 
 	/* Check that the value will actually change */
-	if (!gck_object_match (self, session, attr))
-		GCK_OBJECT_GET_CLASS (self)->set_attribute (self, session, transaction, attr);
+	if (!gkm_object_match (self, session, attr))
+		GKM_OBJECT_GET_CLASS (self)->set_attribute (self, session, transaction, attr);
 }
 
 void
-gck_object_create_attributes (GckObject *self, GckSession *session, GckTransaction *transaction,
+gkm_object_create_attributes (GkmObject *self, GkmSession *session, GkmTransaction *transaction,
                               CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
 {
-	g_return_if_fail (GCK_IS_OBJECT (self));
-	g_return_if_fail (GCK_IS_TRANSACTION (transaction));
-	g_return_if_fail (!gck_transaction_get_failed (transaction));
-	g_return_if_fail (GCK_IS_SESSION (session));
+	g_return_if_fail (GKM_IS_OBJECT (self));
+	g_return_if_fail (GKM_IS_TRANSACTION (transaction));
+	g_return_if_fail (!gkm_transaction_get_failed (transaction));
+	g_return_if_fail (GKM_IS_SESSION (session));
 	g_return_if_fail (attrs);
 
-	g_assert (GCK_OBJECT_GET_CLASS (self)->create_attributes);
+	g_assert (GKM_OBJECT_GET_CLASS (self)->create_attributes);
 
 	/* Check that the value will actually change */
-	GCK_OBJECT_GET_CLASS (self)->create_attributes (self, session, transaction, attrs, n_attrs);
+	GKM_OBJECT_GET_CLASS (self)->create_attributes (self, session, transaction, attrs, n_attrs);
 }
 
 void
-gck_object_notify_attribute  (GckObject *self, CK_ATTRIBUTE_TYPE attr_type)
+gkm_object_notify_attribute  (GkmObject *self, CK_ATTRIBUTE_TYPE attr_type)
 {
-	g_return_if_fail (GCK_IS_OBJECT (self));
+	g_return_if_fail (GKM_IS_OBJECT (self));
 	g_signal_emit (self, signals[NOTIFY_ATTRIBUTE], 0, attr_type);
 }
 
 gboolean
-gck_object_match (GckObject *self, GckSession *session, CK_ATTRIBUTE_PTR match)
+gkm_object_match (GkmObject *self, GkmSession *session, CK_ATTRIBUTE_PTR match)
 {
 	CK_ATTRIBUTE attr;
 	gboolean matched = FALSE;
 	CK_RV rv;
-	
-	g_return_val_if_fail (GCK_IS_OBJECT (self), FALSE);
-	
+
+	g_return_val_if_fail (GKM_IS_OBJECT (self), FALSE);
+
 	if (!match->pValue)
 		return FALSE;
-	
+
 	attr.type = match->type;
 	attr.pValue = g_malloc0 (match->ulValueLen > 4 ? match->ulValueLen : 4);
 	attr.ulValueLen = match->ulValueLen;
-	
+
 	matched = FALSE;
-	
-	rv = gck_object_get_attribute (self, session, &attr);
-	matched = (rv == CKR_OK) && 
+
+	rv = gkm_object_get_attribute (self, session, &attr);
+	matched = (rv == CKR_OK) &&
 	          (match->ulValueLen == attr.ulValueLen) &&
 	          (memcmp (match->pValue, attr.pValue, attr.ulValueLen) == 0);
-	
+
 	g_free (attr.pValue);
 	return matched;
 }
 
 gboolean
-gck_object_match_all (GckObject *self, GckSession *session,
+gkm_object_match_all (GkmObject *self, GkmSession *session,
                       CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
 {
 	CK_ULONG i;
-	
-	g_return_val_if_fail (GCK_IS_OBJECT (self), FALSE);
-	
+
+	g_return_val_if_fail (GKM_IS_OBJECT (self), FALSE);
+
 	for (i = 0; i < n_attrs; ++i) {
-		if (!gck_object_match (self, session, &attrs[i]))
+		if (!gkm_object_match (self, session, &attrs[i]))
 			return FALSE;
 	}
-	
+
 	return TRUE;
 }
 
 CK_OBJECT_HANDLE
-gck_object_get_handle (GckObject *self)
+gkm_object_get_handle (GkmObject *self)
 {
-	g_return_val_if_fail (GCK_IS_OBJECT (self), 0);
-	return self->pv->handle;	
+	g_return_val_if_fail (GKM_IS_OBJECT (self), 0);
+	return self->pv->handle;
 }
 
 void
-gck_object_set_handle (GckObject *self, CK_OBJECT_HANDLE handle)
+gkm_object_set_handle (GkmObject *self, CK_OBJECT_HANDLE handle)
 {
-	g_return_if_fail (GCK_IS_OBJECT (self));
+	g_return_if_fail (GKM_IS_OBJECT (self));
 	g_return_if_fail (handle != 0);
 	g_return_if_fail (self->pv->handle == 0);
 
 	self->pv->handle = handle;
-	g_object_notify (G_OBJECT (self), "handle");	
+	g_object_notify (G_OBJECT (self), "handle");
 }
 
-GckManager*
-gck_object_get_manager (GckObject *self)
+GkmManager*
+gkm_object_get_manager (GkmObject *self)
 {
-	g_return_val_if_fail (GCK_IS_OBJECT (self), NULL);
+	g_return_val_if_fail (GKM_IS_OBJECT (self), NULL);
 	return self->pv->manager;
 }
 
-GckModule*
-gck_object_get_module (GckObject *self)
+GkmModule*
+gkm_object_get_module (GkmObject *self)
 {
-	g_return_val_if_fail (GCK_IS_OBJECT (self), NULL);
-	g_return_val_if_fail (GCK_IS_MODULE (self->pv->module), NULL);
+	g_return_val_if_fail (GKM_IS_OBJECT (self), NULL);
+	g_return_val_if_fail (GKM_IS_MODULE (self->pv->module), NULL);
 	return self->pv->module;
 }
 
 const gchar*
-gck_object_get_unique (GckObject *self)
+gkm_object_get_unique (GkmObject *self)
 {
-	g_return_val_if_fail (GCK_IS_OBJECT (self), NULL);
+	g_return_val_if_fail (GKM_IS_OBJECT (self), NULL);
 	return self->pv->unique;
 }
 
 gboolean
-gck_object_is_token (GckObject *self)
+gkm_object_is_token (GkmObject *self)
 {
-	g_return_val_if_fail (GCK_IS_OBJECT (self), FALSE);
+	g_return_val_if_fail (GKM_IS_OBJECT (self), FALSE);
 	if (!self->pv->manager)
 		return FALSE;
-	return gck_manager_get_for_token (self->pv->manager);
+	return gkm_manager_get_for_token (self->pv->manager);
 }
 
 gboolean
-gck_object_is_transient (GckObject *self)
+gkm_object_is_transient (GkmObject *self)
 {
-	g_return_val_if_fail (GCK_IS_OBJECT (self), FALSE);
+	g_return_val_if_fail (GKM_IS_OBJECT (self), FALSE);
 	return self->pv->transient ? TRUE : FALSE;
 }
 
 void
-gck_object_mark_used (GckObject *self)
+gkm_object_mark_used (GkmObject *self)
 {
-	GckObjectTransient *transient;
+	GkmObjectTransient *transient;
 	GTimeVal tv;
 
-	g_return_if_fail (GCK_IS_OBJECT (self));
+	g_return_if_fail (GKM_IS_OBJECT (self));
 	transient = self->pv->transient;
 
 	if (transient) {
@@ -762,97 +762,97 @@ gck_object_mark_used (GckObject *self)
 }
 
 CK_RV
-gck_object_unlock (GckObject *self, GckCredential *cred)
+gkm_object_unlock (GkmObject *self, GkmCredential *cred)
 {
-	g_return_val_if_fail (GCK_IS_OBJECT (self), CKR_GENERAL_ERROR);
-	g_return_val_if_fail (GCK_OBJECT_GET_CLASS (self)->unlock, CKR_GENERAL_ERROR);
-	return GCK_OBJECT_GET_CLASS (self)->unlock (self, cred);
+	g_return_val_if_fail (GKM_IS_OBJECT (self), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (GKM_OBJECT_GET_CLASS (self)->unlock, CKR_GENERAL_ERROR);
+	return GKM_OBJECT_GET_CLASS (self)->unlock (self, cred);
 }
 
 
 gboolean
-gck_object_get_attribute_boolean (GckObject *self, GckSession *session,
+gkm_object_get_attribute_boolean (GkmObject *self, GkmSession *session,
                                   CK_ATTRIBUTE_TYPE type, gboolean *value)
 {
 	CK_ATTRIBUTE attr;
 	CK_BBOOL bvalue;
-	
-	g_return_val_if_fail (GCK_IS_OBJECT (self), FALSE);
+
+	g_return_val_if_fail (GKM_IS_OBJECT (self), FALSE);
 	g_return_val_if_fail (value, FALSE);
-	
+
 	attr.type = type;
 	attr.ulValueLen = sizeof (CK_BBOOL);
 	attr.pValue = &bvalue;
-	
-	if (gck_object_get_attribute (self, session, &attr) != CKR_OK)
+
+	if (gkm_object_get_attribute (self, session, &attr) != CKR_OK)
 		return FALSE;
-	
+
 	*value = (bvalue == CK_TRUE) ? TRUE : FALSE;
 	return TRUE;
 }
 
 gboolean
-gck_object_get_attribute_ulong (GckObject *self, GckSession *session,
+gkm_object_get_attribute_ulong (GkmObject *self, GkmSession *session,
                                 CK_ATTRIBUTE_TYPE type, gulong *value)
 {
 	CK_ATTRIBUTE attr;
 	CK_ULONG uvalue;
-	
-	g_return_val_if_fail (GCK_IS_OBJECT (self), FALSE);
+
+	g_return_val_if_fail (GKM_IS_OBJECT (self), FALSE);
 	g_return_val_if_fail (value, FALSE);
-	
+
 	attr.type = type;
 	attr.ulValueLen = sizeof (CK_ULONG);
 	attr.pValue = &uvalue;
-	
-	if (gck_object_get_attribute (self, session, &attr) != CKR_OK)
+
+	if (gkm_object_get_attribute (self, session, &attr) != CKR_OK)
 		return FALSE;
-	
+
 	*value = uvalue;
 	return TRUE;
 }
 
 void*
-gck_object_get_attribute_data (GckObject *self, GckSession *session,
+gkm_object_get_attribute_data (GkmObject *self, GkmSession *session,
                                CK_ATTRIBUTE_TYPE type, gsize *n_data)
 {
 	CK_ATTRIBUTE attr;
-	
-	g_return_val_if_fail (GCK_IS_OBJECT (self), NULL);
+
+	g_return_val_if_fail (GKM_IS_OBJECT (self), NULL);
 	g_return_val_if_fail (n_data, NULL);
-	
+
 	attr.type = type;
 	attr.ulValueLen = 0;
 	attr.pValue = NULL;
-	
-	if (gck_object_get_attribute (self, session, &attr) != CKR_OK)
+
+	if (gkm_object_get_attribute (self, session, &attr) != CKR_OK)
 		return NULL;
 
 	if (attr.ulValueLen == 0)
 		attr.ulValueLen = 1;
-	
+
 	attr.pValue = g_malloc0 (attr.ulValueLen);
-	
-	if (gck_object_get_attribute (self, session, &attr) != CKR_OK) {
+
+	if (gkm_object_get_attribute (self, session, &attr) != CKR_OK) {
 		g_free (attr.pValue);
 		return NULL;
 	}
-	
+
 	*n_data = attr.ulValueLen;
 	return attr.pValue;
 }
 
 gboolean
-gck_object_has_attribute_ulong (GckObject *self, GckSession *session,
+gkm_object_has_attribute_ulong (GkmObject *self, GkmSession *session,
                                 CK_ATTRIBUTE_TYPE type, gulong value)
 {
 	gulong *data;
 	gsize n_data, i;
 
-	g_return_val_if_fail (GCK_IS_OBJECT (self), FALSE);
-	g_return_val_if_fail (GCK_IS_SESSION (session), FALSE);
+	g_return_val_if_fail (GKM_IS_OBJECT (self), FALSE);
+	g_return_val_if_fail (GKM_IS_SESSION (session), FALSE);
 
-	data = gck_object_get_attribute_data (self, session, type, &n_data);
+	data = gkm_object_get_attribute_data (self, session, type, &n_data);
 	if (data == NULL)
 		return FALSE;
 
@@ -869,80 +869,80 @@ gck_object_has_attribute_ulong (GckObject *self, GckSession *session,
 }
 
 gboolean
-gck_object_has_attribute_boolean (GckObject *self, GckSession *session,
+gkm_object_has_attribute_boolean (GkmObject *self, GkmSession *session,
                                   CK_ATTRIBUTE_TYPE type, gboolean value)
 {
 	gboolean data;
 
-	g_return_val_if_fail (GCK_IS_OBJECT (self), FALSE);
-	g_return_val_if_fail (GCK_IS_SESSION (session), FALSE);
+	g_return_val_if_fail (GKM_IS_OBJECT (self), FALSE);
+	g_return_val_if_fail (GKM_IS_SESSION (session), FALSE);
 
-	if (!gck_object_get_attribute_boolean (self, session, type, &data))
+	if (!gkm_object_get_attribute_boolean (self, session, type, &data))
 		return FALSE;
 	return data == value;
 }
 
 void
-gck_object_destroy (GckObject *self, GckTransaction *transaction)
+gkm_object_destroy (GkmObject *self, GkmTransaction *transaction)
 {
-	GckSession *session;
-	GckManager *manager;
-	GckModule *module;
+	GkmSession *session;
+	GkmManager *manager;
+	GkmModule *module;
 
-	g_return_if_fail (GCK_IS_OBJECT (self));
-	g_return_if_fail (GCK_IS_TRANSACTION (transaction));
-	g_return_if_fail (!gck_transaction_get_failed (transaction));
+	g_return_if_fail (GKM_IS_OBJECT (self));
+	g_return_if_fail (GKM_IS_TRANSACTION (transaction));
+	g_return_if_fail (!gkm_transaction_get_failed (transaction));
 	g_return_if_fail (self->pv->module);
 
 	g_object_ref (self);
 
-	session = gck_session_for_session_object (self);
+	session = gkm_session_for_session_object (self);
 	if (session != NULL) {
-		gck_session_destroy_session_object (session, transaction, self);
+		gkm_session_destroy_session_object (session, transaction, self);
 	} else {
-		manager = gck_object_get_manager (self);
-		module = gck_object_get_module (self);
-		if (manager == gck_module_get_manager (module))
-			gck_module_remove_token_object (module, transaction, self);
+		manager = gkm_object_get_manager (self);
+		module = gkm_object_get_module (self);
+		if (manager == gkm_module_get_manager (module))
+			gkm_module_remove_token_object (module, transaction, self);
 	}
 
 	/* Forcefully dispose of the object once the transaction completes */
-	gck_transaction_add (transaction, NULL, complete_destroy, g_object_ref (self));
+	gkm_transaction_add (transaction, NULL, complete_destroy, g_object_ref (self));
 
 	g_object_unref (self);
 }
 
 gboolean
-gck_object_is_exposed (GckObject *self)
+gkm_object_is_exposed (GkmObject *self)
 {
-	g_return_val_if_fail (GCK_IS_OBJECT (self), FALSE);
+	g_return_val_if_fail (GKM_IS_OBJECT (self), FALSE);
 	return self->pv->exposed;
 }
 
 void
-gck_object_expose (GckObject *self, gboolean expose)
+gkm_object_expose (GkmObject *self, gboolean expose)
 {
 	if (!expose && !self)
 		return;
 
-	g_return_if_fail (GCK_IS_OBJECT (self));
+	g_return_if_fail (GKM_IS_OBJECT (self));
 
 	if (self->pv->exposed != expose)
 		g_signal_emit (self, signals[EXPOSE_OBJECT], 0, expose);
 }
 
 void
-gck_object_expose_full (GckObject *self, GckTransaction *transaction, gboolean expose)
+gkm_object_expose_full (GkmObject *self, GkmTransaction *transaction, gboolean expose)
 {
 	if (!expose && !self)
 		return;
 
-	g_return_if_fail (GCK_IS_OBJECT (self));
-	g_return_if_fail (!transaction || !gck_transaction_get_failed (transaction));
+	g_return_if_fail (GKM_IS_OBJECT (self));
+	g_return_if_fail (!transaction || !gkm_transaction_get_failed (transaction));
 
 	if (self->pv->exposed != expose) {
 		if (transaction)
-			gck_transaction_add (transaction, self, complete_expose, GUINT_TO_POINTER (expose));
-		gck_object_expose (self, expose);
+			gkm_transaction_add (transaction, self, complete_expose, GUINT_TO_POINTER (expose));
+		gkm_object_expose (self, expose);
 	}
 }
diff --git a/pkcs11/gkm/gkm-object.h b/pkcs11/gkm/gkm-object.h
new file mode 100644
index 0000000..61f6cef
--- /dev/null
+++ b/pkcs11/gkm/gkm-object.h
@@ -0,0 +1,155 @@
+/*
+ * 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 __GKM_OBJECT_H__
+#define __GKM_OBJECT_H__
+
+#include <glib-object.h>
+
+#include "pkcs11/pkcs11.h"
+
+#include "gkm-types.h"
+
+#define GKM_TYPE_OBJECT               (gkm_object_get_type ())
+#define GKM_OBJECT(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_OBJECT, GkmObject))
+#define GKM_OBJECT_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_OBJECT, GkmObjectClass))
+#define GKM_IS_OBJECT(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_OBJECT))
+#define GKM_IS_OBJECT_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_OBJECT))
+#define GKM_OBJECT_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_OBJECT, GkmObjectClass))
+
+typedef struct _GkmObjectClass GkmObjectClass;
+typedef struct _GkmObjectPrivate GkmObjectPrivate;
+
+struct _GkmObject {
+	GObject parent;
+	GkmObjectPrivate *pv;
+};
+
+struct _GkmObjectClass {
+	GObjectClass parent_class;
+
+	/* signals ------------------------------------------------------------------ */
+
+	void (*expose_object) (GkmObject *object, gboolean exposed);
+
+	void (*notify_attribute) (GkmObject *object, CK_ATTRIBUTE_TYPE attr_type);
+
+	/* virtual methods  --------------------------------------------------------- */
+
+	CK_RV (*get_attribute) (GkmObject *object, GkmSession *session,
+	                        CK_ATTRIBUTE *attr);
+
+	void (*set_attribute) (GkmObject *object, GkmSession *session,
+	                       GkmTransaction *transaction, CK_ATTRIBUTE *attr);
+
+	void (*create_attributes) (GkmObject *object, GkmSession *session,
+	                           GkmTransaction *transaction, CK_ATTRIBUTE *attrs, CK_ULONG n_attrs);
+
+	CK_RV (*unlock) (GkmObject *self, GkmCredential *cred);
+};
+
+GType                  gkm_object_get_type               (void);
+
+CK_OBJECT_HANDLE       gkm_object_get_handle             (GkmObject *self);
+
+void                   gkm_object_set_handle             (GkmObject *self,
+                                                          CK_OBJECT_HANDLE handle);
+
+GkmModule*             gkm_object_get_module             (GkmObject *self);
+
+GkmManager*            gkm_object_get_manager            (GkmObject *self);
+
+const gchar*           gkm_object_get_unique             (GkmObject *self);
+
+gboolean               gkm_object_is_token               (GkmObject *self);
+
+gboolean               gkm_object_is_transient           (GkmObject *self);
+
+void                   gkm_object_mark_used              (GkmObject *self);
+
+CK_RV                  gkm_object_unlock                 (GkmObject *self,
+                                                          GkmCredential *cred);
+
+void                   gkm_object_destroy                (GkmObject *self,
+                                                          GkmTransaction *transaction);
+
+gboolean               gkm_object_is_exposed             (GkmObject *self);
+
+void                   gkm_object_expose                 (GkmObject *self,
+                                                          gboolean expose);
+
+void                   gkm_object_expose_full            (GkmObject *self,
+                                                          GkmTransaction *transaction,
+                                                          gboolean expose);
+
+gboolean               gkm_object_match                  (GkmObject *self,
+                                                          GkmSession *session,
+                                                          CK_ATTRIBUTE_PTR attr);
+
+gboolean               gkm_object_match_all              (GkmObject *self,
+                                                          GkmSession *session,
+                                                          CK_ATTRIBUTE_PTR attrs,
+                                                          CK_ULONG n_attrs);
+
+CK_RV                  gkm_object_get_attribute          (GkmObject *self,
+                                                          GkmSession *session,
+                                                          CK_ATTRIBUTE_PTR attr);
+
+void                   gkm_object_set_attribute          (GkmObject *self,
+                                                          GkmSession *session,
+                                                          GkmTransaction *transaction,
+                                                          CK_ATTRIBUTE_PTR attr);
+
+void                   gkm_object_create_attributes      (GkmObject *self,
+                                                          GkmSession *session,
+                                                          GkmTransaction *transaction,
+                                                          CK_ATTRIBUTE_PTR attrs,
+                                                          CK_ULONG n_attrs);
+
+void                   gkm_object_notify_attribute       (GkmObject *self,
+                                                          CK_ATTRIBUTE_TYPE attr_type);
+
+gboolean               gkm_object_get_attribute_boolean  (GkmObject *self,
+                                                          GkmSession *session,
+                                                          CK_ATTRIBUTE_TYPE type,
+                                                          gboolean *value);
+
+gboolean               gkm_object_get_attribute_ulong    (GkmObject *self,
+                                                          GkmSession *session,
+                                                          CK_ATTRIBUTE_TYPE type,
+                                                          gulong *value);
+
+void*                  gkm_object_get_attribute_data     (GkmObject *self,
+                                                          GkmSession *session,
+                                                          CK_ATTRIBUTE_TYPE type,
+                                                          gsize *n_data);
+
+gboolean               gkm_object_has_attribute_ulong    (GkmObject *self,
+                                                          GkmSession *session,
+                                                          CK_ATTRIBUTE_TYPE type,
+                                                          gulong value);
+
+gboolean               gkm_object_has_attribute_boolean  (GkmObject *self,
+                                                          GkmSession *session,
+                                                          CK_ATTRIBUTE_TYPE type,
+                                                          gboolean value);
+
+#endif /* __GKM_OBJECT_H__ */
diff --git a/pkcs11/gck/gck-private-xsa-key.c b/pkcs11/gkm/gkm-private-xsa-key.c
similarity index 54%
rename from pkcs11/gck/gck-private-xsa-key.c
rename to pkcs11/gkm/gkm-private-xsa-key.c
index 4c2704a..7348384 100644
--- a/pkcs11/gck/gck-private-xsa-key.c
+++ b/pkcs11/gkm/gkm-private-xsa-key.c
@@ -23,19 +23,19 @@
 
 #include "pkcs11/pkcs11.h"
 
-#include "gck-attributes.h"
-#include "gck-credential.h"
-#include "gck-factory.h"
-#include "gck-private-xsa-key.h"
-#include "gck-session.h"
-#include "gck-transaction.h"
-#include "gck-util.h"
-
-struct _GckPrivateXsaKeyPrivate {
-	GckSexp *sexp;
+#include "gkm-attributes.h"
+#include "gkm-credential.h"
+#include "gkm-factory.h"
+#include "gkm-private-xsa-key.h"
+#include "gkm-session.h"
+#include "gkm-transaction.h"
+#include "gkm-util.h"
+
+struct _GkmPrivateXsaKeyPrivate {
+	GkmSexp *sexp;
 };
 
-G_DEFINE_TYPE (GckPrivateXsaKey, gck_private_xsa_key, GCK_TYPE_SEXP_KEY);
+G_DEFINE_TYPE (GkmPrivateXsaKey, gkm_private_xsa_key, GKM_TYPE_SEXP_KEY);
 
 /* -----------------------------------------------------------------------------
  * INTERNAL
@@ -54,11 +54,11 @@ create_rsa_private (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, gcry_sexp_t *skey)
 	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_PRIME_2, &q)) {
+	if (!gkm_attributes_find_mpi (attrs, n_attrs, CKA_MODULUS, &n) ||
+	    !gkm_attributes_find_mpi (attrs, n_attrs, CKA_PUBLIC_EXPONENT, &e) ||
+	    !gkm_attributes_find_mpi (attrs, n_attrs, CKA_PRIVATE_EXPONENT, &d) ||
+	    !gkm_attributes_find_mpi (attrs, n_attrs, CKA_PRIME_1, &p) ||
+	    !gkm_attributes_find_mpi (attrs, n_attrs, CKA_PRIME_2, &q)) {
 		ret = CKR_TEMPLATE_INCOMPLETE;
 		goto done;
 	}
@@ -81,7 +81,7 @@ create_rsa_private (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, gcry_sexp_t *skey)
 		goto done;
 	}
 
-	gck_attributes_consume (attrs, n_attrs, CKA_MODULUS, CKA_PUBLIC_EXPONENT,
+	gkm_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;
@@ -107,10 +107,10 @@ create_dsa_private (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, gcry_sexp_t *skey)
 	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_BASE, &g) ||
-	    !gck_attributes_find_mpi (attrs, n_attrs, CKA_VALUE, &value)) {
+	if (!gkm_attributes_find_mpi (attrs, n_attrs, CKA_PRIME, &p) ||
+	    !gkm_attributes_find_mpi (attrs, n_attrs, CKA_SUBPRIME, &q) ||
+	    !gkm_attributes_find_mpi (attrs, n_attrs, CKA_BASE, &g) ||
+	    !gkm_attributes_find_mpi (attrs, n_attrs, CKA_VALUE, &value)) {
 		ret = CKR_TEMPLATE_INCOMPLETE;
 		goto done;
 	}
@@ -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,
+	gkm_attributes_consume (attrs, n_attrs, CKA_PRIME, CKA_SUBPRIME,
 	                        CKA_BASE, CKA_VALUE, G_MAXULONG);
 	ret = CKR_OK;
 
@@ -143,41 +143,41 @@ done:
 	return ret;
 }
 
-static GckObject*
-factory_create_private_xsa_key (GckSession *session, GckTransaction *transaction,
+static GkmObject*
+factory_create_private_xsa_key (GkmSession *session, GkmTransaction *transaction,
                             CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
 {
-	GckPrivateXsaKey *key;
-	GckSexp *sexp;
+	GkmPrivateXsaKey *key;
+	GkmSexp *sexp;
 
-	g_return_val_if_fail (GCK_IS_TRANSACTION (transaction), NULL);
+	g_return_val_if_fail (GKM_IS_TRANSACTION (transaction), NULL);
 	g_return_val_if_fail (attrs || !n_attrs, NULL);
 
-	sexp = gck_private_xsa_key_create_sexp (session, transaction, attrs, n_attrs);
+	sexp = gkm_private_xsa_key_create_sexp (session, transaction, attrs, n_attrs);
 	if (sexp == NULL)
 		return NULL;
 
-	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),
+	key = g_object_new (GKM_TYPE_PRIVATE_XSA_KEY, "base-sexp", sexp,
+	                    "module", gkm_session_get_module (session),
+	                    "manager", gkm_manager_for_template (attrs, n_attrs, session),
 	                    NULL);
 	key->pv->sexp = sexp;
 
-	gck_session_complete_object_creation (session, transaction, GCK_OBJECT (key),
+	gkm_session_complete_object_creation (session, transaction, GKM_OBJECT (key),
 	                                      TRUE, attrs, n_attrs);
-	return GCK_OBJECT (key);
+	return GKM_OBJECT (key);
 }
 
 static gboolean
-acquire_from_credential (GckCredential *cred, GckObject *object, gpointer user_data)
+acquire_from_credential (GkmCredential *cred, GkmObject *object, gpointer user_data)
 {
-	GckSexp **result = user_data;
+	GkmSexp **result = user_data;
 
 	g_assert (result);
 	g_assert (!*result);
 
 	/* The sexp we stored on the credential */
-	*result = gck_credential_pop_data (cred, GCK_BOXED_SEXP);
+	*result = gkm_credential_pop_data (cred, GKM_BOXED_SEXP);
 	if (*result != NULL)
 		return TRUE;
 
@@ -185,10 +185,10 @@ acquire_from_credential (GckCredential *cred, GckObject *object, gpointer user_d
 }
 
 static gboolean
-have_from_credential (GckCredential *cred, GckObject *object, gpointer unused)
+have_from_credential (GkmCredential *cred, GkmObject *object, gpointer unused)
 {
 	/* The sexp we stored on the credential */
-	return gck_credential_peek_data (cred, GCK_BOXED_SEXP) ? TRUE : FALSE;
+	return gkm_credential_peek_data (cred, GKM_BOXED_SEXP) ? TRUE : FALSE;
 }
 
 /* -----------------------------------------------------------------------------
@@ -196,46 +196,46 @@ have_from_credential (GckCredential *cred, GckObject *object, gpointer unused)
  */
 
 static CK_RV
-gck_private_xsa_key_real_get_attribute (GckObject *base, GckSession *session, CK_ATTRIBUTE* attr)
+gkm_private_xsa_key_real_get_attribute (GkmObject *base, GkmSession *session, CK_ATTRIBUTE* attr)
 {
-	GckPrivateXsaKey *self = GCK_PRIVATE_XSA_KEY (base);
+	GkmPrivateXsaKey *self = GKM_PRIVATE_XSA_KEY (base);
 	gboolean have;
 	gint algorithm;
 
 	switch (attr->type) {
 	case CKA_CLASS:
-		return gck_attribute_set_ulong (attr, CKO_PRIVATE_KEY);
+		return gkm_attribute_set_ulong (attr, CKO_PRIVATE_KEY);
 
 	case CKA_PRIVATE:
-		return gck_attribute_set_bool (attr, TRUE);
+		return gkm_attribute_set_bool (attr, TRUE);
 
 	case CKA_SENSITIVE:
-		return gck_attribute_set_bool (attr, TRUE);
+		return gkm_attribute_set_bool (attr, TRUE);
 
 	case CKA_DECRYPT:
-		algorithm = gck_sexp_key_get_algorithm (GCK_SEXP_KEY (self));
-		return gck_attribute_set_bool (attr, algorithm == GCRY_PK_RSA);
+		algorithm = gkm_sexp_key_get_algorithm (GKM_SEXP_KEY (self));
+		return gkm_attribute_set_bool (attr, algorithm == GCRY_PK_RSA);
 
 	case CKA_SIGN:
-		return gck_attribute_set_bool (attr, TRUE);
+		return gkm_attribute_set_bool (attr, TRUE);
 
 	case CKA_SIGN_RECOVER:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_UNWRAP:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_EXTRACTABLE:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_ALWAYS_SENSITIVE:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_NEVER_EXTRACTABLE:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_WRAP_WITH_TRUSTED:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_UNWRAP_TEMPLATE:
 		return CKR_ATTRIBUTE_TYPE_INVALID;
@@ -243,14 +243,14 @@ gck_private_xsa_key_real_get_attribute (GckObject *base, GckSession *session, CK
 	case CKA_ALWAYS_AUTHENTICATE:
 		have = self->pv->sexp ? TRUE : FALSE;
 		if (!have && session)
-			have = gck_credential_for_each (session, base, have_from_credential, NULL);
-		return gck_attribute_set_bool (attr, !have);
+			have = gkm_credential_for_each (session, base, have_from_credential, NULL);
+		return gkm_attribute_set_bool (attr, !have);
 
 	case CKA_MODULUS:
-		return gck_sexp_key_set_part (GCK_SEXP_KEY (self), GCRY_PK_RSA, "n", attr);
+		return gkm_sexp_key_set_part (GKM_SEXP_KEY (self), GCRY_PK_RSA, "n", attr);
 
 	case CKA_PUBLIC_EXPONENT:
-		return gck_sexp_key_set_part (GCK_SEXP_KEY (self), GCRY_PK_RSA, "e", attr);
+		return gkm_sexp_key_set_part (GKM_SEXP_KEY (self), GCRY_PK_RSA, "e", attr);
 
 	/* RSA private key parts */
 	case CKA_PRIVATE_EXPONENT:
@@ -262,84 +262,84 @@ gck_private_xsa_key_real_get_attribute (GckObject *base, GckSession *session, CK
 		return CKR_ATTRIBUTE_SENSITIVE;
 
 	case CKA_PRIME:
-		return gck_sexp_key_set_part (GCK_SEXP_KEY (self), GCRY_PK_DSA, "p", attr);
+		return gkm_sexp_key_set_part (GKM_SEXP_KEY (self), GCRY_PK_DSA, "p", attr);
 
 	case CKA_SUBPRIME:
-		return gck_sexp_key_set_part (GCK_SEXP_KEY (self), GCRY_PK_DSA, "q", attr);
+		return gkm_sexp_key_set_part (GKM_SEXP_KEY (self), GCRY_PK_DSA, "q", attr);
 
 	case CKA_BASE:
-		return gck_sexp_key_set_part (GCK_SEXP_KEY (self), GCRY_PK_DSA, "g", attr);
+		return gkm_sexp_key_set_part (GKM_SEXP_KEY (self), GCRY_PK_DSA, "g", attr);
 
 	/* DSA private parts */
 	case CKA_VALUE:
 		return CKR_ATTRIBUTE_SENSITIVE;
 	};
 
-	return GCK_OBJECT_CLASS (gck_private_xsa_key_parent_class)->get_attribute (base, session, attr);
+	return GKM_OBJECT_CLASS (gkm_private_xsa_key_parent_class)->get_attribute (base, session, attr);
 }
 
-static GckSexp*
-gck_private_xsa_key_real_acquire_crypto_sexp (GckSexpKey *base, GckSession *session)
+static GkmSexp*
+gkm_private_xsa_key_real_acquire_crypto_sexp (GkmSexpKey *base, GkmSession *session)
 {
-	GckPrivateXsaKey *self = GCK_PRIVATE_XSA_KEY (base);
-	GckSexp *sexp = NULL;
+	GkmPrivateXsaKey *self = GKM_PRIVATE_XSA_KEY (base);
+	GkmSexp *sexp = NULL;
 
 	/* We have an unlocked private key here */
 	if (self->pv->sexp)
-		sexp = gck_sexp_ref (self->pv->sexp);
+		sexp = gkm_sexp_ref (self->pv->sexp);
 
 	/* Find an credential, with an unlocked copy */
 	else
-		gck_credential_for_each (session, GCK_OBJECT (self),
+		gkm_credential_for_each (session, GKM_OBJECT (self),
 		                         acquire_from_credential, &sexp);
 
 	return sexp;
 }
 
 static void
-gck_private_xsa_key_init (GckPrivateXsaKey *self)
+gkm_private_xsa_key_init (GkmPrivateXsaKey *self)
 {
-	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GCK_TYPE_PRIVATE_XSA_KEY, GckPrivateXsaKeyPrivate);
+	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GKM_TYPE_PRIVATE_XSA_KEY, GkmPrivateXsaKeyPrivate);
 }
 
 static void
-gck_private_xsa_key_dispose (GObject *obj)
+gkm_private_xsa_key_dispose (GObject *obj)
 {
-	GckPrivateXsaKey *self = GCK_PRIVATE_XSA_KEY (obj);
+	GkmPrivateXsaKey *self = GKM_PRIVATE_XSA_KEY (obj);
 
 	if (self->pv->sexp)
-		gck_sexp_unref (self->pv->sexp);
+		gkm_sexp_unref (self->pv->sexp);
 	self->pv->sexp = NULL;
 
-	G_OBJECT_CLASS (gck_private_xsa_key_parent_class)->dispose (obj);
+	G_OBJECT_CLASS (gkm_private_xsa_key_parent_class)->dispose (obj);
 }
 
 static void
-gck_private_xsa_key_finalize (GObject *obj)
+gkm_private_xsa_key_finalize (GObject *obj)
 {
-	GckPrivateXsaKey *self = GCK_PRIVATE_XSA_KEY (obj);
+	GkmPrivateXsaKey *self = GKM_PRIVATE_XSA_KEY (obj);
 
 	g_assert (self->pv->sexp == NULL);
 
-	G_OBJECT_CLASS (gck_private_xsa_key_parent_class)->finalize (obj);
+	G_OBJECT_CLASS (gkm_private_xsa_key_parent_class)->finalize (obj);
 }
 
 static void
-gck_private_xsa_key_class_init (GckPrivateXsaKeyClass *klass)
+gkm_private_xsa_key_class_init (GkmPrivateXsaKeyClass *klass)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	GckObjectClass *gck_class = GCK_OBJECT_CLASS (klass);
-	GckSexpKeyClass *key_class = GCK_SEXP_KEY_CLASS (klass);
+	GkmObjectClass *gkm_class = GKM_OBJECT_CLASS (klass);
+	GkmSexpKeyClass *key_class = GKM_SEXP_KEY_CLASS (klass);
 
-	gck_private_xsa_key_parent_class = g_type_class_peek_parent (klass);
-	g_type_class_add_private (klass, sizeof (GckPrivateXsaKeyPrivate));
+	gkm_private_xsa_key_parent_class = g_type_class_peek_parent (klass);
+	g_type_class_add_private (klass, sizeof (GkmPrivateXsaKeyPrivate));
 
-	gobject_class->dispose = gck_private_xsa_key_dispose;
-	gobject_class->finalize = gck_private_xsa_key_finalize;
+	gobject_class->dispose = gkm_private_xsa_key_dispose;
+	gobject_class->finalize = gkm_private_xsa_key_finalize;
 
-	gck_class->get_attribute = gck_private_xsa_key_real_get_attribute;
+	gkm_class->get_attribute = gkm_private_xsa_key_real_get_attribute;
 
-	key_class->acquire_crypto_sexp = gck_private_xsa_key_real_acquire_crypto_sexp;
+	key_class->acquire_crypto_sexp = gkm_private_xsa_key_real_acquire_crypto_sexp;
 }
 
 /* -----------------------------------------------------------------------------
@@ -347,45 +347,45 @@ gck_private_xsa_key_class_init (GckPrivateXsaKeyClass *klass)
  */
 
 void
-gck_private_xsa_key_set_unlocked_private (GckPrivateXsaKey *self, GckSexp *sexp)
+gkm_private_xsa_key_set_unlocked_private (GkmPrivateXsaKey *self, GkmSexp *sexp)
 {
-	g_return_if_fail (GCK_IS_PRIVATE_XSA_KEY (self));
+	g_return_if_fail (GKM_IS_PRIVATE_XSA_KEY (self));
 	g_return_if_fail (sexp);
 
 	if (sexp)
-		gck_sexp_ref (sexp);
+		gkm_sexp_ref (sexp);
 	if (self->pv->sexp)
-		gck_sexp_unref (self->pv->sexp);
+		gkm_sexp_unref (self->pv->sexp);
 	self->pv->sexp = sexp;
 }
 
 void
-gck_private_xsa_key_set_locked_private (GckPrivateXsaKey *self, GckCredential *cred,
-                                        GckSexp *sexp)
+gkm_private_xsa_key_set_locked_private (GkmPrivateXsaKey *self, GkmCredential *cred,
+                                        GkmSexp *sexp)
 {
-	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));
-	gck_credential_set_data (cred, GCK_BOXED_SEXP, sexp);
+	g_return_if_fail (GKM_IS_PRIVATE_XSA_KEY (self));
+	g_return_if_fail (GKM_IS_CREDENTIAL (cred));
+	g_return_if_fail (gkm_credential_get_object (cred) == GKM_OBJECT (self));
+	gkm_credential_set_data (cred, GKM_BOXED_SEXP, sexp);
 }
 
-GckSexp*
-gck_private_xsa_key_create_sexp (GckSession *session, GckTransaction *transaction,
+GkmSexp*
+gkm_private_xsa_key_create_sexp (GkmSession *session, GkmTransaction *transaction,
                                  CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
 {
 	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 (GKM_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);
+	if (!gkm_attributes_find_ulong (attrs, n_attrs, CKA_KEY_TYPE, &type)) {
+		gkm_transaction_fail (transaction, CKR_TEMPLATE_INCOMPLETE);
 		return NULL;
 	}
 
-	gck_attributes_consume (attrs, n_attrs, CKA_KEY_TYPE, CKA_CLASS, G_MAXULONG);
+	gkm_attributes_consume (attrs, n_attrs, CKA_KEY_TYPE, CKA_CLASS, G_MAXULONG);
 
 	switch (type) {
 	case CKK_RSA:
@@ -400,16 +400,16 @@ gck_private_xsa_key_create_sexp (GckSession *session, GckTransaction *transactio
 	};
 
 	if (ret != CKR_OK) {
-		gck_transaction_fail (transaction, ret);
+		gkm_transaction_fail (transaction, ret);
 		return NULL;
 	}
 
 	g_return_val_if_fail (sexp, NULL);
-	return gck_sexp_new (sexp);
+	return gkm_sexp_new (sexp);
 }
 
-GckFactory*
-gck_private_xsa_key_get_factory (void)
+GkmFactory*
+gkm_private_xsa_key_get_factory (void)
 {
 	static CK_OBJECT_CLASS klass = CKO_PRIVATE_KEY;
 
@@ -417,7 +417,7 @@ gck_private_xsa_key_get_factory (void)
 		{ CKA_CLASS, &klass, sizeof (klass) }
 	};
 
-	static GckFactory factory = {
+	static GkmFactory factory = {
 		attributes,
 		G_N_ELEMENTS (attributes),
 		factory_create_private_xsa_key
diff --git a/pkcs11/gkm/gkm-private-xsa-key.h b/pkcs11/gkm/gkm-private-xsa-key.h
new file mode 100644
index 0000000..d3d14b0
--- /dev/null
+++ b/pkcs11/gkm/gkm-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 __GKM_PRIVATE_XSA_KEY_H__
+#define __GKM_PRIVATE_XSA_KEY_H__
+
+#include <glib-object.h>
+
+#include "gkm-sexp-key.h"
+#include "gkm-types.h"
+
+#define GKM_FACTORY_PRIVATE_XSA_KEY            (gkm_private_xsa_key_get_factory ())
+
+#define GKM_TYPE_PRIVATE_XSA_KEY               (gkm_private_xsa_key_get_type ())
+#define GKM_PRIVATE_XSA_KEY(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_PRIVATE_XSA_KEY, GkmPrivateXsaKey))
+#define GKM_PRIVATE_XSA_KEY_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_PRIVATE_XSA_KEY, GkmPrivateXsaKeyClass))
+#define GKM_IS_PRIVATE_XSA_KEY(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_PRIVATE_XSA_KEY))
+#define GKM_IS_PRIVATE_XSA_KEY_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_PRIVATE_XSA_KEY))
+#define GKM_PRIVATE_XSA_KEY_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_PRIVATE_XSA_KEY, GkmPrivateXsaKeyClass))
+
+typedef struct _GkmPrivateXsaKeyClass GkmPrivateXsaKeyClass;
+typedef struct _GkmPrivateXsaKeyPrivate GkmPrivateXsaKeyPrivate;
+
+struct _GkmPrivateXsaKey {
+	GkmSexpKey parent;
+	GkmPrivateXsaKeyPrivate *pv;
+};
+
+struct _GkmPrivateXsaKeyClass {
+	GkmSexpKeyClass parent_class;
+};
+
+GType                  gkm_private_xsa_key_get_type               (void);
+
+void                   gkm_private_xsa_key_set_unlocked_private   (GkmPrivateXsaKey *self,
+                                                                   GkmSexp *sexp);
+
+void                   gkm_private_xsa_key_set_locked_private     (GkmPrivateXsaKey *self,
+                                                                   GkmCredential *cred,
+                                                                   GkmSexp *sexp);
+
+GkmFactory*            gkm_private_xsa_key_get_factory            (void);
+
+GkmSexp*               gkm_private_xsa_key_create_sexp            (GkmSession *session,
+                                                                   GkmTransaction *transaction,
+                                                                   CK_ATTRIBUTE_PTR attrs,
+                                                                   CK_ULONG n_attrs);
+
+#endif /* __GKM_PRIVATE_XSA_KEY_H__ */
diff --git a/pkcs11/gck/gck-public-xsa-key.c b/pkcs11/gkm/gkm-public-xsa-key.c
similarity index 57%
rename from pkcs11/gck/gck-public-xsa-key.c
rename to pkcs11/gkm/gkm-public-xsa-key.c
index f28d56a..5c3f256 100644
--- a/pkcs11/gck/gck-public-xsa-key.c
+++ b/pkcs11/gkm/gkm-public-xsa-key.c
@@ -23,29 +23,29 @@
 
 #include "pkcs11/pkcs11.h"
 
-#include "gck-attributes.h"
-#include "gck-factory.h"
-#include "gck-public-xsa-key.h"
-#include "gck-session.h"
-#include "gck-sexp.h"
-#include "gck-transaction.h"
-#include "gck-util.h"
+#include "gkm-attributes.h"
+#include "gkm-factory.h"
+#include "gkm-public-xsa-key.h"
+#include "gkm-session.h"
+#include "gkm-sexp.h"
+#include "gkm-transaction.h"
+#include "gkm-util.h"
 
-G_DEFINE_TYPE (GckPublicXsaKey, gck_public_xsa_key, GCK_TYPE_SEXP_KEY);
+G_DEFINE_TYPE (GkmPublicXsaKey, gkm_public_xsa_key, GKM_TYPE_SEXP_KEY);
 
 /* -----------------------------------------------------------------------------
  * INTERNAL
  */
 
 static CK_RV
-return_modulus_bits (GckPublicXsaKey *self, CK_ATTRIBUTE_PTR attr)
+return_modulus_bits (GkmPublicXsaKey *self, CK_ATTRIBUTE_PTR attr)
 {
 	gcry_sexp_t numbers;
 	gcry_mpi_t mpi;
 	int algorithm;
 	CK_RV rv;
 
-	if (!gck_sexp_parse_key (gck_sexp_get (gck_sexp_key_get_base (GCK_SEXP_KEY (self))),
+	if (!gkm_sexp_parse_key (gkm_sexp_get (gkm_sexp_key_get_base (GKM_SEXP_KEY (self))),
 	                         &algorithm, NULL, &numbers))
 		g_return_val_if_reached (CKR_GENERAL_ERROR);
 
@@ -55,11 +55,11 @@ return_modulus_bits (GckPublicXsaKey *self, CK_ATTRIBUTE_PTR attr)
 	}
 
 	g_assert (numbers);
-	if (!gck_sexp_extract_mpi (numbers, &mpi, "n", NULL))
+	if (!gkm_sexp_extract_mpi (numbers, &mpi, "n", NULL))
 		g_return_val_if_reached (CKR_GENERAL_ERROR);
 
 	gcry_sexp_release (numbers);
-	rv = gck_attribute_set_ulong (attr, gcry_mpi_get_nbits (mpi));
+	rv = gkm_attribute_set_ulong (attr, gcry_mpi_get_nbits (mpi));
 	gcry_mpi_release (mpi);
 
 	return rv;
@@ -73,8 +73,8 @@ create_rsa_public (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, gcry_sexp_t *skey)
 	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)) {
+	if (!gkm_attributes_find_mpi (attrs, n_attrs, CKA_MODULUS, &n) ||
+	    !gkm_attributes_find_mpi (attrs, n_attrs, CKA_PUBLIC_EXPONENT, &e)) {
 		ret = CKR_TEMPLATE_INCOMPLETE;
 		goto done;
 	}
@@ -89,7 +89,7 @@ create_rsa_public (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, gcry_sexp_t *skey)
 		goto done;
 	}
 
-	gck_attributes_consume (attrs, n_attrs, CKA_MODULUS, CKA_PUBLIC_EXPONENT, CKA_MODULUS_BITS, G_MAXULONG);
+	gkm_attributes_consume (attrs, n_attrs, CKA_MODULUS, CKA_PUBLIC_EXPONENT, CKA_MODULUS_BITS, G_MAXULONG);
 	ret = CKR_OK;
 
 done:
@@ -108,10 +108,10 @@ create_dsa_public (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, gcry_sexp_t *skey)
 	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_BASE, &g) ||
-	    !gck_attributes_find_mpi (attrs, n_attrs, CKA_VALUE, &y)) {
+	if (!gkm_attributes_find_mpi (attrs, n_attrs, CKA_PRIME, &p) ||
+	    !gkm_attributes_find_mpi (attrs, n_attrs, CKA_SUBPRIME, &q) ||
+	    !gkm_attributes_find_mpi (attrs, n_attrs, CKA_BASE, &g) ||
+	    !gkm_attributes_find_mpi (attrs, n_attrs, CKA_VALUE, &y)) {
 		ret = CKR_TEMPLATE_INCOMPLETE;
 		goto done;
 	}
@@ -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,
+	gkm_attributes_consume (attrs, n_attrs, CKA_PRIME, CKA_SUBPRIME,
 	                        CKA_BASE, CKA_VALUE, G_MAXULONG);
 	ret = CKR_OK;
 
@@ -138,24 +138,24 @@ done:
 	return ret;
 }
 
-static GckObject*
-factory_create_public_xsa_key (GckSession *session, GckTransaction *transaction,
+static GkmObject*
+factory_create_public_xsa_key (GkmSession *session, GkmTransaction *transaction,
                                CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
 {
-	GckObject *object = NULL;
-	GckSexp *sexp;
+	GkmObject *object = NULL;
+	GkmSexp *sexp;
 
-	g_return_val_if_fail (GCK_IS_TRANSACTION (transaction), NULL);
+	g_return_val_if_fail (GKM_IS_TRANSACTION (transaction), NULL);
 	g_return_val_if_fail (attrs || !n_attrs, NULL);
 
-	sexp = gck_public_xsa_key_create_sexp (session, transaction, attrs, n_attrs);
+	sexp = gkm_public_xsa_key_create_sexp (session, transaction, attrs, n_attrs);
 	if (sexp != NULL) {
-		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),
+		object = g_object_new (GKM_TYPE_PUBLIC_XSA_KEY, "base-sexp", sexp,
+		                       "module", gkm_session_get_module (session),
+		                       "manager", gkm_manager_for_template (attrs, n_attrs, session),
 		                       NULL);
-		gck_sexp_unref (sexp);
-		gck_session_complete_object_creation (session, transaction, object,
+		gkm_sexp_unref (sexp);
+		gkm_session_complete_object_creation (session, transaction, object,
 		                                      TRUE, attrs, n_attrs);
 	}
 
@@ -167,32 +167,32 @@ factory_create_public_xsa_key (GckSession *session, GckTransaction *transaction,
  */
 
 static CK_RV
-gck_public_xsa_key_real_get_attribute (GckObject *base, GckSession *session, CK_ATTRIBUTE* attr)
+gkm_public_xsa_key_real_get_attribute (GkmObject *base, GkmSession *session, CK_ATTRIBUTE* attr)
 {
-	GckPublicXsaKey *self = GCK_PUBLIC_XSA_KEY (base);
+	GkmPublicXsaKey *self = GKM_PUBLIC_XSA_KEY (base);
 	gint algorithm;
 
 	switch (attr->type)
 	{
 
 	case CKA_CLASS:
-		return gck_attribute_set_ulong (attr, CKO_PUBLIC_KEY);
+		return gkm_attribute_set_ulong (attr, CKO_PUBLIC_KEY);
 
 	case CKA_ENCRYPT:
-		algorithm = gck_sexp_key_get_algorithm (GCK_SEXP_KEY (self));
-		return gck_attribute_set_bool (attr, algorithm == GCRY_PK_RSA);
+		algorithm = gkm_sexp_key_get_algorithm (GKM_SEXP_KEY (self));
+		return gkm_attribute_set_bool (attr, algorithm == GCRY_PK_RSA);
 
 	case CKA_VERIFY:
-		return gck_attribute_set_bool (attr, TRUE);
+		return gkm_attribute_set_bool (attr, TRUE);
 
 	case CKA_VERIFY_RECOVER:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_WRAP:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_TRUSTED:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_WRAP_TEMPLATE:
 		return CKR_ATTRIBUTE_TYPE_INVALID;
@@ -201,80 +201,80 @@ gck_public_xsa_key_real_get_attribute (GckObject *base, GckSession *session, CK_
 		return return_modulus_bits (self, attr);
 
 	case CKA_MODULUS:
-		return gck_sexp_key_set_part (GCK_SEXP_KEY (self), GCRY_PK_RSA, "n", attr);
+		return gkm_sexp_key_set_part (GKM_SEXP_KEY (self), GCRY_PK_RSA, "n", attr);
 
 	case CKA_PUBLIC_EXPONENT:
-		return gck_sexp_key_set_part (GCK_SEXP_KEY (self), GCRY_PK_RSA, "e", attr);
+		return gkm_sexp_key_set_part (GKM_SEXP_KEY (self), GCRY_PK_RSA, "e", attr);
 
 	case CKA_PRIME:
-		return gck_sexp_key_set_part (GCK_SEXP_KEY (self), GCRY_PK_DSA, "p", attr);
+		return gkm_sexp_key_set_part (GKM_SEXP_KEY (self), GCRY_PK_DSA, "p", attr);
 
 	case CKA_SUBPRIME:
-		return gck_sexp_key_set_part (GCK_SEXP_KEY (self), GCRY_PK_DSA, "q", attr);
+		return gkm_sexp_key_set_part (GKM_SEXP_KEY (self), GCRY_PK_DSA, "q", attr);
 
 	case CKA_BASE:
-		return gck_sexp_key_set_part (GCK_SEXP_KEY (self), GCRY_PK_DSA, "g", attr);
+		return gkm_sexp_key_set_part (GKM_SEXP_KEY (self), GCRY_PK_DSA, "g", attr);
 
 	/* DSA public value */
 	case CKA_VALUE:
-		return gck_sexp_key_set_part (GCK_SEXP_KEY (self), GCRY_PK_DSA, "y", attr);
+		return gkm_sexp_key_set_part (GKM_SEXP_KEY (self), GCRY_PK_DSA, "y", attr);
 	};
 
-	return GCK_OBJECT_CLASS (gck_public_xsa_key_parent_class)->get_attribute (base, session, attr);
+	return GKM_OBJECT_CLASS (gkm_public_xsa_key_parent_class)->get_attribute (base, session, attr);
 }
 
-static GckSexp*
-gck_public_xsa_key_acquire_crypto_sexp (GckSexpKey *self, GckSession *session)
+static GkmSexp*
+gkm_public_xsa_key_acquire_crypto_sexp (GkmSexpKey *self, GkmSession *session)
 {
-	GckSexp* sexp;
+	GkmSexp* sexp;
 
-	sexp = gck_sexp_key_get_base (self);
+	sexp = gkm_sexp_key_get_base (self);
 	if (sexp != NULL)
-		gck_sexp_ref (sexp);
+		gkm_sexp_ref (sexp);
 
 	return sexp;
 }
 
 static void
-gck_public_xsa_key_init (GckPublicXsaKey *self)
+gkm_public_xsa_key_init (GkmPublicXsaKey *self)
 {
 
 }
 
 static void
-gck_public_xsa_key_class_init (GckPublicXsaKeyClass *klass)
+gkm_public_xsa_key_class_init (GkmPublicXsaKeyClass *klass)
 {
-	GckObjectClass *gck_class = GCK_OBJECT_CLASS (klass);
-	GckSexpKeyClass *key_class = GCK_SEXP_KEY_CLASS (klass);
+	GkmObjectClass *gkm_class = GKM_OBJECT_CLASS (klass);
+	GkmSexpKeyClass *key_class = GKM_SEXP_KEY_CLASS (klass);
 
-	gck_public_xsa_key_parent_class = g_type_class_peek_parent (klass);
+	gkm_public_xsa_key_parent_class = g_type_class_peek_parent (klass);
 
-	gck_class->get_attribute = gck_public_xsa_key_real_get_attribute;
+	gkm_class->get_attribute = gkm_public_xsa_key_real_get_attribute;
 
-	key_class->acquire_crypto_sexp = gck_public_xsa_key_acquire_crypto_sexp;
+	key_class->acquire_crypto_sexp = gkm_public_xsa_key_acquire_crypto_sexp;
 }
 
 /* -----------------------------------------------------------------------------
  * PUBLIC
  */
 
-GckSexp*
-gck_public_xsa_key_create_sexp (GckSession *session, GckTransaction *transaction,
+GkmSexp*
+gkm_public_xsa_key_create_sexp (GkmSession *session, GkmTransaction *transaction,
                                 CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
 {
 	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 (GKM_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);
+	if (!gkm_attributes_find_ulong (attrs, n_attrs, CKA_KEY_TYPE, &type)) {
+		gkm_transaction_fail (transaction, CKR_TEMPLATE_INCOMPLETE);
 		return NULL;
 	}
 
-	gck_attributes_consume (attrs, n_attrs, CKA_KEY_TYPE, CKA_CLASS, G_MAXULONG);
+	gkm_attributes_consume (attrs, n_attrs, CKA_KEY_TYPE, CKA_CLASS, G_MAXULONG);
 
 	switch (type) {
 	case CKK_RSA:
@@ -289,16 +289,16 @@ gck_public_xsa_key_create_sexp (GckSession *session, GckTransaction *transaction
 	};
 
 	if (ret != CKR_OK) {
-		gck_transaction_fail (transaction, ret);
+		gkm_transaction_fail (transaction, ret);
 		return NULL;
 	}
 
 	g_return_val_if_fail (sexp, NULL);
-	return gck_sexp_new (sexp);
+	return gkm_sexp_new (sexp);
 }
 
-GckFactory*
-gck_public_xsa_key_get_factory (void)
+GkmFactory*
+gkm_public_xsa_key_get_factory (void)
 {
 	static CK_OBJECT_CLASS klass = CKO_PUBLIC_KEY;
 
@@ -306,7 +306,7 @@ gck_public_xsa_key_get_factory (void)
 		{ CKA_CLASS, &klass, sizeof (klass) }
 	};
 
-	static GckFactory factory = {
+	static GkmFactory factory = {
 		attributes,
 		G_N_ELEMENTS (attributes),
 		factory_create_public_xsa_key
diff --git a/pkcs11/gkm/gkm-public-xsa-key.h b/pkcs11/gkm/gkm-public-xsa-key.h
new file mode 100644
index 0000000..1b35f71
--- /dev/null
+++ b/pkcs11/gkm/gkm-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 __GKM_PUBLIC_XSA_KEY_H__
+#define __GKM_PUBLIC_XSA_KEY_H__
+
+#include <glib-object.h>
+
+#include "gkm-sexp-key.h"
+#include "gkm-types.h"
+
+#define GKM_FACTORY_PUBLIC_XSA_KEY            (gkm_public_xsa_key_get_factory ())
+
+#define GKM_TYPE_PUBLIC_XSA_KEY               (gkm_public_xsa_key_get_type ())
+#define GKM_PUBLIC_XSA_KEY(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_PUBLIC_XSA_KEY, GkmPublicXsaKey))
+#define GKM_PUBLIC_XSA_KEY_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_PUBLIC_XSA_KEY, GkmPublicXsaKeyClass))
+#define GKM_IS_PUBLIC_XSA_KEY(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_PUBLIC_XSA_KEY))
+#define GKM_IS_PUBLIC_XSA_KEY_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_PUBLIC_XSA_KEY))
+#define GKM_PUBLIC_XSA_KEY_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_PUBLIC_XSA_KEY, GkmPublicXsaKeyClass))
+
+typedef struct _GkmPublicXsaKeyClass GkmPublicXsaKeyClass;
+typedef struct _GkmPublicXsaKeyPrivate GkmPublicXsaKeyPrivate;
+
+struct _GkmPublicXsaKey {
+	GkmSexpKey parent;
+	GkmPublicXsaKeyPrivate *pv;
+};
+
+struct _GkmPublicXsaKeyClass {
+	GkmSexpKeyClass parent_class;
+};
+
+GType                     gkm_public_xsa_key_get_type           (void);
+
+GkmFactory*               gkm_public_xsa_key_get_factory        (void);
+
+GkmSexp*                  gkm_public_xsa_key_create_sexp        (GkmSession *session,
+                                                                 GkmTransaction *transaction,
+                                                                 CK_ATTRIBUTE_PTR attrs,
+                                                                 CK_ULONG n_attrs);
+
+#endif /* __GKM_PUBLIC_XSA_KEY_H__ */
diff --git a/pkcs11/gck/gck-secret-key.c b/pkcs11/gkm/gkm-secret-key.c
similarity index 55%
rename from pkcs11/gck/gck-secret-key.c
rename to pkcs11/gkm/gkm-secret-key.c
index dedc790..dd46563 100644
--- a/pkcs11/gck/gck-secret-key.c
+++ b/pkcs11/gkm/gkm-secret-key.c
@@ -23,18 +23,18 @@
 
 #include "pkcs11/pkcs11.h"
 
-#include "gck-attributes.h"
-#include "gck-crypto.h"
-#include "gck-secret-key.h"
-#include "gck-session.h"
-#include "gck-util.h"
+#include "gkm-attributes.h"
+#include "gkm-crypto.h"
+#include "gkm-secret-key.h"
+#include "gkm-session.h"
+#include "gkm-util.h"
 
-struct _GckSecretKeyPrivate {
+struct _GkmSecretKeyPrivate {
 	gpointer id;
 	gsize n_id;
 };
 
-G_DEFINE_TYPE (GckSecretKey, gck_secret_key, GCK_TYPE_OBJECT);
+G_DEFINE_TYPE (GkmSecretKey, gkm_secret_key, GKM_TYPE_OBJECT);
 
 /* -----------------------------------------------------------------------------
  * INTERNAL
@@ -45,14 +45,14 @@ G_DEFINE_TYPE (GckSecretKey, gck_secret_key, GCK_TYPE_OBJECT);
  */
 
 static CK_RV
-gck_secret_key_real_get_attribute (GckObject *base, GckSession *session, CK_ATTRIBUTE* attr)
+gkm_secret_key_real_get_attribute (GkmObject *base, GkmSession *session, CK_ATTRIBUTE* attr)
 {
-	GckSecretKey *self = GCK_SECRET_KEY (base);
+	GkmSecretKey *self = GKM_SECRET_KEY (base);
 
 	switch (attr->type)
 	{
 	case CKA_CLASS:
-		return gck_attribute_set_ulong (attr, CKO_SECRET_KEY);
+		return gkm_attribute_set_ulong (attr, CKO_SECRET_KEY);
 
 	case CKA_SENSITIVE:
 	case CKA_ENCRYPT:
@@ -62,22 +62,22 @@ gck_secret_key_real_get_attribute (GckObject *base, GckSession *session, CK_ATTR
 	case CKA_WRAP:
 	case CKA_UNWRAP:
 	case CKA_DERIVE:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_EXTRACTABLE:
-		return gck_attribute_set_bool (attr, TRUE);
+		return gkm_attribute_set_bool (attr, TRUE);
 
 	case CKA_ALWAYS_SENSITIVE:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_NEVER_EXTRACTABLE:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_WRAP_WITH_TRUSTED:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_TRUSTED:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_WRAP_TEMPLATE:
 	case CKA_UNWRAP_TEMPLATE:
@@ -85,76 +85,75 @@ gck_secret_key_real_get_attribute (GckObject *base, GckSession *session, CK_ATTR
 
 	case CKA_START_DATE:
 	case CKA_END_DATE:
-		return gck_attribute_set_empty (attr);
+		return gkm_attribute_set_empty (attr);
 
 	case CKA_LOCAL:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_ID:
-		return gck_attribute_set_data (attr, self->pv->id, self->pv->n_id);
+		return gkm_attribute_set_data (attr, self->pv->id, self->pv->n_id);
 
 	case CKA_KEY_GEN_MECHANISM:
-		return gck_attribute_set_ulong (attr, CK_UNAVAILABLE_INFORMATION);
+		return gkm_attribute_set_ulong (attr, CK_UNAVAILABLE_INFORMATION);
 	};
 
-	return GCK_OBJECT_CLASS (gck_secret_key_parent_class)->get_attribute (base, session, attr);
+	return GKM_OBJECT_CLASS (gkm_secret_key_parent_class)->get_attribute (base, session, attr);
 }
 
 static void
-gck_secret_key_real_create_attributes (GckObject *object, GckSession *session, GckTransaction *transaction,
+gkm_secret_key_real_create_attributes (GkmObject *object, GkmSession *session, GkmTransaction *transaction,
                                        CK_ATTRIBUTE *attrs, CK_ULONG n_attrs)
 {
-	GckSecretKey *self = GCK_SECRET_KEY (object);
+	GkmSecretKey *self = GKM_SECRET_KEY (object);
 	CK_ATTRIBUTE_PTR id;
 
 	if (!self->pv->n_id) {
-		id = gck_attributes_find (attrs, n_attrs, CKA_ID);
+		id = gkm_attributes_find (attrs, n_attrs, CKA_ID);
 		if (id == NULL) {
 			self->pv->id = NULL;
 			self->pv->n_id = 0;
 		} else {
 			self->pv->id = g_memdup (id->pValue, id->ulValueLen);
 			self->pv->n_id = id->ulValueLen;
-			gck_attribute_consume (id);
+			gkm_attribute_consume (id);
 		}
 	}
 }
 
 static void
-gck_secret_key_init (GckSecretKey *self)
+gkm_secret_key_init (GkmSecretKey *self)
 {
-	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GCK_TYPE_SECRET_KEY, GckSecretKeyPrivate);
+	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GKM_TYPE_SECRET_KEY, GkmSecretKeyPrivate);
 }
 
 static void
-gck_secret_key_finalize (GObject *obj)
+gkm_secret_key_finalize (GObject *obj)
 {
-	GckSecretKey *self = GCK_SECRET_KEY (obj);
+	GkmSecretKey *self = GKM_SECRET_KEY (obj);
 
 	g_free (self->pv->id);
 	self->pv->id = NULL;
 	self->pv->n_id = 0;
 
-	G_OBJECT_CLASS (gck_secret_key_parent_class)->finalize (obj);
+	G_OBJECT_CLASS (gkm_secret_key_parent_class)->finalize (obj);
 }
 
 static void
-gck_secret_key_class_init (GckSecretKeyClass *klass)
+gkm_secret_key_class_init (GkmSecretKeyClass *klass)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	GckObjectClass *gck_class = GCK_OBJECT_CLASS (klass);
+	GkmObjectClass *gkm_class = GKM_OBJECT_CLASS (klass);
 
-	gck_secret_key_parent_class = g_type_class_peek_parent (klass);
+	gkm_secret_key_parent_class = g_type_class_peek_parent (klass);
 
-	gobject_class->finalize = gck_secret_key_finalize;
+	gobject_class->finalize = gkm_secret_key_finalize;
 
-	gck_class->get_attribute = gck_secret_key_real_get_attribute;
-	gck_class->create_attributes = gck_secret_key_real_create_attributes;
+	gkm_class->get_attribute = gkm_secret_key_real_get_attribute;
+	gkm_class->create_attributes = gkm_secret_key_real_create_attributes;
 
-	g_type_class_add_private (klass, sizeof (GckSecretKeyPrivate));
+	g_type_class_add_private (klass, sizeof (GkmSecretKeyPrivate));
 }
 
 /* -----------------------------------------------------------------------------
  * PUBLIC
  */
-
diff --git a/pkcs11/gkm/gkm-secret-key.h b/pkcs11/gkm/gkm-secret-key.h
new file mode 100644
index 0000000..4a1d325
--- /dev/null
+++ b/pkcs11/gkm/gkm-secret-key.h
@@ -0,0 +1,51 @@
+/*
+ * 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 __GKM_SECRET_KEY_H__
+#define __GKM_SECRET_KEY_H__
+
+#include <glib-object.h>
+
+#include "gkm-object.h"
+#include "gkm-types.h"
+
+#define GKM_TYPE_SECRET_KEY               (gkm_secret_key_get_type ())
+#define GKM_SECRET_KEY(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_SECRET_KEY, GkmSecretKey))
+#define GKM_SECRET_KEY_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_SECRET_KEY, GkmSecretKeyClass))
+#define GKM_IS_SECRET_KEY(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_SECRET_KEY))
+#define GKM_IS_SECRET_KEY_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_SECRET_KEY))
+#define GKM_SECRET_KEY_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_SECRET_KEY, GkmSecretKeyClass))
+
+typedef struct _GkmSecretKeyClass GkmSecretKeyClass;
+typedef struct _GkmSecretKeyPrivate GkmSecretKeyPrivate;
+
+struct _GkmSecretKey {
+	GkmObject parent;
+	GkmSecretKeyPrivate *pv;
+};
+
+struct _GkmSecretKeyClass {
+	GkmObjectClass parent_class;
+};
+
+GType                     gkm_secret_key_get_type           (void);
+
+#endif /* __GKM_SECRET_KEY_H__ */
diff --git a/pkcs11/gck/gck-secret.c b/pkcs11/gkm/gkm-secret.c
similarity index 61%
rename from pkcs11/gck/gck-secret.c
rename to pkcs11/gkm/gkm-secret.c
index a8a2cb6..3bf8d05 100644
--- a/pkcs11/gck/gck-secret.c
+++ b/pkcs11/gkm/gkm-secret.c
@@ -1,89 +1,89 @@
-/* 
+/*
  * 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"
 
-#include "gck-secret.h"
+#include "gkm-secret.h"
 
 #include "egg/egg-secure-memory.h"
 
 #include <string.h>
 
-struct _GckSecret {
+struct _GkmSecret {
 	GObject parent;
 	guchar *memory;
 	gsize n_memory;
 };
 
-G_DEFINE_TYPE (GckSecret, gck_secret, G_TYPE_OBJECT);
+G_DEFINE_TYPE (GkmSecret, gkm_secret, G_TYPE_OBJECT);
 
 /* -----------------------------------------------------------------------------
- * OBJECT 
+ * OBJECT
  */
 
 static void
-gck_secret_init (GckSecret *self)
+gkm_secret_init (GkmSecret *self)
 {
 
 }
 
 static void
-gck_secret_dispose (GObject *obj)
+gkm_secret_dispose (GObject *obj)
 {
-	GckSecret *self = GCK_SECRET (obj);
-	
+	GkmSecret *self = GKM_SECRET (obj);
+
 	egg_secure_clear (self->memory, self->n_memory);
-    
-	G_OBJECT_CLASS (gck_secret_parent_class)->dispose (obj);
+
+	G_OBJECT_CLASS (gkm_secret_parent_class)->dispose (obj);
 }
 
 static void
-gck_secret_finalize (GObject *obj)
+gkm_secret_finalize (GObject *obj)
 {
-	GckSecret *self = GCK_SECRET (obj);
+	GkmSecret *self = GKM_SECRET (obj);
 
 	egg_secure_free (self->memory);
 	self->memory = NULL;
 	self->n_memory = 0;
 
-	G_OBJECT_CLASS (gck_secret_parent_class)->finalize (obj);
+	G_OBJECT_CLASS (gkm_secret_parent_class)->finalize (obj);
 }
 
 static void
-gck_secret_class_init (GckSecretClass *klass)
+gkm_secret_class_init (GkmSecretClass *klass)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	gobject_class->dispose = gck_secret_dispose;
-	gobject_class->finalize = gck_secret_finalize;
+	gobject_class->dispose = gkm_secret_dispose;
+	gobject_class->finalize = gkm_secret_finalize;
 }
 
 /* -----------------------------------------------------------------------------
- * PUBLIC 
+ * PUBLIC
  */
 
-GckSecret*
-gck_secret_new (const guchar *data, gssize n_data)
+GkmSecret*
+gkm_secret_new (const guchar *data, gssize n_data)
 {
-	GckSecret *secret = g_object_new (GCK_TYPE_SECRET, NULL);
-	
+	GkmSecret *secret = g_object_new (GKM_TYPE_SECRET, NULL);
+
 	if (data) {
 		if (n_data == -1) {
 			secret->memory = (guchar*)egg_secure_strdup ((const gchar*)data);
@@ -97,62 +97,62 @@ gck_secret_new (const guchar *data, gssize n_data)
 		secret->memory = NULL;
 		secret->n_memory = 0;
 	}
-	
+
 	return secret;
 }
 
-GckSecret*
-gck_secret_new_from_login (CK_UTF8CHAR_PTR pin, CK_ULONG n_pin)
+GkmSecret*
+gkm_secret_new_from_login (CK_UTF8CHAR_PTR pin, CK_ULONG n_pin)
 {
 	if (n_pin == (CK_ULONG)-1)
-		return gck_secret_new ((const guchar*)pin, -1);
+		return gkm_secret_new ((const guchar*)pin, -1);
 	else
-		return gck_secret_new ((const guchar*)pin, (gssize)n_pin);
+		return gkm_secret_new ((const guchar*)pin, (gssize)n_pin);
 }
 
-GckSecret*
-gck_secret_new_from_password (const gchar *password)
+GkmSecret*
+gkm_secret_new_from_password (const gchar *password)
 {
-	return gck_secret_new ((const guchar*)password, -1);
+	return gkm_secret_new ((const guchar*)password, -1);
 }
 
 const guchar*
-gck_secret_get (GckSecret *self, gsize *n_data)
+gkm_secret_get (GkmSecret *self, gsize *n_data)
 {
-	g_return_val_if_fail (GCK_IS_SECRET (self), NULL);
+	g_return_val_if_fail (GKM_IS_SECRET (self), NULL);
 	g_return_val_if_fail (n_data, NULL);
 	*n_data = self->n_memory;
 	return self->memory;
 }
 
 const gchar*
-gck_secret_get_password (GckSecret *self, gsize *n_data)
+gkm_secret_get_password (GkmSecret *self, gsize *n_data)
 {
-	g_return_val_if_fail (GCK_IS_SECRET (self), NULL);
+	g_return_val_if_fail (GKM_IS_SECRET (self), NULL);
 	g_return_val_if_fail (n_data, NULL);
 	*n_data = self->n_memory;
 	return (gchar*)self->memory;
 }
 
 gboolean
-gck_secret_equal (GckSecret *self, GckSecret *other)
+gkm_secret_equal (GkmSecret *self, GkmSecret *other)
 {
-	g_return_val_if_fail (GCK_IS_SECRET (self), FALSE);
-	g_return_val_if_fail (GCK_IS_SECRET (other), FALSE);
+	g_return_val_if_fail (GKM_IS_SECRET (self), FALSE);
+	g_return_val_if_fail (GKM_IS_SECRET (other), FALSE);
 	if (self == other)
 		return TRUE;
-	return gck_secret_equals (self, other->memory, other->n_memory);
+	return gkm_secret_equals (self, other->memory, other->n_memory);
 }
 
 gboolean
-gck_secret_equals (GckSecret *self, const guchar* pin, gssize n_pin)
+gkm_secret_equals (GkmSecret *self, const guchar* pin, gssize n_pin)
 {
-	g_return_val_if_fail (GCK_IS_SECRET (self), FALSE);
-	
+	g_return_val_if_fail (GKM_IS_SECRET (self), FALSE);
+
 	/* In case they're different somewhere */
 	if (n_pin == (CK_ULONG)-1)
 		n_pin = -1;
-	
+
 	if (n_pin == -1 && pin != NULL)
 		n_pin = strlen ((const gchar*)pin);
 
diff --git a/pkcs11/gkm/gkm-secret.h b/pkcs11/gkm/gkm-secret.h
new file mode 100644
index 0000000..4920b8d
--- /dev/null
+++ b/pkcs11/gkm/gkm-secret.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 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 __GKM_SECRET_H__
+#define __GKM_SECRET_H__
+
+#include <glib-object.h>
+
+#include "gkm-types.h"
+
+#include "pkcs11/pkcs11.h"
+
+#define GKM_TYPE_SECRET               (gkm_secret_get_type ())
+#define GKM_SECRET(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_SECRET, GkmSecret))
+#define GKM_SECRET_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_SECRET, GkmSecretClass))
+#define GKM_IS_SECRET(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_SECRET))
+#define GKM_IS_SECRET_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_SECRET))
+#define GKM_SECRET_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_SECRET, GkmSecretClass))
+
+typedef struct _GkmSecretClass GkmSecretClass;
+
+struct _GkmSecretClass {
+	GObjectClass parent_class;
+};
+
+GType               gkm_secret_get_type               (void);
+
+GkmSecret*          gkm_secret_new                    (const guchar *data,
+                                                       gssize n_data);
+
+GkmSecret*          gkm_secret_new_from_login         (CK_UTF8CHAR_PTR pin,
+                                                       CK_ULONG n_pin);
+
+GkmSecret*          gkm_secret_new_from_password      (const gchar *password);
+
+const guchar*       gkm_secret_get                    (GkmSecret *self,
+                                                       gsize *n_data);
+
+const gchar*        gkm_secret_get_password           (GkmSecret *self,
+                                                       gsize *n_pin);
+
+gboolean            gkm_secret_equal                  (GkmSecret *self,
+                                                       GkmSecret *other);
+
+gboolean            gkm_secret_equals                 (GkmSecret *self,
+                                                       const guchar *data,
+                                                       gssize n_data);
+
+#endif /* __GKM_SECRET_H__ */
diff --git a/pkcs11/gck/gck-serializable.c b/pkcs11/gkm/gkm-serializable.c
similarity index 66%
rename from pkcs11/gck/gck-serializable.c
rename to pkcs11/gkm/gkm-serializable.c
index ef42505..aded466 100644
--- a/pkcs11/gck/gck-serializable.c
+++ b/pkcs11/gkm/gkm-serializable.c
@@ -1,49 +1,49 @@
-/* 
+/*
  * 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"
 
-#include "gck-serializable.h"
+#include "gkm-serializable.h"
 
 static void
-gck_serializable_base_init (gpointer gobject_class)
+gkm_serializable_base_init (gpointer gobject_class)
 {
 	static gboolean initialized = FALSE;
 	if (!initialized) {
 		/* Add properties and signals to the interface */
-		
-		
+
+
 		initialized = TRUE;
 	}
 }
 
 GType
-gck_serializable_get_type (void)
+gkm_serializable_get_type (void)
 {
 	static volatile gsize type_id__volatile = 0;
-	
+
 	if (g_once_init_enter (&type_id__volatile)) {
 		static const GTypeInfo info = {
-			sizeof (GckSerializableIface),
-			gck_serializable_base_init,               /* base init */
+			sizeof (GkmSerializableIface),
+			gkm_serializable_base_init,               /* base init */
 			NULL,             /* base finalize */
 			NULL,             /* class_init */
 			NULL,             /* class finalize */
@@ -52,28 +52,28 @@ gck_serializable_get_type (void)
 			0,                /* n_preallocs */
 			NULL,             /* instance init */
 		};
-		
-		GType type_id = g_type_register_static (G_TYPE_INTERFACE, "GckSerializableIface", &info, 0);
+
+		GType type_id = g_type_register_static (G_TYPE_INTERFACE, "GkmSerializableIface", &info, 0);
 		g_type_interface_add_prerequisite (type_id, G_TYPE_OBJECT);
-		
+
 		g_once_init_leave (&type_id__volatile, type_id);
 	}
-	
+
 	return type_id__volatile;
 }
 
 gboolean
-gck_serializable_load (GckSerializable *self, GckSecret *login, const guchar *data, gsize n_data)
+gkm_serializable_load (GkmSerializable *self, GkmSecret *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);
-	return GCK_SERIALIZABLE_GET_INTERFACE (self)->load (self, login, data, n_data);
+	g_return_val_if_fail (GKM_IS_SERIALIZABLE (self), FALSE);
+	g_return_val_if_fail (GKM_SERIALIZABLE_GET_INTERFACE (self)->load, FALSE);
+	return GKM_SERIALIZABLE_GET_INTERFACE (self)->load (self, login, data, n_data);
 }
 
 gboolean
-gck_serializable_save (GckSerializable *self, GckSecret *login, guchar **data, gsize *n_data)
+gkm_serializable_save (GkmSerializable *self, GkmSecret *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);
-	return GCK_SERIALIZABLE_GET_INTERFACE (self)->save (self, login, data, n_data);
+	g_return_val_if_fail (GKM_IS_SERIALIZABLE (self), FALSE);
+	g_return_val_if_fail (GKM_SERIALIZABLE_GET_INTERFACE (self)->save, FALSE);
+	return GKM_SERIALIZABLE_GET_INTERFACE (self)->save (self, login, data, n_data);
 }
diff --git a/pkcs11/gck/gck-serializable.h b/pkcs11/gkm/gkm-serializable.h
similarity index 55%
rename from pkcs11/gck/gck-serializable.h
rename to pkcs11/gkm/gkm-serializable.h
index f19878c..fbf3583 100644
--- a/pkcs11/gck/gck-serializable.h
+++ b/pkcs11/gkm/gkm-serializable.h
@@ -1,64 +1,63 @@
-/* 
+/*
  * 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.
  */
 
-#ifndef __GCK_SERIALIZABLE_H__
-#define __GCK_SERIALIZABLE_H__
+#ifndef __GKM_SERIALIZABLE_H__
+#define __GKM_SERIALIZABLE_H__
 
 #include <glib-object.h>
 
-#include "gck-types.h"
+#include "gkm-types.h"
 
 G_BEGIN_DECLS
 
-#define GCK_TYPE_SERIALIZABLE                 (gck_serializable_get_type())
-#define GCK_SERIALIZABLE(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCK_TYPE_SERIALIZABLE, GckSerializable))
-#define GCK_IS_SERIALIZABLE(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCK_TYPE_SERIALIZABLE))
-#define GCK_SERIALIZABLE_GET_INTERFACE(inst)  (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GCK_TYPE_SERIALIZABLE, GckSerializableIface))
+#define GKM_TYPE_SERIALIZABLE                 (gkm_serializable_get_type())
+#define GKM_SERIALIZABLE(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_SERIALIZABLE, GkmSerializable))
+#define GKM_IS_SERIALIZABLE(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_SERIALIZABLE))
+#define GKM_SERIALIZABLE_GET_INTERFACE(inst)  (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GKM_TYPE_SERIALIZABLE, GkmSerializableIface))
 
-typedef struct _GckSerializable      GckSerializable;
-typedef struct _GckSerializableIface GckSerializableIface;
+typedef struct _GkmSerializable      GkmSerializable;
+typedef struct _GkmSerializableIface GkmSerializableIface;
 
-struct _GckSerializableIface {
+struct _GkmSerializableIface {
 	GTypeInterface parent;
-	
+
 	const gchar *extension;
 
-	gboolean (*load) (GckSerializable *self, GckSecret *login, const guchar *data, gsize n_data);
-	
-	gboolean (*save) (GckSerializable *self, GckSecret *login, guchar **data, gsize *n_data);
+	gboolean (*load) (GkmSerializable *self, GkmSecret *login, const guchar *data, gsize n_data);
+
+	gboolean (*save) (GkmSerializable *self, GkmSecret *login, guchar **data, gsize *n_data);
 };
 
-GType                  gck_serializable_get_type                          (void) G_GNUC_CONST;
+GType                  gkm_serializable_get_type                          (void) G_GNUC_CONST;
 
-gboolean               gck_serializable_load                              (GckSerializable *self,
-                                                                           GckSecret *login,
+gboolean               gkm_serializable_load                              (GkmSerializable *self,
+                                                                           GkmSecret *login,
                                                                            const guchar *data,
                                                                            gsize n_data);
 
-gboolean                gck_serializable_save                             (GckSerializable *self,
-                                                                           GckSecret *login,
+gboolean                gkm_serializable_save                             (GkmSerializable *self,
+                                                                           GkmSecret *login,
                                                                            guchar** data,
                                                                            gsize *n_data);
 
 G_END_DECLS
 
-#endif /* __GCK_SERIALIZABLE_H__ */
-
+#endif /* __GKM_SERIALIZABLE_H__ */
diff --git a/pkcs11/gck/gck-session.c b/pkcs11/gkm/gkm-session.c
similarity index 58%
rename from pkcs11/gck/gck-session.c
rename to pkcs11/gkm/gkm-session.c
index d2f0ae4..474c1b2 100644
--- a/pkcs11/gck/gck-session.c
+++ b/pkcs11/gkm/gkm-session.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"
@@ -24,17 +24,17 @@
 #include "pkcs11/pkcs11.h"
 #include "pkcs11/pkcs11i.h"
 
-#include "gck-attributes.h"
-#include "gck-credential.h"
-#include "gck-crypto.h"
-#include "gck-factory.h"
-#include "gck-manager.h"
-#include "gck-memory-store.h"
-#include "gck-session.h"
-#include "gck-sexp.h"
-#include "gck-sexp-key.h"
-#include "gck-transaction.h"
-#include "gck-util.h"
+#include "gkm-attributes.h"
+#include "gkm-credential.h"
+#include "gkm-crypto.h"
+#include "gkm-factory.h"
+#include "gkm-manager.h"
+#include "gkm-memory-store.h"
+#include "gkm-session.h"
+#include "gkm-sexp.h"
+#include "gkm-sexp-key.h"
+#include "gkm-transaction.h"
+#include "gkm-util.h"
 
 enum {
 	PROP_0,
@@ -47,29 +47,29 @@ enum {
 	PROP_LOGGED_IN
 };
 
-struct _GckSessionPrivate {
+struct _GkmSessionPrivate {
 
 	CK_SESSION_HANDLE handle;
 	CK_SLOT_ID slot_id;
 	CK_ULONG apartment;
 
-	GckModule *module;
-	GckManager *manager;
-	GckStore *store;
+	GkmModule *module;
+	GkmManager *manager;
+	GkmStore *store;
 
 	CK_USER_TYPE logged_in;
 	gboolean read_only;
 
 	CK_NOTIFY notify_callback;
 	CK_VOID_PTR application_ptr;
-	
+
 	/* Objects owned by this session */
 	GHashTable *objects;
 
 	/* Used for operations */
-	void (*current_operation) (GckSession *self);
-	GckObject *current_object;
-	GckCredential *credential;
+	void (*current_operation) (GkmSession *self);
+	GkmObject *current_object;
+	GkmCredential *credential;
 
 	/* Used for find operations */
 	GArray *found_objects;
@@ -81,17 +81,17 @@ struct _GckSessionPrivate {
 	CK_ATTRIBUTE_TYPE crypto_method;
 };
 
-G_DEFINE_TYPE (GckSession, gck_session, G_TYPE_OBJECT);
+G_DEFINE_TYPE (GkmSession, gkm_session, G_TYPE_OBJECT);
 
-static void add_object (GckSession *self, GckTransaction *transaction, GckObject *object);
-static void remove_object (GckSession *self, GckTransaction *transaction, GckObject *object);
+static void add_object (GkmSession *self, GkmTransaction *transaction, GkmObject *object);
+static void remove_object (GkmSession *self, GkmTransaction *transaction, GkmObject *object);
 
 /* -----------------------------------------------------------------------------
- * INTERNAL 
+ * INTERNAL
  */
 
 static void
-cleanup_crypto (GckSession *self)
+cleanup_crypto (GkmSession *self)
 {
 	g_assert (self->pv->current_operation == cleanup_crypto);
 
@@ -102,7 +102,7 @@ cleanup_crypto (GckSession *self)
 	self->pv->crypto_mechanism = 0;
 	self->pv->crypto_method = 0;
 
-	g_assert (GCK_IS_OBJECT (self->pv->current_object));
+	g_assert (GKM_IS_OBJECT (self->pv->current_object));
 	if (self->pv->current_object)
 		g_object_unref (self->pv->current_object);
 	self->pv->current_object = NULL;
@@ -117,10 +117,10 @@ cleanup_crypto (GckSession *self)
 }
 
 static CK_RV
-prepare_crypto (GckSession *self, CK_MECHANISM_PTR mech, 
+prepare_crypto (GkmSession *self, CK_MECHANISM_PTR mech,
                 CK_ATTRIBUTE_TYPE method, CK_OBJECT_HANDLE handle)
 {
-	GckObject *object;
+	GkmObject *object;
 	CK_MECHANISM_TYPE_PTR mechanisms;
 	CK_ULONG n_mechanisms, i;
 	gsize n_data;
@@ -128,7 +128,7 @@ prepare_crypto (GckSession *self, CK_MECHANISM_PTR mech,
 	gulong key_type;
 	CK_RV rv;
 
-	g_assert (GCK_IS_SESSION (self));
+	g_assert (GKM_IS_SESSION (self));
 
 	/* Cancel any current operation */
 	if (self->pv->current_operation) {
@@ -139,16 +139,16 @@ prepare_crypto (GckSession *self, CK_MECHANISM_PTR mech,
 	g_assert (!self->pv->crypto_state);
 
 	/* First find the object */
-	rv = gck_session_lookup_readable_object (self, handle, &object);
+	rv = gkm_session_lookup_readable_object (self, handle, &object);
 	if (rv != CKR_OK)
 		return rv;
 
 	/* Make sure it's a key */
-	if (!gck_object_get_attribute_ulong (object, self, CKA_KEY_TYPE, &key_type))
+	if (!gkm_object_get_attribute_ulong (object, self, CKA_KEY_TYPE, &key_type))
 		return CKR_KEY_HANDLE_INVALID;
 
 	/* Lookup the mechanisms this object can do */
-	mechanisms = gck_object_get_attribute_data (object, self, CKA_ALLOWED_MECHANISMS, &n_data);
+	mechanisms = gkm_object_get_attribute_data (object, self, CKA_ALLOWED_MECHANISMS, &n_data);
 	if (mechanisms)
 		n_mechanisms = n_data / sizeof (CK_MECHANISM_TYPE);
 	else
@@ -160,20 +160,20 @@ prepare_crypto (GckSession *self, CK_MECHANISM_PTR mech,
 		if (mechanisms[i] == mech->mechanism)
 			have = TRUE;
 	}
-	
+
 	g_free (mechanisms);
 
 	if (have == FALSE)
 		return CKR_KEY_TYPE_INCONSISTENT;
 
 	/* Check that the object can do this method */
-	if (!gck_object_get_attribute_boolean (object, self, method, &have) || !have)
+	if (!gkm_object_get_attribute_boolean (object, self, method, &have) || !have)
 		return CKR_KEY_FUNCTION_NOT_PERMITTED;
-	
+
 	/* Track the cyrpto object */
 	self->pv->current_object = object;
 	g_object_ref (object);
-	
+
 	/* And note what we're setup for */
 	self->pv->current_operation = cleanup_crypto;
 	self->pv->crypto_mechanism = mech->mechanism;
@@ -183,240 +183,240 @@ prepare_crypto (GckSession *self, CK_MECHANISM_PTR mech,
 }
 
 static CK_RV
-process_crypto (GckSession *self, CK_ATTRIBUTE_TYPE method, CK_BYTE_PTR bufone, 
+process_crypto (GkmSession *self, CK_ATTRIBUTE_TYPE method, CK_BYTE_PTR bufone,
                 CK_ULONG n_bufone, CK_BYTE_PTR buftwo, CK_ULONG_PTR n_buftwo)
 {
 	CK_RV rv = CKR_OK;
-	
-	g_assert (GCK_IS_SESSION (self));
+
+	g_assert (GKM_IS_SESSION (self));
 
 	if (self->pv->current_operation != cleanup_crypto)
 		return CKR_OPERATION_NOT_INITIALIZED;
 	if (method != self->pv->crypto_method)
 		return CKR_OPERATION_NOT_INITIALIZED;
-	
+
 	if (!bufone || !n_buftwo)
 		rv = CKR_ARGUMENTS_BAD;
-	
+
 	if (rv == CKR_OK) {
 		/* Load up the actual sexp we're going to use */
 		if (!self->pv->crypto_state) {
-			g_return_val_if_fail (GCK_IS_OBJECT (self->pv->current_object), CKR_GENERAL_ERROR);
-			rv = gck_crypto_prepare (self, self->pv->crypto_mechanism, self->pv->current_object);
+			g_return_val_if_fail (GKM_IS_OBJECT (self->pv->current_object), CKR_GENERAL_ERROR);
+			rv = gkm_crypto_prepare (self, self->pv->crypto_mechanism, self->pv->current_object);
 		}
 	}
 
 	if (rv == CKR_OK) {
 		g_assert (self->pv->crypto_mechanism);
-		rv = gck_crypto_perform (self, self->pv->crypto_mechanism, method,
+		rv = gkm_crypto_perform (self, self->pv->crypto_mechanism, method,
 		                         bufone, n_bufone, buftwo, n_buftwo);
 	}
-	
+
 	/* Under these conditions the operation isn't complete */
-	if (rv == CKR_BUFFER_TOO_SMALL || rv == CKR_USER_NOT_LOGGED_IN || 
+	if (rv == CKR_BUFFER_TOO_SMALL || rv == CKR_USER_NOT_LOGGED_IN ||
 	    (rv == CKR_OK && buftwo == NULL))
 		return rv;
-	
+
 	cleanup_crypto (self);
 	return rv;
 }
 
 static void
-cleanup_found (GckSession *self)
+cleanup_found (GkmSession *self)
 {
-	g_assert (GCK_IS_SESSION (self));
-	
+	g_assert (GKM_IS_SESSION (self));
+
 	g_assert (self->pv->found_objects);
 	g_array_free (self->pv->found_objects, TRUE);
 	self->pv->found_objects = NULL;
-	
+
 	self->pv->current_operation = NULL;
 }
 
 static CK_RV
-lookup_object_from_handle (GckSession *self, CK_OBJECT_HANDLE handle,
-                           gboolean writable, GckObject **result)
+lookup_object_from_handle (GkmSession *self, CK_OBJECT_HANDLE handle,
+                           gboolean writable, GkmObject **result)
 {
-	GckManager *manager;
-	GckObject *object;
+	GkmManager *manager;
+	GkmObject *object;
 	gboolean is_private;
 	gboolean is_token;
 	gboolean is_modifiable;
-	
+
 	g_return_val_if_fail (result, CKR_GENERAL_ERROR);
-	g_return_val_if_fail (GCK_IS_SESSION (self), CKR_GENERAL_ERROR);
-	
+	g_return_val_if_fail (GKM_IS_SESSION (self), CKR_GENERAL_ERROR);
+
 	if (handle == 0)
 		return CKR_OBJECT_HANDLE_INVALID;
 
 	/* Try looking up in the token manager */
-	manager = gck_module_get_manager (self->pv->module);
-	object = gck_manager_find_by_handle (manager, handle);
+	manager = gkm_module_get_manager (self->pv->module);
+	object = gkm_manager_find_by_handle (manager, handle);
 	is_token = TRUE;
-	
+
 	/* Try looking up in the session manager */
 	if (object == NULL) {
-		manager = gck_session_get_manager (self);
-		object = gck_manager_find_by_handle (manager, handle);
+		manager = gkm_session_get_manager (self);
+		object = gkm_manager_find_by_handle (manager, handle);
 		is_token = FALSE;
 	}
-	
+
 	if (object == NULL)
 		return CKR_OBJECT_HANDLE_INVALID;
 
 	g_return_val_if_fail (manager, CKR_GENERAL_ERROR);
-	
-	/* 
-	 * Check that we're not accessing private objects on a 
-	 * non-logged in session 
+
+	/*
+	 * Check that we're not accessing private objects on a
+	 * non-logged in session
 	 */
 	if (self->pv->logged_in != CKU_USER) {
-		if (!gck_object_get_attribute_boolean (object, self, CKA_PRIVATE, &is_private))
+		if (!gkm_object_get_attribute_boolean (object, self, CKA_PRIVATE, &is_private))
 			is_private = FALSE;
 		if (is_private)
 			return CKR_USER_NOT_LOGGED_IN;
 	}
-	
-	/* 
-	 * If we're going to write to this object check that we're in a 
+
+	/*
+	 * If we're going to write to this object check that we're in a
 	 * writable session and object is modifiable.
 	 */
 	if (writable) {
 		if (is_token) {
-			if (!gck_object_is_transient (object))
-				if (gck_module_get_write_protected (self->pv->module))
+			if (!gkm_object_is_transient (object))
+				if (gkm_module_get_write_protected (self->pv->module))
 					return CKR_TOKEN_WRITE_PROTECTED;
 			if (self->pv->read_only)
 				return CKR_SESSION_READ_ONLY;
 		}
-		if (!gck_object_get_attribute_boolean (object, self, CKA_MODIFIABLE, &is_modifiable))
+		if (!gkm_object_get_attribute_boolean (object, self, CKA_MODIFIABLE, &is_modifiable))
 			is_modifiable = FALSE;
 		if (!is_modifiable) /* What's a better return code in this case? */
 			return CKR_ATTRIBUTE_READ_ONLY;
 	}
-	
+
 	*result = object;
 	return CKR_OK;
 }
 
 
 static gboolean
-complete_remove (GckTransaction *transaction, GckSession *self, GckObject *object)
+complete_remove (GkmTransaction *transaction, GkmSession *self, GkmObject *object)
 {
-	if (gck_transaction_get_failed (transaction))
+	if (gkm_transaction_get_failed (transaction))
 		add_object (self, NULL, object);
 	g_object_unref (object);
 	return TRUE;
 }
 
 static void
-remove_object (GckSession *self, GckTransaction *transaction, GckObject *object)
+remove_object (GkmSession *self, GkmTransaction *transaction, GkmObject *object)
 {
-	g_assert (GCK_IS_SESSION (self));
-	g_assert (GCK_IS_OBJECT (object));
-	
+	g_assert (GKM_IS_SESSION (self));
+	g_assert (GKM_IS_OBJECT (object));
+
 	g_object_ref (object);
-	
-	gck_object_expose_full (object, transaction, FALSE);
+
+	gkm_object_expose_full (object, transaction, FALSE);
 	if (!g_hash_table_remove (self->pv->objects, object))
 		g_return_if_reached ();
 	g_object_set (object, "store", NULL, NULL);
-	
+
 	if (transaction)
-		gck_transaction_add (transaction, self, (GckTransactionFunc)complete_remove, 
+		gkm_transaction_add (transaction, self, (GkmTransactionFunc)complete_remove,
 		                     g_object_ref (object));
-	
+
 	g_object_unref (object);
 }
 
 static gboolean
-complete_add (GckTransaction *transaction, GckSession *self, GckObject *object)
+complete_add (GkmTransaction *transaction, GkmSession *self, GkmObject *object)
 {
-	if (gck_transaction_get_failed (transaction))
+	if (gkm_transaction_get_failed (transaction))
 		remove_object (self, NULL, object);
 	g_object_unref (object);
 	return TRUE;
 }
 
 static void
-add_object (GckSession *self, GckTransaction *transaction, GckObject *object)
+add_object (GkmSession *self, GkmTransaction *transaction, GkmObject *object)
 {
-	g_assert (GCK_IS_SESSION (self));
-	g_assert (GCK_IS_OBJECT (object));
-	
+	g_assert (GKM_IS_SESSION (self));
+	g_assert (GKM_IS_OBJECT (object));
+
 	/* Must not already be associated with a session or manager */
-	g_return_if_fail (gck_object_get_manager (object) == self->pv->manager);
+	g_return_if_fail (gkm_object_get_manager (object) == self->pv->manager);
 	g_return_if_fail (g_object_get_data (G_OBJECT (object), "owned-by-session") == NULL);
 	g_return_if_fail (g_hash_table_lookup (self->pv->objects, object) == NULL);
-	
+
 	g_hash_table_insert (self->pv->objects, object, g_object_ref (object));
 	g_object_set_data (G_OBJECT (object), "owned-by-session", self);
 	g_object_set (object, "store", self->pv->store, NULL);
-	gck_object_expose_full (object, transaction, TRUE);
+	gkm_object_expose_full (object, transaction, TRUE);
 
 	if (transaction)
-		gck_transaction_add (transaction, self, (GckTransactionFunc)complete_add, 
+		gkm_transaction_add (transaction, self, (GkmTransactionFunc)complete_add,
 		                     g_object_ref (object));
 }
 
 static gboolean
-attributes_find_boolean (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, 
+attributes_find_boolean (CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs,
                          CK_ATTRIBUTE_TYPE type, CK_BBOOL *value)
 {
 	CK_ULONG i;
-	
+
 	g_assert (attrs || !n_attrs);
 	g_assert (value);
-	
+
 	for (i = 0; i < n_attrs; ++i) {
-		if (attrs[i].type == type && 
-		    attrs[i].pValue != NULL && 
+		if (attrs[i].type == type &&
+		    attrs[i].pValue != NULL &&
 		    attrs[i].ulValueLen == sizeof (CK_BBOOL)) {
 			*value = *((CK_BBOOL*)attrs[i].pValue);
 			return TRUE;
 		}
 	}
-	
+
 	return FALSE;
 }
 
 /* -----------------------------------------------------------------------------
- * OBJECT 
+ * OBJECT
  */
 
 
-static GObject* 
-gck_session_constructor (GType type, guint n_props, GObjectConstructParam *props) 
+static GObject*
+gkm_session_constructor (GType type, guint n_props, GObjectConstructParam *props)
 {
-	GckSession *self = GCK_SESSION (G_OBJECT_CLASS (gck_session_parent_class)->constructor(type, n_props, props));
+	GkmSession *self = GKM_SESSION (G_OBJECT_CLASS (gkm_session_parent_class)->constructor(type, n_props, props));
 	CK_ATTRIBUTE attr;
 
-	g_return_val_if_fail (self, NULL);	
+	g_return_val_if_fail (self, NULL);
 
 	/* Register store attributes */
 	attr.type = CKA_LABEL;
 	attr.pValue = "";
 	attr.ulValueLen = 0;
-	gck_store_register_schema (self->pv->store, &attr, NULL, 0);
-	
+	gkm_store_register_schema (self->pv->store, &attr, NULL, 0);
+
 	return G_OBJECT (self);
 }
 
 static void
-gck_session_init (GckSession *self)
+gkm_session_init (GkmSession *self)
 {
-	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GCK_TYPE_SESSION, GckSessionPrivate);
-	self->pv->objects = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, gck_util_dispose_unref);
+	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GKM_TYPE_SESSION, GkmSessionPrivate);
+	self->pv->objects = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, gkm_util_dispose_unref);
 	self->pv->read_only = TRUE;
-	
+
 	/* Create the store and register attributes */
-	self->pv->store = GCK_STORE (gck_memory_store_new ());
+	self->pv->store = GKM_STORE (gkm_memory_store_new ());
 }
 
 static void
-gck_session_dispose (GObject *obj)
+gkm_session_dispose (GObject *obj)
 {
-	GckSession *self = GCK_SESSION (obj);
+	GkmSession *self = GKM_SESSION (obj);
 
 	/* Cleanup any current operation */
 	if (self->pv->current_operation)
@@ -439,32 +439,32 @@ gck_session_dispose (GObject *obj)
 		g_object_unref (self->pv->manager);
 	self->pv->manager = NULL;
 
-	G_OBJECT_CLASS (gck_session_parent_class)->dispose (obj);
+	G_OBJECT_CLASS (gkm_session_parent_class)->dispose (obj);
 }
 
 static void
-gck_session_finalize (GObject *obj)
+gkm_session_finalize (GObject *obj)
 {
-	GckSession *self = GCK_SESSION (obj);
+	GkmSession *self = GKM_SESSION (obj);
 
 	g_assert (self->pv->module == NULL);
 	g_assert (self->pv->manager == NULL);
-	
+
 	g_hash_table_destroy (self->pv->objects);
 	self->pv->objects = NULL;
-	
+
 	g_object_unref (self->pv->store);
 	self->pv->store = NULL;
-	
-	G_OBJECT_CLASS (gck_session_parent_class)->finalize (obj);
+
+	G_OBJECT_CLASS (gkm_session_parent_class)->finalize (obj);
 }
 
 static void
-gck_session_set_property (GObject *obj, guint prop_id, const GValue *value, 
+gkm_session_set_property (GObject *obj, guint prop_id, const GValue *value,
                            GParamSpec *pspec)
 {
-	GckSession *self = GCK_SESSION (obj);
-	
+	GkmSession *self = GKM_SESSION (obj);
+
 	switch (prop_id) {
 	case PROP_MODULE:
 		g_return_if_fail (!self->pv->module);
@@ -492,7 +492,7 @@ gck_session_set_property (GObject *obj, guint prop_id, const GValue *value,
 		self->pv->read_only = g_value_get_boolean (value);
 		break;
 	case PROP_LOGGED_IN:
-		gck_session_set_logged_in (self, g_value_get_ulong (value));
+		gkm_session_set_logged_in (self, g_value_get_ulong (value));
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -501,32 +501,32 @@ gck_session_set_property (GObject *obj, guint prop_id, const GValue *value,
 }
 
 static void
-gck_session_get_property (GObject *obj, guint prop_id, GValue *value, 
+gkm_session_get_property (GObject *obj, guint prop_id, GValue *value,
                            GParamSpec *pspec)
 {
-	GckSession *self = GCK_SESSION (obj);
-	
+	GkmSession *self = GKM_SESSION (obj);
+
 	switch (prop_id) {
 	case PROP_MODULE:
-		g_value_set_object (value, gck_session_get_module (self));
+		g_value_set_object (value, gkm_session_get_module (self));
 		break;
 	case PROP_MANAGER:
-		g_value_set_object (value, gck_session_get_manager (self));
+		g_value_set_object (value, gkm_session_get_manager (self));
 		break;
 	case PROP_SLOT_ID:
-		g_value_set_ulong (value, gck_session_get_slot_id (self));
+		g_value_set_ulong (value, gkm_session_get_slot_id (self));
 		break;
 	case PROP_APARTMENT:
-		g_value_set_ulong (value, gck_session_get_apartment (self));
+		g_value_set_ulong (value, gkm_session_get_apartment (self));
 		break;
 	case PROP_HANDLE:
-		g_value_set_ulong (value, gck_session_get_handle (self));
+		g_value_set_ulong (value, gkm_session_get_handle (self));
 		break;
 	case PROP_READ_ONLY:
-		g_value_set_boolean (value, gck_session_get_read_only (self));
+		g_value_set_boolean (value, gkm_session_get_read_only (self));
 		break;
 	case PROP_LOGGED_IN:
-		g_value_set_ulong (value, gck_session_get_logged_in (self));
+		g_value_set_ulong (value, gkm_session_get_logged_in (self));
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -535,33 +535,33 @@ gck_session_get_property (GObject *obj, guint prop_id, GValue *value,
 }
 
 static void
-gck_session_class_init (GckSessionClass *klass)
+gkm_session_class_init (GkmSessionClass *klass)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-    
-	gck_session_parent_class = g_type_class_peek_parent (klass);
-	g_type_class_add_private (klass, sizeof (GckSessionPrivate));
-
-	gobject_class->constructor = gck_session_constructor;
-	gobject_class->dispose = gck_session_dispose;
-	gobject_class->finalize = gck_session_finalize;
-	gobject_class->set_property = gck_session_set_property;
-	gobject_class->get_property = gck_session_get_property;
-    
+
+	gkm_session_parent_class = g_type_class_peek_parent (klass);
+	g_type_class_add_private (klass, sizeof (GkmSessionPrivate));
+
+	gobject_class->constructor = gkm_session_constructor;
+	gobject_class->dispose = gkm_session_dispose;
+	gobject_class->finalize = gkm_session_finalize;
+	gobject_class->set_property = gkm_session_set_property;
+	gobject_class->get_property = gkm_session_get_property;
+
 	g_object_class_install_property (gobject_class, PROP_MODULE,
-	         g_param_spec_object ("module", "Module", "Module this session belongs to", 
-	                              GCK_TYPE_MODULE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-	
+	         g_param_spec_object ("module", "Module", "Module this session belongs to",
+	                              GKM_TYPE_MODULE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
 	g_object_class_install_property (gobject_class, PROP_MANAGER,
-	         g_param_spec_object ("manager", "Manager", "Object manager for this session", 
-	                              GCK_TYPE_MANAGER, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+	         g_param_spec_object ("manager", "Manager", "Object manager for this session",
+	                              GKM_TYPE_MANAGER, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
 
 	g_object_class_install_property (gobject_class, PROP_HANDLE,
-	         g_param_spec_ulong ("handle", "Handle", "PKCS#11 session handle", 
+	         g_param_spec_ulong ("handle", "Handle", "PKCS#11 session handle",
 	                             0, G_MAXULONG, 0, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
 
 	g_object_class_install_property (gobject_class, PROP_SLOT_ID,
-	         g_param_spec_ulong ("slot-id", "Slot ID", "Slot ID this session is opened on", 
+	         g_param_spec_ulong ("slot-id", "Slot ID", "Slot ID this session is opened on",
 	                             0, G_MAXULONG, 0, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
 
 	g_object_class_install_property (gobject_class, PROP_APARTMENT,
@@ -573,85 +573,85 @@ gck_session_class_init (GckSessionClass *klass)
 	                               TRUE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
 
 	g_object_class_install_property (gobject_class, PROP_LOGGED_IN,
-	         g_param_spec_ulong ("logged-in", "Logged in", "Whether this session is logged in or not", 
+	         g_param_spec_ulong ("logged-in", "Logged in", "Whether this session is logged in or not",
 	                             0, G_MAXULONG, CKU_NONE, G_PARAM_READWRITE));
 }
 
 /* -----------------------------------------------------------------------------
- * PUBLIC 
+ * PUBLIC
  */
 
-GckSession*
-gck_session_for_session_object (GckObject *obj)
+GkmSession*
+gkm_session_for_session_object (GkmObject *obj)
 {
-	g_return_val_if_fail (GCK_IS_OBJECT (obj), NULL);
-	return GCK_SESSION (g_object_get_data (G_OBJECT (obj), "owned-by-session"));
+	g_return_val_if_fail (GKM_IS_OBJECT (obj), NULL);
+	return GKM_SESSION (g_object_get_data (G_OBJECT (obj), "owned-by-session"));
 }
 
 CK_SESSION_HANDLE
-gck_session_get_handle (GckSession *self)
+gkm_session_get_handle (GkmSession *self)
 {
-	g_return_val_if_fail (GCK_IS_SESSION (self), 0);
+	g_return_val_if_fail (GKM_IS_SESSION (self), 0);
 	return self->pv->handle;
 }
 
 CK_SLOT_ID
-gck_session_get_slot_id (GckSession *self)
+gkm_session_get_slot_id (GkmSession *self)
 {
-	g_return_val_if_fail (GCK_IS_SESSION (self), 0);
-	return self->pv->slot_id;	
+	g_return_val_if_fail (GKM_IS_SESSION (self), 0);
+	return self->pv->slot_id;
 }
 
 CK_ULONG
-gck_session_get_apartment (GckSession *self)
+gkm_session_get_apartment (GkmSession *self)
 {
-	g_return_val_if_fail (GCK_IS_SESSION (self), 0);
+	g_return_val_if_fail (GKM_IS_SESSION (self), 0);
 	return self->pv->apartment;
 }
 
-GckModule*
-gck_session_get_module (GckSession *self)
+GkmModule*
+gkm_session_get_module (GkmSession *self)
 {
-	g_return_val_if_fail (GCK_IS_SESSION (self), NULL);
-	g_return_val_if_fail (GCK_IS_MODULE (self->pv->module), NULL);
-	return self->pv->module;	
+	g_return_val_if_fail (GKM_IS_SESSION (self), NULL);
+	g_return_val_if_fail (GKM_IS_MODULE (self->pv->module), NULL);
+	return self->pv->module;
 }
 
-GckManager*
-gck_session_get_manager (GckSession *self)
+GkmManager*
+gkm_session_get_manager (GkmSession *self)
 {
-	g_return_val_if_fail (GCK_IS_SESSION (self), NULL);
-	g_return_val_if_fail (GCK_IS_MANAGER (self->pv->manager), NULL);
-	return self->pv->manager;	
+	g_return_val_if_fail (GKM_IS_SESSION (self), NULL);
+	g_return_val_if_fail (GKM_IS_MANAGER (self->pv->manager), NULL);
+	return self->pv->manager;
 }
 
 gulong
-gck_session_get_logged_in (GckSession *self)
+gkm_session_get_logged_in (GkmSession *self)
 {
-	g_return_val_if_fail (GCK_IS_SESSION (self), FALSE);
+	g_return_val_if_fail (GKM_IS_SESSION (self), FALSE);
 	return self->pv->logged_in;
 }
 
 void
-gck_session_set_logged_in (GckSession *self, gulong logged_in)
+gkm_session_set_logged_in (GkmSession *self, gulong logged_in)
 {
-	g_return_if_fail (GCK_IS_SESSION (self));
+	g_return_if_fail (GKM_IS_SESSION (self));
 	self->pv->logged_in = logged_in;
 	g_object_notify (G_OBJECT (self), "logged-in");
 }
 
 gpointer
-gck_session_get_crypto_state (GckSession *self)
+gkm_session_get_crypto_state (GkmSession *self)
 {
-	g_return_val_if_fail (GCK_IS_SESSION (self), NULL);
+	g_return_val_if_fail (GKM_IS_SESSION (self), NULL);
 	return self->pv->crypto_state;
 }
 
 void
-gck_session_set_crypto_state (GckSession *self, gpointer state,
+gkm_session_set_crypto_state (GkmSession *self, gpointer state,
                               GDestroyNotify destroy)
 {
-	g_return_if_fail (GCK_IS_SESSION (self));
+	g_return_if_fail (GKM_IS_SESSION (self));
 	if (self->pv->crypto_state != state) {
 		if (self->pv->crypto_state && self->pv->crypto_destroy)
 			(self->pv->crypto_destroy) (self->pv->crypto_state);
@@ -661,57 +661,57 @@ gck_session_set_crypto_state (GckSession *self, gpointer state,
 }
 
 gboolean
-gck_session_get_read_only (GckSession *self)
+gkm_session_get_read_only (GkmSession *self)
 {
-	g_return_val_if_fail (GCK_IS_SESSION (self), TRUE);
+	g_return_val_if_fail (GKM_IS_SESSION (self), TRUE);
 	return self->pv->read_only;
 }
 
 CK_RV
-gck_session_lookup_readable_object (GckSession *self, CK_OBJECT_HANDLE handle, 
-                                    GckObject **result)
+gkm_session_lookup_readable_object (GkmSession *self, CK_OBJECT_HANDLE handle,
+                                    GkmObject **result)
 {
 	return lookup_object_from_handle (self, handle, FALSE, result);
 }
 
 CK_RV
-gck_session_lookup_writable_object (GckSession *self, CK_OBJECT_HANDLE handle, 
-                                    GckObject **result)
+gkm_session_lookup_writable_object (GkmSession *self, CK_OBJECT_HANDLE handle,
+                                    GkmObject **result)
 {
 	return lookup_object_from_handle (self, handle, TRUE, result);
 }
 
 CK_RV
-gck_session_login_context_specific (GckSession *self, CK_UTF8CHAR_PTR pin, CK_ULONG n_pin)
+gkm_session_login_context_specific (GkmSession *self, CK_UTF8CHAR_PTR pin, CK_ULONG n_pin)
 {
-	GckCredential *cred;
+	GkmCredential *cred;
 	gboolean always_auth;
 	gboolean is_private;
-	GckObject *object;
+	GkmObject *object;
 	CK_RV rv;
-	
-	g_return_val_if_fail (GCK_IS_SESSION (self), CKR_GENERAL_ERROR);
+
+	g_return_val_if_fail (GKM_IS_SESSION (self), CKR_GENERAL_ERROR);
 
 	if (!self->pv->current_object)
 		return CKR_OPERATION_NOT_INITIALIZED;
 
 	object = self->pv->current_object;
-	g_return_val_if_fail (GCK_IS_OBJECT (object), CKR_GENERAL_ERROR);
-	
-	if (!gck_object_get_attribute_boolean (object, self, CKA_ALWAYS_AUTHENTICATE, &always_auth))
-		always_auth = FALSE; 
-	if (!gck_object_get_attribute_boolean (object, self, CKA_PRIVATE, &is_private))
+	g_return_val_if_fail (GKM_IS_OBJECT (object), CKR_GENERAL_ERROR);
+
+	if (!gkm_object_get_attribute_boolean (object, self, CKA_ALWAYS_AUTHENTICATE, &always_auth))
+		always_auth = FALSE;
+	if (!gkm_object_get_attribute_boolean (object, self, CKA_PRIVATE, &is_private))
 		is_private = FALSE;
-	
+
 	/* A strange code, but that's what the spec says */
-	if (always_auth == FALSE) 
+	if (always_auth == FALSE)
 		return CKR_OPERATION_NOT_INITIALIZED;
-	
+
 	/* Double check that the object has what it takes */
 	g_return_val_if_fail (is_private == TRUE, CKR_GENERAL_ERROR);
 
 	/* Now create the strange object */
-	rv = gck_credential_create (self->pv->module, self->pv->manager,
+	rv = gkm_credential_create (self->pv->module, self->pv->manager,
 	                            self->pv->current_object, pin, n_pin, &cred);
 	if (rv != CKR_OK)
 		return rv;
@@ -725,63 +725,63 @@ gck_session_login_context_specific (GckSession *self, CK_UTF8CHAR_PTR pin, CK_UL
 }
 
 void
-gck_session_add_session_object (GckSession *self, GckTransaction *transaction,
-                                GckObject *obj)
+gkm_session_add_session_object (GkmSession *self, GkmTransaction *transaction,
+                                GkmObject *obj)
 {
-	g_return_if_fail (GCK_IS_SESSION (self));
-	g_return_if_fail (gck_session_for_session_object (obj) == NULL);
+	g_return_if_fail (GKM_IS_SESSION (self));
+	g_return_if_fail (gkm_session_for_session_object (obj) == NULL);
 
 	if (transaction) {
-		g_return_if_fail (GCK_IS_TRANSACTION (transaction));
-		g_return_if_fail (!gck_transaction_get_failed (transaction));
+		g_return_if_fail (GKM_IS_TRANSACTION (transaction));
+		g_return_if_fail (!gkm_transaction_get_failed (transaction));
 	}
 
 	add_object (self, transaction, obj);
 }
 
 void
-gck_session_destroy_session_object (GckSession *self, GckTransaction *transaction,
-                                    GckObject *obj)
+gkm_session_destroy_session_object (GkmSession *self, GkmTransaction *transaction,
+                                    GkmObject *obj)
 {
-	g_return_if_fail (GCK_IS_SESSION (self));
-	g_return_if_fail (gck_session_for_session_object (obj) == self);
+	g_return_if_fail (GKM_IS_SESSION (self));
+	g_return_if_fail (gkm_session_for_session_object (obj) == self);
 
 	if (transaction) {
-		g_return_if_fail (GCK_IS_TRANSACTION (transaction));
-		g_return_if_fail (!gck_transaction_get_failed (transaction));
+		g_return_if_fail (GKM_IS_TRANSACTION (transaction));
+		g_return_if_fail (!gkm_transaction_get_failed (transaction));
 	}
 
 	/* Don't actually destroy the credential */
-	if (self->pv->credential && GCK_OBJECT (self->pv->credential) == obj)
+	if (self->pv->credential && GKM_OBJECT (self->pv->credential) == obj)
 		return;
 
 	remove_object (self, transaction, obj);
 }
 
-GckCredential*
-gck_session_get_credential (GckSession *self)
+GkmCredential*
+gkm_session_get_credential (GkmSession *self)
 {
-	g_return_val_if_fail (GCK_IS_SESSION (self), NULL);
+	g_return_val_if_fail (GKM_IS_SESSION (self), NULL);
 	return self->pv->credential;
 }
 
-GckObject*
-gck_session_create_object_for_factory (GckSession *self, GckFactory *factory,
-                                       GckTransaction *transaction,
+GkmObject*
+gkm_session_create_object_for_factory (GkmSession *self, GkmFactory *factory,
+                                       GkmTransaction *transaction,
                                        CK_ATTRIBUTE_PTR template, CK_ULONG count)
 {
-	GckTransaction *owned = NULL;
-	GckObject  *object;
+	GkmTransaction *owned = NULL;
+	GkmObject  *object;
 
-	g_return_val_if_fail (GCK_IS_SESSION (self), NULL);
+	g_return_val_if_fail (GKM_IS_SESSION (self), NULL);
 	g_return_val_if_fail (factory && factory->func, NULL);
 	g_return_val_if_fail (template || !count, NULL);
 
 	/* The transaction for this whole dealio */
 	if (!transaction)
-		owned = transaction = gck_transaction_new ();
+		owned = transaction = gkm_transaction_new ();
 
-	g_return_val_if_fail (GCK_IS_TRANSACTION (transaction), NULL);
+	g_return_val_if_fail (GKM_IS_TRANSACTION (transaction), NULL);
 
 	/*
 	 * Duplicate the memory for the attributes (but not values) so we
@@ -793,18 +793,18 @@ gck_session_create_object_for_factory (GckSession *self, GckFactory *factory,
 	object = (factory->func) (self, transaction, template, count);
 
 	/* A NULL result without a failure code, bad */
-	if (object == NULL && !gck_transaction_get_failed (transaction)) {
+	if (object == NULL && !gkm_transaction_get_failed (transaction)) {
 		g_warn_if_reached ();
-		gck_transaction_fail (transaction, CKR_GENERAL_ERROR);
+		gkm_transaction_fail (transaction, CKR_GENERAL_ERROR);
 	}
 
 	g_free (template);
 
 	if (owned)
-		gck_transaction_complete (transaction);
+		gkm_transaction_complete (transaction);
 
 	/* Object is owned by module or session */
-	if (gck_transaction_get_failed (transaction)) {
+	if (gkm_transaction_get_failed (transaction)) {
 		if (object)
 			g_object_unref (object);
 		object = NULL;
@@ -816,81 +816,81 @@ gck_session_create_object_for_factory (GckSession *self, GckFactory *factory,
 	return object;
 }
 
-GckObject*
-gck_session_create_object_for_attributes (GckSession *self, GckTransaction *transaction,
+GkmObject*
+gkm_session_create_object_for_attributes (GkmSession *self, GkmTransaction *transaction,
                                           CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
 {
-	GckFactory *factory;
+	GkmFactory *factory;
 
-	g_return_val_if_fail (GCK_IS_SESSION (self), NULL);
+	g_return_val_if_fail (GKM_IS_SESSION (self), NULL);
 
 	/* Find out if we can create such an object */
-	factory = gck_module_find_factory (gck_session_get_module (self), attrs, n_attrs);
+	factory = gkm_module_find_factory (gkm_session_get_module (self), attrs, n_attrs);
 	if (factory == NULL) {
 		if (transaction)
-			gck_transaction_fail (transaction, CKR_TEMPLATE_INCOMPLETE);
+			gkm_transaction_fail (transaction, CKR_TEMPLATE_INCOMPLETE);
 		return NULL;
 	}
 
-	return gck_session_create_object_for_factory (self, factory, transaction, attrs, n_attrs);
+	return gkm_session_create_object_for_factory (self, factory, transaction, attrs, n_attrs);
 }
 
 void
-gck_session_complete_object_creation (GckSession *self, GckTransaction *transaction, GckObject *object,
+gkm_session_complete_object_creation (GkmSession *self, GkmTransaction *transaction, GkmObject *object,
                                       gboolean add, CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
 {
 	gboolean is_private;
 	gulong i;
 
-	g_return_if_fail (GCK_IS_SESSION (self));
-	g_return_if_fail (GCK_IS_OBJECT (object));
-	g_return_if_fail (GCK_IS_TRANSACTION (transaction));
-	g_return_if_fail (!gck_transaction_get_failed (transaction));
+	g_return_if_fail (GKM_IS_SESSION (self));
+	g_return_if_fail (GKM_IS_OBJECT (object));
+	g_return_if_fail (GKM_IS_TRANSACTION (transaction));
+	g_return_if_fail (!gkm_transaction_get_failed (transaction));
 
-	gck_object_create_attributes (object, self, transaction, attrs, n_attrs);
-	if (gck_transaction_get_failed (transaction))
+	gkm_object_create_attributes (object, self, transaction, attrs, n_attrs);
+	if (gkm_transaction_get_failed (transaction))
 		return;
 
 	/* See if we can create due to read-only */
-	if (gck_object_is_token (object)) {
-		if (!gck_object_is_transient (object) &&
-		    gck_module_get_write_protected (self->pv->module)) {
-			gck_transaction_fail (transaction, CKR_TOKEN_WRITE_PROTECTED);
+	if (gkm_object_is_token (object)) {
+		if (!gkm_object_is_transient (object) &&
+		    gkm_module_get_write_protected (self->pv->module)) {
+			gkm_transaction_fail (transaction, CKR_TOKEN_WRITE_PROTECTED);
 			return;
 		}
 		else if (self->pv->read_only) {
-			gck_transaction_fail (transaction, CKR_SESSION_READ_ONLY);
+			gkm_transaction_fail (transaction, CKR_SESSION_READ_ONLY);
 			return;
 		}
 	}
 
 	/* Can only create public objects unless logged in */
-	if (gck_session_get_logged_in (self) != CKU_USER &&
-	    gck_object_get_attribute_boolean (object, self, CKA_PRIVATE, &is_private) &&
+	if (gkm_session_get_logged_in (self) != CKU_USER &&
+	    gkm_object_get_attribute_boolean (object, self, CKA_PRIVATE, &is_private) &&
 	    is_private == TRUE) {
-		gck_transaction_fail (transaction, CKR_USER_NOT_LOGGED_IN);
+		gkm_transaction_fail (transaction, CKR_USER_NOT_LOGGED_IN);
 		return;
 	}
 
 	/* Add the object to session or token */
-	if (add && !gck_transaction_get_failed (transaction)) {
-		if (gck_object_is_token (object))
-			gck_module_add_token_object (self->pv->module, transaction, object);
+	if (add && !gkm_transaction_get_failed (transaction)) {
+		if (gkm_object_is_token (object))
+			gkm_module_add_token_object (self->pv->module, transaction, object);
 		else
 			add_object (self, transaction, object);
 	}
 
 	/* Next go through and set all attributes that weren't used initially */
-	gck_attributes_consume (attrs, n_attrs, CKA_TOKEN, G_MAXULONG);
-	for (i = 0; i < n_attrs && !gck_transaction_get_failed (transaction); ++i) {
-		if (!gck_attribute_consumed (&attrs[i]))
-			gck_object_set_attribute (object, self, transaction, &attrs[i]);
+	gkm_attributes_consume (attrs, n_attrs, CKA_TOKEN, G_MAXULONG);
+	for (i = 0; i < n_attrs && !gkm_transaction_get_failed (transaction); ++i) {
+		if (!gkm_attribute_consumed (&attrs[i]))
+			gkm_object_set_attribute (object, self, transaction, &attrs[i]);
 	}
 
 	/* Store the object */
-	if (!gck_transaction_get_failed (transaction)) {
-		if (gck_object_is_token (object))
-			gck_module_store_token_object (self->pv->module, transaction, object);
+	if (!gkm_transaction_get_failed (transaction)) {
+		if (gkm_object_is_token (object))
+			gkm_module_store_token_object (self->pv->module, transaction, object);
 	}
 }
 
@@ -898,27 +898,27 @@ gck_session_complete_object_creation (GckSession *self, GckTransaction *transact
  * PKCS#11
  */
 
-CK_RV 
-gck_session_C_GetFunctionStatus (GckSession *self)
+CK_RV
+gkm_session_C_GetFunctionStatus (GkmSession *self)
 {
-	g_return_val_if_fail (GCK_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
+	g_return_val_if_fail (GKM_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
 	return CKR_FUNCTION_NOT_PARALLEL;
 }
 
-CK_RV 
-gck_session_C_CancelFunction (GckSession *self)
+CK_RV
+gkm_session_C_CancelFunction (GkmSession *self)
 {
-	g_return_val_if_fail (GCK_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
+	g_return_val_if_fail (GKM_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
 	return CKR_FUNCTION_NOT_PARALLEL;
 }
 
 CK_RV
-gck_session_C_GetSessionInfo(GckSession* self, CK_SESSION_INFO_PTR info)
+gkm_session_C_GetSessionInfo(GkmSession* self, CK_SESSION_INFO_PTR info)
 {
-	g_return_val_if_fail (GCK_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
+	g_return_val_if_fail (GKM_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
 	if (!info)
 		return CKR_ARGUMENTS_BAD;
-	
+
 	info->slotID = self->pv->slot_id;
 	if (self->pv->logged_in == CKU_USER)
 		info->state = self->pv->read_only ? CKS_RO_USER_FUNCTIONS : CKS_RW_USER_FUNCTIONS;
@@ -930,12 +930,12 @@ gck_session_C_GetSessionInfo(GckSession* self, CK_SESSION_INFO_PTR info)
 	if (!self->pv->read_only)
 		info->flags |= CKF_RW_SESSION;
 	info->ulDeviceError = 0;
-	
+
 	return CKR_OK;
 }
 
 CK_RV
-gck_session_C_GetOperationState (GckSession* self, CK_BYTE_PTR operation_state,
+gkm_session_C_GetOperationState (GkmSession* self, CK_BYTE_PTR operation_state,
                                  CK_ULONG_PTR operation_state_len)
 {
 	/* Nope, We don't bend that way */
@@ -943,7 +943,7 @@ gck_session_C_GetOperationState (GckSession* self, CK_BYTE_PTR operation_state,
 }
 
 CK_RV
-gck_session_C_SetOperationState (GckSession* self, CK_BYTE_PTR operation_state,
+gkm_session_C_SetOperationState (GkmSession* self, CK_BYTE_PTR operation_state,
                                  CK_ULONG operation_state_len, CK_OBJECT_HANDLE encryption_key,
                                  CK_OBJECT_HANDLE authentication_key)
 {
@@ -952,28 +952,28 @@ gck_session_C_SetOperationState (GckSession* self, CK_BYTE_PTR operation_state,
 }
 
 CK_RV
-gck_session_C_CreateObject (GckSession* self, CK_ATTRIBUTE_PTR template,
+gkm_session_C_CreateObject (GkmSession* self, CK_ATTRIBUTE_PTR template,
                             CK_ULONG count, CK_OBJECT_HANDLE_PTR new_object)
 {
-	GckObject *object = NULL;
-	GckTransaction *transaction;
+	GkmObject *object = NULL;
+	GkmTransaction *transaction;
 	CK_RV rv;
 
-	g_return_val_if_fail (GCK_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
+	g_return_val_if_fail (GKM_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
 	if (!new_object)
 		return CKR_ARGUMENTS_BAD;
 	if (!(!count || template))
 		return CKR_ARGUMENTS_BAD;
 
-	transaction = gck_transaction_new ();
+	transaction = gkm_transaction_new ();
 
-	object = gck_session_create_object_for_attributes (self, transaction, template, count);
+	object = gkm_session_create_object_for_attributes (self, transaction, template, count);
 
-	rv = gck_transaction_complete_and_unref (transaction);
+	rv = gkm_transaction_complete_and_unref (transaction);
 
 	if (rv == CKR_OK) {
 		g_assert (object);
-		*new_object = gck_object_get_handle (object);
+		*new_object = gkm_object_get_handle (object);
 		g_object_unref (object);
 	}
 
@@ -981,54 +981,54 @@ gck_session_C_CreateObject (GckSession* self, CK_ATTRIBUTE_PTR template,
 }
 
 CK_RV
-gck_session_C_CopyObject (GckSession* self, CK_OBJECT_HANDLE object,
+gkm_session_C_CopyObject (GkmSession* self, CK_OBJECT_HANDLE object,
                           CK_ATTRIBUTE_PTR template, CK_ULONG count,
                           CK_OBJECT_HANDLE_PTR new_object)
 {
-	/* 
-	 * TODO: We need to implement this, initially perhaps only 
+	/*
+	 * TODO: We need to implement this, initially perhaps only
 	 * only for session objects.
 	 */
- 	return CKR_FUNCTION_NOT_SUPPORTED;
+	return CKR_FUNCTION_NOT_SUPPORTED;
 }
 
 CK_RV
-gck_session_C_GetObjectSize (GckSession* self, CK_OBJECT_HANDLE object, CK_ULONG_PTR size)
+gkm_session_C_GetObjectSize (GkmSession* self, CK_OBJECT_HANDLE object, CK_ULONG_PTR size)
 {
 	/* TODO: Do we need to implement this? */
 	return CKR_FUNCTION_NOT_SUPPORTED;
 }
 
 CK_RV
-gck_session_C_GetAttributeValue (GckSession* self, CK_OBJECT_HANDLE handle, 
+gkm_session_C_GetAttributeValue (GkmSession* self, CK_OBJECT_HANDLE handle,
                                  CK_ATTRIBUTE_PTR template, CK_ULONG count)
 {
-	GckObject *object;
+	GkmObject *object;
 	CK_ULONG i;
 	CK_RV code, rv;
-	
-	g_return_val_if_fail (GCK_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
+
+	g_return_val_if_fail (GKM_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
 	if (!(!count || template))
 		return CKR_ARGUMENTS_BAD;
-	
-	rv = gck_session_lookup_readable_object (self, handle, &object);
+
+	rv = gkm_session_lookup_readable_object (self, handle, &object);
 	if (rv != CKR_OK)
 		return rv;
-	
+
 	rv = CKR_OK;
-	
+
 	for (i = 0; i < count; ++i) {
-		code = gck_object_get_attribute (object, self, &template[i]);
+		code = gkm_object_get_attribute (object, self, &template[i]);
 
 		/* Not a true error, keep going */
 		if (code == CKR_ATTRIBUTE_SENSITIVE ||
 		    code == CKR_ATTRIBUTE_TYPE_INVALID) {
 			template[i].ulValueLen = (CK_ULONG)-1;
 			rv = code;
-			
+
 		} else if(code == CKR_BUFFER_TOO_SMALL) {
 			rv = code;
-			
+
 		/* Any other error aborts */
 		} else if (code != CKR_OK) {
 			rv = code;
@@ -1040,77 +1040,77 @@ gck_session_C_GetAttributeValue (GckSession* self, CK_OBJECT_HANDLE handle,
 }
 
 CK_RV
-gck_session_C_SetAttributeValue (GckSession* self, CK_OBJECT_HANDLE handle, 
+gkm_session_C_SetAttributeValue (GkmSession* self, CK_OBJECT_HANDLE handle,
                                  CK_ATTRIBUTE_PTR template, CK_ULONG count)
 {
-	GckObject *object = NULL;
-	GckTransaction *transaction;
+	GkmObject *object = NULL;
+	GkmTransaction *transaction;
 	CK_ULONG i;
 	CK_RV rv;
 
-	g_return_val_if_fail (GCK_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
+	g_return_val_if_fail (GKM_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
 	if (!(!count || template))
 		return CKR_ARGUMENTS_BAD;
 
-	rv = gck_session_lookup_writable_object (self, handle, &object);
+	rv = gkm_session_lookup_writable_object (self, handle, &object);
 	if (rv != CKR_OK)
 		return rv;
 
 	/* The transaction for this whole dealio */
-	transaction = gck_transaction_new ();
+	transaction = gkm_transaction_new ();
 
-	for (i = 0; i < count && !gck_transaction_get_failed (transaction); ++i) 
-		gck_object_set_attribute (object, self, transaction, &template[i]);
+	for (i = 0; i < count && !gkm_transaction_get_failed (transaction); ++i)
+		gkm_object_set_attribute (object, self, transaction, &template[i]);
 
 	/* Store the object */
-	if (!gck_transaction_get_failed (transaction) && gck_object_is_token (object))
-		gck_module_store_token_object (self->pv->module, transaction, object);
+	if (!gkm_transaction_get_failed (transaction) && gkm_object_is_token (object))
+		gkm_module_store_token_object (self->pv->module, transaction, object);
 
-	gck_transaction_complete (transaction);
-	rv = gck_transaction_get_result (transaction);
+	gkm_transaction_complete (transaction);
+	rv = gkm_transaction_get_result (transaction);
 	g_object_unref (transaction);
 
 	return rv;
 }
 
 CK_RV
-gck_session_C_DestroyObject (GckSession* self, CK_OBJECT_HANDLE handle)
+gkm_session_C_DestroyObject (GkmSession* self, CK_OBJECT_HANDLE handle)
 {
-	GckObject *object;
-	GckSession *session;
-	GckTransaction *transaction;
+	GkmObject *object;
+	GkmSession *session;
+	GkmTransaction *transaction;
 	CK_RV rv;
-	
-	g_return_val_if_fail (GCK_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
-	
-	rv = gck_session_lookup_writable_object (self, handle, &object);
+
+	g_return_val_if_fail (GKM_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
+
+	rv = gkm_session_lookup_writable_object (self, handle, &object);
 	if (rv != CKR_OK)
 		return rv;
-	
-	transaction = gck_transaction_new ();
+
+	transaction = gkm_transaction_new ();
 
 	/* Lookup the actual session that owns this object, if no session, then a token object */
-	session = gck_session_for_session_object (object);
+	session = gkm_session_for_session_object (object);
 	if (session != NULL)
 		remove_object (session, transaction, object);
 	else
-		gck_module_remove_token_object (self->pv->module, transaction, object);
-	
-	gck_transaction_complete (transaction);
-	rv = gck_transaction_get_result (transaction);
+		gkm_module_remove_token_object (self->pv->module, transaction, object);
+
+	gkm_transaction_complete (transaction);
+	rv = gkm_transaction_get_result (transaction);
 	g_object_unref (transaction);
-	
+
 	if (rv == CKR_OK) {
 		/* Check that it's really gone */
-		g_return_val_if_fail (gck_session_lookup_readable_object (self, handle, &object) == 
+		g_return_val_if_fail (gkm_session_lookup_readable_object (self, handle, &object) ==
 		                      CKR_OBJECT_HANDLE_INVALID, CKR_GENERAL_ERROR);
 	}
-	
+
 	return rv;
 }
 
 CK_RV
-gck_session_C_FindObjectsInit (GckSession* self, CK_ATTRIBUTE_PTR template,
+gkm_session_C_FindObjectsInit (GkmSession* self, CK_ATTRIBUTE_PTR template,
                                CK_ULONG count)
 {
 	CK_BBOOL token = CK_FALSE;
@@ -1118,11 +1118,11 @@ gck_session_C_FindObjectsInit (GckSession* self, CK_ATTRIBUTE_PTR template,
 	CK_RV rv = CKR_OK;
 	GArray *found;
 	gboolean all;
-	
-	g_return_val_if_fail (GCK_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
+
+	g_return_val_if_fail (GKM_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
 	if (!(template || !count))
 		return CKR_ARGUMENTS_BAD;
-	
+
 	/* Cancel any current operation */
 	if (self->pv->current_operation) {
 		(self->pv->current_operation) (self);
@@ -1131,22 +1131,22 @@ gck_session_C_FindObjectsInit (GckSession* self, CK_ATTRIBUTE_PTR template,
 
 	/* See whether this is token or not */
 	all = !attributes_find_boolean (template, count, CKA_TOKEN, &token);
-	
+
 	/* An array of object handles */
 	found = g_array_new (FALSE, TRUE, sizeof (CK_OBJECT_HANDLE));
 
 	/* If not logged in, then skip private objects */
-	also_private = gck_session_get_logged_in (self) == CKU_USER; 
+	also_private = gkm_session_get_logged_in (self) == CKU_USER;
 
 	if (all || token) {
-		rv = gck_module_refresh_token (self->pv->module);
+		rv = gkm_module_refresh_token (self->pv->module);
 		if (rv == CKR_OK)
-			rv = gck_manager_find_handles (gck_module_get_manager (self->pv->module), 
+			rv = gkm_manager_find_handles (gkm_module_get_manager (self->pv->module),
 			                               also_private, template, count, found);
 	}
-	
+
 	if (rv == CKR_OK && (all || !token)) {
-		rv = gck_manager_find_handles (self->pv->manager, also_private,
+		rv = gkm_manager_find_handles (self->pv->manager, also_private,
 		                               template, count, found);
 	}
 
@@ -1154,24 +1154,24 @@ gck_session_C_FindObjectsInit (GckSession* self, CK_ATTRIBUTE_PTR template,
 		g_array_free (found, TRUE);
 		return rv;
 	}
-	
+
 	g_assert (!self->pv->current_operation);
 	g_assert (!self->pv->found_objects);
-	
+
 	self->pv->found_objects = found;
 	self->pv->current_operation = cleanup_found;
-	
+
 	return CKR_OK;
 }
 
 CK_RV
-gck_session_C_FindObjects (GckSession* self, CK_OBJECT_HANDLE_PTR objects,
+gkm_session_C_FindObjects (GkmSession* self, CK_OBJECT_HANDLE_PTR objects,
                            CK_ULONG max_count, CK_ULONG_PTR count)
 {
 	CK_ULONG n_objects, i;
 	GArray *found;
-	
-	g_return_val_if_fail (GCK_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
+
+	g_return_val_if_fail (GKM_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
 	if (!(objects || !max_count))
 		return CKR_ARGUMENTS_BAD;
 	if (!count)
@@ -1179,26 +1179,26 @@ gck_session_C_FindObjects (GckSession* self, CK_OBJECT_HANDLE_PTR objects,
 
 	if (self->pv->current_operation != cleanup_found)
 		return CKR_OPERATION_NOT_INITIALIZED;
-	
+
 	g_assert (self->pv->found_objects);
 	found = self->pv->found_objects;
-	
+
 	n_objects = MIN (max_count, found->len);
 	if (n_objects > 0) {
 		for (i = 0; i < n_objects; ++i)
 			objects[i] = g_array_index (found, CK_OBJECT_HANDLE, i);
 		g_array_remove_range (found, 0, n_objects);
 	}
-	
+
 	*count = n_objects;
 	return CKR_OK;
-	
+
 }
 
 CK_RV
-gck_session_C_FindObjectsFinal (GckSession* self)
+gkm_session_C_FindObjectsFinal (GkmSession* self)
 {
-	g_return_val_if_fail (GCK_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
+	g_return_val_if_fail (GKM_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
 
 	if (self->pv->current_operation != cleanup_found)
 		return CKR_OPERATION_NOT_INITIALIZED;
@@ -1208,267 +1208,267 @@ gck_session_C_FindObjectsFinal (GckSession* self)
 }
 
 CK_RV
-gck_session_C_EncryptInit (GckSession *self, CK_MECHANISM_PTR mechanism,
+gkm_session_C_EncryptInit (GkmSession *self, CK_MECHANISM_PTR mechanism,
                            CK_OBJECT_HANDLE key)
 {
-	g_return_val_if_fail (GCK_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
+	g_return_val_if_fail (GKM_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
 	if (!mechanism)
 		return CKR_ARGUMENTS_BAD;
 	return prepare_crypto (self, mechanism, CKA_ENCRYPT, key);
 }
 
 CK_RV
-gck_session_C_Encrypt (GckSession *self, CK_BYTE_PTR data, CK_ULONG data_len,
+gkm_session_C_Encrypt (GkmSession *self, CK_BYTE_PTR data, CK_ULONG data_len,
                        CK_BYTE_PTR encrypted_data, CK_ULONG_PTR encrypted_data_len)
 {
-	g_return_val_if_fail (GCK_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
+	g_return_val_if_fail (GKM_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
 	return process_crypto (self, CKA_ENCRYPT, data, data_len, encrypted_data, encrypted_data_len);
 }
 
 CK_RV
-gck_session_C_EncryptUpdate (GckSession *self, CK_BYTE_PTR part,
+gkm_session_C_EncryptUpdate (GkmSession *self, CK_BYTE_PTR part,
                              CK_ULONG part_len, CK_BYTE_PTR encrypted_part,
                              CK_ULONG_PTR encrypted_part_len)
 {
 	/* Our keys don't support this incremental encryption */
- 	return CKR_FUNCTION_NOT_SUPPORTED;
+	return CKR_FUNCTION_NOT_SUPPORTED;
 }
 
 CK_RV
-gck_session_C_EncryptFinal (GckSession *self, CK_BYTE_PTR last_part,
+gkm_session_C_EncryptFinal (GkmSession *self, CK_BYTE_PTR last_part,
                             CK_ULONG_PTR last_part_len)
 {
 	/* Our keys don't support this incremental encryption */
- 	return CKR_FUNCTION_NOT_SUPPORTED;
+	return CKR_FUNCTION_NOT_SUPPORTED;
 }
 
 CK_RV
-gck_session_C_DecryptInit (GckSession *self, CK_MECHANISM_PTR mechanism,
+gkm_session_C_DecryptInit (GkmSession *self, CK_MECHANISM_PTR mechanism,
                            CK_OBJECT_HANDLE key)
 {
-	g_return_val_if_fail (GCK_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
+	g_return_val_if_fail (GKM_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
 	if (!mechanism)
 		return CKR_ARGUMENTS_BAD;
-	return prepare_crypto (self, mechanism, CKA_DECRYPT, key);	
+	return prepare_crypto (self, mechanism, CKA_DECRYPT, key);
 }
 
 CK_RV
-gck_session_C_Decrypt (GckSession *self, CK_BYTE_PTR enc_data,
+gkm_session_C_Decrypt (GkmSession *self, CK_BYTE_PTR enc_data,
                        CK_ULONG enc_data_len, CK_BYTE_PTR data, CK_ULONG_PTR data_len)
 {
-	g_return_val_if_fail (GCK_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
+	g_return_val_if_fail (GKM_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
 	return process_crypto (self, CKA_DECRYPT, enc_data, enc_data_len, data, data_len);
 }
 
 CK_RV
-gck_session_C_DecryptUpdate (GckSession *self, CK_BYTE_PTR enc_part,
+gkm_session_C_DecryptUpdate (GkmSession *self, CK_BYTE_PTR enc_part,
                              CK_ULONG enc_part_len, CK_BYTE_PTR part, CK_ULONG_PTR part_len)
 {
 	/* Our keys don't support this incremental decryption */
- 	return CKR_FUNCTION_NOT_SUPPORTED;
+	return CKR_FUNCTION_NOT_SUPPORTED;
 }
 
 CK_RV
-gck_session_C_DecryptFinal (GckSession *self, CK_BYTE_PTR last_part,
+gkm_session_C_DecryptFinal (GkmSession *self, CK_BYTE_PTR last_part,
                             CK_ULONG_PTR last_part_len)
 {
 	/* Our keys don't support this incremental decryption */
- 	return CKR_FUNCTION_NOT_SUPPORTED;
+	return CKR_FUNCTION_NOT_SUPPORTED;
 }
 
 CK_RV
-gck_session_C_DigestInit (GckSession *self, CK_MECHANISM_PTR mechanism)
+gkm_session_C_DigestInit (GkmSession *self, CK_MECHANISM_PTR mechanism)
 {
 	/* We don't do digests */
- 	return CKR_FUNCTION_NOT_SUPPORTED;
+	return CKR_FUNCTION_NOT_SUPPORTED;
 }
 
 CK_RV
-gck_session_C_Digest (GckSession *self, CK_BYTE_PTR data, CK_ULONG data_len,
+gkm_session_C_Digest (GkmSession *self, CK_BYTE_PTR data, CK_ULONG data_len,
                       CK_BYTE_PTR digest, CK_ULONG_PTR digest_len)
 {
 	/* We don't do digests */
- 	return CKR_FUNCTION_NOT_SUPPORTED;
+	return CKR_FUNCTION_NOT_SUPPORTED;
 }
 
 CK_RV
-gck_session_C_DigestUpdate (GckSession *self, CK_BYTE_PTR part, CK_ULONG part_len)
+gkm_session_C_DigestUpdate (GkmSession *self, CK_BYTE_PTR part, CK_ULONG part_len)
 {
 	/* We don't do digests */
- 	return CKR_FUNCTION_NOT_SUPPORTED;
+	return CKR_FUNCTION_NOT_SUPPORTED;
 }
 
 CK_RV
-gck_session_C_DigestKey (GckSession *self, CK_OBJECT_HANDLE key)
+gkm_session_C_DigestKey (GkmSession *self, CK_OBJECT_HANDLE key)
 {
 	/* We don't do digests */
- 	return CKR_FUNCTION_NOT_SUPPORTED;
+	return CKR_FUNCTION_NOT_SUPPORTED;
 }
 
 CK_RV
-gck_session_C_DigestFinal (GckSession *self, CK_BYTE_PTR digest,
+gkm_session_C_DigestFinal (GkmSession *self, CK_BYTE_PTR digest,
                            CK_ULONG_PTR digest_len)
 {
 	/* We don't do digests */
- 	return CKR_FUNCTION_NOT_SUPPORTED;
+	return CKR_FUNCTION_NOT_SUPPORTED;
 }
 
 CK_RV
-gck_session_C_SignInit (GckSession *self, CK_MECHANISM_PTR mechanism, 
+gkm_session_C_SignInit (GkmSession *self, CK_MECHANISM_PTR mechanism,
                         CK_OBJECT_HANDLE key)
 {
-	g_return_val_if_fail (GCK_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
+	g_return_val_if_fail (GKM_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
 	if (!mechanism)
 		return CKR_ARGUMENTS_BAD;
 	return prepare_crypto (self, mechanism, CKA_SIGN, key);
 }
 
 CK_RV
-gck_session_C_Sign (GckSession *self, CK_BYTE_PTR data, CK_ULONG data_len,
+gkm_session_C_Sign (GkmSession *self, CK_BYTE_PTR data, CK_ULONG data_len,
                     CK_BYTE_PTR signature, CK_ULONG_PTR signature_len)
 {
-	g_return_val_if_fail (GCK_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
+	g_return_val_if_fail (GKM_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
 	return process_crypto (self, CKA_SIGN, data, data_len, signature, signature_len);
 }
 
 CK_RV
-gck_session_C_SignUpdate (GckSession *self, CK_BYTE_PTR part, CK_ULONG part_len)
+gkm_session_C_SignUpdate (GkmSession *self, CK_BYTE_PTR part, CK_ULONG part_len)
 {
 	/* Our keys don't support incremental operations */
- 	return CKR_FUNCTION_NOT_SUPPORTED;
+	return CKR_FUNCTION_NOT_SUPPORTED;
 }
 
 CK_RV
-gck_session_C_SignFinal (GckSession *self, CK_BYTE_PTR signature,
+gkm_session_C_SignFinal (GkmSession *self, CK_BYTE_PTR signature,
                          CK_ULONG_PTR signature_len)
 {
 	/* Our keys don't support incremental operations */
- 	return CKR_FUNCTION_NOT_SUPPORTED;
+	return CKR_FUNCTION_NOT_SUPPORTED;
 }
 
 CK_RV
-gck_session_C_SignRecoverInit (GckSession *self, CK_MECHANISM_PTR mechanism,
+gkm_session_C_SignRecoverInit (GkmSession *self, CK_MECHANISM_PTR mechanism,
                                CK_OBJECT_HANDLE key)
 {
 	/* TODO: Need to implement */
- 	return CKR_FUNCTION_NOT_SUPPORTED;
+	return CKR_FUNCTION_NOT_SUPPORTED;
 }
 
 CK_RV
-gck_session_C_SignRecover (GckSession *self, CK_BYTE_PTR data, CK_ULONG data_len, 
+gkm_session_C_SignRecover (GkmSession *self, CK_BYTE_PTR data, CK_ULONG data_len,
                            CK_BYTE_PTR signature, CK_ULONG_PTR signature_len)
 {
 	/* TODO: Need to implement */
- 	return CKR_FUNCTION_NOT_SUPPORTED;
+	return CKR_FUNCTION_NOT_SUPPORTED;
 }
 
 CK_RV
-gck_session_C_VerifyInit (GckSession *self, CK_MECHANISM_PTR mechanism,
+gkm_session_C_VerifyInit (GkmSession *self, CK_MECHANISM_PTR mechanism,
                           CK_OBJECT_HANDLE key)
 {
-	g_return_val_if_fail (GCK_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
+	g_return_val_if_fail (GKM_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
 	if (!mechanism)
 		return CKR_ARGUMENTS_BAD;
 	return prepare_crypto (self, mechanism, CKA_VERIFY, key);
 }
 
 CK_RV
-gck_session_C_Verify (GckSession *self, CK_BYTE_PTR data, CK_ULONG data_len,
+gkm_session_C_Verify (GkmSession *self, CK_BYTE_PTR data, CK_ULONG data_len,
                       CK_BYTE_PTR signature, CK_ULONG signature_len)
 {
-	g_return_val_if_fail (GCK_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
+	g_return_val_if_fail (GKM_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
 	return process_crypto (self, CKA_VERIFY, data, data_len, signature, &signature_len);
 }
 
 CK_RV
-gck_session_C_VerifyUpdate (GckSession *self, CK_BYTE_PTR part, CK_ULONG part_len)
+gkm_session_C_VerifyUpdate (GkmSession *self, CK_BYTE_PTR part, CK_ULONG part_len)
 {
 	/* Our keys don't support incremental operations */
- 	return CKR_FUNCTION_NOT_SUPPORTED;	
+	return CKR_FUNCTION_NOT_SUPPORTED;
 }
 
 CK_RV
-gck_session_C_VerifyFinal (GckSession *self, CK_BYTE_PTR signature,
+gkm_session_C_VerifyFinal (GkmSession *self, CK_BYTE_PTR signature,
                            CK_ULONG signature_len)
 {
 	/* Our keys don't support incremental operations */
- 	return CKR_FUNCTION_NOT_SUPPORTED;
+	return CKR_FUNCTION_NOT_SUPPORTED;
 }
 
 CK_RV
-gck_session_C_VerifyRecoverInit (GckSession *self, CK_MECHANISM_PTR mechanism,
+gkm_session_C_VerifyRecoverInit (GkmSession *self, CK_MECHANISM_PTR mechanism,
                                  CK_OBJECT_HANDLE key)
 {
 	/* TODO: Need to implement */
- 	return CKR_FUNCTION_NOT_SUPPORTED;	
+	return CKR_FUNCTION_NOT_SUPPORTED;
 }
 
 CK_RV
-gck_session_C_VerifyRecover (GckSession *self, CK_BYTE_PTR signature,
-                             CK_ULONG signature_len, CK_BYTE_PTR data, 
+gkm_session_C_VerifyRecover (GkmSession *self, CK_BYTE_PTR signature,
+                             CK_ULONG signature_len, CK_BYTE_PTR data,
                              CK_ULONG_PTR data_len)
 {
 	/* TODO: Need to implement */
- 	return CKR_FUNCTION_NOT_SUPPORTED;
+	return CKR_FUNCTION_NOT_SUPPORTED;
 }
 
 CK_RV
-gck_session_C_DigestEncryptUpdate (GckSession *self, CK_BYTE_PTR part,
+gkm_session_C_DigestEncryptUpdate (GkmSession *self, CK_BYTE_PTR part,
                                    CK_ULONG part_len, CK_BYTE_PTR enc_part,
                                    CK_ULONG_PTR enc_part_len)
 {
 	/* We don't support double operations */
- 	return CKR_FUNCTION_NOT_SUPPORTED;
+	return CKR_FUNCTION_NOT_SUPPORTED;
 }
 
 CK_RV
-gck_session_C_DecryptDigestUpdate (GckSession *self, CK_BYTE_PTR enc_part,
-                                   CK_ULONG enc_part_len, CK_BYTE_PTR part, 
+gkm_session_C_DecryptDigestUpdate (GkmSession *self, CK_BYTE_PTR enc_part,
+                                   CK_ULONG enc_part_len, CK_BYTE_PTR part,
                                    CK_ULONG_PTR part_len)
 {
 	/* We don't support double operations */
- 	return CKR_FUNCTION_NOT_SUPPORTED;	
+	return CKR_FUNCTION_NOT_SUPPORTED;
 }
 
 CK_RV
-gck_session_C_SignEncryptUpdate (GckSession *self, CK_BYTE_PTR part,
+gkm_session_C_SignEncryptUpdate (GkmSession *self, CK_BYTE_PTR part,
                                  CK_ULONG part_len, CK_BYTE_PTR enc_part,
 				 CK_ULONG_PTR enc_part_len)
 {
 	/* We don't support double operations */
- 	return CKR_FUNCTION_NOT_SUPPORTED;	
+	return CKR_FUNCTION_NOT_SUPPORTED;
 }
 
 CK_RV
-gck_session_C_DecryptVerifyUpdate (GckSession *self, CK_BYTE_PTR enc_part,
-                                   CK_ULONG enc_part_len, CK_BYTE_PTR part, 
+gkm_session_C_DecryptVerifyUpdate (GkmSession *self, CK_BYTE_PTR enc_part,
+                                   CK_ULONG enc_part_len, CK_BYTE_PTR part,
                                    CK_ULONG_PTR part_len)
 {
 	/* We don't support double operations */
- 	return CKR_FUNCTION_NOT_SUPPORTED;
+	return CKR_FUNCTION_NOT_SUPPORTED;
 }
 
 CK_RV
-gck_session_C_GenerateKey (GckSession* self, CK_MECHANISM_PTR mechanism,
-                           CK_ATTRIBUTE_PTR template, CK_ULONG count, 
+gkm_session_C_GenerateKey (GkmSession* self, CK_MECHANISM_PTR mechanism,
+                           CK_ATTRIBUTE_PTR template, CK_ULONG count,
                            CK_OBJECT_HANDLE_PTR key)
 {
 	/* TODO: We need to implement this */
- 	return CKR_FUNCTION_NOT_SUPPORTED;
+	return CKR_FUNCTION_NOT_SUPPORTED;
 }
 
 CK_RV
-gck_session_C_GenerateKeyPair (GckSession* self, CK_MECHANISM_PTR mechanism,
+gkm_session_C_GenerateKeyPair (GkmSession* self, CK_MECHANISM_PTR mechanism,
                                CK_ATTRIBUTE_PTR pub_template, CK_ULONG pub_count,
                                CK_ATTRIBUTE_PTR priv_template, CK_ULONG priv_count,
                                CK_OBJECT_HANDLE_PTR pub_key, CK_OBJECT_HANDLE_PTR priv_key)
 {
-	GckObject *pub = NULL;
-	GckObject *priv = NULL;
-	GckTransaction *transaction;
+	GkmObject *pub = NULL;
+	GkmObject *priv = NULL;
+	GkmTransaction *transaction;
 	CK_RV rv;
 
-	g_return_val_if_fail (GCK_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
+	g_return_val_if_fail (GKM_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
 	if (!mechanism)
 		return CKR_ARGUMENTS_BAD;
 	if (!(!pub_count || pub_template))
@@ -1484,24 +1484,24 @@ gck_session_C_GenerateKeyPair (GckSession* self, CK_MECHANISM_PTR mechanism,
 	 */
 	pub_template = g_memdup (pub_template, pub_count * sizeof (CK_ATTRIBUTE));
 	priv_template = g_memdup (priv_template, priv_count * sizeof (CK_ATTRIBUTE));
-	transaction = gck_transaction_new ();
+	transaction = gkm_transaction_new ();
 
 	/* Actually do the object creation */
-	rv = gck_crypto_generate_key_pair (self, mechanism->mechanism, pub_template, pub_count,
+	rv = gkm_crypto_generate_key_pair (self, mechanism->mechanism, pub_template, pub_count,
 	                                   priv_template, priv_count, &pub, &priv);
 	if (rv != CKR_OK)
-		gck_transaction_fail (transaction, rv);
+		gkm_transaction_fail (transaction, rv);
 
 	g_free (pub_template);
 	g_free (priv_template);
 
-	gck_transaction_complete (transaction);
-	rv = gck_transaction_get_result (transaction);
+	gkm_transaction_complete (transaction);
+	rv = gkm_transaction_get_result (transaction);
 	g_object_unref (transaction);
 
 	if (rv == CKR_OK) {
-		*pub_key = gck_object_get_handle (pub);
-		*priv_key = gck_object_get_handle (priv);
+		*pub_key = gkm_object_get_handle (pub);
+		*priv_key = gkm_object_get_handle (priv);
 	}
 
 	/* Objects are owned by storage */
@@ -1514,47 +1514,47 @@ gck_session_C_GenerateKeyPair (GckSession* self, CK_MECHANISM_PTR mechanism,
 }
 
 CK_RV
-gck_session_C_WrapKey (GckSession* self, CK_MECHANISM_PTR mechanism,
+gkm_session_C_WrapKey (GkmSession* self, CK_MECHANISM_PTR mechanism,
                        CK_OBJECT_HANDLE wrapping_key, CK_OBJECT_HANDLE key,
                        CK_BYTE_PTR wrapped_key, CK_ULONG_PTR wrapped_key_len)
 {
-	GckObject *wrapper = NULL;
-	GckObject *wrapped = NULL;
+	GkmObject *wrapper = NULL;
+	GkmObject *wrapped = NULL;
 	CK_RV rv;
 
-	g_return_val_if_fail (GCK_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
+	g_return_val_if_fail (GKM_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
 	if (!mechanism)
 		return CKR_ARGUMENTS_BAD;
 	if (!wrapped_key_len)
 		return CKR_ARGUMENTS_BAD;
 
-	rv = gck_session_lookup_readable_object (self, wrapping_key, &wrapper);
+	rv = gkm_session_lookup_readable_object (self, wrapping_key, &wrapper);
 	if (rv == CKR_OBJECT_HANDLE_INVALID)
 		return CKR_WRAPPING_KEY_HANDLE_INVALID;
 	else if (rv != CKR_OK)
 		return rv;
 
-	rv = gck_session_lookup_readable_object (self, key, &wrapped);
+	rv = gkm_session_lookup_readable_object (self, key, &wrapped);
 	if (rv == CKR_OBJECT_HANDLE_INVALID)
 		return CKR_KEY_HANDLE_INVALID;
 	else if (rv != CKR_OK)
 		return rv;
 
-	return gck_crypto_wrap_key (self, mechanism, wrapper, wrapped,
+	return gkm_crypto_wrap_key (self, mechanism, wrapper, wrapped,
 	                            wrapped_key, wrapped_key_len);
 }
 
 CK_RV
-gck_session_C_UnwrapKey (GckSession* self, CK_MECHANISM_PTR mechanism,
+gkm_session_C_UnwrapKey (GkmSession* self, CK_MECHANISM_PTR mechanism,
                          CK_OBJECT_HANDLE unwrapping_key, CK_BYTE_PTR wrapped_key,
                          CK_ULONG wrapped_key_len, CK_ATTRIBUTE_PTR template,
                          CK_ULONG count, CK_OBJECT_HANDLE_PTR key)
 {
-	GckObject *wrapper = NULL;
-	GckObject *unwrapped = NULL;
+	GkmObject *wrapper = NULL;
+	GkmObject *unwrapped = NULL;
 	CK_RV rv;
 
-	g_return_val_if_fail (GCK_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
+	g_return_val_if_fail (GKM_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
 	if (!mechanism)
 		return CKR_ARGUMENTS_BAD;
 	if (!(!count || template))
@@ -1562,7 +1562,7 @@ gck_session_C_UnwrapKey (GckSession* self, CK_MECHANISM_PTR mechanism,
 	if (!key)
 		return CKR_ARGUMENTS_BAD;
 
-	rv = gck_session_lookup_readable_object (self, unwrapping_key, &wrapper);
+	rv = gkm_session_lookup_readable_object (self, unwrapping_key, &wrapper);
 	if (rv == CKR_OBJECT_HANDLE_INVALID)
 		return CKR_WRAPPING_KEY_HANDLE_INVALID;
 	else if (rv != CKR_OK)
@@ -1574,13 +1574,13 @@ gck_session_C_UnwrapKey (GckSession* self, CK_MECHANISM_PTR mechanism,
 	 */
 	template = g_memdup (template, count * sizeof (CK_ATTRIBUTE));
 
-	rv = gck_crypto_unwrap_key (self, mechanism, wrapper, wrapped_key,
+	rv = gkm_crypto_unwrap_key (self, mechanism, wrapper, wrapped_key,
 	                            wrapped_key_len, template, count, &unwrapped);
 
 	g_free (template);
 
 	if (rv == CKR_OK) {
-		*key = gck_object_get_handle (unwrapped);
+		*key = gkm_object_get_handle (unwrapped);
 		g_object_unref (unwrapped);
 	}
 
@@ -1588,15 +1588,15 @@ gck_session_C_UnwrapKey (GckSession* self, CK_MECHANISM_PTR mechanism,
 }
 
 CK_RV
-gck_session_C_DeriveKey (GckSession* self, CK_MECHANISM_PTR mechanism,
+gkm_session_C_DeriveKey (GkmSession* self, CK_MECHANISM_PTR mechanism,
                          CK_OBJECT_HANDLE base_key, CK_ATTRIBUTE_PTR template,
                          CK_ULONG count, CK_OBJECT_HANDLE_PTR key)
 {
-	GckObject *base = NULL;
-	GckObject *derived = NULL;
+	GkmObject *base = NULL;
+	GkmObject *derived = NULL;
 	CK_RV rv;
 
-	g_return_val_if_fail (GCK_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
+	g_return_val_if_fail (GKM_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
 	if (!mechanism)
 		return CKR_ARGUMENTS_BAD;
 	if (!(!count || template))
@@ -1604,7 +1604,7 @@ gck_session_C_DeriveKey (GckSession* self, CK_MECHANISM_PTR mechanism,
 	if (!key)
 		return CKR_ARGUMENTS_BAD;
 
-	rv = gck_session_lookup_readable_object (self, base_key, &base);
+	rv = gkm_session_lookup_readable_object (self, base_key, &base);
 	if (rv != CKR_OK)
 		return rv;
 
@@ -1615,12 +1615,12 @@ gck_session_C_DeriveKey (GckSession* self, CK_MECHANISM_PTR mechanism,
 	template = g_memdup (template, count * sizeof (CK_ATTRIBUTE));
 
 	/* Actually do the object creation */
-	rv = gck_crypto_derive_key (self, mechanism, base, template, count, &derived);
+	rv = gkm_crypto_derive_key (self, mechanism, base, template, count, &derived);
 
 	g_free (template);
 
 	if (rv == CKR_OK) {
-		*key = gck_object_get_handle (derived);
+		*key = gkm_object_get_handle (derived);
 		g_object_unref (derived);
 	}
 
@@ -1628,16 +1628,16 @@ gck_session_C_DeriveKey (GckSession* self, CK_MECHANISM_PTR mechanism,
 }
 
 CK_RV
-gck_session_C_SeedRandom (GckSession* self, CK_BYTE_PTR seed, CK_ULONG seed_len)
+gkm_session_C_SeedRandom (GkmSession* self, CK_BYTE_PTR seed, CK_ULONG seed_len)
 {
 	/* We don't have a RNG */
- 	return CKR_RANDOM_NO_RNG;
+	return CKR_RANDOM_NO_RNG;
 }
 
 CK_RV
-gck_session_C_GenerateRandom (GckSession* self, CK_BYTE_PTR random_data,
+gkm_session_C_GenerateRandom (GkmSession* self, CK_BYTE_PTR random_data,
                               CK_ULONG random_len)
 {
 	/* We don't have a RNG */
- 	return CKR_RANDOM_NO_RNG;	
+	return CKR_RANDOM_NO_RNG;
 }
diff --git a/pkcs11/gck/gck-session.h b/pkcs11/gkm/gkm-session.h
similarity index 61%
rename from pkcs11/gck/gck-session.h
rename to pkcs11/gkm/gkm-session.h
index fa4cb01..01c69ae 100644
--- a/pkcs11/gck/gck-session.h
+++ b/pkcs11/gkm/gkm-session.h
@@ -1,366 +1,366 @@
-/* 
+/*
  * 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.
  */
 
-#ifndef __GCK_SESSION_H__
-#define __GCK_SESSION_H__
+#ifndef __GKM_SESSION_H__
+#define __GKM_SESSION_H__
 
 #include <glib-object.h>
 
-#include "gck-module.h"
-#include "gck-manager.h"
+#include "gkm-module.h"
+#include "gkm-manager.h"
 
-#define GCK_TYPE_SESSION               (gck_session_get_type ())
-#define GCK_SESSION(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCK_TYPE_SESSION, GckSession))
-#define GCK_SESSION_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GCK_TYPE_SESSION, GckSessionClass))
-#define GCK_IS_SESSION(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCK_TYPE_SESSION))
-#define GCK_IS_SESSION_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GCK_TYPE_SESSION))
-#define GCK_SESSION_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GCK_TYPE_SESSION, GckSessionClass))
+#define GKM_TYPE_SESSION               (gkm_session_get_type ())
+#define GKM_SESSION(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_SESSION, GkmSession))
+#define GKM_SESSION_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_SESSION, GkmSessionClass))
+#define GKM_IS_SESSION(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_SESSION))
+#define GKM_IS_SESSION_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_SESSION))
+#define GKM_SESSION_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_SESSION, GkmSessionClass))
 
-typedef struct _GckSessionClass GckSessionClass;
-typedef struct _GckSessionPrivate GckSessionPrivate;
-    
-struct _GckSession {
+typedef struct _GkmSessionClass GkmSessionClass;
+typedef struct _GkmSessionPrivate GkmSessionPrivate;
+
+struct _GkmSession {
 	GObject parent;
-	GckSessionPrivate *pv;
+	GkmSessionPrivate *pv;
 };
 
-struct _GckSessionClass {
+struct _GkmSessionClass {
 	GObjectClass parent_class;
-    
+
 #if 0
 	/* signals --------------------------------------------------------- */
-    
-	void (*signal) (GckSession *session);
+
+	void (*signal) (GkmSession *session);
 #endif
 };
 
-GType                    gck_session_get_type                           (void);
+GType                    gkm_session_get_type                           (void);
 
-GckSession*              gck_session_for_session_object                 (GckObject *obj);
+GkmSession*              gkm_session_for_session_object                 (GkmObject *obj);
 
-GckSession*              gck_session_for_session_object                 (GckObject *obj);
+GkmSession*              gkm_session_for_session_object                 (GkmObject *obj);
 
-CK_SESSION_HANDLE        gck_session_get_handle                         (GckSession *self);
+CK_SESSION_HANDLE        gkm_session_get_handle                         (GkmSession *self);
 
-CK_SLOT_ID               gck_session_get_slot_id                        (GckSession *self);
+CK_SLOT_ID               gkm_session_get_slot_id                        (GkmSession *self);
 
-CK_ULONG                 gck_session_get_apartment                      (GckSession *self);
+CK_ULONG                 gkm_session_get_apartment                      (GkmSession *self);
 
-GckModule*               gck_session_get_module                         (GckSession *self);
+GkmModule*               gkm_session_get_module                         (GkmSession *self);
 
-GckManager*              gck_session_get_manager                        (GckSession *self);
+GkmManager*              gkm_session_get_manager                        (GkmSession *self);
 
-gboolean                 gck_session_get_read_only                      (GckSession *self);
+gboolean                 gkm_session_get_read_only                      (GkmSession *self);
 
-gulong                   gck_session_get_logged_in                      (GckSession *self);
+gulong                   gkm_session_get_logged_in                      (GkmSession *self);
 
-void                     gck_session_set_logged_in                      (GckSession *self,
+void                     gkm_session_set_logged_in                      (GkmSession *self,
                                                                          gulong logged_in);
 
-gpointer                 gck_session_get_crypto_state                   (GckSession *self);
+gpointer                 gkm_session_get_crypto_state                   (GkmSession *self);
 
-void                     gck_session_set_crypto_state                   (GckSession *self,
+void                     gkm_session_set_crypto_state                   (GkmSession *self,
                                                                          gpointer state,
                                                                          GDestroyNotify destroy);
 
-GckCredential*           gck_session_get_credential                     (GckSession *self);
+GkmCredential*           gkm_session_get_credential                     (GkmSession *self);
 
-CK_RV                    gck_session_lookup_readable_object             (GckSession *self, 
-                                                                         CK_OBJECT_HANDLE handle, 
-                                                                         GckObject **result);
+CK_RV                    gkm_session_lookup_readable_object             (GkmSession *self,
+                                                                         CK_OBJECT_HANDLE handle,
+                                                                         GkmObject **result);
 
-CK_RV                    gck_session_lookup_writable_object             (GckSession *self, 
-                                                                         CK_OBJECT_HANDLE handle, 
-                                                                         GckObject **result);
+CK_RV                    gkm_session_lookup_writable_object             (GkmSession *self,
+                                                                         CK_OBJECT_HANDLE handle,
+                                                                         GkmObject **result);
 
-CK_RV                    gck_session_login_context_specific             (GckSession *self,
+CK_RV                    gkm_session_login_context_specific             (GkmSession *self,
                                                                          CK_UTF8CHAR_PTR pin,
                                                                          CK_ULONG n_pin);
 
-void                     gck_session_add_session_object                 (GckSession *self,
-                                                                         GckTransaction *transaction,
-                                                                         GckObject *obj);
+void                     gkm_session_add_session_object                 (GkmSession *self,
+                                                                         GkmTransaction *transaction,
+                                                                         GkmObject *obj);
 
-void                     gck_session_destroy_session_object             (GckSession *self,
-                                                                         GckTransaction *transaction,
-                                                                         GckObject *obj);
+void                     gkm_session_destroy_session_object             (GkmSession *self,
+                                                                         GkmTransaction *transaction,
+                                                                         GkmObject *obj);
 
-GckObject*               gck_session_create_object_for_factory          (GckSession *self,
-                                                                         GckFactory *factory,
-                                                                         GckTransaction *transaction,
+GkmObject*               gkm_session_create_object_for_factory          (GkmSession *self,
+                                                                         GkmFactory *factory,
+                                                                         GkmTransaction *transaction,
                                                                          CK_ATTRIBUTE_PTR attrs,
                                                                          CK_ULONG n_attrs);
 
-GckObject*               gck_session_create_object_for_attributes       (GckSession *self,
-                                                                         GckTransaction *transaction,
+GkmObject*               gkm_session_create_object_for_attributes       (GkmSession *self,
+                                                                         GkmTransaction *transaction,
                                                                          CK_ATTRIBUTE_PTR attrs,
                                                                          CK_ULONG n_attrs);
 
-void                     gck_session_complete_object_creation           (GckSession *self,
-                                                                         GckTransaction *transaction,
-                                                                         GckObject *object,
+void                     gkm_session_complete_object_creation           (GkmSession *self,
+                                                                         GkmTransaction *transaction,
+                                                                         GkmObject *object,
                                                                          gboolean add,
                                                                          CK_ATTRIBUTE_PTR attrs,
                                                                          CK_ULONG n_attrs);
 
-CK_RV                    gck_session_C_GetFunctionStatus                (GckSession *self);
+CK_RV                    gkm_session_C_GetFunctionStatus                (GkmSession *self);
 
-CK_RV                    gck_session_C_CancelFunction                   (GckSession *self);
+CK_RV                    gkm_session_C_CancelFunction                   (GkmSession *self);
 
-CK_RV                    gck_session_C_GetSessionInfo                   (GckSession* self, 
+CK_RV                    gkm_session_C_GetSessionInfo                   (GkmSession* self,
                                                                          CK_SESSION_INFO_PTR info);
 
-CK_RV                    gck_session_C_GetOperationState                (GckSession* self, 
+CK_RV                    gkm_session_C_GetOperationState                (GkmSession* self,
                                                                          CK_BYTE_PTR operation_state,
                                                                          CK_ULONG_PTR operation_state_len);
 
-CK_RV                    gck_session_C_SetOperationState                (GckSession* self, 
+CK_RV                    gkm_session_C_SetOperationState                (GkmSession* self,
                                                                          CK_BYTE_PTR operation_state,
-                                                                         CK_ULONG operation_state_len, 
+                                                                         CK_ULONG operation_state_len,
                                                                          CK_OBJECT_HANDLE encryption_key,
                                                                          CK_OBJECT_HANDLE authentication_key);
 
-CK_RV                    gck_session_C_CreateObject                     (GckSession* self, 
+CK_RV                    gkm_session_C_CreateObject                     (GkmSession* self,
                                                                          CK_ATTRIBUTE_PTR template,
-                                                                         CK_ULONG count, 
+                                                                         CK_ULONG count,
                                                                          CK_OBJECT_HANDLE_PTR new_object);
 
-CK_RV                    gck_session_C_CopyObject                       (GckSession* self, 
+CK_RV                    gkm_session_C_CopyObject                       (GkmSession* self,
                                                                          CK_OBJECT_HANDLE object,
-                                                                         CK_ATTRIBUTE_PTR template, 
+                                                                         CK_ATTRIBUTE_PTR template,
                                                                          CK_ULONG count,
                                                                          CK_OBJECT_HANDLE_PTR new_object);
 
-CK_RV                    gck_session_C_DestroyObject                    (GckSession* self, 
+CK_RV                    gkm_session_C_DestroyObject                    (GkmSession* self,
                                                                          CK_OBJECT_HANDLE object);
 
-CK_RV                    gck_session_C_GetObjectSize                    (GckSession* self, 
+CK_RV                    gkm_session_C_GetObjectSize                    (GkmSession* self,
                                                                          CK_OBJECT_HANDLE object,
                                                                          CK_ULONG_PTR size);
 
-CK_RV                    gck_session_C_GetAttributeValue                (GckSession* self, 
-                                                                         CK_OBJECT_HANDLE handle, 
-                                                                         CK_ATTRIBUTE_PTR template, 
+CK_RV                    gkm_session_C_GetAttributeValue                (GkmSession* self,
+                                                                         CK_OBJECT_HANDLE handle,
+                                                                         CK_ATTRIBUTE_PTR template,
                                                                          CK_ULONG count);
 
-CK_RV                    gck_session_C_SetAttributeValue                (GckSession* self, 
-                                                                         CK_OBJECT_HANDLE handle, 
-                                                                         CK_ATTRIBUTE_PTR template, 
+CK_RV                    gkm_session_C_SetAttributeValue                (GkmSession* self,
+                                                                         CK_OBJECT_HANDLE handle,
+                                                                         CK_ATTRIBUTE_PTR template,
                                                                          CK_ULONG count);
 
-CK_RV                    gck_session_C_FindObjectsInit                  (GckSession* self, 
+CK_RV                    gkm_session_C_FindObjectsInit                  (GkmSession* self,
                                                                          CK_ATTRIBUTE_PTR template,
                                                                          CK_ULONG count);
 
-CK_RV                    gck_session_C_FindObjects                      (GckSession* self, 
+CK_RV                    gkm_session_C_FindObjects                      (GkmSession* self,
                                                                          CK_OBJECT_HANDLE_PTR objects,
-                                                                         CK_ULONG max_count, 
+                                                                         CK_ULONG max_count,
                                                                          CK_ULONG_PTR count);
 
-CK_RV                    gck_session_C_FindObjectsFinal                 (GckSession* self);
+CK_RV                    gkm_session_C_FindObjectsFinal                 (GkmSession* self);
 
-CK_RV                    gck_session_C_EncryptInit                      (GckSession *self, 
+CK_RV                    gkm_session_C_EncryptInit                      (GkmSession *self,
                                                                          CK_MECHANISM_PTR mechanism,
                                                                          CK_OBJECT_HANDLE key);
 
-CK_RV                    gck_session_C_Encrypt                          (GckSession *self, 
-                                                                         CK_BYTE_PTR data, 
+CK_RV                    gkm_session_C_Encrypt                          (GkmSession *self,
+                                                                         CK_BYTE_PTR data,
                                                                          CK_ULONG data_len,
-                                                                         CK_BYTE_PTR encrypted_data, 
+                                                                         CK_BYTE_PTR encrypted_data,
                                                                          CK_ULONG_PTR encrypted_data_len);
 
-CK_RV                    gck_session_C_EncryptUpdate                    (GckSession *self, 
+CK_RV                    gkm_session_C_EncryptUpdate                    (GkmSession *self,
                                                                          CK_BYTE_PTR part,
-                                                                         CK_ULONG part_len, 
+                                                                         CK_ULONG part_len,
                                                                          CK_BYTE_PTR encrypted_part,
                                                                          CK_ULONG_PTR encrypted_part_len);
 
-CK_RV                    gck_session_C_EncryptFinal                     (GckSession *self, 
+CK_RV                    gkm_session_C_EncryptFinal                     (GkmSession *self,
                                                                          CK_BYTE_PTR last_part,
                                                                          CK_ULONG_PTR last_part_len);
 
-CK_RV                    gck_session_C_DecryptInit                      (GckSession *self, 
+CK_RV                    gkm_session_C_DecryptInit                      (GkmSession *self,
                                                                          CK_MECHANISM_PTR mechanism,
                                                                          CK_OBJECT_HANDLE key);
 
-CK_RV                    gck_session_C_Decrypt                          (GckSession *self, 
+CK_RV                    gkm_session_C_Decrypt                          (GkmSession *self,
                                                                          CK_BYTE_PTR enc_data,
-                                                                         CK_ULONG enc_data_len, 
-                                                                         CK_BYTE_PTR data, 
+                                                                         CK_ULONG enc_data_len,
+                                                                         CK_BYTE_PTR data,
                                                                          CK_ULONG_PTR data_len);
 
-CK_RV                    gck_session_C_DecryptUpdate                    (GckSession *self, 
+CK_RV                    gkm_session_C_DecryptUpdate                    (GkmSession *self,
                                                                          CK_BYTE_PTR enc_part,
-                                                                         CK_ULONG enc_part_len, 
-                                                                         CK_BYTE_PTR part, 
+                                                                         CK_ULONG enc_part_len,
+                                                                         CK_BYTE_PTR part,
                                                                          CK_ULONG_PTR part_len);
 
-CK_RV                    gck_session_C_DecryptFinal                     (GckSession *self, 
+CK_RV                    gkm_session_C_DecryptFinal                     (GkmSession *self,
                                                                          CK_BYTE_PTR last_part,
                                                                          CK_ULONG_PTR last_part_len);
 
-CK_RV                    gck_session_C_DigestInit                       (GckSession *self, 
+CK_RV                    gkm_session_C_DigestInit                       (GkmSession *self,
                                                                          CK_MECHANISM_PTR mechanism);
 
-CK_RV                    gck_session_C_Digest                           (GckSession *self, 
-                                                                         CK_BYTE_PTR data, 
+CK_RV                    gkm_session_C_Digest                           (GkmSession *self,
+                                                                         CK_BYTE_PTR data,
                                                                          CK_ULONG data_len,
-                                                                         CK_BYTE_PTR digest, 
+                                                                         CK_BYTE_PTR digest,
                                                                          CK_ULONG_PTR digest_len);
 
-CK_RV                    gck_session_C_DigestUpdate                     (GckSession *self, 
-                                                                         CK_BYTE_PTR part, 
+CK_RV                    gkm_session_C_DigestUpdate                     (GkmSession *self,
+                                                                         CK_BYTE_PTR part,
                                                                          CK_ULONG part_len);
 
-CK_RV                    gck_session_C_DigestKey                        (GckSession *self, 
+CK_RV                    gkm_session_C_DigestKey                        (GkmSession *self,
                                                                          CK_OBJECT_HANDLE key);
 
-CK_RV                    gck_session_C_DigestFinal                      (GckSession *self, 
+CK_RV                    gkm_session_C_DigestFinal                      (GkmSession *self,
                                                                          CK_BYTE_PTR digest,
                                                                          CK_ULONG_PTR digest_len);
 
-CK_RV                    gck_session_C_SignInit                         (GckSession *self, 
-                                                                         CK_MECHANISM_PTR mechanism, 
+CK_RV                    gkm_session_C_SignInit                         (GkmSession *self,
+                                                                         CK_MECHANISM_PTR mechanism,
                                                                          CK_OBJECT_HANDLE key);
 
-CK_RV                    gck_session_C_Sign                             (GckSession *self, 
-                                                                         CK_BYTE_PTR data, 
+CK_RV                    gkm_session_C_Sign                             (GkmSession *self,
+                                                                         CK_BYTE_PTR data,
                                                                          CK_ULONG data_len,
-                                                                         CK_BYTE_PTR signature, 
+                                                                         CK_BYTE_PTR signature,
                                                                          CK_ULONG_PTR signature_len);
 
-CK_RV                    gck_session_C_SignUpdate                       (GckSession *self, 
-                                                                         CK_BYTE_PTR part, 
+CK_RV                    gkm_session_C_SignUpdate                       (GkmSession *self,
+                                                                         CK_BYTE_PTR part,
                                                                          CK_ULONG part_len);
 
-CK_RV                    gck_session_C_SignFinal                        (GckSession *self, 
+CK_RV                    gkm_session_C_SignFinal                        (GkmSession *self,
                                                                          CK_BYTE_PTR signature,
                                                                          CK_ULONG_PTR signature_len);
 
-CK_RV                    gck_session_C_SignRecoverInit                  (GckSession *self, 
+CK_RV                    gkm_session_C_SignRecoverInit                  (GkmSession *self,
                                                                          CK_MECHANISM_PTR mechanism,
                                                                          CK_OBJECT_HANDLE key);
 
-CK_RV                    gck_session_C_SignRecover                      (GckSession *self, 
-                                                                         CK_BYTE_PTR data, 
-                                                                         CK_ULONG data_len, 
-                                                                         CK_BYTE_PTR signature, 
+CK_RV                    gkm_session_C_SignRecover                      (GkmSession *self,
+                                                                         CK_BYTE_PTR data,
+                                                                         CK_ULONG data_len,
+                                                                         CK_BYTE_PTR signature,
                                                                          CK_ULONG_PTR signature_len);
 
-CK_RV                    gck_session_C_VerifyInit                       (GckSession *self, 
+CK_RV                    gkm_session_C_VerifyInit                       (GkmSession *self,
                                                                          CK_MECHANISM_PTR mechanism,
                                                                          CK_OBJECT_HANDLE key);
 
-CK_RV                    gck_session_C_Verify                           (GckSession *self, 
-                                                                         CK_BYTE_PTR data, 
+CK_RV                    gkm_session_C_Verify                           (GkmSession *self,
+                                                                         CK_BYTE_PTR data,
                                                                          CK_ULONG data_len,
-                                                                         CK_BYTE_PTR signature, 
+                                                                         CK_BYTE_PTR signature,
                                                                          CK_ULONG signature_len);
 
-CK_RV                    gck_session_C_VerifyUpdate                     (GckSession *self, 
-                                                                         CK_BYTE_PTR part, 
+CK_RV                    gkm_session_C_VerifyUpdate                     (GkmSession *self,
+                                                                         CK_BYTE_PTR part,
                                                                          CK_ULONG part_len);
 
-CK_RV                    gck_session_C_VerifyFinal                      (GckSession *self, 
+CK_RV                    gkm_session_C_VerifyFinal                      (GkmSession *self,
                                                                          CK_BYTE_PTR signature,
                                                                          CK_ULONG signature_len);
 
-CK_RV                    gck_session_C_VerifyRecoverInit                (GckSession *self, 
+CK_RV                    gkm_session_C_VerifyRecoverInit                (GkmSession *self,
                                                                          CK_MECHANISM_PTR mechanism,
                                                                          CK_OBJECT_HANDLE key);
 
-CK_RV                    gck_session_C_VerifyRecover                    (GckSession *self, 
+CK_RV                    gkm_session_C_VerifyRecover                    (GkmSession *self,
                                                                          CK_BYTE_PTR signature,
-                                                                         CK_ULONG signature_len, 
-                                                                         CK_BYTE_PTR data, 
+                                                                         CK_ULONG signature_len,
+                                                                         CK_BYTE_PTR data,
                                                                          CK_ULONG_PTR data_len);
 
-CK_RV                    gck_session_C_DigestEncryptUpdate              (GckSession *self, 
+CK_RV                    gkm_session_C_DigestEncryptUpdate              (GkmSession *self,
                                                                          CK_BYTE_PTR part,
-                                                                         CK_ULONG part_len, 
+                                                                         CK_ULONG part_len,
                                                                          CK_BYTE_PTR enc_part,
                                                                          CK_ULONG_PTR enc_part_len);
 
-CK_RV                    gck_session_C_DecryptDigestUpdate              (GckSession *self, 
+CK_RV                    gkm_session_C_DecryptDigestUpdate              (GkmSession *self,
                                                                          CK_BYTE_PTR enc_part,
-                                                                         CK_ULONG enc_part_len, 
-                                                                         CK_BYTE_PTR part, 
+                                                                         CK_ULONG enc_part_len,
+                                                                         CK_BYTE_PTR part,
                                                                          CK_ULONG_PTR part_len);
 
-CK_RV                    gck_session_C_SignEncryptUpdate                (GckSession *self, 
+CK_RV                    gkm_session_C_SignEncryptUpdate                (GkmSession *self,
                                                                          CK_BYTE_PTR part,
-                                                                         CK_ULONG part_len, 
+                                                                         CK_ULONG part_len,
                                                                          CK_BYTE_PTR enc_part,
                                                                          CK_ULONG_PTR enc_part_len);
 
-CK_RV                    gck_session_C_DecryptVerifyUpdate              (GckSession *self, 
+CK_RV                    gkm_session_C_DecryptVerifyUpdate              (GkmSession *self,
                                                                          CK_BYTE_PTR enc_part,
-                                                                         CK_ULONG enc_part_len, 
-                                                                         CK_BYTE_PTR part, 
+                                                                         CK_ULONG enc_part_len,
+                                                                         CK_BYTE_PTR part,
                                                                          CK_ULONG_PTR part_len);
 
-CK_RV                    gck_session_C_GenerateKey                      (GckSession* self, 
+CK_RV                    gkm_session_C_GenerateKey                      (GkmSession* self,
                                                                          CK_MECHANISM_PTR mechanism,
-                                                                         CK_ATTRIBUTE_PTR template, 
-                                                                         CK_ULONG count, 
+                                                                         CK_ATTRIBUTE_PTR template,
+                                                                         CK_ULONG count,
                                                                          CK_OBJECT_HANDLE_PTR key);
 
-CK_RV                    gck_session_C_GenerateKeyPair                  (GckSession* self, 
+CK_RV                    gkm_session_C_GenerateKeyPair                  (GkmSession* self,
                                                                          CK_MECHANISM_PTR mechanism,
-                                                                         CK_ATTRIBUTE_PTR pub_template, 
+                                                                         CK_ATTRIBUTE_PTR pub_template,
                                                                          CK_ULONG pub_count,
-                                                                         CK_ATTRIBUTE_PTR priv_template, 
+                                                                         CK_ATTRIBUTE_PTR priv_template,
                                                                          CK_ULONG priv_count,
-                                                                         CK_OBJECT_HANDLE_PTR pub_key, 
+                                                                         CK_OBJECT_HANDLE_PTR pub_key,
                                                                          CK_OBJECT_HANDLE_PTR priv_key);
 
-CK_RV                    gck_session_C_WrapKey                          (GckSession* self, 
+CK_RV                    gkm_session_C_WrapKey                          (GkmSession* self,
                                                                          CK_MECHANISM_PTR mechanism,
-                                                                         CK_OBJECT_HANDLE wrapping_key, 
+                                                                         CK_OBJECT_HANDLE wrapping_key,
                                                                          CK_OBJECT_HANDLE key,
-                                                                         CK_BYTE_PTR wrapped_key, 
+                                                                         CK_BYTE_PTR wrapped_key,
                                                                          CK_ULONG_PTR wrapped_key_len);
 
-CK_RV                    gck_session_C_UnwrapKey                        (GckSession* self, 
+CK_RV                    gkm_session_C_UnwrapKey                        (GkmSession* self,
                                                                          CK_MECHANISM_PTR mechanism,
-                                                                         CK_OBJECT_HANDLE unwrapping_key, 
+                                                                         CK_OBJECT_HANDLE unwrapping_key,
                                                                          CK_BYTE_PTR wrapped_key,
-                                                                         CK_ULONG wrapped_key_len, 
+                                                                         CK_ULONG wrapped_key_len,
                                                                          CK_ATTRIBUTE_PTR template,
-                                                                         CK_ULONG count, 
+                                                                         CK_ULONG count,
                                                                          CK_OBJECT_HANDLE_PTR key);
 
-CK_RV                    gck_session_C_DeriveKey                        (GckSession* self, 
+CK_RV                    gkm_session_C_DeriveKey                        (GkmSession* self,
                                                                          CK_MECHANISM_PTR mechanism,
-                                                                         CK_OBJECT_HANDLE base_key, 
+                                                                         CK_OBJECT_HANDLE base_key,
                                                                          CK_ATTRIBUTE_PTR template,
-                                                                         CK_ULONG count, 
+                                                                         CK_ULONG count,
                                                                          CK_OBJECT_HANDLE_PTR key);
 
-CK_RV                    gck_session_C_SeedRandom                       (GckSession* self, 
-                                                                         CK_BYTE_PTR seed, 
+CK_RV                    gkm_session_C_SeedRandom                       (GkmSession* self,
+                                                                         CK_BYTE_PTR seed,
                                                                          CK_ULONG seed_len);
 
-CK_RV                    gck_session_C_GenerateRandom                   (GckSession* self, 
+CK_RV                    gkm_session_C_GenerateRandom                   (GkmSession* self,
                                                                          CK_BYTE_PTR random_data,
                                                                          CK_ULONG random_len);
 
-#endif /* __GCK_SESSION_H__ */
+#endif /* __GKM_SESSION_H__ */
diff --git a/pkcs11/gck/gck-sexp-key.c b/pkcs11/gkm/gkm-sexp-key.c
similarity index 53%
rename from pkcs11/gck/gck-sexp-key.c
rename to pkcs11/gkm/gkm-sexp-key.c
index e899a42..1752fa6 100644
--- a/pkcs11/gck/gck-sexp-key.c
+++ b/pkcs11/gkm/gkm-sexp-key.c
@@ -23,11 +23,11 @@
 
 #include "pkcs11/pkcs11.h"
 
-#include "gck-attributes.h"
-#include "gck-mechanism-dsa.h"
-#include "gck-mechanism-rsa.h"
-#include "gck-sexp-key.h"
-#include "gck-util.h"
+#include "gkm-attributes.h"
+#include "gkm-mechanism-dsa.h"
+#include "gkm-mechanism-rsa.h"
+#include "gkm-sexp-key.h"
+#include "gkm-util.h"
 
 enum {
 	PROP_0,
@@ -35,11 +35,11 @@ enum {
 	PROP_ALGORITHM
 };
 
-struct _GckSexpKeyPrivate {
-	GckSexp *base_sexp;
+struct _GkmSexpKeyPrivate {
+	GkmSexp *base_sexp;
 };
 
-G_DEFINE_TYPE (GckSexpKey, gck_sexp_key, GCK_TYPE_OBJECT);
+G_DEFINE_TYPE (GkmSexpKey, gkm_sexp_key, GKM_TYPE_OBJECT);
 
 /* -----------------------------------------------------------------------------
  * INTERNAL
@@ -50,18 +50,18 @@ G_DEFINE_TYPE (GckSexpKey, gck_sexp_key, GCK_TYPE_OBJECT);
  */
 
 static CK_RV
-gck_sexp_key_real_get_attribute (GckObject *base, GckSession *session, CK_ATTRIBUTE* attr)
+gkm_sexp_key_real_get_attribute (GkmObject *base, GkmSession *session, CK_ATTRIBUTE* attr)
 {
-	GckSexpKey *self = GCK_SEXP_KEY (base);
+	GkmSexpKey *self = GKM_SEXP_KEY (base);
 
 	switch (attr->type) {
 	case CKA_KEY_TYPE:
 		{
-			switch (gck_sexp_key_get_algorithm (self)) {
+			switch (gkm_sexp_key_get_algorithm (self)) {
 			case GCRY_PK_RSA:
-				return gck_attribute_set_ulong (attr, CKK_RSA);
+				return gkm_attribute_set_ulong (attr, CKK_RSA);
 			case GCRY_PK_DSA:
-				return gck_attribute_set_ulong (attr, CKK_DSA);
+				return gkm_attribute_set_ulong (attr, CKK_DSA);
 			default:
 				g_return_val_if_reached (CKR_GENERAL_ERROR);
 			};
@@ -72,33 +72,33 @@ gck_sexp_key_real_get_attribute (GckObject *base, GckSession *session, CK_ATTRIB
 		{
 			guchar hash[20];
 			g_return_val_if_fail (self->pv->base_sexp, CKR_GENERAL_ERROR);
-			if (!gcry_pk_get_keygrip (gck_sexp_get (self->pv->base_sexp), hash))
+			if (!gcry_pk_get_keygrip (gkm_sexp_get (self->pv->base_sexp), hash))
 				g_return_val_if_reached (CKR_GENERAL_ERROR);
-			return gck_attribute_set_data (attr, hash, sizeof (hash));
+			return gkm_attribute_set_data (attr, hash, sizeof (hash));
 		}
 		break;
 
 	case CKA_START_DATE:
 	case CKA_END_DATE:
-		return gck_attribute_set_data (attr, "", 0);
+		return gkm_attribute_set_data (attr, "", 0);
 
 	case CKA_DERIVE:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_LOCAL:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 
 	case CKA_KEY_GEN_MECHANISM:
-		return gck_attribute_set_ulong (attr, CK_UNAVAILABLE_INFORMATION);
+		return gkm_attribute_set_ulong (attr, CK_UNAVAILABLE_INFORMATION);
 
 	case CKA_ALLOWED_MECHANISMS:
-		switch (gck_sexp_key_get_algorithm (self)) {
+		switch (gkm_sexp_key_get_algorithm (self)) {
 		case GCRY_PK_RSA:
-			return gck_attribute_set_data (attr, (CK_VOID_PTR)GCK_CRYPTO_RSA_MECHANISMS,
-			                               sizeof (GCK_CRYPTO_RSA_MECHANISMS));
+			return gkm_attribute_set_data (attr, (CK_VOID_PTR)GKM_CRYPTO_RSA_MECHANISMS,
+			                               sizeof (GKM_CRYPTO_RSA_MECHANISMS));
 		case GCRY_PK_DSA:
-			return gck_attribute_set_data (attr, (CK_VOID_PTR)GCK_CRYPTO_DSA_MECHANISMS,
-			                               sizeof (GCK_CRYPTO_DSA_MECHANISMS));
+			return gkm_attribute_set_data (attr, (CK_VOID_PTR)GKM_CRYPTO_DSA_MECHANISMS,
+			                               sizeof (GKM_CRYPTO_DSA_MECHANISMS));
 		default:
 			g_return_val_if_reached (CKR_GENERAL_ERROR);
 		};
@@ -106,39 +106,39 @@ gck_sexp_key_real_get_attribute (GckObject *base, GckSession *session, CK_ATTRIB
 	/* Lookup the certificate subject */
 	case CKA_SUBJECT:
 		/* TODO: When we have certificates, implement this */
-		return gck_attribute_set_data (attr, "", 0);
+		return gkm_attribute_set_data (attr, "", 0);
 	};
 
-	return GCK_OBJECT_CLASS (gck_sexp_key_parent_class)->get_attribute (base, session, attr);
+	return GKM_OBJECT_CLASS (gkm_sexp_key_parent_class)->get_attribute (base, session, attr);
 }
 
 static void
-gck_sexp_key_init (GckSexpKey *self)
+gkm_sexp_key_init (GkmSexpKey *self)
 {
-	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GCK_TYPE_SEXP_KEY, GckSexpKeyPrivate);
+	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GKM_TYPE_SEXP_KEY, GkmSexpKeyPrivate);
 }
 
 static void
-gck_sexp_key_finalize (GObject *obj)
+gkm_sexp_key_finalize (GObject *obj)
 {
-	GckSexpKey *self = GCK_SEXP_KEY (obj);
+	GkmSexpKey *self = GKM_SEXP_KEY (obj);
 
 	if (self->pv->base_sexp)
-		gck_sexp_unref (self->pv->base_sexp);
+		gkm_sexp_unref (self->pv->base_sexp);
 	self->pv->base_sexp = NULL;
 
-	G_OBJECT_CLASS (gck_sexp_key_parent_class)->finalize (obj);
+	G_OBJECT_CLASS (gkm_sexp_key_parent_class)->finalize (obj);
 }
 
 static void
-gck_sexp_key_set_property (GObject *obj, guint prop_id, const GValue *value,
+gkm_sexp_key_set_property (GObject *obj, guint prop_id, const GValue *value,
                       GParamSpec *pspec)
 {
-	GckSexpKey *self = GCK_SEXP_KEY (obj);
+	GkmSexpKey *self = GKM_SEXP_KEY (obj);
 
 	switch (prop_id) {
 	case PROP_BASE_SEXP:
-		gck_sexp_key_set_base (self, g_value_get_boxed (value));
+		gkm_sexp_key_set_base (self, g_value_get_boxed (value));
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -147,17 +147,17 @@ gck_sexp_key_set_property (GObject *obj, guint prop_id, const GValue *value,
 }
 
 static void
-gck_sexp_key_get_property (GObject *obj, guint prop_id, GValue *value,
+gkm_sexp_key_get_property (GObject *obj, guint prop_id, GValue *value,
                       GParamSpec *pspec)
 {
-	GckSexpKey *self = GCK_SEXP_KEY (obj);
+	GkmSexpKey *self = GKM_SEXP_KEY (obj);
 
 	switch (prop_id) {
 	case PROP_BASE_SEXP:
-		g_value_set_boxed (value, gck_sexp_key_get_base (self));
+		g_value_set_boxed (value, gkm_sexp_key_get_base (self));
 		break;
 	case PROP_ALGORITHM:
-		g_value_set_int (value, gck_sexp_key_get_algorithm (self));
+		g_value_set_int (value, gkm_sexp_key_get_algorithm (self));
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -166,23 +166,23 @@ gck_sexp_key_get_property (GObject *obj, guint prop_id, GValue *value,
 }
 
 static void
-gck_sexp_key_class_init (GckSexpKeyClass *klass)
+gkm_sexp_key_class_init (GkmSexpKeyClass *klass)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	GckObjectClass *gck_class = GCK_OBJECT_CLASS (klass);
+	GkmObjectClass *gkm_class = GKM_OBJECT_CLASS (klass);
 
-	gck_sexp_key_parent_class = g_type_class_peek_parent (klass);
-	g_type_class_add_private (klass, sizeof (GckSexpKeyPrivate));
+	gkm_sexp_key_parent_class = g_type_class_peek_parent (klass);
+	g_type_class_add_private (klass, sizeof (GkmSexpKeyPrivate));
 
-	gobject_class->finalize = gck_sexp_key_finalize;
-	gobject_class->set_property = gck_sexp_key_set_property;
-	gobject_class->get_property = gck_sexp_key_get_property;
+	gobject_class->finalize = gkm_sexp_key_finalize;
+	gobject_class->set_property = gkm_sexp_key_set_property;
+	gobject_class->get_property = gkm_sexp_key_get_property;
 
-	gck_class->get_attribute = gck_sexp_key_real_get_attribute;
+	gkm_class->get_attribute = gkm_sexp_key_real_get_attribute;
 
 	g_object_class_install_property (gobject_class, PROP_BASE_SEXP,
 	           g_param_spec_boxed ("base-sexp", "Base S-Exp", "Base Key S-Expression",
-	                               GCK_BOXED_SEXP, G_PARAM_READWRITE));
+	                               GKM_BOXED_SEXP, G_PARAM_READWRITE));
 
 	g_object_class_install_property (gobject_class, PROP_ALGORITHM,
 	           g_param_spec_int ("algorithm", "Algorithm", "GCrypt Algorithm",
@@ -193,48 +193,48 @@ gck_sexp_key_class_init (GckSexpKeyClass *klass)
  * PUBLIC
  */
 
-GckSexp*
-gck_sexp_key_get_base (GckSexpKey *self)
+GkmSexp*
+gkm_sexp_key_get_base (GkmSexpKey *self)
 {
-	g_return_val_if_fail (GCK_IS_SEXP_KEY (self), NULL);
+	g_return_val_if_fail (GKM_IS_SEXP_KEY (self), NULL);
 	return self->pv->base_sexp;
 }
 
 void
-gck_sexp_key_set_base (GckSexpKey *self, GckSexp *sexp)
+gkm_sexp_key_set_base (GkmSexpKey *self, GkmSexp *sexp)
 {
-	g_return_if_fail (GCK_IS_SEXP_KEY (self));
+	g_return_if_fail (GKM_IS_SEXP_KEY (self));
 	if (sexp)
-		gck_sexp_ref (sexp);
+		gkm_sexp_ref (sexp);
 	if (self->pv->base_sexp)
-		gck_sexp_unref (self->pv->base_sexp);
+		gkm_sexp_unref (self->pv->base_sexp);
 	self->pv->base_sexp = sexp;
 	g_object_notify (G_OBJECT (self), "base-sexp");
 	g_object_notify (G_OBJECT (self), "algorithm");
 }
 
 int
-gck_sexp_key_get_algorithm (GckSexpKey *self)
+gkm_sexp_key_get_algorithm (GkmSexpKey *self)
 {
 	int algorithm;
 	g_return_val_if_fail (self->pv->base_sexp, 0);
-	if (!gck_sexp_parse_key (gck_sexp_get (self->pv->base_sexp), &algorithm, NULL, NULL))
+	if (!gkm_sexp_parse_key (gkm_sexp_get (self->pv->base_sexp), &algorithm, NULL, NULL))
 		g_return_val_if_reached (0);
 	return algorithm;
 }
 
 CK_RV
-gck_sexp_key_set_part (GckSexpKey *self, int algo, const char *part, CK_ATTRIBUTE_PTR attr)
+gkm_sexp_key_set_part (GkmSexpKey *self, int algo, const char *part, CK_ATTRIBUTE_PTR attr)
 {
 	gcry_sexp_t numbers;
 	gcry_mpi_t mpi;
 	int algorithm;
 	CK_RV rv;
 
-	g_return_val_if_fail (GCK_IS_SEXP_KEY (self), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (GKM_IS_SEXP_KEY (self), CKR_GENERAL_ERROR);
 	g_return_val_if_fail (self->pv->base_sexp, CKR_GENERAL_ERROR);
 
-	if (!gck_sexp_parse_key (gck_sexp_get (self->pv->base_sexp),
+	if (!gkm_sexp_parse_key (gkm_sexp_get (self->pv->base_sexp),
 	                                &algorithm, NULL, &numbers))
 		g_return_val_if_reached (CKR_GENERAL_ERROR);
 
@@ -243,19 +243,19 @@ gck_sexp_key_set_part (GckSexpKey *self, int algo, const char *part, CK_ATTRIBUT
 		return CKR_ATTRIBUTE_TYPE_INVALID;
 	}
 
-	if (!gck_sexp_extract_mpi (numbers, &mpi, part, NULL))
+	if (!gkm_sexp_extract_mpi (numbers, &mpi, part, NULL))
 		g_return_val_if_reached (CKR_GENERAL_ERROR);
-	rv = gck_attribute_set_mpi (attr, mpi);
+	rv = gkm_attribute_set_mpi (attr, mpi);
 	gcry_sexp_release (numbers);
 	gcry_mpi_release (mpi);
 
 	return rv;
 }
 
-GckSexp*
-gck_sexp_key_acquire_crypto_sexp (GckSexpKey *self, GckSession *session)
+GkmSexp*
+gkm_sexp_key_acquire_crypto_sexp (GkmSexpKey *self, GkmSession *session)
 {
-	g_return_val_if_fail (GCK_IS_SEXP_KEY (self), NULL);
-	g_return_val_if_fail (GCK_SEXP_KEY_GET_CLASS (self)->acquire_crypto_sexp, NULL);
-	return GCK_SEXP_KEY_GET_CLASS (self)->acquire_crypto_sexp (self, session);
+	g_return_val_if_fail (GKM_IS_SEXP_KEY (self), NULL);
+	g_return_val_if_fail (GKM_SEXP_KEY_GET_CLASS (self)->acquire_crypto_sexp, NULL);
+	return GKM_SEXP_KEY_GET_CLASS (self)->acquire_crypto_sexp (self, session);
 }
diff --git a/pkcs11/gkm/gkm-sexp-key.h b/pkcs11/gkm/gkm-sexp-key.h
new file mode 100644
index 0000000..61274c9
--- /dev/null
+++ b/pkcs11/gkm/gkm-sexp-key.h
@@ -0,0 +1,71 @@
+/*
+ * gnome-sexp_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  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  License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * 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 __GKM_SEXP_KEY_H__
+#define __GKM_SEXP_KEY_H__
+
+#include <glib-object.h>
+
+#include "gkm-sexp.h"
+#include "gkm-object.h"
+#include "gkm-types.h"
+
+#define GKM_TYPE_SEXP_KEY               (gkm_sexp_key_get_type ())
+#define GKM_SEXP_KEY(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_SEXP_KEY, GkmSexpKey))
+#define GKM_SEXP_KEY_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_SEXP_KEY, GkmSexpKeyClass))
+#define GKM_IS_SEXP_KEY(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_SEXP_KEY))
+#define GKM_IS_SEXP_KEY_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_SEXP_KEY))
+#define GKM_SEXP_KEY_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_SEXP_KEY, GkmSexpKeyClass))
+
+typedef struct _GkmSexpKeyClass GkmSexpKeyClass;
+typedef struct _GkmSexpKeyPrivate GkmSexpKeyPrivate;
+
+struct _GkmSexpKey {
+	GkmObject parent;
+	GkmSexpKeyPrivate *pv;
+};
+
+struct _GkmSexpKeyClass {
+	GkmObjectClass parent_class;
+
+	/* virtual methods */
+
+	GkmSexp* (*acquire_crypto_sexp) (GkmSexpKey *self, GkmSession *session);
+};
+
+GType                gkm_sexp_key_get_type                (void);
+
+GkmSexp*             gkm_sexp_key_get_base                (GkmSexpKey *self);
+
+void                 gkm_sexp_key_set_base                (GkmSexpKey *self,
+                                                           GkmSexp *sexp);
+
+int                  gkm_sexp_key_get_algorithm           (GkmSexpKey *self);
+
+CK_RV                gkm_sexp_key_set_part                (GkmSexpKey *self,
+                                                           int algorithm,
+                                                           const char *part,
+                                                           CK_ATTRIBUTE_PTR attr);
+
+GkmSexp*             gkm_sexp_key_acquire_crypto_sexp     (GkmSexpKey *self,
+                                                           GkmSession *session);
+
+#endif /* __GKM_SEXP_KEY_H__ */
diff --git a/pkcs11/gck/gck-sexp.c b/pkcs11/gkm/gkm-sexp.c
similarity index 77%
rename from pkcs11/gck/gck-sexp.c
rename to pkcs11/gkm/gkm-sexp.c
index b48c4d6..cd34829 100644
--- a/pkcs11/gck/gck-sexp.c
+++ b/pkcs11/gkm/gkm-sexp.c
@@ -1,46 +1,46 @@
-/* 
+/*
  * 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  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  License for more details.
- *  
- * You should have received a copy of the GNU Lesser General 
+ *
+ * You should have received a copy of the GNU Lesser General
  * 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"
 
-#include "gck-sexp.h"
+#include "gkm-sexp.h"
 
-struct _GckSexp {
+struct _GkmSexp {
 	gint refs;
 	gcry_sexp_t real;
 };
 
-GckSexp*
-gck_sexp_new (gcry_sexp_t real)
+GkmSexp*
+gkm_sexp_new (gcry_sexp_t real)
 {
-	GckSexp *sexp;
+	GkmSexp *sexp;
 	g_return_val_if_fail (real, NULL);
-	sexp = g_slice_new0 (GckSexp);
+	sexp = g_slice_new0 (GkmSexp);
 	sexp->refs = 1;
 	sexp->real = real;
 	return sexp;
 }
 
-GckSexp*
-gck_sexp_ref (GckSexp *sexp)
+GkmSexp*
+gkm_sexp_ref (GkmSexp *sexp)
 {
 	g_return_val_if_fail (sexp, NULL);
 	++(sexp->refs);
@@ -48,19 +48,19 @@ gck_sexp_ref (GckSexp *sexp)
 }
 
 void
-gck_sexp_unref (gpointer data)
+gkm_sexp_unref (gpointer data)
 {
-	GckSexp *sexp = data;
+	GkmSexp *sexp = data;
 	g_return_if_fail (sexp);
 	if (--(sexp->refs) == 0) {
 		g_assert (sexp->real);
 		gcry_sexp_release (sexp->real);
-		g_slice_free (GckSexp, sexp); 
+		g_slice_free (GkmSexp, sexp);
 	}
 }
 
 gcry_sexp_t
-gck_sexp_get (GckSexp *sexp)
+gkm_sexp_get (GkmSexp *sexp)
 {
 	g_return_val_if_fail (sexp, NULL);
 	g_return_val_if_fail (sexp->real, NULL);
@@ -68,13 +68,13 @@ gck_sexp_get (GckSexp *sexp)
 }
 
 GType
-gck_sexp_boxed_type (void)
+gkm_sexp_boxed_type (void)
 {
 	static GType type = 0;
-	if (!type) 
-		type = g_boxed_type_register_static ("GckSexp", 
-		                                     (GBoxedCopyFunc)gck_sexp_ref,
-		                                     (GBoxedFreeFunc)gck_sexp_unref);
+	if (!type)
+		type = g_boxed_type_register_static ("GkmSexp",
+		                                     (GBoxedCopyFunc)gkm_sexp_ref,
+		                                     (GBoxedFreeFunc)gkm_sexp_unref);
 	return type;
 }
 
@@ -84,7 +84,7 @@ gck_sexp_boxed_type (void)
 #define PRIVATE_KEY_L 11
 
 gboolean
-gck_sexp_parse_key (gcry_sexp_t s_key, int *algorithm, gboolean *is_private,
+gkm_sexp_parse_key (gcry_sexp_t s_key, int *algorithm, gboolean *is_private,
                     gcry_sexp_t *numbers)
 {
 	gboolean ret = FALSE;
@@ -148,8 +148,8 @@ rsa_numbers_to_public (gcry_sexp_t rsa)
 
 	n = e = NULL;
 
-	if (!gck_sexp_extract_mpi (rsa, &n, "n", NULL) ||
-	    !gck_sexp_extract_mpi (rsa, &e, "e", NULL))
+	if (!gkm_sexp_extract_mpi (rsa, &n, "n", NULL) ||
+	    !gkm_sexp_extract_mpi (rsa, &e, "e", NULL))
 		goto done;
 
 	gcry = gcry_sexp_build (&pubkey, NULL, "(public-key (rsa (n %m) (e %m)))",
@@ -174,10 +174,10 @@ dsa_numbers_to_public (gcry_sexp_t dsa)
 
 	p = q = g = y = NULL;
 
-	if (!gck_sexp_extract_mpi (dsa, &p, "p", NULL) ||
-	    !gck_sexp_extract_mpi (dsa, &q, "q", NULL) ||
-	    !gck_sexp_extract_mpi (dsa, &g, "g", NULL) ||
-	    !gck_sexp_extract_mpi (dsa, &y, "y", NULL))
+	if (!gkm_sexp_extract_mpi (dsa, &p, "p", NULL) ||
+	    !gkm_sexp_extract_mpi (dsa, &q, "q", NULL) ||
+	    !gkm_sexp_extract_mpi (dsa, &g, "g", NULL) ||
+	    !gkm_sexp_extract_mpi (dsa, &y, "y", NULL))
 		goto done;
 
 	gcry = gcry_sexp_build (&pubkey, NULL, "(public-key (dsa (p %m) (q %m) (g %m) (y %m)))",
@@ -196,12 +196,12 @@ done:
 }
 
 gboolean
-gck_sexp_key_to_public (gcry_sexp_t privkey, gcry_sexp_t *pubkey)
+gkm_sexp_key_to_public (gcry_sexp_t privkey, gcry_sexp_t *pubkey)
 {
 	gcry_sexp_t numbers;
 	int algorithm;
 
-	if (!gck_sexp_parse_key (privkey, &algorithm, NULL, &numbers))
+	if (!gkm_sexp_parse_key (privkey, &algorithm, NULL, &numbers))
 		g_return_val_if_reached (FALSE);
 
 	switch (algorithm) {
@@ -220,7 +220,7 @@ gck_sexp_key_to_public (gcry_sexp_t privkey, gcry_sexp_t *pubkey)
 }
 
 gboolean
-gck_sexp_extract_mpi (gcry_sexp_t sexp, gcry_mpi_t *mpi, ...)
+gkm_sexp_extract_mpi (gcry_sexp_t sexp, gcry_mpi_t *mpi, ...)
 {
 	gcry_sexp_t at = NULL;
 	va_list va;
@@ -229,7 +229,7 @@ gck_sexp_extract_mpi (gcry_sexp_t sexp, gcry_mpi_t *mpi, ...)
 	g_assert (mpi);
 
 	va_start (va, mpi);
-	at = gck_sexp_get_childv (sexp, va);
+	at = gkm_sexp_get_childv (sexp, va);
 	va_end (va);
 
 	*mpi = NULL;
@@ -242,7 +242,7 @@ gck_sexp_extract_mpi (gcry_sexp_t sexp, gcry_mpi_t *mpi, ...)
 }
 
 gcry_sexp_t
-gck_sexp_get_childv (gcry_sexp_t sexp, va_list va)
+gkm_sexp_get_childv (gcry_sexp_t sexp, va_list va)
 {
 	gcry_sexp_t at = NULL;
 	gcry_sexp_t child;
@@ -268,7 +268,7 @@ gck_sexp_get_childv (gcry_sexp_t sexp, va_list va)
 }
 
 void
-gck_sexp_dump (gcry_sexp_t sexp)
+gkm_sexp_dump (gcry_sexp_t sexp)
 {
 	gsize len;
 	gchar *buf;
diff --git a/pkcs11/gck/gck-sexp.h b/pkcs11/gkm/gkm-sexp.h
similarity index 59%
rename from pkcs11/gck/gck-sexp.h
rename to pkcs11/gkm/gkm-sexp.h
index 1bfd463..ae4ca7a 100644
--- a/pkcs11/gck/gck-sexp.h
+++ b/pkcs11/gkm/gkm-sexp.h
@@ -1,61 +1,61 @@
-/* 
+/*
  * 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  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  License for more details.
- *  
- * You should have received a copy of the GNU Lesser General 
+ *
+ * You should have received a copy of the GNU Lesser General
  * 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.
  */
 
-#ifndef GCKSEXP_H_
-#define GCKSEXP_H_
+#ifndef GKM_SEXP_H_
+#define GKM_SEXP_H_
 
 #include <gcrypt.h>
 
 #include <glib-object.h>
 
-#include "gck-types.h"
+#include "gkm-types.h"
 
-GckSexp*       gck_sexp_new           (gcry_sexp_t sexp);
+GkmSexp*       gkm_sexp_new           (gcry_sexp_t sexp);
 
-GckSexp*       gck_sexp_ref           (GckSexp *sexp);
+GkmSexp*       gkm_sexp_ref           (GkmSexp *sexp);
 
-void           gck_sexp_unref         (gpointer sexp);
+void           gkm_sexp_unref         (gpointer sexp);
 
-gcry_sexp_t    gck_sexp_get           (GckSexp *sexp);
+gcry_sexp_t    gkm_sexp_get           (GkmSexp *sexp);
 
-#define        GCK_BOXED_SEXP         (gck_sexp_boxed_type ())
+#define        GKM_BOXED_SEXP         (gkm_sexp_boxed_type ())
 
-GType          gck_sexp_boxed_type    (void);
+GType          gkm_sexp_boxed_type    (void);
 
 
-gboolean       gck_sexp_parse_key                (gcry_sexp_t sexp,
+gboolean       gkm_sexp_parse_key                (gcry_sexp_t sexp,
                                                   int *algorithm,
                                                   gboolean *is_private,
                                                   gcry_sexp_t *numbers);
 
-gboolean       gck_sexp_key_to_public            (gcry_sexp_t sexp,
+gboolean       gkm_sexp_key_to_public            (gcry_sexp_t sexp,
                                                   gcry_sexp_t *pub);
 
-gboolean       gck_sexp_extract_mpi              (gcry_sexp_t sexp,
+gboolean       gkm_sexp_extract_mpi              (gcry_sexp_t sexp,
                                                   gcry_mpi_t *mpi,
                                                   ...) G_GNUC_NULL_TERMINATED;
 
-gcry_sexp_t    gck_sexp_get_childv               (gcry_sexp_t sexp,
+gcry_sexp_t    gkm_sexp_get_childv               (gcry_sexp_t sexp,
                                                   va_list va);
 
-void           gck_sexp_dump                     (gcry_sexp_t sexp);
+void           gkm_sexp_dump                     (gcry_sexp_t sexp);
 
-#endif /* GCKSEXP_H_ */
+#endif /* GKM_SEXP_H_ */
diff --git a/pkcs11/gck/gck-store.c b/pkcs11/gkm/gkm-store.c
similarity index 55%
rename from pkcs11/gck/gck-store.c
rename to pkcs11/gkm/gkm-store.c
index af7ab14..06dcdb8 100644
--- a/pkcs11/gck/gck-store.c
+++ b/pkcs11/gkm/gkm-store.c
@@ -1,106 +1,106 @@
-/* 
+/*
  * 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"
 
-#include "gck-attributes.h"
-#include "gck-object.h"
-#include "gck-store.h"
-#include "gck-transaction.h"
-#include "gck-util.h"
+#include "gkm-attributes.h"
+#include "gkm-object.h"
+#include "gkm-store.h"
+#include "gkm-transaction.h"
+#include "gkm-util.h"
 
 typedef struct _Schema {
 	CK_ATTRIBUTE_TYPE type;
 	gpointer default_value;
 	gsize default_length;
-	GckStoreValidator validator;
+	GkmStoreValidator validator;
 	guint flags;
 } Schema;
 
-struct _GckStorePrivate {
+struct _GkmStorePrivate {
 	GHashTable *schemas;
 };
 
-G_DEFINE_TYPE (GckStore, gck_store, G_TYPE_OBJECT);
+G_DEFINE_TYPE (GkmStore, gkm_store, G_TYPE_OBJECT);
 
 /* -----------------------------------------------------------------------------
- * INTERNAL 
+ * INTERNAL
  */
 
 static void
 schema_free (gpointer data)
 {
 	Schema *schema;
-	
+
 	if (data == NULL)
 		return;
-	
+
 	schema = data;
 	g_free (schema->default_value);
 	g_slice_free (Schema, schema);
 }
 
 /* -----------------------------------------------------------------------------
- * OBJECT 
+ * OBJECT
  */
 
-static GObject* 
-gck_store_constructor (GType type, guint n_props, GObjectConstructParam *props) 
+static GObject*
+gkm_store_constructor (GType type, guint n_props, GObjectConstructParam *props)
 {
-	GckStore *self = GCK_STORE (G_OBJECT_CLASS (gck_store_parent_class)->constructor(type, n_props, props));
-	g_return_val_if_fail (self, NULL);	
+	GkmStore *self = GKM_STORE (G_OBJECT_CLASS (gkm_store_parent_class)->constructor(type, n_props, props));
+	g_return_val_if_fail (self, NULL);
 
 	return G_OBJECT (self);
 }
 
 static void
-gck_store_init (GckStore *self)
+gkm_store_init (GkmStore *self)
 {
-	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GCK_TYPE_STORE, GckStorePrivate);
-	self->pv->schemas = g_hash_table_new_full (gck_util_ulong_hash, gck_util_ulong_equal, 
+	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GKM_TYPE_STORE, GkmStorePrivate);
+	self->pv->schemas = g_hash_table_new_full (gkm_util_ulong_hash, gkm_util_ulong_equal,
 	                                           NULL, schema_free);
 }
 
 static void
-gck_store_dispose (GObject *obj)
+gkm_store_dispose (GObject *obj)
 {
-	GckStore *self = GCK_STORE (obj);
+	GkmStore *self = GKM_STORE (obj);
 
 	g_hash_table_remove_all (self->pv->schemas);
-	
-	G_OBJECT_CLASS (gck_store_parent_class)->dispose (obj);
+
+	G_OBJECT_CLASS (gkm_store_parent_class)->dispose (obj);
 }
 
 static void
-gck_store_finalize (GObject *obj)
+gkm_store_finalize (GObject *obj)
 {
-	GckStore *self = GCK_STORE (obj);
+	GkmStore *self = GKM_STORE (obj);
 
 	g_hash_table_destroy (self->pv->schemas);
 
-	G_OBJECT_CLASS (gck_store_parent_class)->finalize (obj);
+	G_OBJECT_CLASS (gkm_store_parent_class)->finalize (obj);
 }
 
 static void
-gck_store_set_property (GObject *obj, guint prop_id, const GValue *value, 
+gkm_store_set_property (GObject *obj, guint prop_id, const GValue *value,
                            GParamSpec *pspec)
 {
 	switch (prop_id) {
@@ -111,7 +111,7 @@ gck_store_set_property (GObject *obj, guint prop_id, const GValue *value,
 }
 
 static void
-gck_store_get_property (GObject *obj, guint prop_id, GValue *value, 
+gkm_store_get_property (GObject *obj, guint prop_id, GValue *value,
                            GParamSpec *pspec)
 {
 	switch (prop_id) {
@@ -122,36 +122,36 @@ gck_store_get_property (GObject *obj, guint prop_id, GValue *value,
 }
 
 static void
-gck_store_class_init (GckStoreClass *klass)
+gkm_store_class_init (GkmStoreClass *klass)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-    
-	gobject_class->constructor = gck_store_constructor;
-	gobject_class->dispose = gck_store_dispose;
-	gobject_class->finalize = gck_store_finalize;
-	gobject_class->set_property = gck_store_set_property;
-	gobject_class->get_property = gck_store_get_property;
-	
-	g_type_class_add_private (klass, sizeof (GckStorePrivate));
+
+	gobject_class->constructor = gkm_store_constructor;
+	gobject_class->dispose = gkm_store_dispose;
+	gobject_class->finalize = gkm_store_finalize;
+	gobject_class->set_property = gkm_store_set_property;
+	gobject_class->get_property = gkm_store_get_property;
+
+	g_type_class_add_private (klass, sizeof (GkmStorePrivate));
 }
 
 /* -----------------------------------------------------------------------------
- * PUBLIC 
+ * PUBLIC
  */
 
 gconstpointer
-gck_store_read_value (GckStore *self, GckObject *object, 
+gkm_store_read_value (GkmStore *self, GkmObject *object,
                       CK_ATTRIBUTE_TYPE type, gsize *n_value)
 {
 	CK_ATTRIBUTE at;
 	Schema *schema;
 	CK_RV rv;
-	
-	g_return_val_if_fail (GCK_IS_STORE (self), NULL);
-	g_return_val_if_fail (GCK_IS_OBJECT (object), NULL);
+
+	g_return_val_if_fail (GKM_IS_STORE (self), NULL);
+	g_return_val_if_fail (GKM_IS_OBJECT (object), NULL);
 	g_return_val_if_fail (n_value, NULL);
 
-	g_assert (GCK_STORE_GET_CLASS (self)->read_value);
+	g_assert (GKM_STORE_GET_CLASS (self)->read_value);
 
 	schema = g_hash_table_lookup (self->pv->schemas, &type);
 	if (schema == NULL)
@@ -160,164 +160,164 @@ gck_store_read_value (GckStore *self, GckObject *object,
 	at.type = type;
 	at.pValue = NULL;
 	at.ulValueLen = 0;
-	
-	rv = GCK_STORE_GET_CLASS (self)->read_value (self, object, &at);
+
+	rv = GKM_STORE_GET_CLASS (self)->read_value (self, object, &at);
 	if (rv == CKR_ATTRIBUTE_TYPE_INVALID || rv == CKR_USER_NOT_LOGGED_IN) {
 		at.pValue = schema->default_value;
 		at.ulValueLen = schema->default_length;
 	} else if (rv != CKR_OK) {
 		g_return_val_if_reached (NULL);
 	}
-	
+
 	*n_value = at.ulValueLen;
 	return at.pValue;
 }
 
 gchar*
-gck_store_read_string (GckStore *self, GckObject *object, CK_ATTRIBUTE_TYPE type)
+gkm_store_read_string (GkmStore *self, GkmObject *object, CK_ATTRIBUTE_TYPE type)
 {
 	gconstpointer value;
 	gsize n_value;
-	
-	g_return_val_if_fail (GCK_IS_STORE (self), NULL);
-	g_return_val_if_fail (GCK_IS_OBJECT (object), NULL);
-	
-	value = gck_store_read_value (self, object, type, &n_value);
+
+	g_return_val_if_fail (GKM_IS_STORE (self), NULL);
+	g_return_val_if_fail (GKM_IS_OBJECT (object), NULL);
+
+	value = gkm_store_read_value (self, object, type, &n_value);
 	if (!value)
 		return NULL;
-	
+
 	return g_strndup (value, n_value);
 }
 
 CK_RV
-gck_store_get_attribute (GckStore *self, GckObject *object, CK_ATTRIBUTE_PTR attr)
+gkm_store_get_attribute (GkmStore *self, GkmObject *object, CK_ATTRIBUTE_PTR attr)
 {
 	CK_ATTRIBUTE at;
 	Schema *schema;
 	CK_RV rv;
-	
-	g_return_val_if_fail (GCK_IS_STORE (self), CKR_GENERAL_ERROR);
-	g_return_val_if_fail (GCK_IS_OBJECT (object), CKR_GENERAL_ERROR);
+
+	g_return_val_if_fail (GKM_IS_STORE (self), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (GKM_IS_OBJECT (object), CKR_GENERAL_ERROR);
 	g_return_val_if_fail (attr, CKR_GENERAL_ERROR);
 
-	g_assert (GCK_STORE_GET_CLASS (self)->read_value);
+	g_assert (GKM_STORE_GET_CLASS (self)->read_value);
 
 	schema = g_hash_table_lookup (self->pv->schemas, &(attr->type));
 	if (schema == NULL)
 		return CKR_ATTRIBUTE_TYPE_INVALID;
-	
-	if (schema->flags & GCK_STORE_IS_INTERNAL)
+
+	if (schema->flags & GKM_STORE_IS_INTERNAL)
 		return CKR_ATTRIBUTE_TYPE_INVALID;
 
-	if (schema->flags & GCK_STORE_IS_SENSITIVE)
+	if (schema->flags & GKM_STORE_IS_SENSITIVE)
 		return CKR_ATTRIBUTE_SENSITIVE;
-	
+
 	at.type = attr->type;
 	at.pValue = NULL;
 	at.ulValueLen = 0;
 
-	rv = GCK_STORE_GET_CLASS (self)->read_value (self, object, &at);
+	rv = GKM_STORE_GET_CLASS (self)->read_value (self, object, &at);
 	if (rv == CKR_ATTRIBUTE_TYPE_INVALID) {
 		at.pValue = schema->default_value;
 		at.ulValueLen = schema->default_length;
 	} else if (rv != CKR_OK) {
 		return rv;
 	}
-	
-	/* 
-	 * If we get an assert here, then the derived class is probably 
+
+	/*
+	 * If we get an assert here, then the derived class is probably
 	 * trying to fill the  buffer in the attribute passed. It should
 	 * actually just be setting the pValue to its own buffers.
-	 */ 
+	 */
 	g_assert (at.pValue || !at.ulValueLen);
-	
-	return gck_attribute_set_data (attr, at.pValue, at.ulValueLen);
+
+	return gkm_attribute_set_data (attr, at.pValue, at.ulValueLen);
 }
 
 void
-gck_store_write_value (GckStore *self, GckTransaction *transaction,
-                       GckObject *object, CK_ATTRIBUTE_PTR attr)
+gkm_store_write_value (GkmStore *self, GkmTransaction *transaction,
+                       GkmObject *object, CK_ATTRIBUTE_PTR attr)
 {
 	Schema *schema;
 
-	g_return_if_fail (GCK_IS_STORE (self));
-	g_return_if_fail (GCK_IS_TRANSACTION (transaction));
-	g_return_if_fail (GCK_IS_OBJECT (object));
+	g_return_if_fail (GKM_IS_STORE (self));
+	g_return_if_fail (GKM_IS_TRANSACTION (transaction));
+	g_return_if_fail (GKM_IS_OBJECT (object));
 	g_return_if_fail (attr);
 
-	g_return_if_fail (!gck_transaction_get_failed (transaction));
-	g_assert (GCK_STORE_GET_CLASS (self)->write_value);
-	
+	g_return_if_fail (!gkm_transaction_get_failed (transaction));
+	g_assert (GKM_STORE_GET_CLASS (self)->write_value);
+
 	schema = g_hash_table_lookup (self->pv->schemas, &(attr->type));
 	if (schema == NULL) {
-		gck_transaction_fail (transaction, CKR_ATTRIBUTE_TYPE_INVALID);
+		gkm_transaction_fail (transaction, CKR_ATTRIBUTE_TYPE_INVALID);
 		return;
 	}
 
-	GCK_STORE_GET_CLASS (self)->write_value (self, transaction, object, attr);
+	GKM_STORE_GET_CLASS (self)->write_value (self, transaction, object, attr);
 }
 
 void
-gck_store_set_attribute (GckStore *self, GckTransaction *transaction,
-                         GckObject *object, CK_ATTRIBUTE_PTR attr)
+gkm_store_set_attribute (GkmStore *self, GkmTransaction *transaction,
+                         GkmObject *object, CK_ATTRIBUTE_PTR attr)
 {
 	Schema *schema;
 	CK_RV rv = CKR_OK;
 
-	g_return_if_fail (GCK_IS_STORE (self));
-	g_return_if_fail (GCK_IS_TRANSACTION (transaction));
-	g_return_if_fail (GCK_IS_OBJECT (object));
+	g_return_if_fail (GKM_IS_STORE (self));
+	g_return_if_fail (GKM_IS_TRANSACTION (transaction));
+	g_return_if_fail (GKM_IS_OBJECT (object));
 	g_return_if_fail (attr);
 
-	g_return_if_fail (!gck_transaction_get_failed (transaction));
-	g_assert (GCK_STORE_GET_CLASS (self)->write_value);
-	
+	g_return_if_fail (!gkm_transaction_get_failed (transaction));
+	g_assert (GKM_STORE_GET_CLASS (self)->write_value);
+
 	schema = g_hash_table_lookup (self->pv->schemas, &(attr->type));
 	if (schema == NULL)
 		rv = CKR_ATTRIBUTE_TYPE_INVALID;
-	else if (schema->flags & GCK_STORE_IS_INTERNAL)
+	else if (schema->flags & GKM_STORE_IS_INTERNAL)
 		rv = CKR_ATTRIBUTE_TYPE_INVALID;
 	else if (schema->validator)
 		rv = (schema->validator) (object, attr);
 
 	if (rv != CKR_OK) {
-		gck_transaction_fail (transaction, rv);
+		gkm_transaction_fail (transaction, rv);
 		return;
 	}
 
-	GCK_STORE_GET_CLASS (self)->write_value (self, transaction, object, attr);
+	GKM_STORE_GET_CLASS (self)->write_value (self, transaction, object, attr);
 }
 
 void
-gck_store_register_schema (GckStore *self, CK_ATTRIBUTE_PTR attr, 
-                           GckStoreValidator validator, guint flags)
+gkm_store_register_schema (GkmStore *self, CK_ATTRIBUTE_PTR attr,
+                           GkmStoreValidator validator, guint flags)
 {
 	Schema *schema;
-	
-	g_return_if_fail (GCK_IS_STORE (self));
+
+	g_return_if_fail (GKM_IS_STORE (self));
 	g_return_if_fail (g_hash_table_lookup (self->pv->schemas, &(attr->type)) == NULL);
 	g_return_if_fail (!attr->ulValueLen || attr->pValue);
 	g_return_if_fail (attr->ulValueLen != (CK_ULONG)-1);
-	
+
 	schema = g_slice_new0 (Schema);
 	schema->type = attr->type;
 	schema->flags = flags;
 	schema->validator = validator;
 	schema->default_value = attr->pValue;
 	schema->default_length = attr->ulValueLen;
-	if (schema->default_value) 
-		schema->default_value = g_memdup (schema->default_value, 
+	if (schema->default_value)
+		schema->default_value = g_memdup (schema->default_value,
 		                                  schema->default_length);
-	
+
 	g_hash_table_insert (self->pv->schemas, &(schema->type), schema);
 }
 
 gboolean
-gck_store_lookup_schema (GckStore *self, CK_ATTRIBUTE_TYPE type, guint *flags)
+gkm_store_lookup_schema (GkmStore *self, CK_ATTRIBUTE_TYPE type, guint *flags)
 {
 	Schema *schema;
-	
-	g_return_val_if_fail (GCK_IS_STORE (self), FALSE);
+
+	g_return_val_if_fail (GKM_IS_STORE (self), FALSE);
 
 	schema = g_hash_table_lookup (self->pv->schemas, &type);
 	if (!schema)
diff --git a/pkcs11/gkm/gkm-store.h b/pkcs11/gkm/gkm-store.h
new file mode 100644
index 0000000..3e0a97e
--- /dev/null
+++ b/pkcs11/gkm/gkm-store.h
@@ -0,0 +1,102 @@
+/*
+ * 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 __GKM_STORE_H__
+#define __GKM_STORE_H__
+
+#include <glib-object.h>
+
+#include "gkm-types.h"
+
+#include "pkcs11/pkcs11.h"
+
+enum {
+	GKM_STORE_IS_INTERNAL = 0x01,
+	GKM_STORE_IS_SENSITIVE = 0x02
+};
+
+#define GKM_TYPE_STORE               (gkm_store_get_type ())
+#define GKM_STORE(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_STORE, GkmStore))
+#define GKM_STORE_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_STORE, GkmStoreClass))
+#define GKM_IS_STORE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_STORE))
+#define GKM_IS_STORE_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_STORE))
+#define GKM_STORE_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_STORE, GkmStoreClass))
+
+typedef struct _GkmStoreClass GkmStoreClass;
+typedef struct _GkmStorePrivate GkmStorePrivate;
+
+struct _GkmStore {
+	GObject parent;
+	GkmStorePrivate *pv;
+};
+
+struct _GkmStoreClass {
+	GObjectClass parent_class;
+
+	/* Virtual methods */
+
+	CK_RV (*read_value) (GkmStore *self, GkmObject *object, CK_ATTRIBUTE_PTR attr);
+
+	void (*write_value) (GkmStore *self, GkmTransaction *transaction, GkmObject *object, CK_ATTRIBUTE_PTR attr);
+};
+
+typedef CK_RV         (*GkmStoreValidator)                (GkmObject *object,
+                                                           CK_ATTRIBUTE_PTR attr);
+
+GType                 gkm_store_get_type                  (void);
+
+gboolean              gkm_store_lookup_schema             (GkmStore *self,
+                                                           CK_ATTRIBUTE_TYPE type,
+                                                           guint *flags);
+
+void                  gkm_store_register_schema           (GkmStore *self,
+                                                           CK_ATTRIBUTE_PTR type_and_default,
+                                                           GkmStoreValidator validator,
+                                                           guint flags);
+
+void                  gkm_store_set_attribute             (GkmStore *self,
+                                                           GkmTransaction *transaction,
+                                                           GkmObject *object,
+                                                           CK_ATTRIBUTE_PTR attr);
+
+void                  gkm_store_write_value               (GkmStore *self,
+                                                           GkmTransaction *transaction,
+                                                           GkmObject *object,
+                                                           CK_ATTRIBUTE_PTR attr);
+
+CK_RV                 gkm_store_get_attribute             (GkmStore *self,
+                                                           GkmObject *object,
+                                                           CK_ATTRIBUTE_PTR attr);
+
+gconstpointer         gkm_store_read_value                (GkmStore *self,
+                                                           GkmObject *object,
+                                                           CK_ATTRIBUTE_TYPE type,
+                                                           gsize *n_value);
+
+gchar*                gkm_store_read_string               (GkmStore *self,
+                                                           GkmObject *object,
+                                                           CK_ATTRIBUTE_TYPE type);
+
+void                  gkm_store_notify_attribute          (GkmStore *self,
+                                                           GkmObject *object,
+                                                           CK_ATTRIBUTE_TYPE type);
+
+#endif /* __GKM_STORE_H__ */
diff --git a/pkcs11/gck/gck-timer.c b/pkcs11/gkm/gkm-timer.c
similarity index 83%
rename from pkcs11/gck/gck-timer.c
rename to pkcs11/gkm/gkm-timer.c
index 70b653d..1368de5 100644
--- a/pkcs11/gck/gck-timer.c
+++ b/pkcs11/gkm/gkm-timer.c
@@ -21,17 +21,17 @@
 
 #include "config.h"
 
-#include "gck-timer.h"
+#include "gkm-timer.h"
 
 #include "egg/egg-error.h"
 
 #include <glib.h>
 
-struct _GckTimer {
+struct _GkmTimer {
 	glong when;
 	GMutex *mutex;
 	gpointer identifier;
-	GckTimerFunc callback;
+	GkmTimerFunc callback;
 	gpointer user_data;
 };
 
@@ -45,8 +45,8 @@ static gint timer_refs = 0;
 static gint
 compare_timers (gconstpointer a, gconstpointer b, gpointer user_data)
 {
-	const GckTimer *ta = a;
-	const GckTimer *tb = b;
+	const GkmTimer *ta = a;
+	const GkmTimer *tb = b;
 	if (ta->when < tb->when)
 		return -1;
 	return ta->when > tb->when;
@@ -56,7 +56,7 @@ static gpointer
 timer_thread_func (gpointer unused)
 {
 	GMutex *mutex = g_static_mutex_get_mutex (&timer_mutex);
-	GckTimer *timer;
+	GkmTimer *timer;
 	GTimeVal tv;
 
 	g_mutex_lock (mutex);
@@ -73,7 +73,7 @@ timer_thread_func (gpointer unused)
 		g_get_current_time (&tv);
 
 		/* We have to wait until the next timer? */
-		if (tv.tv_sec < timer->when) { 
+		if (tv.tv_sec < timer->when) {
 			tv.tv_sec = timer->when;
 			tv.tv_usec = 0;
 			g_cond_timed_wait (timer_cond, mutex, &tv);
@@ -84,7 +84,7 @@ timer_thread_func (gpointer unused)
 		g_mutex_unlock (mutex);
 		g_mutex_lock (timer->mutex);
 
-			if (timer->callback) 
+			if (timer->callback)
 				(timer->callback) (timer, timer->user_data);
 
 		/* Leave the module, and go back into our thread mutex */
@@ -93,7 +93,7 @@ timer_thread_func (gpointer unused)
 
 		/* There's a chance that the timer may no longer be at head of queue */
 		g_queue_remove (timer_queue, timer);
-		g_slice_free (GckTimer, timer);
+		g_slice_free (GkmTimer, timer);
 	}
 
 	g_mutex_unlock (mutex);
@@ -101,7 +101,7 @@ timer_thread_func (gpointer unused)
 }
 
 void
-gck_timer_initialize (void)
+gkm_timer_initialize (void)
 {
 	GError *error = NULL;
 	g_static_mutex_lock (&timer_mutex);
@@ -113,11 +113,11 @@ gck_timer_initialize (void)
 			if (timer_thread) {
 				g_assert (timer_queue == NULL);
 				timer_queue = g_queue_new ();
-			
+
 				g_assert (timer_cond == NULL);
 				timer_cond = g_cond_new ();
 			} else {
-				g_warning ("could not create timer thread: %s", 
+				g_warning ("could not create timer thread: %s",
 				           egg_error_message (error));
 			}
 		}
@@ -126,9 +126,9 @@ gck_timer_initialize (void)
 }
 
 void
-gck_timer_shutdown (void)
+gkm_timer_shutdown (void)
 {
-	GckTimer *timer;
+	GkmTimer *timer;
 
 	if (g_atomic_int_dec_and_test (&timer_refs)) {
 		timer_run = FALSE;
@@ -144,7 +144,7 @@ gck_timer_shutdown (void)
 		/* Cleanup any outstanding timers */
 		while (!g_queue_is_empty (timer_queue)) {
 			timer = g_queue_pop_head (timer_queue);
-			g_slice_free (GckTimer, timer);
+			g_slice_free (GkmTimer, timer);
 		}
 
 		g_queue_free (timer_queue);
@@ -156,12 +156,12 @@ gck_timer_shutdown (void)
 }
 
 /* We're the only caller of this function */
-GMutex* _gck_module_get_scary_mutex_that_you_should_not_touch (GckModule *self);
+GMutex* _gkm_module_get_scary_mutex_that_you_should_not_touch (GkmModule *self);
 
-GckTimer*
-gck_timer_start (GckModule *module, glong seconds, GckTimerFunc callback, gpointer user_data)
+GkmTimer*
+gkm_timer_start (GkmModule *module, glong seconds, GkmTimerFunc callback, gpointer user_data)
 {
-	GckTimer *timer;
+	GkmTimer *timer;
 	GTimeVal tv;
 
 	g_return_val_if_fail (callback, NULL);
@@ -169,12 +169,12 @@ gck_timer_start (GckModule *module, glong seconds, GckTimerFunc callback, gpoint
 
 	g_get_current_time (&tv);
 
-	timer = g_slice_new (GckTimer);
+	timer = g_slice_new (GkmTimer);
 	timer->when = seconds + tv.tv_sec;
 	timer->callback = callback;
 	timer->user_data = user_data;
 
-	timer->mutex = _gck_module_get_scary_mutex_that_you_should_not_touch (module);
+	timer->mutex = _gkm_module_get_scary_mutex_that_you_should_not_touch (module);
 	g_return_val_if_fail (timer->mutex, NULL);
 
 	g_static_mutex_lock (&timer_mutex);
@@ -186,8 +186,8 @@ gck_timer_start (GckModule *module, glong seconds, GckTimerFunc callback, gpoint
 
 	g_static_mutex_unlock (&timer_mutex);
 
-	/* 
-	 * Note that the timer thread could not already completed this timer. 
+	/*
+	 * Note that the timer thread could not already completed this timer.
 	 * This is because we're in the module, and in order to complete a timer
 	 * the timer thread must enter the module mutex.
 	 */
@@ -196,7 +196,7 @@ gck_timer_start (GckModule *module, glong seconds, GckTimerFunc callback, gpoint
 }
 
 void
-gck_timer_cancel (GckTimer *timer)
+gkm_timer_cancel (GkmTimer *timer)
 {
 	GList *link;
 
@@ -209,10 +209,10 @@ gck_timer_cancel (GckTimer *timer)
 		link = g_queue_find (timer_queue, timer);
 		if (link) {
 
-			/* 
-			 * For thread safety the timer struct must be freed 
-			 * from the timer thread. So to cancel, what we do 
-			 * is move the timer to the front of the queue, 
+			/*
+			 * For thread safety the timer struct must be freed
+			 * from the timer thread. So to cancel, what we do
+			 * is move the timer to the front of the queue,
 			 * and reset the callback and when.
 			 */
 
diff --git a/pkcs11/gck/gck-timer.h b/pkcs11/gkm/gkm-timer.h
similarity index 60%
rename from pkcs11/gck/gck-timer.h
rename to pkcs11/gkm/gkm-timer.h
index 170db4e..91ce1ee 100644
--- a/pkcs11/gck/gck-timer.h
+++ b/pkcs11/gkm/gkm-timer.h
@@ -1,43 +1,43 @@
-/* 
+/*
  * gnome-keyring
- * 
+ *
  * Copyright (C) 2009 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  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  License for more details.
- *  
- * You should have received a copy of the GNU Lesser General 
+ *
+ * You should have received a copy of the GNU Lesser General
  * 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.
  */
 
-#ifndef GCKTIMER_H_
-#define GCKTIMER_H_
+#ifndef GKM_TIMER_H_
+#define GKM_TIMER_H_
 
 #include <glib.h>
 
-#include "gck-types.h"
+#include "gkm-types.h"
 
-typedef void    (*GckTimerFunc)                (GckTimer *timer,
-                                                gpointer user_data); 
+typedef void    (*GkmTimerFunc)                (GkmTimer *timer,
+                                                gpointer user_data);
 
-GckTimer*       gck_timer_start                (GckModule *module, 
+GkmTimer*       gkm_timer_start                (GkmModule *module,
                                                 glong seconds,
-                                                GckTimerFunc func, 
+                                                GkmTimerFunc func,
                                                 gpointer user_data);
 
-void            gck_timer_cancel               (GckTimer *timer);
+void            gkm_timer_cancel               (GkmTimer *timer);
 
-void            gck_timer_initialize           (void);
+void            gkm_timer_initialize           (void);
 
-void            gck_timer_shutdown             (void);
+void            gkm_timer_shutdown             (void);
 
-#endif /* GCKTIMER_H_ */
+#endif /* GKM_TIMER_H_ */
diff --git a/pkcs11/gck/gck-transaction.c b/pkcs11/gkm/gkm-transaction.c
similarity index 67%
rename from pkcs11/gck/gck-transaction.c
rename to pkcs11/gkm/gkm-transaction.c
index f848793..ef45a98 100644
--- a/pkcs11/gck/gck-transaction.c
+++ b/pkcs11/gkm/gkm-transaction.c
@@ -1,28 +1,28 @@
-/* 
+/*
  * 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"
 
-#include "gck-marshal.h"
-#include "gck-transaction.h"
+#include "gkm-marshal.h"
+#include "gkm-transaction.h"
 
 #include <glib/gstdio.h>
 
@@ -45,7 +45,7 @@ enum {
 
 static guint signals[LAST_SIGNAL] = { 0 };
 
-struct _GckTransaction {
+struct _GkmTransaction {
 	GObject parent;
 	GList *completes;
 	gboolean failed;
@@ -55,22 +55,22 @@ struct _GckTransaction {
 
 typedef struct _Complete {
 	GObject *object;
-	GckTransactionFunc func;
+	GkmTransactionFunc func;
 	gpointer user_data;
 } Complete;
 
-G_DEFINE_TYPE (GckTransaction, gck_transaction, G_TYPE_OBJECT);
+G_DEFINE_TYPE (GkmTransaction, gkm_transaction, G_TYPE_OBJECT);
 
 /* -----------------------------------------------------------------------------
- * INTERNAL 
+ * INTERNAL
  */
 
 static gboolean
-complete_invoke (GckTransaction *transaction, Complete *complete)
+complete_invoke (GkmTransaction *transaction, Complete *complete)
 {
 	g_assert (complete);
 	g_assert (complete->func);
-	
+
 	return (complete->func) (transaction, complete->object, complete->user_data);
 }
 
@@ -84,114 +84,114 @@ complete_destroy (Complete *complete)
 }
 
 static gboolean
-complete_accumulator (GSignalInvocationHint *ihint, GValue *return_accu, 
+complete_accumulator (GSignalInvocationHint *ihint, GValue *return_accu,
                       const GValue *handler_return, gpointer data)
 {
 	gboolean result;
-	
+
 	/* If any of them return false, then the result is false */
 	result = g_value_get_boolean (handler_return);
 	if (result == FALSE)
 		g_value_set_boolean (return_accu, FALSE);
-	
+
 	/* Continue signal invocations */
 	return TRUE;
 }
 
 static gboolean
-complete_new_file (GckTransaction *self, GObject *unused, gpointer user_data)
+complete_new_file (GkmTransaction *self, GObject *unused, gpointer user_data)
 {
 	gchar *path = user_data;
 	gboolean ret = TRUE;
-	
-	if (gck_transaction_get_failed (self)) {
+
+	if (gkm_transaction_get_failed (self)) {
 		if (g_unlink (path) < 0) {
 			g_warning ("couldn't delete aborted file, data may be lost: %s: %s",
 			           path, g_strerror (errno));
 			ret = FALSE;
 		}
 	}
-	
+
 	g_free (path);
 	return ret;
 }
 
 static gboolean
-begin_new_file (GckTransaction *self, const gchar *filename)
+begin_new_file (GkmTransaction *self, const gchar *filename)
 {
-	g_assert (GCK_IS_TRANSACTION (self));
-	g_assert (!gck_transaction_get_failed (self));
+	g_assert (GKM_IS_TRANSACTION (self));
+	g_assert (!gkm_transaction_get_failed (self));
 	g_assert (filename);
-	
-	gck_transaction_add (self, NULL, complete_new_file, g_strdup (filename));
+
+	gkm_transaction_add (self, NULL, complete_new_file, g_strdup (filename));
 	return TRUE;
 }
 
 static gboolean
-complete_link_temporary (GckTransaction *self, GObject *unused, gpointer user_data)
+complete_link_temporary (GkmTransaction *self, GObject *unused, gpointer user_data)
 {
 	gchar *path = user_data;
 	gboolean ret = TRUE;
 	gchar *original;
 	gchar *ext;
-	
+
 	/* When failed, rename temporary back */
-	if (gck_transaction_get_failed (self)) {
+	if (gkm_transaction_get_failed (self)) {
 
 		/* Figure out the original file name */
 		original = g_strdup (path);
 		ext = strrchr (original, '.');
 		g_return_val_if_fail (ext, FALSE);
 		*ext = '\0';
-		
+
 		/* Now rename us back */
 		if (g_rename (path, original) == -1) {
-			g_warning ("couldn't restore original file, data may be lost: %s: %s", 
+			g_warning ("couldn't restore original file, data may be lost: %s: %s",
 			           original, g_strerror (errno));
 			ret = FALSE;
 		}
-		
+
 		g_free (original);
 
 	/* When succeeded, remove temporary */
 	} else {
 		if (g_unlink (path) == -1) {
-			g_warning ("couldn't delete temporary backup file: %s: %s", 
-			           path, g_strerror (errno)); 
+			g_warning ("couldn't delete temporary backup file: %s: %s",
+			           path, g_strerror (errno));
 			ret = TRUE; /* Not actually that bad of a situation */
 		}
 	}
-	
+
 	g_free (path);
 	return ret;
 }
 
 static gboolean
-begin_link_temporary (GckTransaction *self, const gchar *filename)
+begin_link_temporary (GkmTransaction *self, const gchar *filename)
 {
 	gchar *result;
-	
-	g_assert (GCK_IS_TRANSACTION (self));
-	g_assert (!gck_transaction_get_failed (self));
+
+	g_assert (GKM_IS_TRANSACTION (self));
+	g_assert (!gkm_transaction_get_failed (self));
 	g_assert (filename);
-	
+
 	for (;;) {
 		/* Try to link to random temporary file names */
 		result = g_strdup_printf ("%s.temp-%d", filename, g_random_int_range (0, G_MAXINT));
 		if (link (filename, result) == 0) {
-			gck_transaction_add (self, NULL, complete_link_temporary, result);
+			gkm_transaction_add (self, NULL, complete_link_temporary, result);
 			return TRUE;
 		}
-		
+
 		g_free (result);
-		
+
 		if (errno != EEXIST) {
 			g_warning ("couldn't create temporary file for: %s: %s", filename, g_strerror (errno));
-			gck_transaction_fail (self, CKR_DEVICE_ERROR);
+			gkm_transaction_fail (self, CKR_DEVICE_ERROR);
 			return FALSE;
 		}
 	}
-	
+
 	g_assert_not_reached ();
 }
 
@@ -252,59 +252,59 @@ write_to_file (const gchar *filename, const guchar *data, gsize n_data)
 }
 
 /* -----------------------------------------------------------------------------
- * OBJECT 
+ * OBJECT
  */
 
 static gboolean
-gck_transaction_real_complete (GckTransaction *self)
+gkm_transaction_real_complete (GkmTransaction *self)
 {
 	GList *l;
-	
+
 	g_return_val_if_fail (!self->completed, FALSE);
 	self->completed = TRUE;
 	g_object_notify (G_OBJECT (self), "completed");
-	
+
 	for (l = self->completes; l; l = g_list_next (l)) {
 		complete_invoke (self, l->data);
 		complete_destroy (l->data);
 	}
-	
+
 	g_list_free (self->completes);
 	self->completes = NULL;
-	
+
 	return TRUE;
 }
 
 static void
-gck_transaction_init (GckTransaction *self)
+gkm_transaction_init (GkmTransaction *self)
 {
 
 }
 
 static void
-gck_transaction_dispose (GObject *obj)
+gkm_transaction_dispose (GObject *obj)
 {
-	GckTransaction *self = GCK_TRANSACTION (obj);
-	
+	GkmTransaction *self = GKM_TRANSACTION (obj);
+
 	if (!self->completed)
-		gck_transaction_complete (self);
-    
-	G_OBJECT_CLASS (gck_transaction_parent_class)->dispose (obj);
+		gkm_transaction_complete (self);
+
+	G_OBJECT_CLASS (gkm_transaction_parent_class)->dispose (obj);
 }
 
 static void
-gck_transaction_finalize (GObject *obj)
+gkm_transaction_finalize (GObject *obj)
 {
-	GckTransaction *self = GCK_TRANSACTION (obj);
+	GkmTransaction *self = GKM_TRANSACTION (obj);
 
 	g_assert (!self->completes);
 	g_assert (self->completed);
-	
-	G_OBJECT_CLASS (gck_transaction_parent_class)->finalize (obj);
+
+	G_OBJECT_CLASS (gkm_transaction_parent_class)->finalize (obj);
 }
 
 static void
-gck_transaction_set_property (GObject *obj, guint prop_id, const GValue *value, 
+gkm_transaction_set_property (GObject *obj, guint prop_id, const GValue *value,
                               GParamSpec *pspec)
 {
 	switch (prop_id) {
@@ -315,20 +315,20 @@ gck_transaction_set_property (GObject *obj, guint prop_id, const GValue *value,
 }
 
 static void
-gck_transaction_get_property (GObject *obj, guint prop_id, GValue *value, 
+gkm_transaction_get_property (GObject *obj, guint prop_id, GValue *value,
                               GParamSpec *pspec)
 {
-	GckTransaction *self = GCK_TRANSACTION (obj);
+	GkmTransaction *self = GKM_TRANSACTION (obj);
 
 	switch (prop_id) {
 	case PROP_COMPLETED:
-		g_value_set_boolean (value, gck_transaction_get_completed (self));
+		g_value_set_boolean (value, gkm_transaction_get_completed (self));
 		break;
 	case PROP_FAILED:
-		g_value_set_boolean (value, gck_transaction_get_failed (self));
+		g_value_set_boolean (value, gkm_transaction_get_failed (self));
 		break;
 	case PROP_RESULT:
-		g_value_set_ulong (value, gck_transaction_get_result (self));
+		g_value_set_ulong (value, gkm_transaction_get_result (self));
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -337,88 +337,88 @@ gck_transaction_get_property (GObject *obj, guint prop_id, GValue *value,
 }
 
 static void
-gck_transaction_class_init (GckTransactionClass *klass)
+gkm_transaction_class_init (GkmTransactionClass *klass)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-    
-	gobject_class->dispose = gck_transaction_dispose;
-	gobject_class->finalize = gck_transaction_finalize;
-	gobject_class->set_property = gck_transaction_set_property;
-	gobject_class->get_property = gck_transaction_get_property;
-	
-	klass->complete = gck_transaction_real_complete;
-    
+
+	gobject_class->dispose = gkm_transaction_dispose;
+	gobject_class->finalize = gkm_transaction_finalize;
+	gobject_class->set_property = gkm_transaction_set_property;
+	gobject_class->get_property = gkm_transaction_get_property;
+
+	klass->complete = gkm_transaction_real_complete;
+
 	g_object_class_install_property (gobject_class, PROP_COMPLETED,
-	           g_param_spec_boolean ("completed", "Completed", "Whether transaction is complete", 
+	           g_param_spec_boolean ("completed", "Completed", "Whether transaction is complete",
 	                                 FALSE, G_PARAM_READABLE));
-	
+
 	g_object_class_install_property (gobject_class, PROP_FAILED,
-	           g_param_spec_boolean ("failed", "Failed", "Whether transaction failed", 
+	           g_param_spec_boolean ("failed", "Failed", "Whether transaction failed",
 	                                 FALSE, G_PARAM_READABLE));
-    
+
 	g_object_class_install_property (gobject_class, PROP_RESULT,
 	           g_param_spec_ulong ("result", "Result", "Result code for transaction",
 	                               0, G_MAXULONG, CKR_OK, G_PARAM_READABLE));
-	                               
-	signals[COMPLETE] = g_signal_new ("complete", GCK_TYPE_TRANSACTION, 
-	                                  G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GckTransactionClass, complete),
-	                                  complete_accumulator, NULL, gck_marshal_BOOLEAN__VOID, 
+
+	signals[COMPLETE] = g_signal_new ("complete", GKM_TYPE_TRANSACTION,
+	                                  G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GkmTransactionClass, complete),
+	                                  complete_accumulator, NULL, gkm_marshal_BOOLEAN__VOID,
 	                                  G_TYPE_BOOLEAN, 0, G_TYPE_NONE);
 }
 
 /* -----------------------------------------------------------------------------
- * PUBLIC 
+ * PUBLIC
  */
 
-GckTransaction*
-gck_transaction_new (void)
+GkmTransaction*
+gkm_transaction_new (void)
 {
-	return g_object_new (GCK_TYPE_TRANSACTION, NULL);
+	return g_object_new (GKM_TYPE_TRANSACTION, NULL);
 }
 
 void
-gck_transaction_add (GckTransaction *self, gpointer object,
-                     GckTransactionFunc func, gpointer user_data)
+gkm_transaction_add (GkmTransaction *self, gpointer object,
+                     GkmTransactionFunc func, gpointer user_data)
 {
 	Complete *complete;
-	
-	g_return_if_fail (GCK_IS_TRANSACTION (self));
+
+	g_return_if_fail (GKM_IS_TRANSACTION (self));
 	g_return_if_fail (func);
-	
+
 	complete = g_slice_new0 (Complete);
 	complete->func = func;
 	if (object)
 		complete->object = g_object_ref (object);
 	complete->user_data = user_data;
-	
+
 	self->completes = g_list_prepend (self->completes, complete);
 }
 
 void
-gck_transaction_fail (GckTransaction *self, CK_RV result)
+gkm_transaction_fail (GkmTransaction *self, CK_RV result)
 {
-	g_return_if_fail (GCK_IS_TRANSACTION (self));
+	g_return_if_fail (GKM_IS_TRANSACTION (self));
 	g_return_if_fail (!self->completed);
 	g_return_if_fail (result != CKR_OK);
 	g_return_if_fail (!self->failed);
 
 	self->failed = TRUE;
 	self->result = result;
-	
+
 	g_object_notify (G_OBJECT (self), "failed");
 	g_object_notify (G_OBJECT (self), "result");
 }
 
 void
-gck_transaction_complete(GckTransaction *self)
+gkm_transaction_complete(GkmTransaction *self)
 {
 	gboolean critical = FALSE;
-	
-	g_return_if_fail (GCK_IS_TRANSACTION (self));
+
+	g_return_if_fail (GKM_IS_TRANSACTION (self));
 	g_return_if_fail (!self->completed);
 	g_signal_emit (self, signals[COMPLETE], 0, &critical);
 	g_assert (self->completed);
-	
+
 	if (!self->failed && critical) {
 		g_warning ("transaction failed to commit, data may be lost");
 		self->failed = TRUE;
@@ -429,35 +429,35 @@ gck_transaction_complete(GckTransaction *self)
 }
 
 gboolean
-gck_transaction_get_completed (GckTransaction *self)
+gkm_transaction_get_completed (GkmTransaction *self)
 {
-	g_return_val_if_fail (GCK_IS_TRANSACTION (self), FALSE);
+	g_return_val_if_fail (GKM_IS_TRANSACTION (self), FALSE);
 	return self->completed;
 }
 
 gboolean
-gck_transaction_get_failed (GckTransaction *self)
+gkm_transaction_get_failed (GkmTransaction *self)
 {
-	g_return_val_if_fail (GCK_IS_TRANSACTION (self), FALSE);
+	g_return_val_if_fail (GKM_IS_TRANSACTION (self), FALSE);
 	return self->failed;
 }
 
 CK_RV
-gck_transaction_get_result (GckTransaction *self)
+gkm_transaction_get_result (GkmTransaction *self)
 {
-	g_return_val_if_fail (GCK_IS_TRANSACTION (self), FALSE);
+	g_return_val_if_fail (GKM_IS_TRANSACTION (self), FALSE);
 	return self->result;
 }
 
 void
-gck_transaction_write_file (GckTransaction *self, const gchar *filename,
+gkm_transaction_write_file (GkmTransaction *self, const gchar *filename,
                             const guchar *data, gsize n_data)
 {
-	g_return_if_fail (GCK_IS_TRANSACTION (self));
+	g_return_if_fail (GKM_IS_TRANSACTION (self));
 	g_return_if_fail (filename);
 	g_return_if_fail (data);
-	g_return_if_fail (!gck_transaction_get_failed (self));
-	
+	g_return_if_fail (!gkm_transaction_get_failed (self));
+
 	/* Prepare file to be reverted */
 	if (!g_file_test (filename, G_FILE_TEST_EXISTS)) {
 		if (!begin_new_file (self, filename))
@@ -470,16 +470,16 @@ gck_transaction_write_file (GckTransaction *self, const gchar *filename,
 	/* Put data in the expected place */
 	if (!write_to_file (filename, data, n_data)) {
 		g_warning ("couldn't write to file: %s: %s", filename, g_strerror (errno));
-		gck_transaction_fail (self, CKR_DEVICE_ERROR);
+		gkm_transaction_fail (self, CKR_DEVICE_ERROR);
 	}
 }
 
 void
-gck_transaction_remove_file (GckTransaction *self, const gchar *filename)
+gkm_transaction_remove_file (GkmTransaction *self, const gchar *filename)
 {
-	g_return_if_fail (GCK_IS_TRANSACTION (self));
+	g_return_if_fail (GKM_IS_TRANSACTION (self));
 	g_return_if_fail (filename);
-	g_return_if_fail (!gck_transaction_get_failed (self));
+	g_return_if_fail (!gkm_transaction_get_failed (self));
 
 	/* Already gone? Job accomplished */
 	if (!g_file_test (filename, G_FILE_TEST_EXISTS))
@@ -487,23 +487,23 @@ gck_transaction_remove_file (GckTransaction *self, const gchar *filename)
 
 	if (!begin_link_temporary (self, filename))
 		return;
-	
+
 	/* If failure, temporary will automatically be removed */
 	if (g_unlink (filename) < 0) {
 		g_warning ("couldn't remove file: %s: %s", filename, g_strerror (errno));
-		gck_transaction_fail (self, CKR_DEVICE_ERROR);
+		gkm_transaction_fail (self, CKR_DEVICE_ERROR);
 	}
 }
 
 CK_RV
-gck_transaction_complete_and_unref (GckTransaction *self)
+gkm_transaction_complete_and_unref (GkmTransaction *self)
 {
 	CK_RV rv;
 
-	g_return_val_if_fail (GCK_IS_TRANSACTION (self), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (GKM_IS_TRANSACTION (self), CKR_GENERAL_ERROR);
 
-	gck_transaction_complete (self);
-	rv = gck_transaction_get_result (self);
+	gkm_transaction_complete (self);
+	rv = gkm_transaction_get_result (self);
 	g_object_unref (self);
 
 	return rv;
diff --git a/pkcs11/gkm/gkm-transaction.h b/pkcs11/gkm/gkm-transaction.h
new file mode 100644
index 0000000..9a39bd1
--- /dev/null
+++ b/pkcs11/gkm/gkm-transaction.h
@@ -0,0 +1,82 @@
+/*
+ * 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 __GKM_TRANSACTION_H__
+#define __GKM_TRANSACTION_H__
+
+#include <glib-object.h>
+
+#include "gkm-types.h"
+
+#include "pkcs11/pkcs11.h"
+
+#define GKM_TYPE_TRANSACTION               (gkm_transaction_get_type ())
+#define GKM_TRANSACTION(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_TRANSACTION, GkmTransaction))
+#define GKM_TRANSACTION_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_TRANSACTION, GkmTransactionClass))
+#define GKM_IS_TRANSACTION(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_TRANSACTION))
+#define GKM_IS_TRANSACTION_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_TRANSACTION))
+#define GKM_TRANSACTION_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_TRANSACTION, GkmTransactionClass))
+
+typedef struct _GkmTransactionClass GkmTransactionClass;
+
+struct _GkmTransactionClass {
+	GObjectClass parent_class;
+
+	/* signals --------------------------------------------------------- */
+
+	gboolean (*complete) (GkmTransaction *transaction);
+};
+
+GType                       gkm_transaction_get_type               (void);
+
+GkmTransaction*             gkm_transaction_new                    (void);
+
+typedef gboolean            (*GkmTransactionFunc)                  (GkmTransaction *self,
+                                                                    GObject *object,
+                                                                    gpointer user_data);
+
+void                        gkm_transaction_add                    (GkmTransaction *self,
+                                                                    gpointer object,
+                                                                    GkmTransactionFunc callback,
+                                                                    gpointer user_data);
+
+void                        gkm_transaction_fail                   (GkmTransaction *self,
+                                                                    CK_RV result);
+
+void                        gkm_transaction_complete               (GkmTransaction *self);
+
+gboolean                    gkm_transaction_get_failed             (GkmTransaction *self);
+
+CK_RV                       gkm_transaction_get_result             (GkmTransaction *self);
+
+gboolean                    gkm_transaction_get_completed          (GkmTransaction *self);
+
+void                        gkm_transaction_write_file             (GkmTransaction *self,
+                                                                    const gchar *filename,
+                                                                    const guchar *data,
+                                                                    gsize n_data);
+
+void                        gkm_transaction_remove_file            (GkmTransaction *self,
+                                                                    const gchar *filename);
+
+CK_RV                       gkm_transaction_complete_and_unref     (GkmTransaction *self);
+
+#endif /* __GKM_TRANSACTION_H__ */
diff --git a/pkcs11/gkm/gkm-types.h b/pkcs11/gkm/gkm-types.h
new file mode 100644
index 0000000..386fd4c
--- /dev/null
+++ b/pkcs11/gkm/gkm-types.h
@@ -0,0 +1,51 @@
+/*
+ * 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 __GKM_TYPES_H__
+#define __GKM_TYPES_H__
+
+typedef struct _GkmAesKey GkmAesKey;
+typedef struct _GkmCertificate GkmCertificate;
+typedef struct _GkmCertificateKey GkmCertificateKey;
+typedef struct _GkmCertificateTrust GkmCertificateTrust;
+typedef struct _GkmCredential GkmCredential;
+typedef struct _GkmDhKey GkmDhKey;
+typedef struct _GkmDhPrivateKey GkmDhPrivateKey;
+typedef struct _GkmDhPublicKey GkmDhPublicKey;
+typedef struct _GkmFactory GkmFactory;
+typedef struct _GkmManager GkmManager;
+typedef struct _GkmModule GkmModule;
+typedef struct _GkmNullKey GkmNullKey;
+typedef struct _GkmObject GkmObject;
+typedef struct _GkmPrivateXsaKey GkmPrivateXsaKey;
+typedef struct _GkmPublicXsaKey GkmPublicXsaKey;
+typedef struct _GkmSecret GkmSecret;
+typedef struct _GkmSecretKey GkmSecretKey;
+typedef struct _GkmSession GkmSession;
+typedef struct _GkmSessionPrivateKey GkmSessionPrivateKey;
+typedef struct _GkmSessionPublicKey GkmSessionPublicKey;
+typedef struct _GkmSexp GkmSexp;
+typedef struct _GkmSexpKey GkmSexpKey;
+typedef struct _GkmStore GkmStore;
+typedef struct _GkmTimer GkmTimer;
+typedef struct _GkmTransaction GkmTransaction;
+
+#endif /* __GKM_TYPES_H__ */
diff --git a/pkcs11/gck/gck-util.c b/pkcs11/gkm/gkm-util.c
similarity index 80%
rename from pkcs11/gck/gck-util.c
rename to pkcs11/gkm/gkm-util.c
index c6439b9..a1c6253 100644
--- a/pkcs11/gck/gck-util.c
+++ b/pkcs11/gkm/gkm-util.c
@@ -1,27 +1,27 @@
-/* 
+/*
  * 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  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  License for more details.
- *  
- * You should have received a copy of the GNU Lesser General 
+ *
+ * You should have received a copy of the GNU Lesser General
  * 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"
 
-#include "gck-util.h"
+#include "gkm-util.h"
 
 #include <glib.h>
 #include <glib-object.h>
@@ -33,19 +33,19 @@
 static gint next_handle = 0x00000010;
 
 gulong*
-gck_util_ulong_alloc (gulong value)
+gkm_util_ulong_alloc (gulong value)
 {
 	return g_slice_dup (gulong, &value);
 }
 
 void
-gck_util_ulong_free (gpointer ptr_to_ulong)
+gkm_util_ulong_free (gpointer ptr_to_ulong)
 {
 	g_slice_free (gulong, ptr_to_ulong);
 }
 
 guint
-gck_util_ulong_hash (gconstpointer v)
+gkm_util_ulong_hash (gconstpointer v)
 {
 	const signed char *p = v;
 	guint32 i, h = *p;
@@ -55,24 +55,24 @@ gck_util_ulong_hash (gconstpointer v)
 }
 
 gboolean
-gck_util_ulong_equal (gconstpointer v1, gconstpointer v2)
+gkm_util_ulong_equal (gconstpointer v1, gconstpointer v2)
 {
 	return *((const gulong*)v1) == *((const gulong*)v2);
 }
 
 CK_RV
-gck_util_return_data (CK_VOID_PTR output, CK_ULONG_PTR n_output,
+gkm_util_return_data (CK_VOID_PTR output, CK_ULONG_PTR n_output,
                       gconstpointer input, gsize n_input)
 {
 	g_return_val_if_fail (n_output, CKR_GENERAL_ERROR);
 	g_return_val_if_fail (input || !n_input, CKR_GENERAL_ERROR);
-	
+
 	/* Just asking for the length */
 	if (!output) {
 		*n_output = n_input;
 		return CKR_OK;
 	}
-	
+
 	/* Buffer is too short */
 	if (n_input > *n_output) {
 		*n_output = n_input;
@@ -86,13 +86,13 @@ gck_util_return_data (CK_VOID_PTR output, CK_ULONG_PTR n_output,
 }
 
 CK_ULONG
-gck_util_next_handle (void)
+gkm_util_next_handle (void)
 {
 	return (CK_ULONG)g_atomic_int_exchange_and_add (&next_handle, 1);
 }
 
 void
-gck_util_dispose_unref (gpointer object)
+gkm_util_dispose_unref (gpointer object)
 {
 	g_return_if_fail (G_IS_OBJECT (object));
 	g_object_run_dispose (G_OBJECT (object));
diff --git a/pkcs11/gck/gck-util.h b/pkcs11/gkm/gkm-util.h
similarity index 62%
rename from pkcs11/gck/gck-util.h
rename to pkcs11/gkm/gkm-util.h
index 18be87e..1152bc8 100644
--- a/pkcs11/gck/gck-util.h
+++ b/pkcs11/gkm/gkm-util.h
@@ -1,26 +1,26 @@
-/* 
+/*
  * 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  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  License for more details.
- *  
- * You should have received a copy of the GNU Lesser General 
+ *
+ * You should have received a copy of the GNU Lesser General
  * 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.
  */
 
-#ifndef GCKUTIL_H_
-#define GCKUTIL_H_
+#ifndef GKM_UTIL_H_
+#define GKM_UTIL_H_
 
 #include <glib.h>
 
@@ -28,25 +28,25 @@
 
 #include "pkcs11/pkcs11.h"
 
-guint                 gck_util_ulong_hash                         (gconstpointer ptr_to_ulong);
+guint                 gkm_util_ulong_hash                         (gconstpointer ptr_to_ulong);
 
-gboolean              gck_util_ulong_equal                        (gconstpointer ptr_to_ulong_1, 
+gboolean              gkm_util_ulong_equal                        (gconstpointer ptr_to_ulong_1,
                                                                    gconstpointer ptr_to_ulong_2);
 
-gulong*               gck_util_ulong_alloc                        (gulong value);
+gulong*               gkm_util_ulong_alloc                        (gulong value);
 
-void                  gck_util_ulong_free                         (gpointer ptr_to_ulong);
+void                  gkm_util_ulong_free                         (gpointer ptr_to_ulong);
 
-CK_RV                 gck_util_return_data                        (CK_VOID_PTR output,
+CK_RV                 gkm_util_return_data                        (CK_VOID_PTR output,
                                                                    CK_ULONG_PTR n_output,
                                                                    gconstpointer input,
                                                                    gsize n_input);
 
-CK_RV                 gck_attribute_set_mpi                       (CK_ATTRIBUTE_PTR attr, 
+CK_RV                 gkm_attribute_set_mpi                       (CK_ATTRIBUTE_PTR attr,
                                                                    gcry_mpi_t mpi);
 
-CK_ULONG              gck_util_next_handle                        (void);
+CK_ULONG              gkm_util_next_handle                        (void);
 
-void                  gck_util_dispose_unref                      (gpointer object); 
+void                  gkm_util_dispose_unref                      (gpointer object);
 
-#endif /* GCKUTIL_H_ */
+#endif /* GKM_UTIL_H_ */
diff --git a/pkcs11/gck/pk.asn b/pkcs11/gkm/pk.asn
similarity index 89%
rename from pkcs11/gck/pk.asn
rename to pkcs11/gkm/pk.asn
index f347c19..60bec59 100644
--- a/pkcs11/gck/pk.asn
+++ b/pkcs11/gkm/pk.asn
@@ -9,11 +9,11 @@ BEGIN
 
 RSAPublicKey ::= SEQUENCE {
         modulus                 INTEGER, -- n
-        publicExponent          INTEGER  -- e 
+        publicExponent          INTEGER  -- e
 }
 
--- 
--- Representation of RSA private key with information for the 
+--
+-- Representation of RSA private key with information for the
 -- CRT algorithm.
 --
 RSAPrivateKey ::= SEQUENCE {
@@ -37,7 +37,7 @@ OtherPrimeInfos ::= SEQUENCE SIZE(1..MAX) OF OtherPrimeInfo
 OtherPrimeInfo ::= SEQUENCE {
 	prime INTEGER,  -- ri
 	exponent INTEGER, -- di
-	coefficient INTEGER -- ti 
+	coefficient INTEGER -- ti
 }
 
 -- for signature calculation
@@ -45,7 +45,7 @@ OtherPrimeInfo ::= SEQUENCE {
 
 AlgorithmIdentifier ::= SEQUENCE  {
      algorithm               OBJECT IDENTIFIER,
-     parameters              ANY DEFINED BY algorithm OPTIONAL  
+     parameters              ANY DEFINED BY algorithm OPTIONAL
 }
                                 -- contains a value of the type
                                 -- registered for use with the
@@ -53,7 +53,7 @@ AlgorithmIdentifier ::= SEQUENCE  {
 
 DigestInfo ::= SEQUENCE {
      digestAlgorithm DigestAlgorithmIdentifier,
-     digest Digest 
+     digest Digest
 }
 
 DigestAlgorithmIdentifier ::= AlgorithmIdentifier
@@ -96,7 +96,7 @@ DSAPrivateKey ::= SEQUENCE {
 DHParameter ::= SEQUENCE {
 	prime INTEGER, -- p
 	base INTEGER, -- g
-	privateValueLength INTEGER OPTIONAL 
+	privateValueLength INTEGER OPTIONAL
 }
 
 
diff --git a/pkcs11/gck/pkix.asn b/pkcs11/gkm/pkix.asn
similarity index 98%
rename from pkcs11/gck/pkix.asn
rename to pkcs11/gkm/pkix.asn
index 1e5d657..23b8b3b 100644
--- a/pkcs11/gck/pkix.asn
+++ b/pkcs11/gkm/pkix.asn
@@ -208,7 +208,7 @@ DistributionPoint ::= SEQUENCE {
 
 DistributionPointName ::= CHOICE {
     fullName                [0]     GeneralNames,
-    nameRelativeToCRLIssuer [1]     RelativeDistinguishedName 
+    nameRelativeToCRLIssuer [1]     RelativeDistinguishedName
 }
 
 ReasonFlags ::= BIT STRING {
@@ -384,7 +384,7 @@ id-ad-caIssuers OBJECT IDENTIFIER ::= { id-ad 2 }
 Attribute       ::=     SEQUENCE {
         type            AttributeType,
         values  SET OF AttributeValue
-                -- at least one value is required -- 
+                -- at least one value is required --
 }
 
 AttributeType           ::=   OBJECT IDENTIFIER
@@ -521,7 +521,7 @@ TBSCertificate  ::=  SEQUENCE  {
      subjectUniqueID [2]  IMPLICIT UniqueIdentifier OPTIONAL,
                           -- If present, version shall be v2 or v3
      extensions      [3]  EXPLICIT Extensions OPTIONAL
-                          -- If present, version shall be v3 --  
+                          -- If present, version shall be v3 --
 }
 
 Version  ::=  INTEGER  {  v1(0), v2(1), v3(2)  }
@@ -573,7 +573,7 @@ TBSCertList  ::=  SEQUENCE  {
                                          -- if present, shall be v2
                                }  OPTIONAL,
      crlExtensions           [0] EXPLICIT Extensions OPTIONAL
-                                         -- if present, shall be v2 -- 
+                                         -- if present, shall be v2 --
 }
 
 -- Version, Time, CertificateSerialNumber, and Extensions were
@@ -604,7 +604,7 @@ id-dsa-with-sha1 OBJECT IDENTIFIER ::=  {
 
 Dss-Sig-Value ::= SEQUENCE {
      r       INTEGER,
-     s       INTEGER  
+     s       INTEGER
 }
 
 dhpublicnumber OBJECT IDENTIFIER ::= {
@@ -658,7 +658,7 @@ BuiltInStandardAttributes ::= SEQUENCE {
    personal-name        [5] EXPLICIT PersonalName OPTIONAL,
    -- see also teletex-personal-name
    organizational-unit-names    [6] EXPLICIT OrganizationalUnitNames OPTIONAL
-   -- see also teletex-organizational-unit-names -- 
+   -- see also teletex-organizational-unit-names --
 }
 
 CountryName ::= [APPLICATION 1] CHOICE {
@@ -939,7 +939,7 @@ pkcs-7-ContentInfo ::= SEQUENCE {
 
 pkcs-7-DigestInfo ::= SEQUENCE {
   digestAlgorithm pkcs-7-DigestAlgorithmIdentifier,
-  digest pkcs-7-Digest 
+  digest pkcs-7-Digest
 }
 
 pkcs-7-Digest ::= OCTET STRING
@@ -952,7 +952,7 @@ pkcs-7-SignedData ::= SEQUENCE {
   encapContentInfo pkcs-7-EncapsulatedContentInfo,
   certificates [0] IMPLICIT pkcs-7-CertificateSet OPTIONAL,
   crls [1] IMPLICIT pkcs-7-CertificateRevocationLists OPTIONAL,
-  signerInfos pkcs-7-SignerInfos 
+  signerInfos pkcs-7-SignerInfos
 }
 
 pkcs-7-CMSVersion ::= INTEGER  { v0(0), v1(1), v2(2), v3(3), v4(4) }
@@ -1041,7 +1041,7 @@ pkcs-8-Attributes ::= SET OF Attribute
 
 pkcs-8-EncryptedPrivateKeyInfo ::= SEQUENCE {
     encryptionAlgorithm AlgorithmIdentifier,
-    encryptedData pkcs-8-EncryptedData 
+    encryptedData pkcs-8-EncryptedData
 }
 
 pkcs-8-EncryptedData ::= OCTET STRING
@@ -1062,9 +1062,9 @@ pkcs-5-des-CBC-params ::= OCTET STRING (SIZE(8))
 
 pkcs-5-rc2-CBC-params ::= SEQUENCE {
   rc2ParameterVersion INTEGER OPTIONAL,
-  iv OCTET STRING (SIZE(8)) 
+  iv OCTET STRING (SIZE(8))
 }
-  
+
 pkcs-5-PBE-params ::= SEQUENCE {
   salt OCTET STRING (SIZE(8)),
   iterationCount INTEGER
@@ -1092,7 +1092,7 @@ pkcs-5-PBKDF2-params ::= SEQUENCE {
   },
   iterationCount INTEGER (1..MAX),
   keyLength INTEGER (1..MAX) OPTIONAL,
-  prf AlgorithmIdentifier OPTIONAL -- DEFAULT pkcs-5-id-hmacWithSHA1 
+  prf AlgorithmIdentifier OPTIONAL -- DEFAULT pkcs-5-id-hmacWithSHA1
 }
 
 -- PKCS #12 stuff
@@ -1100,9 +1100,9 @@ pkcs-5-PBKDF2-params ::= SEQUENCE {
 pkcs-12	OBJECT IDENTIFIER ::= {pkcs 12}
 
 pkcs-12-PFX ::= SEQUENCE {
-    	version		INTEGER {v3(3)},
-    	authSafe	pkcs-7-ContentInfo,
-    	macData    	pkcs-12-MacData OPTIONAL
+	version         INTEGER {v3(3)},
+	authSafe        pkcs-7-ContentInfo,
+	macData         pkcs-12-MacData OPTIONAL
 }
 
 pkcs-12-PbeParams ::= SEQUENCE {
@@ -1111,9 +1111,9 @@ pkcs-12-PbeParams ::= SEQUENCE {
 }
 
 pkcs-12-MacData ::= SEQUENCE {
-    	mac 		pkcs-7-DigestInfo,
-	macSalt	        OCTET STRING,
-	iterations	INTEGER DEFAULT 1
+	mac             pkcs-7-DigestInfo,
+	macSalt         OCTET STRING,
+	iterations      INTEGER DEFAULT 1
 -- Note: The default is for historical reasons and its use is
 -- deprecated. A higher value, like 1024 is recommended.
 }
@@ -1126,9 +1126,9 @@ pkcs-12-AuthenticatedSafe ::= SEQUENCE OF pkcs-7-ContentInfo
 pkcs-12-SafeContents ::= SEQUENCE OF pkcs-12-SafeBag
 
 pkcs-12-SafeBag ::= SEQUENCE {
-  	bagId	      	OBJECT IDENTIFIER,
-  	bagValue      	[0] EXPLICIT ANY DEFINED BY badId,
-  	bagAttributes 	SET OF pkcs-12-PKCS12Attribute OPTIONAL
+	bagId           OBJECT IDENTIFIER,
+	bagValue        [0] EXPLICIT ANY DEFINED BY badId,
+	bagAttributes   SET OF pkcs-12-PKCS12Attribute OPTIONAL
 }
 
 -- Bag types
diff --git a/pkcs11/gck/tests/.gitignore b/pkcs11/gkm/tests/.gitignore
similarity index 100%
rename from pkcs11/gck/tests/.gitignore
rename to pkcs11/gkm/tests/.gitignore
diff --git a/pkcs11/gck/tests/Makefile.am b/pkcs11/gkm/tests/Makefile.am
similarity index 90%
rename from pkcs11/gck/tests/Makefile.am
rename to pkcs11/gkm/tests/Makefile.am
index 1a16b2b..6890297 100644
--- a/pkcs11/gck/tests/Makefile.am
+++ b/pkcs11/gkm/tests/Makefile.am
@@ -24,7 +24,7 @@ UNIT_AUTO = \
 UNIT_PROMPT =
 
 UNIT_LIBS =  \
-	$(top_builddir)/pkcs11/gck/libgck.la \
+	$(top_builddir)/pkcs11/gkm/libgkm.la \
 	$(top_builddir)/egg/libegg.la
 
 EXTRA_DIST = \
@@ -42,7 +42,6 @@ dump_data_file_SOURCES = \
 	dump-data-file.c
 
 dump_data_file_LDADD = \
-	$(top_builddir)/pkcs11/gck/libgck.la \
+	$(top_builddir)/pkcs11/gkm/libgkm.la \
 	$(top_builddir)/egg/libegg.la \
-	$(DAEMON_LIBS)
-
+	$(DAEMON_LIBS)
\ No newline at end of file
diff --git a/pkcs11/gck/tests/dump-data-file.c b/pkcs11/gkm/tests/dump-data-file.c
similarity index 77%
rename from pkcs11/gck/tests/dump-data-file.c
rename to pkcs11/gkm/tests/dump-data-file.c
index 32e3bde..d0a7442 100644
--- a/pkcs11/gck/tests/dump-data-file.c
+++ b/pkcs11/gkm/tests/dump-data-file.c
@@ -1,5 +1,5 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* dump-data-file.c: Dump a gck data file
+/* dump-data-file.c: Dump a gkm data file
 
    Copyright (C) 2009 Stefan Walter
 
@@ -21,8 +21,8 @@
    Author: Stef Walter <stef memberwebs com>
 */
 
-#include "gck-crypto.h"
-#include "gck-data-file.h"
+#include "gkm-crypto.h"
+#include "gkm-data-file.h"
 
 #include "egg/egg-secure-memory.h"
 
@@ -36,11 +36,11 @@
 #include <string.h>
 #include <unistd.h>
 
-void egg_memory_lock (void) 
+void egg_memory_lock (void)
 	{ }
-void egg_memory_unlock (void) 
+void egg_memory_unlock (void)
 	{ }
-void* egg_memory_fallback (void *p, size_t sz) 
+void* egg_memory_fallback (void *p, size_t sz)
 	{ return g_realloc (p, sz); }
 
 static void G_GNUC_NORETURN
@@ -54,47 +54,47 @@ failure (const gchar* message, ...)
 	exit (1);
 }
 
-int 
+int
 main(int argc, char* argv[])
 {
 	const gchar *password;
-	GckDataResult res;
-	GckDataFile *file;
-	GckSecret *login;
+	GkmDataResult res;
+	GkmDataFile *file;
+	GkmSecret *login;
 	int fd;
-	
+
 	g_type_init ();
-	gck_crypto_initialize ();
-	
-	if (argc != 2) 
+	gkm_crypto_initialize ();
+
+	if (argc != 2)
 		failure ("usage: dump-data-file filename");
-	
+
 	fd = open (argv[1], O_RDONLY, 0);
 	if (fd == -1)
 		failure ("dump-data-file: couldn't open file: %s: %s", argv[1], g_strerror (errno));
-	
+
 	password = getpass ("Password: ");
-	login = gck_secret_new ((guchar*)password, strlen (password));
-	
-	file = gck_data_file_new ();
-	res = gck_data_file_read_fd (file, fd, login);
+	login = gkm_secret_new ((guchar*)password, strlen (password));
+
+	file = gkm_data_file_new ();
+	res = gkm_data_file_read_fd (file, fd, login);
 	g_object_unref (login);
 
 	switch(res) {
-	case GCK_DATA_FAILURE:
+	case GKM_DATA_FAILURE:
 		failure ("dump-data-file: failed to read file: %s", argv[1]);
-	case GCK_DATA_LOCKED:
+	case GKM_DATA_LOCKED:
 		failure ("dump-data-file: invalid password for file: %s", argv[1]);
-	case GCK_DATA_UNRECOGNIZED:
+	case GKM_DATA_UNRECOGNIZED:
 		failure ("dump-data-file: unparseable file format: %s", argv[1]);
-	case GCK_DATA_SUCCESS:
+	case GKM_DATA_SUCCESS:
 		break;
 	default:
 		g_assert_not_reached ();
 	}
-	
-	gck_data_file_dump (file);
+
+	gkm_data_file_dump (file);
 	g_object_unref (file);
-	
+
 	return 0;
 }
diff --git a/pkcs11/gck/tests/mock-locked-object.c b/pkcs11/gkm/tests/mock-locked-object.c
similarity index 65%
rename from pkcs11/gck/tests/mock-locked-object.c
rename to pkcs11/gkm/tests/mock-locked-object.c
index 9803921..0e92d07 100644
--- a/pkcs11/gck/tests/mock-locked-object.c
+++ b/pkcs11/gkm/tests/mock-locked-object.c
@@ -1,64 +1,64 @@
-/* 
+/*
  * gnome-keyring
- * 
+ *
  * Copyright (C) 2009 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  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  License for more details.
- *  
- * You should have received a copy of the GNU Lesser General 
+ *
+ * You should have received a copy of the GNU Lesser General
  * 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"
 
 #include "mock-locked-object.h"
 
-#include "gck/gck-attributes.h"
-#include "gck/gck-credential.h"
+#include "gkm/gkm-attributes.h"
+#include "gkm/gkm-credential.h"
 
-G_DEFINE_TYPE (MockLockedObject, mock_locked_object, GCK_TYPE_OBJECT);
+G_DEFINE_TYPE (MockLockedObject, mock_locked_object, GKM_TYPE_OBJECT);
 
 /* -----------------------------------------------------------------------------
- * INTERNAL 
+ * INTERNAL
  */
 
 /* -----------------------------------------------------------------------------
- * KEY 
+ * KEY
  */
 
-static CK_RV 
-mock_locked_object_real_get_attribute (GckObject *base, GckSession *session, CK_ATTRIBUTE* attr)
+static CK_RV
+mock_locked_object_real_get_attribute (GkmObject *base, GkmSession *session, CK_ATTRIBUTE* attr)
 {
 	switch (attr->type) {
 	case CKA_CLASS:
-		return gck_attribute_set_ulong (attr, CKO_DATA);
+		return gkm_attribute_set_ulong (attr, CKO_DATA);
 	case CKA_ALWAYS_AUTHENTICATE:
-		return gck_attribute_set_bool (attr, TRUE);
+		return gkm_attribute_set_bool (attr, TRUE);
 	};
 
-	return GCK_OBJECT_CLASS (mock_locked_object_parent_class)->get_attribute (base, session, attr);
+	return GKM_OBJECT_CLASS (mock_locked_object_parent_class)->get_attribute (base, session, attr);
 }
 
 static CK_RV
-mock_locked_object_real_unlock (GckObject *base, GckCredential *auth)
+mock_locked_object_real_unlock (GkmObject *base, GkmCredential *auth)
 {
 	const gchar *password;
 	gsize n_password;
 
-	password = gck_credential_get_password (auth, &n_password);
+	password = gkm_credential_get_password (auth, &n_password);
 	if (n_password == 4 && memcmp (password, "mock", 4) == 0)
 		return CKR_OK;
-	
+
 	return CKR_USER_NOT_LOGGED_IN;
 }
 
@@ -71,18 +71,18 @@ mock_locked_object_init (MockLockedObject *self)
 static void
 mock_locked_object_class_init (MockLockedObjectClass *klass)
 {
-	GckObjectClass *gck_class = GCK_OBJECT_CLASS (klass);
+	GkmObjectClass *gkm_class = GKM_OBJECT_CLASS (klass);
 	mock_locked_object_parent_class = g_type_class_peek_parent (klass);
-	gck_class->get_attribute = mock_locked_object_real_get_attribute;
-	gck_class->unlock = mock_locked_object_real_unlock;
+	gkm_class->get_attribute = mock_locked_object_real_get_attribute;
+	gkm_class->unlock = mock_locked_object_real_unlock;
 }
 
 /* -----------------------------------------------------------------------------
- * PUBLIC 
+ * PUBLIC
  */
 
-GckObject*
-mock_locked_object_new (GckModule *module, GckManager *manager)
+GkmObject*
+mock_locked_object_new (GkmModule *module, GkmManager *manager)
 {
 	return g_object_new (MOCK_TYPE_LOCKED_OBJECT,
 	                     "module", module,
diff --git a/pkcs11/gck/tests/mock-locked-object.h b/pkcs11/gkm/tests/mock-locked-object.h
similarity index 84%
rename from pkcs11/gck/tests/mock-locked-object.h
rename to pkcs11/gkm/tests/mock-locked-object.h
index 3c8101b..f68c863 100644
--- a/pkcs11/gck/tests/mock-locked-object.h
+++ b/pkcs11/gkm/tests/mock-locked-object.h
@@ -1,22 +1,22 @@
-/* 
+/*
  * gnome-keyring
- * 
+ *
  * Copyright (C) 2009 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  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  License for more details.
- *  
- * You should have received a copy of the GNU Lesser General 
+ *
+ * You should have received a copy of the GNU Lesser General
  * 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.
  */
 
 #ifndef __MOCK_LOCKED_OBJECT_H__
@@ -24,8 +24,8 @@
 
 #include <glib-object.h>
 
-#include "gck-object.h"
-#include "gck-types.h"
+#include "gkm-object.h"
+#include "gkm-types.h"
 
 #define MOCK_TYPE_LOCKED_OBJECT               (mock_locked_object_get_type ())
 #define MOCK_LOCKED_OBJECT(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOCK_TYPE_LOCKED_OBJECT, MockLockedObject))
@@ -36,17 +36,17 @@
 
 typedef struct _MockLockedObject MockLockedObject;
 typedef struct _MockLockedObjectClass MockLockedObjectClass;
-    
+
 struct _MockLockedObject {
-	GckObject parent;
+	GkmObject parent;
 };
 
 struct _MockLockedObjectClass {
-	GckObjectClass parent_class;
+	GkmObjectClass parent_class;
 };
 
 GType                      mock_locked_object_get_type               (void);
 
-GckObject*                 mock_locked_object_new                    (GckModule *module, GckManager *manager);
+GkmObject*                 mock_locked_object_new                    (GkmModule *module, GkmManager *manager);
 
 #endif /* __MOCK_LOCKED_OBJECT_H__ */
diff --git a/pkcs11/gck/tests/test-data/ca-certificates.crt b/pkcs11/gkm/tests/test-data/ca-certificates.crt
similarity index 100%
rename from pkcs11/gck/tests/test-data/ca-certificates.crt
rename to pkcs11/gkm/tests/test-data/ca-certificates.crt
diff --git a/pkcs11/gck/tests/test-data/data-file-private.store b/pkcs11/gkm/tests/test-data/data-file-private.store
similarity index 100%
rename from pkcs11/gck/tests/test-data/data-file-private.store
rename to pkcs11/gkm/tests/test-data/data-file-private.store
diff --git a/pkcs11/gck/tests/test-data/data-file-public.store b/pkcs11/gkm/tests/test-data/data-file-public.store
similarity index 100%
rename from pkcs11/gck/tests/test-data/data-file-public.store
rename to pkcs11/gkm/tests/test-data/data-file-public.store
diff --git a/pkcs11/gck/tests/test-data/der-pkcs8-PBE-MD5-DES.key b/pkcs11/gkm/tests/test-data/der-pkcs8-PBE-MD5-DES.key
similarity index 100%
rename from pkcs11/gck/tests/test-data/der-pkcs8-PBE-MD5-DES.key
rename to pkcs11/gkm/tests/test-data/der-pkcs8-PBE-MD5-DES.key
diff --git a/pkcs11/gck/tests/test-data/der-pkcs8-PBE-SHA1-3DES.key b/pkcs11/gkm/tests/test-data/der-pkcs8-PBE-SHA1-3DES.key
similarity index 100%
rename from pkcs11/gck/tests/test-data/der-pkcs8-PBE-SHA1-3DES.key
rename to pkcs11/gkm/tests/test-data/der-pkcs8-PBE-SHA1-3DES.key
diff --git a/pkcs11/gck/tests/test-data/der-pkcs8-PBE-SHA1-DES.key b/pkcs11/gkm/tests/test-data/der-pkcs8-PBE-SHA1-DES.key
similarity index 100%
rename from pkcs11/gck/tests/test-data/der-pkcs8-PBE-SHA1-DES.key
rename to pkcs11/gkm/tests/test-data/der-pkcs8-PBE-SHA1-DES.key
diff --git a/pkcs11/gck/tests/test-data/der-pkcs8-PBE-SHA1-RC2-40.key b/pkcs11/gkm/tests/test-data/der-pkcs8-PBE-SHA1-RC2-40.key
similarity index 100%
rename from pkcs11/gck/tests/test-data/der-pkcs8-PBE-SHA1-RC2-40.key
rename to pkcs11/gkm/tests/test-data/der-pkcs8-PBE-SHA1-RC2-40.key
diff --git a/pkcs11/gck/tests/test-data/der-pkcs8-PBE-SHA1-RC4-128.key b/pkcs11/gkm/tests/test-data/der-pkcs8-PBE-SHA1-RC4-128.key
similarity index 100%
rename from pkcs11/gck/tests/test-data/der-pkcs8-PBE-SHA1-RC4-128.key
rename to pkcs11/gkm/tests/test-data/der-pkcs8-PBE-SHA1-RC4-128.key
diff --git a/pkcs11/gck/tests/test-data/der-pkcs8-dsa.key b/pkcs11/gkm/tests/test-data/der-pkcs8-dsa.key
similarity index 100%
rename from pkcs11/gck/tests/test-data/der-pkcs8-dsa.key
rename to pkcs11/gkm/tests/test-data/der-pkcs8-dsa.key
diff --git a/pkcs11/gck/tests/test-data/der-pkcs8-encrypted-pkcs5.key b/pkcs11/gkm/tests/test-data/der-pkcs8-encrypted-pkcs5.key
similarity index 100%
rename from pkcs11/gck/tests/test-data/der-pkcs8-encrypted-pkcs5.key
rename to pkcs11/gkm/tests/test-data/der-pkcs8-encrypted-pkcs5.key
diff --git a/pkcs11/gck/tests/test-data/der-pkcs8-v2-des.key b/pkcs11/gkm/tests/test-data/der-pkcs8-v2-des.key
similarity index 100%
rename from pkcs11/gck/tests/test-data/der-pkcs8-v2-des.key
rename to pkcs11/gkm/tests/test-data/der-pkcs8-v2-des.key
diff --git a/pkcs11/gck/tests/test-data/der-pkcs8-v2-des3.key b/pkcs11/gkm/tests/test-data/der-pkcs8-v2-des3.key
similarity index 100%
rename from pkcs11/gck/tests/test-data/der-pkcs8-v2-des3.key
rename to pkcs11/gkm/tests/test-data/der-pkcs8-v2-des3.key
diff --git a/pkcs11/gck/tests/test-data/der-pkcs8.key b/pkcs11/gkm/tests/test-data/der-pkcs8.key
similarity index 100%
rename from pkcs11/gck/tests/test-data/der-pkcs8.key
rename to pkcs11/gkm/tests/test-data/der-pkcs8.key
diff --git a/pkcs11/gck/tests/test-data/pem-rsa-enc.key b/pkcs11/gkm/tests/test-data/pem-rsa-enc.key
similarity index 100%
rename from pkcs11/gck/tests/test-data/pem-rsa-enc.key
rename to pkcs11/gkm/tests/test-data/pem-rsa-enc.key
diff --git a/pkcs11/gck/tests/test-data/test-certificate-1.der b/pkcs11/gkm/tests/test-data/test-certificate-1.der
similarity index 100%
rename from pkcs11/gck/tests/test-data/test-certificate-1.der
rename to pkcs11/gkm/tests/test-data/test-certificate-1.der
diff --git a/pkcs11/gck/tests/test-data/test-certificate-2.der b/pkcs11/gkm/tests/test-data/test-certificate-2.der
similarity index 100%
rename from pkcs11/gck/tests/test-data/test-certificate-2.der
rename to pkcs11/gkm/tests/test-data/test-certificate-2.der
diff --git a/pkcs11/gck/tests/test-module.c b/pkcs11/gkm/tests/test-module.c
similarity index 83%
rename from pkcs11/gck/tests/test-module.c
rename to pkcs11/gkm/tests/test-module.c
index a506ed7..9d8ff33 100644
--- a/pkcs11/gck/tests/test-module.c
+++ b/pkcs11/gkm/tests/test-module.c
@@ -26,20 +26,20 @@
 #include "run-auto-test.h"
 
 /* Include all the module entry points */
-#include "gck/gck-module-ep.h"
-GCK_DEFINE_MODULE (test_module, GCK_TYPE_MODULE);
+#include "gkm/gkm-module-ep.h"
+GKM_DEFINE_MODULE (test_module, GKM_TYPE_MODULE);
 
-#include "gck/gck-certificate.h"
+#include "gkm/gkm-certificate.h"
 
-GckModule*
+GkmModule*
 test_module_initialize_and_enter (void)
 {
 	CK_RV rv;
-	
-	gck_crypto_initialize ();
+
+	gkm_crypto_initialize ();
 	rv = test_module_function_list->C_Initialize (NULL);
 	g_return_val_if_fail (rv == CKR_OK, NULL);
-	
+
 	g_return_val_if_fail (pkcs11_module, NULL);
 
 	test_module_enter ();
@@ -50,7 +50,7 @@ void
 test_module_leave_and_finalize (void)
 {
 	CK_RV rv;
-	
+
 	test_module_leave ();
 	rv = test_module_function_list->C_Finalize (NULL);
 	g_return_if_fail (rv == CKR_OK);
@@ -59,7 +59,7 @@ test_module_leave_and_finalize (void)
 void
 test_module_leave (void)
 {
-	g_static_mutex_unlock (&pkcs11_module_mutex);	
+	g_static_mutex_unlock (&pkcs11_module_mutex);
 }
 
 void
@@ -68,33 +68,33 @@ test_module_enter (void)
 	g_static_mutex_lock (&pkcs11_module_mutex);
 }
 
-GckSession*
+GkmSession*
 test_module_open_session (gboolean writable)
 {
 	CK_ULONG flags = CKF_SERIAL_SESSION;
 	CK_SESSION_HANDLE handle;
-	GckSession *session;
+	GkmSession *session;
 	CK_RV rv;
 
 	if (writable)
 		flags |= CKF_RW_SESSION;
 
-	rv = gck_module_C_OpenSession (pkcs11_module, 1, flags, NULL, NULL, &handle);
+	rv = gkm_module_C_OpenSession (pkcs11_module, 1, flags, NULL, NULL, &handle);
 	g_assert (rv == CKR_OK);
 
-	session = gck_module_lookup_session (pkcs11_module, handle);
+	session = gkm_module_lookup_session (pkcs11_module, handle);
 	g_assert (session);
 
 	return session;
 }
 
-GckObject*
-test_module_object_new (GckSession *session)
+GkmObject*
+test_module_object_new (GkmSession *session)
 {
 	CK_BBOOL token = CK_FALSE;
 	CK_OBJECT_CLASS klass = CKO_CERTIFICATE;
 	CK_CERTIFICATE_TYPE type = CKC_X_509;
-	GckObject *object;
+	GkmObject *object;
 
 	gsize n_data;
 	guchar *data = test_data_read ("test-certificate-1.der", &n_data);
@@ -106,7 +106,7 @@ test_module_object_new (GckSession *session)
 		{ CKA_VALUE, data, n_data },
 	};
 
-	object = gck_session_create_object_for_factory (session, GCK_FACTORY_CERTIFICATE, NULL,
+	object = gkm_session_create_object_for_factory (session, GKM_FACTORY_CERTIFICATE, NULL,
 	                                              attrs, G_N_ELEMENTS (attrs));
 	if (object) /* Owned by storage */
 		g_object_unref (object);
diff --git a/pkcs11/gck/tests/test-module.h b/pkcs11/gkm/tests/test-module.h
similarity index 86%
rename from pkcs11/gck/tests/test-module.h
rename to pkcs11/gkm/tests/test-module.h
index 32fece1..f4223b5 100644
--- a/pkcs11/gck/tests/test-module.h
+++ b/pkcs11/gkm/tests/test-module.h
@@ -26,7 +26,7 @@
 
 #include <glib.h>
 
-#include "gck-types.h"
+#include "gkm-types.h"
 
 #include "pkcs11.h"
 
@@ -34,12 +34,12 @@ void                   test_module_leave                    (void);
 
 void                   test_module_enter                    (void);
 
-GckModule*             test_module_initialize_and_enter     (void);
+GkmModule*             test_module_initialize_and_enter     (void);
 
 void                   test_module_leave_and_finalize       (void);
 
-GckSession*            test_module_open_session             (gboolean writable);
+GkmSession*            test_module_open_session             (gboolean writable);
 
-GckObject*             test_module_object_new               (GckSession *session);
+GkmObject*             test_module_object_new               (GkmSession *session);
 
 #endif /* TESTMODULE_H_ */
diff --git a/pkcs11/gck/tests/test.asn b/pkcs11/gkm/tests/test.asn
similarity index 100%
rename from pkcs11/gck/tests/test.asn
rename to pkcs11/gkm/tests/test.asn
diff --git a/pkcs11/gck/tests/unit-test-attributes.c b/pkcs11/gkm/tests/unit-test-attributes.c
similarity index 77%
rename from pkcs11/gck/tests/unit-test-attributes.c
rename to pkcs11/gkm/tests/unit-test-attributes.c
index ed9cbb0..6c62382 100644
--- a/pkcs11/gck/tests/unit-test-attributes.c
+++ b/pkcs11/gkm/tests/unit-test-attributes.c
@@ -23,7 +23,7 @@
 
 #include "run-auto-test.h"
 
-#include "gck/gck-attributes.h"
+#include "gkm/gkm-attributes.h"
 
 /* Some test data */
 static CK_OBJECT_CLASS attr_template_klass = CKO_DATA;
@@ -40,15 +40,15 @@ DEFINE_TEST(attribute_equal_zero_len_null_ptr)
 {
 	CK_ATTRIBUTE attr1 = { CKA_LABEL, "", 0 };
 	CK_ATTRIBUTE attr2 = { CKA_LABEL, NULL, 0 };
-	g_assert (gck_attribute_equal (&attr1, &attr2));
+	g_assert (gkm_attribute_equal (&attr1, &attr2));
 }
 
 DEFINE_TEST(attribute_consume)
 {
 	CK_ATTRIBUTE attr;
 	attr.type = CKA_LABEL;
-	
-	gck_attribute_consume (&attr);
+
+	gkm_attribute_consume (&attr);
 	g_assert (attr.type == (gulong)-1);
 }
 
@@ -59,12 +59,12 @@ DEFINE_TEST(attribute_consumed)
 
 	attr.type = CKA_LABEL;
 
-	ret = gck_attribute_consumed (&attr);
+	ret = gkm_attribute_consumed (&attr);
 	g_assert (ret == FALSE);
 
-	gck_attribute_consume (&attr);
+	gkm_attribute_consume (&attr);
 
-	ret = gck_attribute_consumed (&attr);
+	ret = gkm_attribute_consumed (&attr);
 	g_assert (ret == TRUE);
 }
 
@@ -74,7 +74,7 @@ DEFINE_TEST(attribute_set_data)
 	CK_ATTRIBUTE attr = { 0, buffer, sizeof (buffer) };
 	CK_RV rv;
 
-	rv = gck_attribute_set_data (&attr, "mytest", 6);
+	rv = gkm_attribute_set_data (&attr, "mytest", 6);
 	g_assert (rv == CKR_OK);
 	g_assert (attr.ulValueLen == 6);
 	g_assert (memcmp (buffer, "mytest", 6) == 0);
@@ -86,7 +86,7 @@ DEFINE_TEST(attribute_set_data_short)
 	CK_ATTRIBUTE attr = { 0, buffer, 4 };
 	CK_RV rv;
 
-	rv = gck_attribute_set_data (&attr, "mytest", 6);
+	rv = gkm_attribute_set_data (&attr, "mytest", 6);
 	g_assert (rv == CKR_BUFFER_TOO_SMALL);
 	g_assert (attr.ulValueLen == (CK_ULONG)-1);
 }
@@ -96,7 +96,7 @@ DEFINE_TEST(attribute_set_data_length)
 	CK_ATTRIBUTE attr = { 0, NULL, 0 };
 	CK_RV rv;
 
-	rv = gck_attribute_set_data (&attr, "mytest", 6);
+	rv = gkm_attribute_set_data (&attr, "mytest", 6);
 	g_assert (rv == CKR_OK);
 	g_assert (attr.ulValueLen == 6);
 }
@@ -109,7 +109,7 @@ DEFINE_TEST(attribute_set_empty)
 
 	attr.ulValueLen = 30;
 	attr.pValue = buf;
-	rv = gck_attribute_set_empty (&attr);
+	rv = gkm_attribute_set_empty (&attr);
 	g_assert (rv == CKR_OK);
 	g_assert (attr.ulValueLen == 0);
 }
@@ -123,7 +123,7 @@ DEFINE_TEST(attribute_get_bool)
 
 	attr.ulValueLen = sizeof (CK_BBOOL);
 	attr.pValue = &val;
-	rv = gck_attribute_get_bool (&attr, &value);
+	rv = gkm_attribute_get_bool (&attr, &value);
 	g_assert (rv == CKR_OK);
 	g_assert (value == TRUE);
 }
@@ -137,7 +137,7 @@ DEFINE_TEST(attribute_get_bool_invalid)
 
 	attr.ulValueLen = sizeof (CK_ULONG);
 	attr.pValue = &val;
-	rv = gck_attribute_get_bool (&attr, &value);
+	rv = gkm_attribute_get_bool (&attr, &value);
 	g_assert (rv == CKR_ATTRIBUTE_VALUE_INVALID);
 }
 
@@ -149,7 +149,7 @@ DEFINE_TEST(attribute_set_time)
 
 	attr.ulValueLen = 30;
 	attr.pValue = buf;
-	rv = gck_attribute_set_time (&attr, 1247930171);
+	rv = gkm_attribute_set_time (&attr, 1247930171);
 	g_assert (rv == CKR_OK);
 	g_assert (attr.ulValueLen == 16);
 	g_assert (memcmp (attr.pValue, "2009071815161100", 16) == 0);
@@ -163,7 +163,7 @@ DEFINE_TEST(attribute_set_time_empty)
 
 	attr.ulValueLen = 30;
 	attr.pValue = buf;
-	rv = gck_attribute_set_time (&attr, -1);
+	rv = gkm_attribute_set_time (&attr, -1);
 	g_assert (rv == CKR_OK);
 	g_assert (attr.ulValueLen == 0);
 }
@@ -175,7 +175,7 @@ DEFINE_TEST(attribute_set_time_length)
 
 	attr.pValue = NULL;
 	attr.ulValueLen = 0;
-	rv = gck_attribute_set_time (&attr, 1247930171);
+	rv = gkm_attribute_set_time (&attr, 1247930171);
 	g_assert (rv == CKR_OK);
 	g_assert (attr.ulValueLen == 16);
 	g_assert (attr.pValue == NULL);
@@ -189,7 +189,7 @@ DEFINE_TEST(attribute_get_time)
 
 	attr.ulValueLen = 16;
 	attr.pValue = "2009071815161100";
-	rv = gck_attribute_get_time (&attr, &when);
+	rv = gkm_attribute_get_time (&attr, &when);
 	g_assert (rv == CKR_OK);
 	g_assert (when == 1247930171);
 }
@@ -202,7 +202,7 @@ DEFINE_TEST(attribute_get_time_empty)
 
 	attr.ulValueLen = 0;
 	attr.pValue = "";
-	rv = gck_attribute_get_time (&attr, &when);
+	rv = gkm_attribute_get_time (&attr, &when);
 	g_assert (rv == CKR_OK);
 	g_assert (when == -1);
 }
@@ -215,7 +215,7 @@ DEFINE_TEST(attribute_get_time_invalid)
 
 	attr.ulValueLen = 16;
 	attr.pValue = "aaaaaaaaaaaaaaaa";
-	rv = gck_attribute_get_time (&attr, &when);
+	rv = gkm_attribute_get_time (&attr, &when);
 	g_assert (rv == CKR_ATTRIBUTE_VALUE_INVALID);
 }
 
@@ -227,7 +227,7 @@ DEFINE_TEST(attribute_get_time_invalid_length)
 
 	attr.ulValueLen = 8;
 	attr.pValue = "2009071815161100";
-	rv = gck_attribute_get_time (&attr, &when);
+	rv = gkm_attribute_get_time (&attr, &when);
 	g_assert (rv == CKR_ATTRIBUTE_VALUE_INVALID);
 }
 
@@ -240,7 +240,7 @@ DEFINE_TEST(attribute_get_string)
 	attr.ulValueLen = 4;
 	attr.pValue = "blah";
 
-	rv = gck_attribute_get_string (&attr, &value);
+	rv = gkm_attribute_get_string (&attr, &value);
 	g_assert (rv == CKR_OK);
 	g_assert_cmpstr (value, ==, "blah");
 
@@ -256,7 +256,7 @@ DEFINE_TEST(attribute_get_string_null)
 	attr.ulValueLen = 0;
 	attr.pValue = NULL;
 
-	rv = gck_attribute_get_string (&attr, &value);
+	rv = gkm_attribute_get_string (&attr, &value);
 	g_assert (rv == CKR_OK);
 	g_assert (value == NULL);
 }
@@ -271,7 +271,7 @@ DEFINE_TEST(attribute_get_string_not_utf8)
 	attr.ulValueLen = 5;
 	attr.pValue = "\0test";
 
-	rv = gck_attribute_get_string (&attr, &value);
+	rv = gkm_attribute_get_string (&attr, &value);
 	g_assert (rv == CKR_ATTRIBUTE_VALUE_INVALID);
 }
 
@@ -285,7 +285,7 @@ DEFINE_TEST(attribute_get_string_bad_pointer)
 	attr.ulValueLen = 5;
 	attr.pValue = NULL;
 
-	rv = gck_attribute_get_string (&attr, &value);
+	rv = gkm_attribute_get_string (&attr, &value);
 	g_assert (rv == CKR_ATTRIBUTE_VALUE_INVALID);
 }
 
@@ -295,12 +295,12 @@ DEFINE_TEST(attribute_set_bool)
 	CK_ATTRIBUTE attr = { 0, buffer, sizeof (buffer) };
 	CK_RV rv;
 
-	rv = gck_attribute_set_bool (&attr, CK_TRUE);
+	rv = gkm_attribute_set_bool (&attr, CK_TRUE);
 	g_assert (rv == CKR_OK);
 	g_assert (attr.ulValueLen == 1);
 	g_assert (memcmp (buffer, "\1", 1) == 0);
 
-	rv = gck_attribute_set_bool (&attr, CK_FALSE);
+	rv = gkm_attribute_set_bool (&attr, CK_FALSE);
 	g_assert (rv == CKR_OK);
 	g_assert (attr.ulValueLen == 1);
 	g_assert (memcmp (buffer, "\0", 1) == 0);
@@ -312,7 +312,7 @@ DEFINE_TEST(attribute_set_bool_short)
 	CK_ATTRIBUTE attr = { 0, buffer, 0 };
 	CK_RV rv;
 
-	rv = gck_attribute_set_bool (&attr, CK_TRUE);
+	rv = gkm_attribute_set_bool (&attr, CK_TRUE);
 	g_assert (rv == CKR_BUFFER_TOO_SMALL);
 	g_assert (attr.ulValueLen == (CK_ULONG)-1);
 }
@@ -322,7 +322,7 @@ DEFINE_TEST(attribute_set_bool_length)
 	CK_ATTRIBUTE attr = { 0, NULL, 0 };
 	CK_RV rv;
 
-	rv = gck_attribute_set_bool (&attr, CK_TRUE);
+	rv = gkm_attribute_set_bool (&attr, CK_TRUE);
 	g_assert (rv == CKR_OK);
 	g_assert (attr.ulValueLen == 1);
 }
@@ -334,7 +334,7 @@ DEFINE_TEST(attribute_set_ulong)
 	CK_ULONG value = 55;
 	CK_RV rv;
 
-	rv = gck_attribute_set_ulong (&attr, value);
+	rv = gkm_attribute_set_ulong (&attr, value);
 	g_assert (rv == CKR_OK);
 	g_assert (attr.ulValueLen == sizeof (CK_ULONG));
 	g_assert (memcmp (buffer, &value, sizeof (CK_ULONG)) == 0);
@@ -346,7 +346,7 @@ DEFINE_TEST(attribute_set_ulong_short)
 	CK_ATTRIBUTE attr = { 0, buffer, 0 };
 	CK_RV rv;
 
-	rv = gck_attribute_set_ulong (&attr, 1);
+	rv = gkm_attribute_set_ulong (&attr, 1);
 	g_assert (rv == CKR_BUFFER_TOO_SMALL);
 	g_assert (attr.ulValueLen == (CK_ULONG)-1);
 }
@@ -356,7 +356,7 @@ DEFINE_TEST(attribute_set_ulong_length)
 	CK_ATTRIBUTE attr = { 0, NULL, 0 };
 	CK_RV rv;
 
-	rv = gck_attribute_set_ulong (&attr, 98889);
+	rv = gkm_attribute_set_ulong (&attr, 98889);
 	g_assert (rv == CKR_OK);
 	g_assert (attr.ulValueLen == sizeof (CK_ULONG));
 }
@@ -367,7 +367,7 @@ DEFINE_TEST(attribute_set_string)
 	CK_ATTRIBUTE attr = { 0, buffer, sizeof (buffer) };
 	CK_RV rv;
 
-	rv = gck_attribute_set_string (&attr, "hello");
+	rv = gkm_attribute_set_string (&attr, "hello");
 	g_assert (rv == CKR_OK);
 	g_assert (attr.ulValueLen == 5);
 	g_assert (memcmp (buffer, "hello", 5) == 0);
@@ -379,7 +379,7 @@ DEFINE_TEST(attribute_set_string_null)
 	CK_ATTRIBUTE attr = { 0, buffer, sizeof (buffer) };
 	CK_RV rv;
 
-	rv = gck_attribute_set_string (&attr, NULL);
+	rv = gkm_attribute_set_string (&attr, NULL);
 	g_assert (rv == CKR_OK);
 	g_assert (attr.ulValueLen == 0);
 }
@@ -390,7 +390,7 @@ DEFINE_TEST(attribute_set_string_short)
 	CK_ATTRIBUTE attr = { 0, buffer, 3 };
 	CK_RV rv;
 
-	rv = gck_attribute_set_string (&attr, "hello");
+	rv = gkm_attribute_set_string (&attr, "hello");
 	g_assert (rv == CKR_BUFFER_TOO_SMALL);
 	g_assert (attr.ulValueLen == (CK_ULONG)-1);
 }
@@ -400,7 +400,7 @@ DEFINE_TEST(attribute_set_string_length)
 	CK_ATTRIBUTE attr = { 0, NULL, 0 };
 	CK_RV rv;
 
-	rv = gck_attribute_set_string (&attr, "hello");
+	rv = gkm_attribute_set_string (&attr, "hello");
 	g_assert (rv == CKR_OK);
 	g_assert (attr.ulValueLen == 5);
 }
@@ -412,7 +412,7 @@ DEFINE_TEST(attribute_set_date)
 	CK_DATE *date;
 	CK_RV rv;
 
-	rv = gck_attribute_set_date (&attr, 1249845741);
+	rv = gkm_attribute_set_date (&attr, 1249845741);
 	g_assert (rv == CKR_OK);
 	g_assert (attr.ulValueLen == sizeof (CK_DATE));
 	date = (CK_DATE*)buffer;
@@ -427,7 +427,7 @@ DEFINE_TEST(attribute_set_date_none)
 	CK_ATTRIBUTE attr = { 0, buffer, sizeof (buffer) };
 	CK_RV rv;
 
-	rv = gck_attribute_set_date (&attr, (time_t)-1);
+	rv = gkm_attribute_set_date (&attr, (time_t)-1);
 	g_assert (rv == CKR_OK);
 	g_assert (attr.ulValueLen == 0);
 }
@@ -438,7 +438,7 @@ DEFINE_TEST(attribute_set_date_short)
 	CK_ATTRIBUTE attr = { 0, buffer, 5 };
 	CK_RV rv;
 
-	rv = gck_attribute_set_date (&attr, 1249845741);
+	rv = gkm_attribute_set_date (&attr, 1249845741);
 	g_assert (rv == CKR_BUFFER_TOO_SMALL);
 	g_assert (attr.ulValueLen == (CK_ULONG)-1);
 }
@@ -448,7 +448,7 @@ DEFINE_TEST(attribute_set_date_length)
 	CK_ATTRIBUTE attr = { 0, NULL, 0 };
 	CK_RV rv;
 
-	rv = gck_attribute_set_date (&attr, 1249845741);
+	rv = gkm_attribute_set_date (&attr, 1249845741);
 	g_assert (rv == CKR_OK);
 	g_assert (attr.ulValueLen == sizeof (CK_DATE));
 }
@@ -463,7 +463,7 @@ DEFINE_TEST(attribute_set_mpi)
 	mpi = gcry_mpi_new (32);
 	gcry_mpi_set_ui (mpi, 123456789);
 
-	rv = gck_attribute_set_mpi (&attr, mpi);
+	rv = gkm_attribute_set_mpi (&attr, mpi);
 	g_assert (rv == CKR_OK);
 	g_assert (attr.ulValueLen == 4);
 	g_assert (memcmp (buffer, "\a[\315\025", 4) == 0);
@@ -481,7 +481,7 @@ DEFINE_TEST(attribute_set_mpi_short)
 	mpi = gcry_mpi_new (32);
 	gcry_mpi_set_ui (mpi, 123456789);
 
-	rv = gck_attribute_set_mpi (&attr, mpi);
+	rv = gkm_attribute_set_mpi (&attr, mpi);
 	g_assert (rv == CKR_BUFFER_TOO_SMALL);
 	g_assert (attr.ulValueLen == (CK_ULONG)-1);
 
@@ -497,7 +497,7 @@ DEFINE_TEST(attribute_set_mpi_length)
 	mpi = gcry_mpi_new (32);
 	gcry_mpi_set_ui (mpi, 123456789);
 
-	rv = gck_attribute_set_mpi (&attr, mpi);
+	rv = gkm_attribute_set_mpi (&attr, mpi);
 	g_assert (rv == CKR_OK);
 	g_assert (attr.ulValueLen == 4);
 
@@ -513,7 +513,7 @@ DEFINE_TEST(attribute_equal)
 	CK_ATTRIBUTE attr2 = { CKA_ID, val2, 13 };
 	gboolean ret;
 
-	ret = gck_attribute_equal (&attr1, &attr2);
+	ret = gkm_attribute_equal (&attr1, &attr2);
 	g_assert (ret == TRUE);
 
 	g_free (val1);
@@ -525,7 +525,7 @@ DEFINE_TEST(attribute_equal_same)
 	CK_ATTRIBUTE attr = { CKA_ID, "my-identifier", 13 };
 	gboolean ret;
 
-	ret = gck_attribute_equal (&attr, &attr);
+	ret = gkm_attribute_equal (&attr, &attr);
 	g_assert (ret == TRUE);
 }
 
@@ -536,7 +536,7 @@ DEFINE_TEST(attribute_equal_same_pointer)
 	CK_ATTRIBUTE attr2 = { CKA_ID, val, 13 };
 	gboolean ret;
 
-	ret = gck_attribute_equal (&attr1, &attr2);
+	ret = gkm_attribute_equal (&attr1, &attr2);
 	g_assert (ret == TRUE);
 }
 
@@ -547,7 +547,7 @@ DEFINE_TEST(attribute_equal_diff_types)
 	CK_ATTRIBUTE attr2 = { CKA_VALUE, val, 13 };
 	gboolean ret;
 
-	ret = gck_attribute_equal (&attr1, &attr2);
+	ret = gkm_attribute_equal (&attr1, &attr2);
 	g_assert (ret == FALSE);
 }
 
@@ -557,7 +557,7 @@ DEFINE_TEST(attribute_equal_diff_length)
 	CK_ATTRIBUTE attr2 = { CKA_ID, "my-identifier", 2 };
 	gboolean ret;
 
-	ret = gck_attribute_equal (&attr1, &attr2);
+	ret = gkm_attribute_equal (&attr1, &attr2);
 	g_assert (ret == FALSE);
 }
 
@@ -567,7 +567,7 @@ DEFINE_TEST(attribute_equal_diff_value)
 	CK_ATTRIBUTE attr2 = { CKA_ID, "xy-identifier", 13 };
 	gboolean ret;
 
-	ret = gck_attribute_equal (&attr1, &attr2);
+	ret = gkm_attribute_equal (&attr1, &attr2);
 	g_assert (ret == FALSE);
 }
 
@@ -577,7 +577,7 @@ DEFINE_TEST(attribute_hash)
 	guint hash;
 
 	/* The hash value below could change as code changes */
-	hash = gck_attribute_hash (&attr);
+	hash = gkm_attribute_hash (&attr);
 	g_assert_cmpuint (hash, !=, 0U);
 }
 
@@ -586,7 +586,7 @@ DEFINE_TEST(attribute_contains)
 	CK_ATTRIBUTE attr = { CKA_ID, "my-identifier", 13 };
 	gboolean ret;
 
-	ret = gck_attributes_contains (attr_template, G_N_ELEMENTS (attr_template), &attr);
+	ret = gkm_attributes_contains (attr_template, G_N_ELEMENTS (attr_template), &attr);
 	g_assert (ret == TRUE);
 }
 
@@ -595,7 +595,7 @@ DEFINE_TEST(attribute_contains_no_value)
 	CK_ATTRIBUTE attr = { CKA_ID, "other-identifier", 16 };
 	gboolean ret;
 
-	ret = gck_attributes_contains (attr_template, G_N_ELEMENTS (attr_template), &attr);
+	ret = gkm_attributes_contains (attr_template, G_N_ELEMENTS (attr_template), &attr);
 	g_assert (ret == FALSE);
 }
 
@@ -604,7 +604,7 @@ DEFINE_TEST(attribute_contains_no_type)
 	CK_ATTRIBUTE attr = { CKA_VALUE, "value", 5 };
 	gboolean ret;
 
-	ret = gck_attributes_contains (attr_template, G_N_ELEMENTS (attr_template), &attr);
+	ret = gkm_attributes_contains (attr_template, G_N_ELEMENTS (attr_template), &attr);
 	g_assert (ret == FALSE);
 }
 
@@ -612,7 +612,7 @@ DEFINE_TEST(attributes_find)
 {
 	CK_ATTRIBUTE_PTR attr;
 
-	attr = gck_attributes_find (attr_template, G_N_ELEMENTS (attr_template), CKA_LABEL);
+	attr = gkm_attributes_find (attr_template, G_N_ELEMENTS (attr_template), CKA_LABEL);
 	g_assert (attr != NULL);
 	g_assert (attr->type == CKA_LABEL);
 }
@@ -621,7 +621,7 @@ DEFINE_TEST(attributes_find_not_found)
 {
 	CK_ATTRIBUTE_PTR attr;
 
-	attr = gck_attributes_find (attr_template, G_N_ELEMENTS (attr_template), CKA_SENSITIVE);
+	attr = gkm_attributes_find (attr_template, G_N_ELEMENTS (attr_template), CKA_SENSITIVE);
 	g_assert (attr == NULL);
 }
 
@@ -630,7 +630,7 @@ DEFINE_TEST(attribute_find_boolean)
 	gboolean value;
 	gboolean ret;
 
-	ret = gck_attributes_find_boolean (attr_template, G_N_ELEMENTS (attr_template), CKA_TOKEN, &value);
+	ret = gkm_attributes_find_boolean (attr_template, G_N_ELEMENTS (attr_template), CKA_TOKEN, &value);
 	g_assert (ret == TRUE);
 	g_assert (value == TRUE);
 }
@@ -640,7 +640,7 @@ DEFINE_TEST(attribute_find_boolean_no_type)
 	gboolean value;
 	gboolean ret;
 
-	ret = gck_attributes_find_boolean (attr_template, G_N_ELEMENTS (attr_template), CKA_SENSITIVE, &value);
+	ret = gkm_attributes_find_boolean (attr_template, G_N_ELEMENTS (attr_template), CKA_SENSITIVE, &value);
 	g_assert (ret == FALSE);
 }
 
@@ -649,7 +649,7 @@ DEFINE_TEST(attribute_find_boolean_not_bbool)
 	gboolean value;
 	gboolean ret;
 
-	ret = gck_attributes_find_boolean (attr_template, G_N_ELEMENTS (attr_template), CKA_CLASS, &value);
+	ret = gkm_attributes_find_boolean (attr_template, G_N_ELEMENTS (attr_template), CKA_CLASS, &value);
 	g_assert (ret == FALSE);
 }
 
@@ -658,7 +658,7 @@ DEFINE_TEST(attribute_find_ulong)
 	gulong value;
 	gboolean ret;
 
-	ret = gck_attributes_find_ulong (attr_template, G_N_ELEMENTS (attr_template), CKA_CLASS, &value);
+	ret = gkm_attributes_find_ulong (attr_template, G_N_ELEMENTS (attr_template), CKA_CLASS, &value);
 	g_assert (ret == TRUE);
 	g_assert (value == CKO_DATA);
 }
@@ -668,7 +668,7 @@ DEFINE_TEST(attribute_find_ulong_no_type)
 	gulong value;
 	gboolean ret;
 
-	ret = gck_attributes_find_ulong (attr_template, G_N_ELEMENTS (attr_template), CKA_KEY_TYPE, &value);
+	ret = gkm_attributes_find_ulong (attr_template, G_N_ELEMENTS (attr_template), CKA_KEY_TYPE, &value);
 	g_assert (ret == FALSE);
 }
 
@@ -677,7 +677,7 @@ DEFINE_TEST(attribute_find_ulong_not_ulong)
 	gulong value;
 	gboolean ret;
 
-	ret = gck_attributes_find_ulong (attr_template, G_N_ELEMENTS (attr_template), CKA_ID, &value);
+	ret = gkm_attributes_find_ulong (attr_template, G_N_ELEMENTS (attr_template), CKA_ID, &value);
 	g_assert (ret == FALSE);
 }
 
@@ -686,7 +686,7 @@ DEFINE_TEST(attribute_find_mpi)
 	gcry_mpi_t mpi = NULL;
 	gboolean ret;
 
-	ret = gck_attributes_find_mpi (attr_template, G_N_ELEMENTS (attr_template), CKA_VALUE, &mpi);
+	ret = gkm_attributes_find_mpi (attr_template, G_N_ELEMENTS (attr_template), CKA_VALUE, &mpi);
 	g_assert (ret == TRUE);
 	g_assert (mpi != NULL);
 
@@ -699,7 +699,7 @@ DEFINE_TEST(attribute_find_mpi_no_type)
 	gcry_mpi_t mpi = NULL;
 	gboolean ret;
 
-	ret = gck_attributes_find_mpi (attr_template, G_N_ELEMENTS (attr_template), CKA_MODULUS, &mpi);
+	ret = gkm_attributes_find_mpi (attr_template, G_N_ELEMENTS (attr_template), CKA_MODULUS, &mpi);
 	g_assert (ret == FALSE);
 	g_assert (mpi == NULL);
 }
@@ -714,66 +714,66 @@ DEFINE_TEST(attributes_consume)
 	n_attrs = G_N_ELEMENTS (attr_template);
 
 	/* All these attributes are there */
-	g_assert (gck_attributes_find (attrs, n_attrs, CKA_LABEL) != NULL);
-	g_assert (gck_attributes_find (attrs, n_attrs, CKA_ID) != NULL);
-	g_assert (gck_attributes_find (attrs, n_attrs, CKA_CLASS) != NULL);
+	g_assert (gkm_attributes_find (attrs, n_attrs, CKA_LABEL) != NULL);
+	g_assert (gkm_attributes_find (attrs, n_attrs, CKA_ID) != NULL);
+	g_assert (gkm_attributes_find (attrs, n_attrs, CKA_CLASS) != NULL);
 
 	/* Consume some of them */
-	gck_attributes_consume (attrs, n_attrs, CKA_LABEL, CKA_ID, G_MAXULONG);
+	gkm_attributes_consume (attrs, n_attrs, CKA_LABEL, CKA_ID, G_MAXULONG);
 
 	/* Two should be gone */
-	g_assert (gck_attributes_find (attrs, n_attrs, CKA_LABEL) == NULL);
-	g_assert (gck_attributes_find (attrs, n_attrs, CKA_ID) == NULL);
-	g_assert (gck_attributes_find (attrs, n_attrs, CKA_CLASS) != NULL);
+	g_assert (gkm_attributes_find (attrs, n_attrs, CKA_LABEL) == NULL);
+	g_assert (gkm_attributes_find (attrs, n_attrs, CKA_ID) == NULL);
+	g_assert (gkm_attributes_find (attrs, n_attrs, CKA_CLASS) != NULL);
 
 	g_free (attrs);
 }
 
 DEFINE_TEST(template_new_free)
 {
-	GArray *template = gck_template_new (attr_template, G_N_ELEMENTS (attr_template));
+	GArray *template = gkm_template_new (attr_template, G_N_ELEMENTS (attr_template));
 	g_assert (template);
-	gck_template_free (template);
+	gkm_template_free (template);
 }
 
 DEFINE_TEST(template_find)
 {
-	GArray *template = gck_template_new (attr_template, G_N_ELEMENTS (attr_template));
+	GArray *template = gkm_template_new (attr_template, G_N_ELEMENTS (attr_template));
 	gulong uvalue;
 	gboolean ret, bvalue;
 
-	ret = gck_template_find_ulong (template, CKA_CLASS, &uvalue);
+	ret = gkm_template_find_ulong (template, CKA_CLASS, &uvalue);
 	g_assert (ret);
 	g_assert (uvalue == attr_template_klass);
 
-	ret = gck_template_find_boolean (template, CKA_TOKEN, &bvalue);
+	ret = gkm_template_find_boolean (template, CKA_TOKEN, &bvalue);
 	g_assert (ret);
 	g_assert (bvalue == attr_template_token);
 
 	/* An invalid attribute */
-	ret = gck_template_find_boolean (template, CKA_AC_ISSUER, &bvalue);
+	ret = gkm_template_find_boolean (template, CKA_AC_ISSUER, &bvalue);
 	g_assert (!ret);
 
-	gck_template_free (template);
+	gkm_template_free (template);
 }
 
 DEFINE_TEST(template_set_replace)
 {
-	GArray *template = gck_template_new (attr_template, G_N_ELEMENTS (attr_template));
+	GArray *template = gkm_template_new (attr_template, G_N_ELEMENTS (attr_template));
 	CK_OBJECT_CLASS klass = CKO_HW_FEATURE;
 	CK_ATTRIBUTE attr = { CKA_CLASS, &klass, sizeof (klass) };
 	gulong uvalue;
 
-	if (!gck_template_find_ulong (template, CKA_CLASS, &uvalue))
+	if (!gkm_template_find_ulong (template, CKA_CLASS, &uvalue))
 		g_assert_not_reached ();
 	g_assert (uvalue == attr_template_klass);
 
 	/* Replace a previous attribute */
-	gck_template_set (template, &attr);
+	gkm_template_set (template, &attr);
 
-	if (!gck_template_find_ulong (template, CKA_CLASS, &uvalue))
+	if (!gkm_template_find_ulong (template, CKA_CLASS, &uvalue))
 		g_assert_not_reached ();
 	g_assert (uvalue == CKO_HW_FEATURE);
 
-	gck_template_free (template);
+	gkm_template_free (template);
 }
diff --git a/pkcs11/gck/tests/unit-test-credential.c b/pkcs11/gkm/tests/unit-test-credential.c
similarity index 68%
rename from pkcs11/gck/tests/unit-test-credential.c
rename to pkcs11/gkm/tests/unit-test-credential.c
index 0e1d9ff..805f950 100644
--- a/pkcs11/gck/tests/unit-test-credential.c
+++ b/pkcs11/gkm/tests/unit-test-credential.c
@@ -25,18 +25,18 @@
 #include "test-module.h"
 #include "mock-locked-object.h"
 
-#include "gck/gck-attributes.h"
-#include "gck/gck-credential.h"
-#include "gck/gck-object.h"
-#include "gck/gck-secret.h"
-#include "gck/gck-session.h"
-#include "gck/gck-module.h"
+#include "gkm/gkm-attributes.h"
+#include "gkm/gkm-credential.h"
+#include "gkm/gkm-object.h"
+#include "gkm/gkm-secret.h"
+#include "gkm/gkm-session.h"
+#include "gkm/gkm-module.h"
 
 #include "pkcs11i.h"
 
-static GckModule *module = NULL;
-static GckSession *session = NULL;
-static GckObject *object = NULL;
+static GkmModule *module = NULL;
+static GkmSession *session = NULL;
+static GkmObject *object = NULL;
 
 DEFINE_SETUP(credential_setup)
 {
@@ -44,11 +44,11 @@ DEFINE_SETUP(credential_setup)
 	module = test_module_initialize_and_enter ();
 	session = test_module_open_session (TRUE);
 
-	rv = gck_module_C_Login (module, gck_session_get_handle (session), CKU_USER, NULL, 0);
+	rv = gkm_module_C_Login (module, gkm_session_get_handle (session), CKU_USER, NULL, 0);
 	g_assert (rv == CKR_OK);
 
-	object = mock_locked_object_new (module, gck_module_get_manager (module));
-	gck_object_expose (object, TRUE);
+	object = mock_locked_object_new (module, gkm_module_get_manager (module));
+	gkm_object_expose (object, TRUE);
 }
 
 DEFINE_TEARDOWN(credential_teardown)
@@ -64,7 +64,7 @@ DEFINE_TEARDOWN(credential_teardown)
 DEFINE_TEST(credential_create)
 {
 	CK_OBJECT_CLASS klass = CKO_G_CREDENTIAL;
-	CK_OBJECT_HANDLE locked = gck_object_get_handle (object);
+	CK_OBJECT_HANDLE locked = gkm_object_get_handle (object);
 
 	CK_ATTRIBUTE attrs[] = {
 		{ CKA_CLASS, &klass, sizeof (klass) },
@@ -75,18 +75,18 @@ DEFINE_TEST(credential_create)
 	CK_OBJECT_HANDLE handle;
 	CK_RV rv;
 
-	rv = gck_session_C_CreateObject (session, attrs, G_N_ELEMENTS (attrs), &handle);
+	rv = gkm_session_C_CreateObject (session, attrs, G_N_ELEMENTS (attrs), &handle);
 	g_assert (rv == CKR_OK);
 	g_assert (handle != 0);
 
-	rv = gck_session_C_DestroyObject (session, handle);
+	rv = gkm_session_C_DestroyObject (session, handle);
 	g_assert (rv == CKR_OK);
 }
 
 DEFINE_TEST(credential_create_missing_pin)
 {
 	CK_OBJECT_CLASS klass = CKO_G_CREDENTIAL;
-	CK_OBJECT_HANDLE locked = gck_object_get_handle (object);
+	CK_OBJECT_HANDLE locked = gkm_object_get_handle (object);
 
 	CK_ATTRIBUTE attrs[] = {
 		{ CKA_CLASS, &klass, sizeof (klass) },
@@ -96,7 +96,7 @@ DEFINE_TEST(credential_create_missing_pin)
 	CK_OBJECT_HANDLE handle;
 	CK_RV rv;
 
-	rv = gck_session_C_CreateObject (session, attrs, G_N_ELEMENTS (attrs), &handle);
+	rv = gkm_session_C_CreateObject (session, attrs, G_N_ELEMENTS (attrs), &handle);
 	g_assert (rv == CKR_USER_NOT_LOGGED_IN);
 }
 
@@ -115,14 +115,14 @@ DEFINE_TEST(credential_create_no_object)
 	CK_OBJECT_HANDLE handle;
 	CK_RV rv;
 
-	rv = gck_session_C_CreateObject (session, attrs, G_N_ELEMENTS (attrs), &handle);
+	rv = gkm_session_C_CreateObject (session, attrs, G_N_ELEMENTS (attrs), &handle);
 	g_assert (rv == CKR_OK);
 	g_assert (handle != 0);
 
 	attr.type = CKA_G_OBJECT;
 	attr.pValue = &objhand;
 	attr.ulValueLen = sizeof (objhand);
-	rv = gck_session_C_GetAttributeValue (session, handle, &attr, 1);
+	rv = gkm_session_C_GetAttributeValue (session, handle, &attr, 1);
 	g_assert (rv == CKR_OK);
 	g_assert (objhand == 0);
 }
@@ -142,14 +142,14 @@ DEFINE_TEST(credential_create_invalid_object)
 	CK_OBJECT_HANDLE handle;
 	CK_RV rv;
 
-	rv = gck_session_C_CreateObject (session, attrs, G_N_ELEMENTS (attrs), &handle);
+	rv = gkm_session_C_CreateObject (session, attrs, G_N_ELEMENTS (attrs), &handle);
 	g_assert (rv == CKR_OBJECT_HANDLE_INVALID);
 }
 
 DEFINE_TEST(credential_get_attributes)
 {
 	CK_OBJECT_CLASS klass = CKO_G_CREDENTIAL;
-	CK_OBJECT_HANDLE locked = gck_object_get_handle (object);
+	CK_OBJECT_HANDLE locked = gkm_object_get_handle (object);
 
 	CK_ATTRIBUTE attrs[] = {
 		{ CKA_CLASS, &klass, sizeof (klass) },
@@ -162,7 +162,7 @@ DEFINE_TEST(credential_get_attributes)
 	CK_ULONG value;
 	CK_RV rv;
 
-	rv = gck_session_C_CreateObject (session, attrs, G_N_ELEMENTS (attrs), &handle);
+	rv = gkm_session_C_CreateObject (session, attrs, G_N_ELEMENTS (attrs), &handle);
 	g_assert (rv == CKR_OK);
 	g_assert (handle != 0);
 
@@ -170,7 +170,7 @@ DEFINE_TEST(credential_get_attributes)
 	check.pValue = &value;
 	check.ulValueLen = sizeof (value);
 
-	rv = gck_session_C_GetAttributeValue (session, handle, &check, 1);
+	rv = gkm_session_C_GetAttributeValue (session, handle, &check, 1);
 	g_assert (rv == CKR_OK);
 	g_assert (check.ulValueLen == sizeof (value));
 	g_assert (value == locked);
@@ -178,11 +178,11 @@ DEFINE_TEST(credential_get_attributes)
 
 DEFINE_TEST(credential_object_property)
 {
-	GckCredential *auth;
-	GckObject *check;
+	GkmCredential *auth;
+	GkmObject *check;
 	CK_RV rv;
 
-	rv = gck_credential_create (module, NULL, object, (guchar*)"mock", 4, &auth);
+	rv = gkm_credential_create (module, NULL, object, (guchar*)"mock", 4, &auth);
 	g_assert (rv == CKR_OK);
 	g_assert (auth);
 
@@ -190,7 +190,7 @@ DEFINE_TEST(credential_object_property)
 	g_assert (check == object);
 	g_object_unref (check);
 
-	check = gck_credential_get_object (auth);
+	check = gkm_credential_get_object (auth);
 	g_assert (check == object);
 
 	g_object_unref (auth);
@@ -198,30 +198,30 @@ DEFINE_TEST(credential_object_property)
 
 DEFINE_TEST(credential_login_property)
 {
-	GckCredential *cred;
-	GckSecret *check, *secret;
+	GkmCredential *cred;
+	GkmSecret *check, *secret;
 	const gchar *password;
 	gsize n_password;
 	CK_RV rv;
 
-	rv = gck_credential_create (module, NULL, object, (guchar*)"mock", 4, &cred);
+	rv = gkm_credential_create (module, NULL, object, (guchar*)"mock", 4, &cred);
 	g_assert (rv == CKR_OK);
 	g_assert (cred);
 
 	g_object_get (cred, "secret", &check, NULL);
 	g_assert (check);
-	password = gck_secret_get_password (check, &n_password);
+	password = gkm_secret_get_password (check, &n_password);
 	g_assert (n_password == 4);
 	g_assert (memcmp (password, "mock", 4) == 0);
 	g_object_unref (check);
 
-	check = gck_credential_get_secret (cred);
+	check = gkm_credential_get_secret (cred);
 	g_assert (n_password == 4);
 	g_assert (memcmp (password, "mock", 4) == 0);
 
-	secret = gck_secret_new ((guchar*)"xxx", -1);
-	gck_credential_set_secret (cred, secret);
-	check = gck_credential_get_secret (cred);
+	secret = gkm_secret_new ((guchar*)"xxx", -1);
+	gkm_credential_set_secret (cred, secret);
+	check = gkm_credential_get_secret (cred);
 	g_assert (check == secret);
 	g_object_unref (secret);
 
@@ -241,45 +241,45 @@ boxed_string (void)
 
 DEFINE_TEST(credential_data)
 {
-	GckCredential *cred;
+	GkmCredential *cred;
 	GType type = boxed_string ();
 	gchar *check;
 	CK_RV rv;
 
-	rv = gck_credential_create (module, NULL, object, (guchar*)"mock", 4, &cred);
+	rv = gkm_credential_create (module, NULL, object, (guchar*)"mock", 4, &cred);
 	g_assert (rv == CKR_OK);
 	g_assert (cred);
 
-	g_assert (gck_credential_peek_data (cred, type) == NULL);
+	g_assert (gkm_credential_peek_data (cred, type) == NULL);
 
-	gck_credential_set_data (cred, type, "one");
+	gkm_credential_set_data (cred, type, "one");
 
-	check = gck_credential_pop_data (cred, type);
+	check = gkm_credential_pop_data (cred, type);
 	g_assert_cmpstr ("one", ==, check);
 	g_free (check);
 
-	g_assert_cmpstr ("one", ==, gck_credential_peek_data (cred, type));
+	g_assert_cmpstr ("one", ==, gkm_credential_peek_data (cred, type));
 
-	gck_credential_set_data (cred, type, "ONE");
-	g_assert_cmpstr ("ONE", ==, gck_credential_peek_data (cred, type));
+	gkm_credential_set_data (cred, type, "ONE");
+	g_assert_cmpstr ("ONE", ==, gkm_credential_peek_data (cred, type));
 
-	gck_credential_set_data (cred, 0, NULL);
-	g_assert (gck_credential_peek_data (cred, 0) == NULL);
+	gkm_credential_set_data (cred, 0, NULL);
+	g_assert (gkm_credential_peek_data (cred, 0) == NULL);
 
 	g_object_unref (cred);
 }
 
 DEFINE_TEST(credential_connect_object)
 {
-	GckCredential *cred;
+	GkmCredential *cred;
 	CK_RV rv;
 
-	rv = gck_credential_create (module, NULL, NULL, (guchar*)"mock", 4, &cred);
+	rv = gkm_credential_create (module, NULL, NULL, (guchar*)"mock", 4, &cred);
 	g_assert (rv == CKR_OK);
 	g_assert (cred);
 
-	gck_credential_connect (cred, object);
-	g_assert (gck_credential_get_object (cred) == object);
+	gkm_credential_connect (cred, object);
+	g_assert (gkm_credential_get_object (cred) == object);
 
 	g_object_unref (cred);
 }
diff --git a/pkcs11/gck/tests/unit-test-data-asn1.c b/pkcs11/gkm/tests/unit-test-data-asn1.c
similarity index 94%
rename from pkcs11/gck/tests/unit-test-data-asn1.c
rename to pkcs11/gkm/tests/unit-test-data-asn1.c
index f02fe16..3ae9f65 100644
--- a/pkcs11/gck/tests/unit-test-data-asn1.c
+++ b/pkcs11/gkm/tests/unit-test-data-asn1.c
@@ -25,7 +25,7 @@
 
 #include "run-auto-test.h"
 
-#include "gck/gck-data-asn1.h"
+#include "gkm/gkm-data-asn1.h"
 
 #include <glib.h>
 #include <gcrypt.h>
@@ -35,7 +35,7 @@
 #include <stdio.h>
 #include <string.h>
 
-#define extern 
+#define extern
 #include "asn1-def-test.h"
 #undef extern
 
@@ -48,21 +48,21 @@ static gsize n_data_cert = 0;
 DEFINE_SETUP(asn1_tree)
 {
 	ASN1_TYPE pkix;
-	
+
 	int res = asn1_array2tree (test_asn1_tab, &asn1_test, NULL);
 	g_assert (res == ASN1_SUCCESS);
 
 	/* -------- */
-	
+
 	data_cert = test_data_read ("test-certificate-1.der", &n_data_cert);
 
 	/* We'll be catching this error later */
 	pkix = egg_asn1_get_pkix_asn1type ();
 	if (!pkix) return;
-	
-	res = asn1_create_element (pkix, "PKIX1.Certificate", &asn1_cert); 
+
+	res = asn1_create_element (pkix, "PKIX1.Certificate", &asn1_cert);
 	g_assert (res == ASN1_SUCCESS);
-	
+
 	res = asn1_der_decoding (&asn1_cert, data_cert, n_data_cert, NULL);
 	g_assert (res == ASN1_SUCCESS);
 }
@@ -83,7 +83,7 @@ DEFINE_TEST(asn1_integers)
 	gsize n_data;
 	gboolean ret;
 	int res;
-	
+
 	res = asn1_create_element (asn1_test, "TEST.TestIntegers", &asn);
 	g_assert ("asn test structure is null" && asn != NULL);
 
@@ -91,24 +91,24 @@ DEFINE_TEST(asn1_integers)
 	mpi = gcry_mpi_new (512);
 	g_return_if_fail (mpi);
 	gcry_mpi_randomize (mpi, 512, GCRY_WEAK_RANDOM);
-	
+
 	/* Write the mpi out */
-	ret = gck_data_asn1_write_mpi (asn, "mpi", mpi);
-	
+	ret = gkm_data_asn1_write_mpi (asn, "mpi", mpi);
+
 	/* Now encode the whole caboodle */
 	data = egg_asn1_encode (asn, "", &n_data, NULL);
 	g_assert ("encoding asn1 didn't work" && data != NULL);
-	
+
 	asn1_delete_structure (&asn);
-	
+
 	/* Now decode it all nicely */
-	res = asn1_create_element (asn1_test, "TEST.TestIntegers", &asn); 
+	res = asn1_create_element (asn1_test, "TEST.TestIntegers", &asn);
 	g_return_if_fail (res == ASN1_SUCCESS);
-	
+
 	res = asn1_der_decoding (&asn, data, n_data, NULL);
 	g_assert ("decoding asn didn't work" && res == ASN1_SUCCESS);
-	
-	ret = gck_data_asn1_read_mpi (asn, "mpi", &mpt);
+
+	ret = gkm_data_asn1_read_mpi (asn, "mpi", &mpt);
 	g_assert ("couldn't read mpi from asn1" && ret);
 	g_assert ("mpi returned is null" && mpt != NULL);
 	g_assert ("mpi is wrong number" && gcry_mpi_cmp (mpi, mpt) == 0);
diff --git a/pkcs11/gck/tests/unit-test-data-der.c b/pkcs11/gkm/tests/unit-test-data-der.c
similarity index 81%
rename from pkcs11/gck/tests/unit-test-data-der.c
rename to pkcs11/gkm/tests/unit-test-data-der.c
index 8105fa5..3e07598 100644
--- a/pkcs11/gck/tests/unit-test-data-der.c
+++ b/pkcs11/gkm/tests/unit-test-data-der.c
@@ -25,10 +25,10 @@
 
 #include "run-auto-test.h"
 
-#include "gck/gck-crypto.h"
-#include "gck/gck-data-asn1.h"
-#include "gck/gck-data-der.h"
-#include "gck/gck-sexp.h"
+#include "gkm/gkm-crypto.h"
+#include "gkm/gkm-data-asn1.h"
+#include "gkm/gkm-data-der.h"
+#include "gkm/gkm-sexp.h"
 
 #include "egg/egg-openssl.h"
 
@@ -39,11 +39,11 @@
 #include <stdio.h>
 #include <string.h>
 
-static ASN1_TYPE certificate = NULL; 
+static ASN1_TYPE certificate = NULL;
 static guchar *certificate_data = NULL;
 static gsize n_certificate_data = 0;
 
-static ASN1_TYPE certificate2 = NULL; 
+static ASN1_TYPE certificate2 = NULL;
 static guchar *certificate2_data = NULL;
 static gsize n_certificate2_data = 0;
 
@@ -77,7 +77,7 @@ compare_keys (gcry_sexp_t key, gcry_sexp_t sexp)
 {
 	guchar hash1[20], hash2[20];
 	guchar *p;
-	
+
 	/* Now compare them */
 	p = gcry_pk_get_keygrip (key, hash1);
 	g_assert ("couldn't get key id for private key" && p == hash1);
@@ -92,21 +92,21 @@ test_der_public (gcry_sexp_t key)
 {
 	guchar *data;
 	gsize n_data;
-	GckDataResult ret;
+	GkmDataResult ret;
 	gcry_sexp_t sexp;
-		
+
 	/* Encode it */
-	data = gck_data_der_write_public_key (key, &n_data);
+	data = gkm_data_der_write_public_key (key, &n_data);
 	g_assert ("couldn't encode public key" && data != NULL);
 	g_assert ("encoding is empty" && n_data > 0);
-	
+
 	/* Now parse it */
-	ret = gck_data_der_read_public_key (data, n_data, &sexp);
-	g_assert ("couldn't decode public key" && ret == GCK_DATA_SUCCESS);
+	ret = gkm_data_der_read_public_key (data, n_data, &sexp);
+	g_assert ("couldn't decode public key" && ret == GKM_DATA_SUCCESS);
 	g_assert ("parsed key is empty" && sexp != NULL);
-	
+
 	/* Now compare them */
-	g_assert ("key parsed differently" && compare_keys (key, sexp)); 	
+	g_assert ("key parsed differently" && compare_keys (key, sexp));
 }
 
 DEFINE_SETUP(preload)
@@ -135,22 +135,22 @@ DEFINE_TEST(der_rsa_public)
 {
 	gcry_sexp_t key;
 	gcry_error_t gcry;
-	
+
 	gcry = gcry_sexp_sscan (&key, NULL, rsapub, strlen (rsapub));
 	g_return_if_fail (gcry == 0);
 
-	test_der_public (key);	
+	test_der_public (key);
 }
 
 DEFINE_TEST(der_dsa_public)
 {
 	gcry_sexp_t key;
 	gcry_error_t gcry;
-	
+
 	gcry = gcry_sexp_sscan (&key, NULL, dsapub, strlen (dsapub));
 	g_return_if_fail (gcry == 0);
 
-	test_der_public (key);	
+	test_der_public (key);
 }
 
 static void
@@ -158,31 +158,31 @@ test_der_private (gcry_sexp_t key)
 {
 	guchar *data;
 	gsize n_data;
-	GckDataResult ret;
+	GkmDataResult ret;
 	gcry_sexp_t sexp;
 
 	/* Encode it */
-	data = gck_data_der_write_private_key (key, &n_data);
+	data = gkm_data_der_write_private_key (key, &n_data);
 	g_assert ("couldn't encode private key" && data != NULL);
 	g_assert ("encoding is empty" && n_data > 0);
-	
+
 	/* Now parse it */
-	ret = gck_data_der_read_private_key (data, n_data, &sexp);
-	g_assert ("couldn't decode private key" && ret == GCK_DATA_SUCCESS);
+	ret = gkm_data_der_read_private_key (data, n_data, &sexp);
+	g_assert ("couldn't decode private key" && ret == GKM_DATA_SUCCESS);
 	g_assert ("parsed key is empty" && sexp != NULL);
-	
+
 	/* Now compare them */
-	g_assert ("key parsed differently" && compare_keys (key, sexp)); 	
+	g_assert ("key parsed differently" && compare_keys (key, sexp));
 }
 
 DEFINE_TEST(der_rsa_private)
 {
 	gcry_sexp_t key;
 	gcry_error_t gcry;
-	
+
 	gcry = gcry_sexp_sscan (&key, NULL, rsaprv, strlen (rsaprv));
 	g_return_if_fail (gcry == 0);
-	
+
 	test_der_private (key);
 }
 
@@ -190,10 +190,10 @@ DEFINE_TEST(der_dsa_private)
 {
 	gcry_sexp_t key;
 	gcry_error_t gcry;
-	
+
 	gcry = gcry_sexp_sscan (&key, NULL, dsaprv, strlen (dsaprv));
 	g_return_if_fail (gcry == 0);
-	
+
 	test_der_private (key);
 }
 
@@ -203,24 +203,24 @@ DEFINE_TEST(der_dsa_private_parts)
 	gsize n_params, n_key;
 	gcry_sexp_t skey, pkey;
 	gcry_error_t gcry;
-	GckDataResult result;
-	
+	GkmDataResult result;
+
 	gcry = gcry_sexp_sscan (&skey, NULL, dsaprv, strlen (dsaprv));
 	g_return_if_fail (gcry == 0);
-	
+
 	/* Encode the the dsa key by parts */
-	params = gck_data_der_write_private_key_dsa_params (skey, &n_params);
+	params = gkm_data_der_write_private_key_dsa_params (skey, &n_params);
 	g_assert ("didn't encode dsa params" && params != NULL);
-	key = gck_data_der_write_private_key_dsa_part (skey, &n_key);
+	key = gkm_data_der_write_private_key_dsa_part (skey, &n_key);
 	g_assert ("didn't encode dsa key" && key != NULL);
-	
+
 	/* Parse the dsa key by parts */
-	result = gck_data_der_read_private_key_dsa_parts (key, n_key, params, n_params, &pkey);
-	g_assert ("couldn't parse dsa parts" && result == GCK_DATA_SUCCESS);
+	result = gkm_data_der_read_private_key_dsa_parts (key, n_key, params, n_params, &pkey);
+	g_assert ("couldn't parse dsa parts" && result == GKM_DATA_SUCCESS);
 	g_assert ("parsing dsa parts resulted in null key" && pkey != NULL);
-	
+
 	/* Now compare them */
-	g_assert ("key parsed differently" && compare_keys (skey, pkey)); 	
+	g_assert ("key parsed differently" && compare_keys (skey, pkey));
 }
 
 const gchar *certpub = "(public-key (rsa " \
@@ -232,17 +232,17 @@ DEFINE_TEST(read_public_key_info)
 	const guchar *data;
 	guchar hash[20];
 	gsize n_data;
-	GckDataResult res;
+	GkmDataResult res;
 	gcry_sexp_t sexp, match;
 	gcry_error_t gcry;
-	
+
 	data = egg_asn1_read_element (certificate, certificate_data, n_certificate_data, "tbsCertificate.subjectPublicKeyInfo", &n_data);
 	g_assert (data);
-	
-	res = gck_data_der_read_public_key_info (data, n_data, &sexp);
-	g_assert (res == GCK_DATA_SUCCESS);
+
+	res = gkm_data_der_read_public_key_info (data, n_data, &sexp);
+	g_assert (res == GKM_DATA_SUCCESS);
 	g_assert (sexp != NULL);
-	
+
 	if (!gcry_pk_get_keygrip (sexp, hash))
 		g_assert_not_reached ();
 
@@ -250,7 +250,7 @@ DEFINE_TEST(read_public_key_info)
 	g_assert (gcry == 0);
 
 	g_assert (compare_keys (sexp, match));
-	
+
 	gcry_sexp_release (sexp);
 	gcry_sexp_release (match);
 }
@@ -258,12 +258,12 @@ DEFINE_TEST(read_public_key_info)
 DEFINE_TEST(read_certificate)
 {
 	ASN1_TYPE asn = NULL;
-	GckDataResult res;
-	
-	res = gck_data_der_read_certificate (certificate_data, n_certificate_data, &asn);
-	g_assert (res == GCK_DATA_SUCCESS);
+	GkmDataResult res;
+
+	res = gkm_data_der_read_certificate (certificate_data, n_certificate_data, &asn);
+	g_assert (res == GKM_DATA_SUCCESS);
 	g_assert (asn != NULL);
-	
+
 	asn1_delete_structure (&asn);
 }
 
@@ -271,8 +271,8 @@ DEFINE_TEST(write_certificate)
 {
 	guchar *data;
 	gsize n_data;
-	
-	data = gck_data_der_write_certificate (certificate, &n_data);
+
+	data = gkm_data_der_write_certificate (certificate, &n_data);
 	g_assert (data);
 	g_assert (n_data == n_certificate_data);
 	g_assert (memcmp (data, certificate_data, n_data) == 0);
@@ -284,7 +284,7 @@ on_ca_certificate_public_key_info (GQuark type, const guchar *data, gsize n_data
                                    GHashTable *headers, gpointer user_data)
 {
 	ASN1_TYPE asn1 = ASN1_TYPE_EMPTY;
-	GckDataResult res;
+	GkmDataResult res;
 	gpointer keydata;
 	gsize n_keydata;
 	gcry_sexp_t sexp;
@@ -292,18 +292,18 @@ on_ca_certificate_public_key_info (GQuark type, const guchar *data, gsize n_data
 	g_assert (g_quark_try_string ("CERTIFICATE") == type);
 
 	/* Parse the ASN1 data */
-	res = gck_data_der_read_certificate (data, n_data, &asn1);
-	g_assert (res == GCK_DATA_SUCCESS);
+	res = gkm_data_der_read_certificate (data, n_data, &asn1);
+	g_assert (res == GKM_DATA_SUCCESS);
 
 	/* Generate a raw public key from our certificate */
 	keydata = egg_asn1_encode (asn1, "tbsCertificate.subjectPublicKeyInfo", &n_keydata, NULL);
 	g_assert (keydata);
 
 	/* Now create us a nice public key with that identifier */
-	res = gck_data_der_read_public_key_info (keydata, n_keydata, &sexp);
-	g_assert (res == GCK_DATA_SUCCESS || res == GCK_DATA_UNRECOGNIZED);
+	res = gkm_data_der_read_public_key_info (keydata, n_keydata, &sexp);
+	g_assert (res == GKM_DATA_SUCCESS || res == GKM_DATA_UNRECOGNIZED);
 
-	if (res == GCK_DATA_SUCCESS)
+	if (res == GKM_DATA_SUCCESS)
 		gcry_sexp_release (sexp);
 	g_free (keydata);
 }
@@ -318,7 +318,7 @@ DEFINE_TEST(read_ca_certificates_public_key_info)
 	g_free (data);
 }
 
-static const guchar* 
+static const guchar*
 find_extension (ASN1_TYPE asn, const guchar *data, gsize n_data, const gchar *oid, gsize *n_extension)
 {
 	const guchar *value;
@@ -327,11 +327,11 @@ find_extension (ASN1_TYPE asn, const guchar *data, gsize n_data, const gchar *oi
 	gchar *name;
 	guint index;
 	int len;
-	
+
 	len = strlen (oid);
-	
+
 	for (index = 1; TRUE; ++index) {
-		
+
 		/* Make sure it is present */
 		name = g_strdup_printf ("tbsCertificate.extensions.?%u.extnID", index);
 		exoid = egg_asn1_read_value (asn, name, &n_exoid, NULL);
@@ -348,7 +348,7 @@ find_extension (ASN1_TYPE asn, const guchar *data, gsize n_data, const gchar *oi
 			g_free (name);
 			return value;
 		}
-		
+
 		g_free (exoid);
 	}
 
@@ -361,13 +361,13 @@ DEFINE_TEST(read_basic_constraints)
 	gsize n_extension;
 	gboolean is_ca;
 	gint path_len;
-	GckDataResult res;
-	
+	GkmDataResult res;
+
 	extension = egg_asn1_read_content (certificate, certificate_data, n_certificate_data, "tbsCertificate.extensions.?1.extnValue", &n_extension);
 	g_assert (extension);
-	
-	res = gck_data_der_read_basic_constraints (extension, n_extension, &is_ca, &path_len);
-	g_assert (res == GCK_DATA_SUCCESS);
+
+	res = gkm_data_der_read_basic_constraints (extension, n_extension, &is_ca, &path_len);
+	g_assert (res == GKM_DATA_SUCCESS);
 	g_assert (is_ca == TRUE);
 	g_assert (path_len == -1);
 }
@@ -377,13 +377,13 @@ DEFINE_TEST(read_key_usage)
 	const guchar *extension;
 	gsize n_extension;
 	guint key_usage;
-	GckDataResult res;
-	
+	GkmDataResult res;
+
 	extension = find_extension (certificate2, certificate2_data, n_certificate2_data, "2.5.29.15", &n_extension);
 	g_assert (extension);
 
-	res = gck_data_der_read_key_usage (extension, n_extension, &key_usage);
-	g_assert (res == GCK_DATA_SUCCESS);
+	res = gkm_data_der_read_key_usage (extension, n_extension, &key_usage);
+	g_assert (res == GKM_DATA_SUCCESS);
 	g_assert_cmpuint (key_usage, ==, 0x80);
 }
 
@@ -392,60 +392,60 @@ DEFINE_TEST(read_enhanced_usage)
 	const guchar *extension;
 	gsize n_extension;
 	GQuark *usages;
-	GckDataResult res;
-	
+	GkmDataResult res;
+
 	extension = find_extension (certificate2, certificate2_data, n_certificate2_data, "2.5.29.37", &n_extension);
 	g_assert (extension);
 
-	res = gck_data_der_read_enhanced_usage (extension, n_extension, &usages);
-	g_assert (res == GCK_DATA_SUCCESS);
-	
+	res = gkm_data_der_read_enhanced_usage (extension, n_extension, &usages);
+	g_assert (res == GKM_DATA_SUCCESS);
+
 	g_free (usages);
 }
 
 DEFINE_TEST(read_all_pkcs8)
 {
 	gcry_sexp_t sexp;
-	GckDataResult res;
+	GkmDataResult res;
 	GDir *dir;
 	const gchar *name;
 	guchar *data;
 	gsize n_data;
-	
+
 	dir = g_dir_open (test_data_directory (), 0, NULL);
 	g_assert (dir);
-	
+
 	for(;;) {
 		name = g_dir_read_name (dir);
 		if (!name)
 			break;
-		
+
 		if (!g_pattern_match_simple ("der-pkcs8-*", name))
 			continue;
-		
+
 		data = test_data_read (name, &n_data);
-		res = gck_data_der_read_private_pkcs8 (data, n_data, "booo", 4, &sexp);
-		g_assert (res == GCK_DATA_SUCCESS);
-		
-		g_assert (gck_sexp_parse_key (sexp, NULL, NULL, NULL));
+		res = gkm_data_der_read_private_pkcs8 (data, n_data, "booo", 4, &sexp);
+		g_assert (res == GKM_DATA_SUCCESS);
+
+		g_assert (gkm_sexp_parse_key (sexp, NULL, NULL, NULL));
 		gcry_sexp_release (sexp);
 		g_free (data);
 	}
-	
+
 	g_dir_close (dir);
 }
 
 DEFINE_TEST(read_pkcs8_bad_password)
 {
 	gcry_sexp_t sexp;
-	GckDataResult res;
+	GkmDataResult res;
 	guchar *data;
 	gsize n_data;
-	
+
 	data = test_data_read ("der-pkcs8-encrypted-pkcs5.key", &n_data);
-	res = gck_data_der_read_private_pkcs8 (data, n_data, "wrong password", 4, &sexp);
-	g_assert (res == GCK_DATA_LOCKED);
-	
+	res = gkm_data_der_read_private_pkcs8 (data, n_data, "wrong password", 4, &sexp);
+	g_assert (res == GKM_DATA_LOCKED);
+
 	g_free (data);
 }
 
@@ -453,43 +453,43 @@ DEFINE_TEST(write_pkcs8_plain)
 {
 	gcry_sexp_t sexp, check;
 	gcry_error_t gcry;
-	GckDataResult res;
+	GkmDataResult res;
 	guchar *data;
 	gsize n_data;
-	
+
 	/* RSA */
-	
+
 	gcry = gcry_sexp_sscan (&sexp, NULL, rsaprv, strlen (rsaprv));
 	g_return_if_fail (gcry == 0);
-	
-	data = gck_data_der_write_private_pkcs8_plain (sexp, &n_data);
+
+	data = gkm_data_der_write_private_pkcs8_plain (sexp, &n_data);
 	g_assert (data);
 	g_assert (n_data);
-	
-	res = gck_data_der_read_private_pkcs8_plain (data, n_data, &check);
+
+	res = gkm_data_der_read_private_pkcs8_plain (data, n_data, &check);
 	g_free (data);
-	g_assert (res == GCK_DATA_SUCCESS);
+	g_assert (res == GKM_DATA_SUCCESS);
 	g_assert (check);
-	
+
 	g_assert (compare_keys (sexp, check));
 	gcry_sexp_release (sexp);
 	gcry_sexp_release (check);
-	
-	
+
+
 	/* DSA */
 
 	gcry = gcry_sexp_sscan (&sexp, NULL, dsaprv, strlen (dsaprv));
 	g_return_if_fail (gcry == 0);
-	
-	data = gck_data_der_write_private_pkcs8_plain (sexp, &n_data);
+
+	data = gkm_data_der_write_private_pkcs8_plain (sexp, &n_data);
 	g_assert (data);
 	g_assert (n_data);
-	
-	res = gck_data_der_read_private_pkcs8_plain (data, n_data, &check);
+
+	res = gkm_data_der_read_private_pkcs8_plain (data, n_data, &check);
 	g_free (data);
-	g_assert (res == GCK_DATA_SUCCESS);
+	g_assert (res == GKM_DATA_SUCCESS);
 	g_assert (check);
-	
+
 	g_assert (compare_keys (sexp, check));
 	gcry_sexp_release (sexp);
 	gcry_sexp_release (check);
@@ -500,43 +500,43 @@ DEFINE_TEST(write_pkcs8_encrypted)
 {
 	gcry_sexp_t sexp, check;
 	gcry_error_t gcry;
-	GckDataResult res;
+	GkmDataResult res;
 	guchar *data;
 	gsize n_data;
-	
+
 	/* RSA */
-	
+
 	gcry = gcry_sexp_sscan (&sexp, NULL, rsaprv, strlen (rsaprv));
 	g_return_if_fail (gcry == 0);
-	
-	data = gck_data_der_write_private_pkcs8_crypted (sexp, "testo", 5, &n_data);
+
+	data = gkm_data_der_write_private_pkcs8_crypted (sexp, "testo", 5, &n_data);
 	g_assert (data);
 	g_assert (n_data);
-	
-	res = gck_data_der_read_private_pkcs8_crypted (data, n_data, "testo", 5, &check);
+
+	res = gkm_data_der_read_private_pkcs8_crypted (data, n_data, "testo", 5, &check);
 	g_free (data);
-	g_assert (res == GCK_DATA_SUCCESS);
+	g_assert (res == GKM_DATA_SUCCESS);
 	g_assert (check);
-	
+
 	g_assert (compare_keys (sexp, check));
 	gcry_sexp_release (sexp);
 	gcry_sexp_release (check);
-	
-	
+
+
 	/* DSA */
 
 	gcry = gcry_sexp_sscan (&sexp, NULL, dsaprv, strlen (dsaprv));
 	g_return_if_fail (gcry == 0);
-	
-	data = gck_data_der_write_private_pkcs8_crypted (sexp, "testo", 5, &n_data);
+
+	data = gkm_data_der_write_private_pkcs8_crypted (sexp, "testo", 5, &n_data);
 	g_assert (data);
 	g_assert (n_data);
-	
-	res = gck_data_der_read_private_pkcs8_crypted (data, n_data, "testo", 5, &check);
+
+	res = gkm_data_der_read_private_pkcs8_crypted (data, n_data, "testo", 5, &check);
 	g_free (data);
-	g_assert (res == GCK_DATA_SUCCESS);
+	g_assert (res == GKM_DATA_SUCCESS);
 	g_assert (check);
-	
+
 	g_assert (compare_keys (sexp, check));
 	gcry_sexp_release (sexp);
 	gcry_sexp_release (check);
diff --git a/pkcs11/gkm/tests/unit-test-data-file.c b/pkcs11/gkm/tests/unit-test-data-file.c
new file mode 100644
index 0000000..af95eab
--- /dev/null
+++ b/pkcs11/gkm/tests/unit-test-data-file.c
@@ -0,0 +1,587 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* unit-test-file-store.c: Test file store functionality
+
+   Copyright (C) 2008 Stefan Walter
+
+   The Gnome Keyring Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The Gnome Keyring Library 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the Gnome Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.
+
+   Author: Stef Walter <stef memberwebs com>
+*/
+
+#include "run-auto-test.h"
+
+#include "gkm/gkm-data-file.h"
+#include "gkm/gkm-object.h"
+
+#include <glib/gstdio.h>
+
+#include <fcntl.h>
+
+/* Both point to the same thing */
+static GkmDataFile *data_file = NULL;
+static gchar *public_filename = NULL;
+static gchar *private_filename = NULL;
+static gchar *write_filename = NULL;
+static int write_fd = -1;
+static int public_fd = -1;
+static int private_fd = -1;
+static GkmSecret *login = NULL;
+
+DEFINE_SETUP(file_store)
+{
+	public_filename = test_data_filename ("data-file-public.store");
+	private_filename = test_data_filename ("data-file-private.store");
+	write_filename = test_scratch_filename ("unit-test-file.store");
+
+	data_file = gkm_data_file_new ();
+
+	public_fd = g_open (public_filename, O_RDONLY, 0);
+	g_assert (public_fd != -1);
+
+	private_fd = g_open (private_filename, O_RDONLY, 0);
+	g_assert (private_fd != -1);
+
+	write_fd = g_open (write_filename, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
+	g_assert (write_fd != -1);
+
+	login = gkm_secret_new ((guchar*)"booo", 4);
+}
+
+DEFINE_TEARDOWN(file_store)
+{
+	g_free (public_filename);
+	g_free (private_filename);
+	g_free (write_filename);
+
+	g_object_unref (data_file);
+	data_file = NULL;
+
+	if (public_fd != -1)
+		close (public_fd);
+	if (private_fd != -1)
+		close (private_fd);
+	if (write_fd != -1)
+		close (write_fd);
+	public_fd = private_fd = write_fd = -1;
+
+	g_object_unref (login);
+}
+
+DEFINE_TEST(test_file_create)
+{
+	GkmDataResult res;
+
+	res = gkm_data_file_create_entry (data_file, "identifier-public", GKM_DATA_FILE_SECTION_PUBLIC);
+	g_assert (res == GKM_DATA_SUCCESS);
+
+	/* Should be able to create private in a new file */
+	res = gkm_data_file_create_entry (data_file, "identifier-public", GKM_DATA_FILE_SECTION_PRIVATE);
+	g_assert (res == GKM_DATA_SUCCESS);
+}
+
+DEFINE_TEST(test_file_write_value)
+{
+	GkmDataResult res;
+
+	/* Can't write when no identifier present */
+	res = gkm_data_file_write_value (data_file, "identifier-public", CKA_LABEL, "public-label", 12);
+	g_assert (res == GKM_DATA_UNRECOGNIZED);
+
+	res = gkm_data_file_create_entry (data_file, "identifier-public", GKM_DATA_FILE_SECTION_PUBLIC);
+	g_assert (res == GKM_DATA_SUCCESS);
+
+	/* Should be able to write now */
+	res = gkm_data_file_write_value (data_file, "identifier-public", CKA_LABEL, "public-label", 12);
+	g_assert (res == GKM_DATA_SUCCESS);
+}
+
+DEFINE_TEST(test_file_read_value)
+{
+	gconstpointer value = NULL;
+	GkmDataResult res;
+	gsize n_value;
+	guint number = 7778;
+
+	/* Write some stuff in */
+	res = gkm_data_file_create_entry (data_file, "ident", GKM_DATA_FILE_SECTION_PUBLIC);
+	g_assert (res == GKM_DATA_SUCCESS);
+	res = gkm_data_file_write_value (data_file, "ident", CKA_LABEL, "TWO-label", 10);
+	g_assert (res == GKM_DATA_SUCCESS);
+	res = gkm_data_file_write_value (data_file, "ident", CKA_VALUE, &number, sizeof (number));
+	g_assert (res == GKM_DATA_SUCCESS);
+
+	/* Read for an invalid item */
+	res = gkm_data_file_read_value (data_file, "non-existant", CKA_LABEL, &value, &n_value);
+	g_assert (res == GKM_DATA_UNRECOGNIZED);
+
+	/* Read for an invalid attribute */
+	res = gkm_data_file_read_value (data_file, "ident", CKA_ID, &value, &n_value);
+	g_assert (res == GKM_DATA_UNRECOGNIZED);
+
+	/* Read out a valid number */
+	res = gkm_data_file_read_value (data_file, "ident", CKA_VALUE, &value, &n_value);
+	g_assert (res == GKM_DATA_SUCCESS);
+	g_assert (value);
+	g_assert (n_value == sizeof (number));
+	g_assert_cmpuint (*((guint*)value), ==, number);
+
+	/* Read out the valid string */
+	res = gkm_data_file_read_value (data_file, "ident", CKA_LABEL, &value, &n_value);
+	g_assert (res == GKM_DATA_SUCCESS);
+	g_assert (value);
+	g_assert (n_value == 10);
+	g_assert_cmpstr ((const gchar*)value, ==, "TWO-label");
+}
+
+DEFINE_TEST(test_file_read)
+{
+	GkmDataResult res;
+
+	res = gkm_data_file_read_fd (data_file, public_fd, NULL);
+	g_assert (res == GKM_DATA_SUCCESS);
+}
+
+DEFINE_TEST(test_file_lookup)
+{
+	GkmDataResult res;
+	guint section;
+	gboolean ret;
+
+	/* Invalid shouldn't succeed */
+	ret = gkm_data_file_lookup_entry (data_file, "non-existant", &section);
+	g_assert (ret == FALSE);
+
+	/* Create a test item */
+	res = gkm_data_file_create_entry (data_file, "test-ident", GKM_DATA_FILE_SECTION_PUBLIC);
+	g_assert (res == GKM_DATA_SUCCESS);
+
+	ret = gkm_data_file_lookup_entry (data_file, "test-ident", &section);
+	g_assert (ret == TRUE);
+	g_assert (section == GKM_DATA_FILE_SECTION_PUBLIC);
+
+	/* Should be able to call without asking for section */
+	ret = gkm_data_file_lookup_entry (data_file, "test-ident", NULL);
+	g_assert (ret == TRUE);
+}
+
+DEFINE_TEST(file_read_private_without_login)
+{
+	GkmDataResult res;
+	guint section;
+	gconstpointer value;
+	gsize n_value;
+	gboolean ret;
+
+	res = gkm_data_file_read_fd (data_file, private_fd, NULL);
+	g_assert (res == GKM_DATA_SUCCESS);
+
+	/* Items from the private section should exist */
+	ret = gkm_data_file_lookup_entry (data_file, "identifier-private", &section);
+	g_assert (ret);
+	g_assert (section == GKM_DATA_FILE_SECTION_PRIVATE);
+
+	/* But we shouldn't be able to read values from those private items */
+	ret = gkm_data_file_read_value (data_file, "identifier-private", CKA_LABEL, &value, &n_value);
+	g_assert (ret == GKM_DATA_LOCKED);
+
+	/* Shouldn't be able to create private items */
+	res = gkm_data_file_create_entry (data_file, "dummy-private", GKM_DATA_FILE_SECTION_PRIVATE);
+	g_assert (res == GKM_DATA_LOCKED);
+
+	/* Shouldn't be able to write with another login */
+	res = gkm_data_file_write_fd (data_file, write_fd, login);
+	g_assert (res == GKM_DATA_LOCKED);
+
+	/* Now load a public file without private bits*/
+	res = gkm_data_file_read_fd (data_file, public_fd, NULL);
+	g_assert (res == GKM_DATA_SUCCESS);
+
+	/* Now we should be able to load private stuff */
+	res = gkm_data_file_create_entry (data_file, "dummy-private", GKM_DATA_FILE_SECTION_PRIVATE);
+	g_assert (res == GKM_DATA_SUCCESS);
+}
+
+DEFINE_TEST(test_file_write)
+{
+	GkmDataResult res;
+
+	res = gkm_data_file_create_entry (data_file, "identifier-public", GKM_DATA_FILE_SECTION_PUBLIC);
+	g_assert (res == GKM_DATA_SUCCESS);
+
+	res = gkm_data_file_write_value (data_file, "identifier-public", CKA_LABEL, "public-label", 12);
+	g_assert (res == GKM_DATA_SUCCESS);
+
+	res = gkm_data_file_create_entry (data_file, "identifier-two", GKM_DATA_FILE_SECTION_PUBLIC);
+	g_assert (res == GKM_DATA_SUCCESS);
+
+	res = gkm_data_file_write_fd (data_file, write_fd, NULL);
+	g_assert (res == GKM_DATA_SUCCESS);
+}
+
+DEFINE_TEST(cant_write_private_without_login)
+{
+	GkmDataResult res;
+
+	res = gkm_data_file_create_entry (data_file, "identifier_private", GKM_DATA_FILE_SECTION_PRIVATE);
+	g_assert (res == GKM_DATA_SUCCESS);
+
+	res = gkm_data_file_write_fd (data_file, write_fd, NULL);
+	g_assert (res == GKM_DATA_LOCKED);
+}
+
+DEFINE_TEST(write_private_with_login)
+{
+	GkmDataResult res;
+	gulong value;
+
+	res = gkm_data_file_create_entry (data_file, "identifier-public", GKM_DATA_FILE_SECTION_PUBLIC);
+	g_assert (res == GKM_DATA_SUCCESS);
+	res = gkm_data_file_write_value (data_file, "identifier-public", CKA_LABEL, "public-label", 12);
+	g_assert (res == GKM_DATA_SUCCESS);
+
+	res = gkm_data_file_create_entry (data_file, "identifier-two", GKM_DATA_FILE_SECTION_PUBLIC);
+	g_assert (res == GKM_DATA_SUCCESS);
+	res = gkm_data_file_write_value (data_file, "identifier-two", CKA_LABEL, "TWO-label", 9);
+	g_assert (res == GKM_DATA_SUCCESS);
+	value = 555;
+	res = gkm_data_file_write_value (data_file, "identifier-two", CKA_VALUE, &value, sizeof (value));
+	g_assert (res == GKM_DATA_SUCCESS);
+
+	res = gkm_data_file_create_entry (data_file, "identifier-private", GKM_DATA_FILE_SECTION_PRIVATE);
+	g_assert (res == GKM_DATA_SUCCESS);
+	res = gkm_data_file_write_value (data_file, "identifier-private", CKA_LABEL, "private-label", 13);
+	g_assert (res == GKM_DATA_SUCCESS);
+
+	res = gkm_data_file_write_fd (data_file, write_fd, login);
+	g_assert (res == GKM_DATA_SUCCESS);
+}
+
+DEFINE_TEST(read_private_with_login)
+{
+	GkmDataResult res;
+	gconstpointer value;
+	gsize n_value;
+
+	res = gkm_data_file_read_fd (data_file, private_fd, login);
+	g_assert (res == GKM_DATA_SUCCESS);
+
+	/* Should be able to read private items */
+	res = gkm_data_file_read_value (data_file, "identifier-private", CKA_LABEL, &value, &n_value);
+	g_assert (res == GKM_DATA_SUCCESS);
+	g_assert_cmpuint (n_value, ==, 13);
+	g_assert (memcmp (value, "private-label", 13) == 0);
+}
+
+DEFINE_TEST(destroy_entry)
+{
+	GkmDataResult res;
+
+	res = gkm_data_file_destroy_entry (data_file, "non-existant");
+	g_assert (res == GKM_DATA_UNRECOGNIZED);
+
+	res = gkm_data_file_read_fd (data_file, public_fd, NULL);
+	g_assert (res == GKM_DATA_SUCCESS);
+
+	/* Make sure it's here */
+	g_assert (gkm_data_file_lookup_entry (data_file, "identifier-public", NULL));
+
+	res = gkm_data_file_destroy_entry (data_file, "identifier-public");
+	g_assert (res == GKM_DATA_SUCCESS);
+
+	/* Make sure it's gone */
+	g_assert (!gkm_data_file_lookup_entry (data_file, "identifier-public", NULL));
+}
+
+DEFINE_TEST(destroy_entry_by_loading)
+{
+	GkmDataResult res;
+
+	/* Create some extra idenifiers */
+	res = gkm_data_file_create_entry (data_file, "my-public", GKM_DATA_FILE_SECTION_PUBLIC);
+	g_assert (res == GKM_DATA_SUCCESS);
+	res = gkm_data_file_create_entry (data_file, "my-private", GKM_DATA_FILE_SECTION_PRIVATE);
+	g_assert (res == GKM_DATA_SUCCESS);
+
+	/* Now read from the file */
+	res = gkm_data_file_read_fd (data_file, public_fd, NULL);
+	g_assert (res == GKM_DATA_SUCCESS);
+
+	/* Both should be gone */
+	g_assert (!gkm_data_file_lookup_entry (data_file, "my-public", NULL));
+	g_assert (!gkm_data_file_lookup_entry (data_file, "my-private", NULL));
+}
+
+
+DEFINE_TEST(destroy_private_without_login)
+{
+	GkmDataResult res;
+
+	res = gkm_data_file_read_fd (data_file, private_fd, NULL);
+	g_assert (res == GKM_DATA_SUCCESS);
+
+	/* Make sure it's here */
+	g_assert (gkm_data_file_lookup_entry (data_file, "identifier-private", NULL));
+
+	/* Shouldn't be able to destroy */
+	res = gkm_data_file_destroy_entry (data_file, "identifier-private");
+	g_assert (res == GKM_DATA_LOCKED);
+
+	/* Make sure it's still here */
+	g_assert (gkm_data_file_lookup_entry (data_file, "identifier-private", NULL));
+}
+
+static void
+entry_added_one (GkmDataFile *df, const gchar *identifier, gboolean *added)
+{
+	g_assert (GKM_IS_DATA_FILE (df));
+	g_assert (df == data_file);
+	g_assert (identifier);
+	g_assert (added);
+
+	/* Should only be called once */
+	g_assert (!*added);
+	*added = TRUE;
+}
+
+DEFINE_TEST(entry_added_signal)
+{
+	GkmDataResult res;
+	gboolean added;
+
+	g_signal_connect (data_file, "entry-added", G_CALLBACK (entry_added_one), &added);
+
+	/* Should fire the signal */
+	added = FALSE;
+	res = gkm_data_file_create_entry (data_file, "identifier-public", GKM_DATA_FILE_SECTION_PUBLIC);
+	g_assert (res == GKM_DATA_SUCCESS);
+	g_assert (added == TRUE);
+
+	/* Another one should be added when we load */
+	added = FALSE;
+	res = gkm_data_file_read_fd (data_file, public_fd, NULL);
+	g_assert (res == GKM_DATA_SUCCESS);
+	g_assert (added == TRUE);
+}
+
+static void
+entry_changed_one (GkmDataFile *df, const gchar *identifier, gulong type, gboolean *changed)
+{
+	g_assert (GKM_IS_DATA_FILE (df));
+	g_assert (df == data_file);
+	g_assert (identifier);
+	g_assert (changed);
+	g_assert (type == CKA_LABEL);
+
+	/* Should only be called once */
+	g_assert (!*changed);
+	*changed = TRUE;
+}
+
+DEFINE_TEST(entry_changed_signal)
+{
+	GkmDataResult res;
+	gboolean changed;
+
+	g_signal_connect (data_file, "entry-changed", G_CALLBACK (entry_changed_one), &changed);
+
+	/* Loading shouldn't fire the signal */
+	changed = FALSE;
+	res = gkm_data_file_read_fd (data_file, public_fd, NULL);
+	g_assert (res == GKM_DATA_SUCCESS);
+	g_assert (changed == FALSE);
+
+	/* Shouldn't fire the signal on nonexistant */
+	changed = FALSE;
+	res = gkm_data_file_write_value (data_file, "non-existant", CKA_LABEL, "new-value", 10);
+	g_assert (res == GKM_DATA_UNRECOGNIZED);
+	g_assert (changed == FALSE);
+
+	/* Should fire the signal */
+	changed = FALSE;
+	res = gkm_data_file_write_value (data_file, "identifier-public", CKA_LABEL, "new-value", 10);
+	g_assert (res == GKM_DATA_SUCCESS);
+	g_assert (changed == TRUE);
+
+	/* Shouldn't fire the signal, same value again */
+	changed = FALSE;
+	res = gkm_data_file_write_value (data_file, "identifier-public", CKA_LABEL, "new-value", 10);
+	g_assert (res == GKM_DATA_SUCCESS);
+	g_assert (changed == FALSE);
+
+	/* Reload file, should revert, fire signal */
+	changed = FALSE;
+	g_assert (lseek (public_fd, 0, SEEK_SET) != -1);
+	res = gkm_data_file_read_fd (data_file, public_fd, NULL);
+	g_assert (res == GKM_DATA_SUCCESS);
+	g_assert (changed == TRUE);
+}
+
+static void
+entry_removed_one (GkmDataFile *df, const gchar *identifier, gboolean *removed)
+{
+	g_assert (GKM_IS_DATA_FILE (df));
+	g_assert (df == data_file);
+	g_assert (identifier);
+	g_assert (removed);
+
+	/* Should only be called once */
+	g_assert (!*removed);
+	*removed = TRUE;
+}
+
+DEFINE_TEST(entry_removed_signal)
+{
+	GkmDataResult res;
+	gboolean removed;
+
+	g_signal_connect (data_file, "entry-removed", G_CALLBACK (entry_removed_one), &removed);
+
+	/* Loading shouldn't fire the signal */
+	removed = FALSE;
+	res = gkm_data_file_read_fd (data_file, public_fd, NULL);
+	g_assert (res == GKM_DATA_SUCCESS);
+	g_assert (removed == FALSE);
+
+	/* Shouldn't fire the signal on removing nonexistant */
+	removed = FALSE;
+	res = gkm_data_file_destroy_entry (data_file, "non-existant");
+	g_assert (res == GKM_DATA_UNRECOGNIZED);
+	g_assert (removed == FALSE);
+
+	/* Remove a real entry */
+	removed = FALSE;
+	res = gkm_data_file_destroy_entry (data_file, "identifier-public");
+	g_assert (res == GKM_DATA_SUCCESS);
+	g_assert (removed == TRUE);
+
+	/* Add a dummy entry */
+	res = gkm_data_file_create_entry (data_file, "extra-dummy", GKM_DATA_FILE_SECTION_PUBLIC);
+	g_assert (res == GKM_DATA_SUCCESS);
+
+	/* That one should go away when we reload, fire signal */
+	removed = FALSE;
+	g_assert (lseek (public_fd, 0, SEEK_SET) != -1);
+	res = gkm_data_file_read_fd (data_file, public_fd, NULL);
+	g_assert (res == GKM_DATA_SUCCESS);
+	g_assert (removed == TRUE);
+}
+
+static void
+foreach_entry (GkmDataFile *df, const gchar *identifier, gpointer data)
+{
+	GPtrArray *array = data;
+	const gchar *ident;
+	int i;
+
+	g_assert (data);
+	g_assert (identifier);
+	g_assert (GKM_IS_DATA_FILE (df));
+
+	/* Check that this is unique */
+	for (i = 0; i < array->len; ++i) {
+		ident = g_ptr_array_index (array, i);
+		g_assert (ident);
+		g_assert_cmpstr (ident, !=, identifier);
+	}
+
+	/* Add it */
+	g_ptr_array_add (array, g_strdup (identifier));
+}
+
+DEFINE_TEST(data_file_foreach)
+{
+	GkmDataResult res;
+	GPtrArray *array;
+
+	res = gkm_data_file_read_fd (data_file, private_fd, login);
+	g_assert (res == GKM_DATA_SUCCESS);
+
+	array = g_ptr_array_new ();
+	gkm_data_file_foreach_entry (data_file, foreach_entry, array);
+	g_assert (array->len == 4);
+
+	g_ptr_array_add (array, NULL);
+	g_strfreev ((gchar**)g_ptr_array_free (array, FALSE));
+}
+
+DEFINE_TEST(unique_entry)
+{
+	GkmDataResult res;
+	gchar *identifier;
+
+	res = gkm_data_file_read_fd (data_file, public_fd, NULL);
+	g_assert (res == GKM_DATA_SUCCESS);
+
+	/* Should change an identifier that conflicts */
+	identifier = g_strdup ("identifier-public");
+	res = gkm_data_file_unique_entry (data_file, &identifier);
+	g_assert (res == GKM_DATA_SUCCESS);
+	g_assert_cmpstr (identifier, !=, "identifier-public");
+	g_free (identifier);
+
+	/* Shouldn't change a unique identifier */
+	identifier = g_strdup ("identifier-unique");
+	res = gkm_data_file_unique_entry (data_file, &identifier);
+	g_assert (res == GKM_DATA_SUCCESS);
+	g_assert_cmpstr (identifier, ==, "identifier-unique");
+	g_free (identifier);
+
+	/* Should be able to get from NULL */
+	identifier = NULL;
+	res = gkm_data_file_unique_entry (data_file, &identifier);
+	g_assert (res == GKM_DATA_SUCCESS);
+	g_assert (identifier != NULL);
+	g_assert (identifier[0] != 0);
+	g_free (identifier);
+}
+
+DEFINE_TEST(have_sections)
+{
+	GkmDataResult res;
+
+	res = gkm_data_file_read_fd (data_file, public_fd, NULL);
+	g_assert (res == GKM_DATA_SUCCESS);
+
+	/* No private section */
+	g_assert (gkm_data_file_have_section (data_file, GKM_DATA_FILE_SECTION_PUBLIC));
+	g_assert (!gkm_data_file_have_section (data_file, GKM_DATA_FILE_SECTION_PRIVATE));
+
+	/* Read private stuff into file, without login */
+	res = gkm_data_file_read_fd (data_file, private_fd, NULL);
+	g_assert (res == GKM_DATA_SUCCESS);
+
+	/* Should have a private section even without login */
+	g_assert (gkm_data_file_have_section (data_file, GKM_DATA_FILE_SECTION_PUBLIC));
+	g_assert (gkm_data_file_have_section (data_file, GKM_DATA_FILE_SECTION_PRIVATE));
+
+	/* Read private stuff into file, with login */
+	g_assert (lseek (private_fd, 0, SEEK_SET) == 0);
+	res = gkm_data_file_read_fd (data_file, private_fd, login);
+	g_assert (res == GKM_DATA_SUCCESS);
+
+	/* Should have a private section now with login */
+	g_assert (gkm_data_file_have_section (data_file, GKM_DATA_FILE_SECTION_PUBLIC));
+	g_assert (gkm_data_file_have_section (data_file, GKM_DATA_FILE_SECTION_PRIVATE));
+
+	/* Read public stuff back into file*/
+	g_assert (lseek (public_fd, 0, SEEK_SET) == 0);
+	res = gkm_data_file_read_fd (data_file, public_fd, login);
+	g_assert (res == GKM_DATA_SUCCESS);
+
+	/* Shouldn't have a private section now  */
+	g_assert (gkm_data_file_have_section (data_file, GKM_DATA_FILE_SECTION_PUBLIC));
+	g_assert (!gkm_data_file_have_section (data_file, GKM_DATA_FILE_SECTION_PRIVATE));
+}
diff --git a/pkcs11/gck/tests/unit-test-file-tracker.c b/pkcs11/gkm/tests/unit-test-file-tracker.c
similarity index 78%
rename from pkcs11/gck/tests/unit-test-file-tracker.c
rename to pkcs11/gkm/tests/unit-test-file-tracker.c
index d900434..393032a 100644
--- a/pkcs11/gck/tests/unit-test-file-tracker.c
+++ b/pkcs11/gkm/tests/unit-test-file-tracker.c
@@ -28,7 +28,7 @@
 
 #include "run-auto-test.h"
 
-#include "gck/gck-file-tracker.h"
+#include "gkm/gkm-file-tracker.h"
 
 #include <glib/gstdio.h>
 
@@ -36,7 +36,7 @@
 #define SUBDIR "test-subdir"
 #define WILDCARD "*.woo?"
 
-static GckFileTracker *the_tracker = NULL;
+static GkmFileTracker *the_tracker = NULL;
 static gchar *test_dir = NULL;
 static gchar *test_file = NULL;
 
@@ -50,30 +50,30 @@ static guint n_files_removed = 0;
 static gchar* last_file_removed = 0;
 
 static void
-file_added (GckFileTracker *tracker, const gchar *path, gpointer unused)
+file_added (GkmFileTracker *tracker, const gchar *path, gpointer unused)
 {
 	g_assert ("should be a non-null path" && path != NULL);
-	
+
 	++n_files_added;
 	g_free (last_file_added);
 	last_file_added = g_strdup (path);
 }
 
 static void
-file_changed (GckFileTracker *tracker, const gchar *path, gpointer unused)
+file_changed (GkmFileTracker *tracker, const gchar *path, gpointer unused)
 {
 	g_assert ("should be a non-null path" && path != NULL);
-	
+
 	++n_files_changed;
 	g_free (last_file_changed);
 	last_file_changed = g_strdup (path);
 }
 
 static void
-file_removed (GckFileTracker *tracker, const gchar *path, gpointer unused)
+file_removed (GkmFileTracker *tracker, const gchar *path, gpointer unused)
 {
 	g_assert ("should be a non-null path" && path != NULL);
-	
+
 	++n_files_removed;
 	g_free (last_file_removed);
 	last_file_removed = g_strdup (path);
@@ -93,15 +93,15 @@ DEFINE_SETUP(tracker)
 {
 	/* Make a test directory */
 	test_dir = g_build_filename ("/tmp", SUBDIR, NULL);
-	
-	the_tracker = gck_file_tracker_new (test_dir, WILDCARD, NULL);
-	g_signal_connect (the_tracker, "file-added", G_CALLBACK (file_added), NULL); 
-	g_signal_connect (the_tracker, "file-removed", G_CALLBACK (file_removed), NULL); 
+
+	the_tracker = gkm_file_tracker_new (test_dir, WILDCARD, NULL);
+	g_signal_connect (the_tracker, "file-added", G_CALLBACK (file_added), NULL);
+	g_signal_connect (the_tracker, "file-removed", G_CALLBACK (file_removed), NULL);
 	g_signal_connect (the_tracker, "file-changed", G_CALLBACK (file_changed), NULL);
-	
+
 	/* Mtime must change so wait between tests */
 	sleep (1);
-	
+
 	test_file = g_build_filename (test_dir, "my-file.woof", NULL);
 	g_unlink (test_file);
 }
@@ -117,20 +117,20 @@ DEFINE_TEARDOWN(tracker)
 DEFINE_TEST(file_watch)
 {
 	/* A watch for an non-existant directory, should have no responses */
-	gck_file_tracker_refresh (the_tracker, FALSE);
-	
+	gkm_file_tracker_refresh (the_tracker, FALSE);
+
 	g_assert_cmpint (0, ==, n_files_added);
 	g_assert_cmpint (0, ==, n_files_changed);
 	g_assert_cmpint (0, ==, n_files_removed);
-	
+
 	g_mkdir_with_parents (test_dir, 0700);
-	
+
 	/* Should still have no responses even though it exists */
-	gck_file_tracker_refresh (the_tracker, FALSE);
-	
+	gkm_file_tracker_refresh (the_tracker, FALSE);
+
 	g_assert_cmpint (0, ==, n_files_added);
 	g_assert_cmpint (0, ==, n_files_changed);
-	g_assert_cmpint (0, ==, n_files_removed);	
+	g_assert_cmpint (0, ==, n_files_removed);
 }
 
 DEFINE_TEST(watch_file)
@@ -138,39 +138,39 @@ DEFINE_TEST(watch_file)
 	gboolean ret;
 
 	/* Make sure things are clean */
-	gck_file_tracker_refresh (the_tracker, FALSE);
-	
+	gkm_file_tracker_refresh (the_tracker, FALSE);
+
 	n_files_added = n_files_changed = n_files_removed = 0;
 	last_file_added = last_file_changed = last_file_removed = 0;
 
 	ret = g_file_set_contents (test_file, DATA, strlen (DATA), NULL);
 	g_assert (ret);
-	
+
 	/* Now make sure that file is located */
-	gck_file_tracker_refresh (the_tracker, FALSE);
-	
+	gkm_file_tracker_refresh (the_tracker, FALSE);
+
 	g_assert_cmpint (1, ==, n_files_added);
 	g_assert_cmpint (0, ==, n_files_changed);
-	g_assert_cmpint (0, ==, n_files_removed);	
-	
+	g_assert_cmpint (0, ==, n_files_removed);
+
 	/* The added one should match our file */
 	g_assert_cmpstr (last_file_added, ==, test_file);
-	
+
 	file_reset_stats ();
 	sleep (1);
-	
+
 	/* Shouldn't find the file again */
-	gck_file_tracker_refresh (the_tracker, FALSE);
+	gkm_file_tracker_refresh (the_tracker, FALSE);
 	g_assert_cmpint (0, ==, n_files_added);
 	g_assert_cmpint (0, ==, n_files_changed);
-	g_assert_cmpint (0, ==, n_files_removed);	
-	
-	/* But we should find the file if forced to */	
-	gck_file_tracker_refresh (the_tracker, TRUE);
+	g_assert_cmpint (0, ==, n_files_removed);
+
+	/* But we should find the file if forced to */
+	gkm_file_tracker_refresh (the_tracker, TRUE);
 	g_assert_cmpint (0, ==, n_files_added);
 	g_assert_cmpint (1, ==, n_files_changed);
 	g_assert_cmpint (0, ==, n_files_removed);
-	g_assert_cmpstr (last_file_changed, ==, test_file);	
+	g_assert_cmpstr (last_file_changed, ==, test_file);
 
 	file_reset_stats ();
 
@@ -178,22 +178,22 @@ DEFINE_TEST(watch_file)
 	g_assert (ret);
 
 	/* File was updated */
-	gck_file_tracker_refresh (the_tracker, FALSE);
+	gkm_file_tracker_refresh (the_tracker, FALSE);
 	g_assert_cmpint (0, ==, n_files_added);
 	g_assert_cmpint (1, ==, n_files_changed);
-	g_assert_cmpint (0, ==, n_files_removed);	
-	g_assert_cmpstr (last_file_changed, ==, test_file);	
+	g_assert_cmpint (0, ==, n_files_removed);
+	g_assert_cmpstr (last_file_changed, ==, test_file);
 
 	file_reset_stats ();
 	g_unlink (test_file);
-	
+
 	/* Now file should be removed */
-	gck_file_tracker_refresh (the_tracker, FALSE);
+	gkm_file_tracker_refresh (the_tracker, FALSE);
 
 	g_assert_cmpint (0, ==, n_files_added);
 	g_assert_cmpint (0, ==, n_files_changed);
-	g_assert_cmpint (1, ==, n_files_removed);	
-	g_assert_cmpstr (last_file_removed, ==, test_file);	
+	g_assert_cmpint (1, ==, n_files_removed);
+	g_assert_cmpstr (last_file_removed, ==, test_file);
 }
 
 DEFINE_TEST(nomatch)
@@ -203,19 +203,19 @@ DEFINE_TEST(nomatch)
 
 	/* Mtime must change so wait between tests */
 	sleep (1);
-	
+
 	ret = g_file_set_contents (file, DATA, strlen (DATA), NULL);
 	g_assert (ret);
 
 	file_reset_stats ();
-	
+
 	/* Now make sure that file is not located */
-	gck_file_tracker_refresh (the_tracker, FALSE);
-	
+	gkm_file_tracker_refresh (the_tracker, FALSE);
+
 	g_assert_cmpint (0, ==, n_files_added);
 	g_assert_cmpint (0, ==, n_files_changed);
-	g_assert_cmpint (0, ==, n_files_removed);	
-	
+	g_assert_cmpint (0, ==, n_files_removed);
+
 	g_unlink (file);
 	g_free (file);
 }
diff --git a/pkcs11/gck/tests/unit-test-memory-store.c b/pkcs11/gkm/tests/unit-test-memory-store.c
similarity index 64%
rename from pkcs11/gck/tests/unit-test-memory-store.c
rename to pkcs11/gkm/tests/unit-test-memory-store.c
index 162a15f..7a5a782 100644
--- a/pkcs11/gck/tests/unit-test-memory-store.c
+++ b/pkcs11/gkm/tests/unit-test-memory-store.c
@@ -29,33 +29,33 @@
 #include "run-auto-test.h"
 #include "test-module.h"
 
-#include "gck/gck-object.h"
-#include "gck/gck-memory-store.h"
-#include "gck/gck-transaction.h"
-
-static GckModule *module = NULL;
-static GckStore *store = NULL;
-static GckObject *object = NULL;
-static GckTransaction *transaction = NULL;
+#include "gkm/gkm-object.h"
+#include "gkm/gkm-memory-store.h"
+#include "gkm/gkm-transaction.h"
+
+static GkmModule *module = NULL;
+static GkmStore *store = NULL;
+static GkmObject *object = NULL;
+static GkmTransaction *transaction = NULL;
 static guchar buffer[1024];
 
 static CK_RV
-test_validator (GckObject *obj, CK_ATTRIBUTE_PTR attr)
+test_validator (GkmObject *obj, CK_ATTRIBUTE_PTR attr)
 {
 	const gchar *data;
 	guint i;
-	
+
 	g_assert (obj == object);
 	g_assert (attr);
 	g_assert (attr->type == CKA_LABEL);
-	
+
 	/* Test that the whole string is ascii and lower case */
-	data = attr->pValue; 
+	data = attr->pValue;
 	for (i = 0; i < attr->ulValueLen; ++i) {
 		if (!g_ascii_isprint(data[i]) || !g_ascii_islower (data[i]))
 			return CKR_ATTRIBUTE_VALUE_INVALID;
 	}
-	
+
 	return CKR_OK;
 }
 
@@ -65,31 +65,31 @@ DEFINE_SETUP(memory_store)
 	CK_ULONG twentyfour = 24;
 
 	module = test_module_initialize_and_enter ();
-	
+
 	attr.type = CKA_LABEL;
 	attr.pValue = "label";
 	attr.ulValueLen = 5;
-	
-	store = GCK_STORE (gck_memory_store_new ());
-	
-	gck_store_register_schema (store, &attr, test_validator, 0);
-	g_assert (gck_store_lookup_schema (store, CKA_LABEL, NULL));
+
+	store = GKM_STORE (gkm_memory_store_new ());
+
+	gkm_store_register_schema (store, &attr, test_validator, 0);
+	g_assert (gkm_store_lookup_schema (store, CKA_LABEL, NULL));
 
 	attr.type = CKA_VALUE;
 	attr.pValue = NULL;
 	attr.ulValueLen = 0;
-	
-	gck_store_register_schema (store, &attr, NULL, GCK_STORE_IS_SENSITIVE);
-	
+
+	gkm_store_register_schema (store, &attr, NULL, GKM_STORE_IS_SENSITIVE);
+
 	attr.type = CKA_BITS_PER_PIXEL;
 	attr.pValue = &twentyfour;
 	attr.ulValueLen = sizeof (twentyfour);
-	
-	gck_store_register_schema (store, &attr, NULL, GCK_STORE_IS_INTERNAL);
-	
-	object = g_object_new (GCK_TYPE_OBJECT, "module", module, NULL); 
-	
-	transaction = gck_transaction_new ();
+
+	gkm_store_register_schema (store, &attr, NULL, GKM_STORE_IS_INTERNAL);
+
+	object = g_object_new (GKM_TYPE_OBJECT, "module", module, NULL);
+
+	transaction = gkm_transaction_new ();
 }
 
 DEFINE_TEARDOWN(memory_store)
@@ -103,7 +103,7 @@ DEFINE_TEARDOWN(memory_store)
 	if (object != NULL)
 		g_object_unref (object);
 	object = NULL;
-	
+
 	test_module_leave_and_finalize ();
 	module = NULL;
 }
@@ -112,14 +112,14 @@ DEFINE_TEST(get_attribute_default)
 {
 	CK_ATTRIBUTE attr;
 	CK_RV rv;
-	
+
 	attr.type = CKA_LABEL;
 	attr.pValue = NULL;
-	rv = gck_store_get_attribute (store, object, &attr);
+	rv = gkm_store_get_attribute (store, object, &attr);
 	g_assert (rv == CKR_OK);
 	g_assert (attr.ulValueLen == 5);
 	attr.pValue = buffer;
-	rv = gck_store_get_attribute (store, object, &attr);
+	rv = gkm_store_get_attribute (store, object, &attr);
 	g_assert (rv == CKR_OK);
 	g_assert (attr.ulValueLen == 5);
 	g_assert (memcmp (attr.pValue, "label", 5) == 0);
@@ -129,13 +129,13 @@ DEFINE_TEST(read_value_default)
 {
 	gconstpointer value;
 	gsize n_value;
-	
-	value = gck_store_read_value (store, object, CKA_LABEL, &n_value);
+
+	value = gkm_store_read_value (store, object, CKA_LABEL, &n_value);
 	g_assert (value);
 	g_assert (n_value == 5);
 	g_assert (memcmp (value, "label", 5) == 0);
 
-	value = gck_store_read_value (store, object, CKA_BITS_PER_PIXEL, &n_value);
+	value = gkm_store_read_value (store, object, CKA_BITS_PER_PIXEL, &n_value);
 	g_assert (value);
 	g_assert (n_value == sizeof (CK_ULONG));
 	g_assert (*((CK_ULONG_PTR)value) == 24);
@@ -144,8 +144,8 @@ DEFINE_TEST(read_value_default)
 DEFINE_TEST(read_string)
 {
 	gchar *str;
-	
-	str = gck_store_read_string (store, object, CKA_LABEL);
+
+	str = gkm_store_read_string (store, object, CKA_LABEL);
 	g_assert_cmpstr (str, ==, "label");
 	g_free (str);
 }
@@ -158,8 +158,8 @@ DEFINE_TEST(get_invalid)
 	attr.type = CKA_APPLICATION;
 	attr.pValue = NULL;
 	attr.ulValueLen = 0;
-	
-	rv = gck_store_get_attribute (store, object, &attr);
+
+	rv = gkm_store_get_attribute (store, object, &attr);
 	g_assert (rv == CKR_ATTRIBUTE_TYPE_INVALID);
 }
 
@@ -171,8 +171,8 @@ DEFINE_TEST(get_sensitive)
 	attr.type = CKA_VALUE;
 	attr.pValue = NULL;
 	attr.ulValueLen = 0;
-	
-	rv = gck_store_get_attribute (store, object, &attr);
+
+	rv = gkm_store_get_attribute (store, object, &attr);
 	g_assert (rv == CKR_ATTRIBUTE_SENSITIVE);
 }
 
@@ -184,53 +184,53 @@ DEFINE_TEST(get_internal)
 	attr.type = CKA_BITS_PER_PIXEL;
 	attr.pValue = NULL;
 	attr.ulValueLen = 0;
-	
-	rv = gck_store_get_attribute (store, object, &attr);
+
+	rv = gkm_store_get_attribute (store, object, &attr);
 	g_assert (rv == CKR_ATTRIBUTE_TYPE_INVALID);
 }
 
 DEFINE_TEST(set_invalid)
 {
 	CK_ATTRIBUTE attr;
-	
+
 	attr.type = CKA_APPLICATION;
 	attr.pValue = "me";
 	attr.ulValueLen = 2;
-	
-	gck_store_set_attribute (store, transaction, object, &attr);
-	g_assert (gck_transaction_get_result (transaction) == CKR_ATTRIBUTE_TYPE_INVALID);
+
+	gkm_store_set_attribute (store, transaction, object, &attr);
+	g_assert (gkm_transaction_get_result (transaction) == CKR_ATTRIBUTE_TYPE_INVALID);
 }
 
 DEFINE_TEST(set_internal)
 {
 	CK_ATTRIBUTE attr;
 	CK_ULONG five = 5;
-	
+
 	attr.type = CKA_BITS_PER_PIXEL;
 	attr.pValue = &five;
 	attr.ulValueLen = sizeof (five);
-	
-	gck_store_set_attribute (store, transaction, object, &attr);
-	g_assert (gck_transaction_get_result (transaction) == CKR_ATTRIBUTE_TYPE_INVALID);
+
+	gkm_store_set_attribute (store, transaction, object, &attr);
+	g_assert (gkm_transaction_get_result (transaction) == CKR_ATTRIBUTE_TYPE_INVALID);
 }
 
 DEFINE_TEST(set_get_attribute)
 {
 	CK_ATTRIBUTE attr;
 	CK_RV rv;
-	
+
 	attr.type = CKA_LABEL;
 	attr.pValue = "booyah";
 	attr.ulValueLen = 6;
-	
-	gck_store_set_attribute (store, transaction, object, &attr);
-	
-	gck_transaction_complete (transaction);
-	g_assert (gck_transaction_get_result (transaction) == CKR_OK);
-	
+
+	gkm_store_set_attribute (store, transaction, object, &attr);
+
+	gkm_transaction_complete (transaction);
+	g_assert (gkm_transaction_get_result (transaction) == CKR_OK);
+
 	attr.pValue = buffer;
 	attr.ulValueLen = 1024;
-	rv = gck_store_get_attribute (store, object, &attr);
+	rv = gkm_store_get_attribute (store, object, &attr);
 	g_assert (rv == CKR_OK);
 	g_assert (attr.ulValueLen == 6);
 	g_assert (memcmp (attr.pValue, "booyah", 6) == 0);
@@ -242,17 +242,17 @@ DEFINE_TEST(write_read_value)
 	CK_ULONG five = 5;
 	gconstpointer value;
 	gsize n_value;
-	
+
 	attr.type = CKA_BITS_PER_PIXEL;
 	attr.pValue = &five;
 	attr.ulValueLen = sizeof (five);
-	
-	gck_store_write_value (store, transaction, object, &attr);
 
-	gck_transaction_complete (transaction);
-	g_assert (gck_transaction_get_result (transaction) == CKR_OK);
+	gkm_store_write_value (store, transaction, object, &attr);
 
-	value = gck_store_read_value (store, object, CKA_BITS_PER_PIXEL, &n_value);
+	gkm_transaction_complete (transaction);
+	g_assert (gkm_transaction_get_result (transaction) == CKR_OK);
+
+	value = gkm_store_read_value (store, object, CKA_BITS_PER_PIXEL, &n_value);
 	g_assert (value);
 	g_assert (n_value == sizeof (five));
 	g_assert (memcmp (value, &five, sizeof (five)) == 0);
@@ -261,16 +261,16 @@ DEFINE_TEST(write_read_value)
 DEFINE_TEST(set_no_validate)
 {
 	CK_ATTRIBUTE attr;
-	
+
 	attr.type = CKA_LABEL;
 	attr.pValue = "CAPITALS";
 	attr.ulValueLen = 8;
-	
-	gck_store_set_attribute (store, transaction, object, &attr);
-	g_assert (gck_transaction_get_failed (transaction));
-	
-	gck_transaction_complete (transaction);
-	g_assert (gck_transaction_get_result (transaction) == CKR_ATTRIBUTE_VALUE_INVALID);
+
+	gkm_store_set_attribute (store, transaction, object, &attr);
+	g_assert (gkm_transaction_get_failed (transaction));
+
+	gkm_transaction_complete (transaction);
+	g_assert (gkm_transaction_get_result (transaction) == CKR_ATTRIBUTE_VALUE_INVALID);
 }
 
 DEFINE_TEST(set_transaction_default)
@@ -279,34 +279,34 @@ DEFINE_TEST(set_transaction_default)
 	gconstpointer value;
 	gsize n_value;
 
-	
+
 	attr.type = CKA_LABEL;
 	attr.pValue = "another";
 	attr.ulValueLen = 7;
 
 	/* Change the attribute */
-	gck_store_set_attribute (store, transaction, object, &attr);
-	g_assert (gck_transaction_get_failed (transaction) == FALSE);
+	gkm_store_set_attribute (store, transaction, object, &attr);
+	g_assert (gkm_transaction_get_failed (transaction) == FALSE);
 
 	/* Should get new value */
-	value = gck_store_read_value (store, object, CKA_LABEL, &n_value);
+	value = gkm_store_read_value (store, object, CKA_LABEL, &n_value);
 	g_assert (value && n_value == attr.ulValueLen);
 	g_assert (memcmp (attr.pValue, value, n_value) == 0);
-	
+
 	/* Fail for some arbitrary reason */
-	gck_transaction_fail (transaction, CKR_ATTRIBUTE_VALUE_INVALID);
-	
+	gkm_transaction_fail (transaction, CKR_ATTRIBUTE_VALUE_INVALID);
+
 	/* Value should not have changed yet */
-	value = gck_store_read_value (store, object, CKA_LABEL, &n_value);
+	value = gkm_store_read_value (store, object, CKA_LABEL, &n_value);
 	g_assert (value && n_value == attr.ulValueLen);
 	g_assert (memcmp (attr.pValue, value, n_value) == 0);
-	
+
 	/* Now complete the transaction */
-	gck_transaction_complete (transaction);
-	g_assert (gck_transaction_get_failed (transaction) == TRUE);
+	gkm_transaction_complete (transaction);
+	g_assert (gkm_transaction_get_failed (transaction) == TRUE);
 
 	/* Value should now have changed, back to default */
-	value = gck_store_read_value (store, object, CKA_LABEL, &n_value);
+	value = gkm_store_read_value (store, object, CKA_LABEL, &n_value);
 	g_assert (value && n_value == 5);
 	g_assert (memcmp (value, "label", 5) == 0);
 }
@@ -316,34 +316,34 @@ DEFINE_TEST(set_transaction_revert_first)
 	CK_ATTRIBUTE attr, prev;
 	gconstpointer value;
 	gsize n_value;
-	
+
 	prev.type = CKA_LABEL;
 	prev.pValue = "numberone";
 	prev.ulValueLen = 9;
 
 	/* Change the attribute */
-	gck_store_set_attribute (store, transaction, object, &prev);
-	gck_transaction_complete (transaction);
-	g_assert (gck_transaction_get_failed (transaction) == FALSE);
+	gkm_store_set_attribute (store, transaction, object, &prev);
+	gkm_transaction_complete (transaction);
+	g_assert (gkm_transaction_get_failed (transaction) == FALSE);
 
 	/* Value should be new value */
-	value = gck_store_read_value (store, object, CKA_LABEL, &n_value);
+	value = gkm_store_read_value (store, object, CKA_LABEL, &n_value);
 	g_assert (value && n_value == prev.ulValueLen);
 	g_assert (memcmp (prev.pValue, value, n_value) == 0);
 
 	/* A new transaction */
 	g_object_unref (transaction);
-	transaction = gck_transaction_new ();
+	transaction = gkm_transaction_new ();
 
 	attr.type = CKA_LABEL;
 	attr.pValue = "second";
 	attr.ulValueLen = 6;
 
-	gck_store_set_attribute (store, transaction, object, &attr);
-	g_assert (gck_transaction_get_failed (transaction) == FALSE);
+	gkm_store_set_attribute (store, transaction, object, &attr);
+	g_assert (gkm_transaction_get_failed (transaction) == FALSE);
 
 	/* Should get new value */
-	value = gck_store_read_value (store, object, CKA_LABEL, &n_value);
+	value = gkm_store_read_value (store, object, CKA_LABEL, &n_value);
 	g_assert (value && n_value == attr.ulValueLen);
 	g_assert (memcmp (attr.pValue, value, n_value) == 0);
 
@@ -351,39 +351,39 @@ DEFINE_TEST(set_transaction_revert_first)
 	attr.pValue = "third";
 	attr.ulValueLen = 5;
 
-	gck_store_set_attribute (store, transaction, object, &attr);
-	g_assert (gck_transaction_get_failed (transaction) == FALSE);
+	gkm_store_set_attribute (store, transaction, object, &attr);
+	g_assert (gkm_transaction_get_failed (transaction) == FALSE);
 
 	/* Should get new value */
-	value = gck_store_read_value (store, object, CKA_LABEL, &n_value);
+	value = gkm_store_read_value (store, object, CKA_LABEL, &n_value);
 	g_assert (value && n_value == attr.ulValueLen);
 	g_assert (memcmp (attr.pValue, value, n_value) == 0);
-	
+
 	/* Fail for some arbitrary reason */
-	gck_transaction_fail (transaction, CKR_ATTRIBUTE_VALUE_INVALID);
-	
+	gkm_transaction_fail (transaction, CKR_ATTRIBUTE_VALUE_INVALID);
+
 	/* Value should not have changed yet */
-	value = gck_store_read_value (store, object, CKA_LABEL, &n_value);
+	value = gkm_store_read_value (store, object, CKA_LABEL, &n_value);
 	g_assert (value && n_value == attr.ulValueLen);
 	g_assert (memcmp (attr.pValue, value, n_value) == 0);
-	
+
 	/* Now complete the transaction */
-	gck_transaction_complete (transaction);
-	g_assert (gck_transaction_get_failed (transaction) == TRUE);
+	gkm_transaction_complete (transaction);
+	g_assert (gkm_transaction_get_failed (transaction) == TRUE);
 
 	/* Value should now have changed, back to default */
-	value = gck_store_read_value (store, object, CKA_LABEL, &n_value);
+	value = gkm_store_read_value (store, object, CKA_LABEL, &n_value);
 	g_assert (value && n_value == prev.ulValueLen);
 	g_assert (memcmp (prev.pValue, value, n_value) == 0);
 }
 
 static void
-notify_attribute (GckObject *obj, CK_ATTRIBUTE_TYPE type, gpointer data)
+notify_attribute (GkmObject *obj, CK_ATTRIBUTE_TYPE type, gpointer data)
 {
 	g_assert (obj == object);
 	g_assert (type == CKA_LABEL);
 	g_assert (data);
-	
+
 	*((CK_ATTRIBUTE_TYPE*)data) = type;
 }
 
@@ -398,23 +398,23 @@ DEFINE_TEST(set_notifies)
 
 	g_signal_connect (object, "notify-attribute", G_CALLBACK (notify_attribute), &type);
 
-	gck_store_set_attribute (store, transaction, object, &attr);
+	gkm_store_set_attribute (store, transaction, object, &attr);
 
 	/* We should have been notified that the attribute changed at this point */
 	g_assert (type == CKA_LABEL);
-	
+
 	/* Reset for next notify */
 	type = 0;
-	
+
 	/* Fail for some arbitrary reason */
-	gck_transaction_fail (transaction, CKR_ATTRIBUTE_VALUE_INVALID);
-	
+	gkm_transaction_fail (transaction, CKR_ATTRIBUTE_VALUE_INVALID);
+
 	/* We should not have been notified yet */
 	g_assert (type == 0);
-	
+
 	/* Now complete the transaction */
-	gck_transaction_complete (transaction);
-	g_assert (gck_transaction_get_failed (transaction) == TRUE);
+	gkm_transaction_complete (transaction);
+	g_assert (gkm_transaction_get_failed (transaction) == TRUE);
 
 	/* Now we should have been notified that this changed back */
 	g_assert (type == CKA_LABEL);
@@ -423,15 +423,15 @@ DEFINE_TEST(set_notifies)
 DEFINE_TEST(set_object_gone_first)
 {
 	CK_ATTRIBUTE attr;
-	
+
 	attr.type = CKA_LABEL;
 	attr.pValue = "valid";
 	attr.ulValueLen = 5;
-	
-	gck_store_set_attribute (store, transaction, object, &attr);
-	gck_transaction_complete (transaction);
-	g_assert (gck_transaction_get_result (transaction) == CKR_OK);
-	
+
+	gkm_store_set_attribute (store, transaction, object, &attr);
+	gkm_transaction_complete (transaction);
+	g_assert (gkm_transaction_get_result (transaction) == CKR_OK);
+
 	/* This tests memory store internal tracking */
 	g_object_unref (object);
 	object = NULL;
diff --git a/pkcs11/gck/tests/unit-test-object.c b/pkcs11/gkm/tests/unit-test-object.c
similarity index 77%
rename from pkcs11/gck/tests/unit-test-object.c
rename to pkcs11/gkm/tests/unit-test-object.c
index fd16dd0..80bc1ba 100644
--- a/pkcs11/gck/tests/unit-test-object.c
+++ b/pkcs11/gkm/tests/unit-test-object.c
@@ -24,16 +24,16 @@
 #include "run-auto-test.h"
 #include "test-module.h"
 
-#include "gck/gck-attributes.h"
-#include "gck/gck-object.h"
-#include "gck/gck-session.h"
-#include "gck/gck-module.h"
-#include "gck/gck-transaction.h"
+#include "gkm/gkm-attributes.h"
+#include "gkm/gkm-object.h"
+#include "gkm/gkm-session.h"
+#include "gkm/gkm-module.h"
+#include "gkm/gkm-transaction.h"
 
 #include "pkcs11i.h"
 
-static GckModule *module = NULL;
-static GckSession *session = NULL;
+static GkmModule *module = NULL;
+static GkmSession *session = NULL;
 static guchar *certificate_data = NULL;
 static gsize certificate_n_data = 0;
 
@@ -49,7 +49,7 @@ DEFINE_TEARDOWN(object_teardown)
 	g_free (certificate_data);
 	certificate_data = NULL;
 	certificate_n_data = 0;
-	
+
 	test_module_leave_and_finalize ();
 	module = NULL;
 	session = NULL;
@@ -61,11 +61,11 @@ check_object_exists (CK_OBJECT_HANDLE handle)
 	CK_BBOOL token;
 	CK_ATTRIBUTE attr = { CKA_TOKEN, &token, sizeof (token) };
 	CK_RV rv;
-	
-	rv = gck_session_C_GetAttributeValue (session, handle, &attr, 1);
+
+	rv = gkm_session_C_GetAttributeValue (session, handle, &attr, 1);
 	if (rv == CKR_OBJECT_HANDLE_INVALID)
 		return FALSE;
-	
+
 	g_assert (rv == CKR_OK);
 	return TRUE;
 }
@@ -76,7 +76,7 @@ DEFINE_TEST(object_create_destroy_transient)
 	CK_BBOOL token = CK_TRUE;
 	CK_OBJECT_CLASS klass = CKO_CERTIFICATE;
 	CK_CERTIFICATE_TYPE type = CKC_X_509;
-	
+
 	CK_ATTRIBUTE attrs[] = {
 	        { CKA_TOKEN, &token, sizeof (token) },
 		{ CKA_GNOME_TRANSIENT, &transient, sizeof (transient) },
@@ -84,25 +84,25 @@ DEFINE_TEST(object_create_destroy_transient)
 		{ CKA_CERTIFICATE_TYPE, &type, sizeof (type) },
 		{ CKA_VALUE, certificate_data, certificate_n_data },
 	};
-	
+
 	CK_ATTRIBUTE lookup = { CKA_GNOME_TRANSIENT, &transient, sizeof (transient) };
 	CK_OBJECT_HANDLE handle;
 	CK_RV rv;
-	
-	rv = gck_session_C_CreateObject (session, attrs, G_N_ELEMENTS (attrs), &handle);
+
+	rv = gkm_session_C_CreateObject (session, attrs, G_N_ELEMENTS (attrs), &handle);
 	g_assert (rv == CKR_OK);
 	g_assert (handle != 0);
-	
+
 	g_assert (check_object_exists (handle));
-	
+
 	transient = CK_FALSE;
-	rv = gck_session_C_GetAttributeValue (session, handle, &lookup, 1);
+	rv = gkm_session_C_GetAttributeValue (session, handle, &lookup, 1);
 	g_assert (rv == CKR_OK);
 	g_assert (transient == CK_TRUE);
-	
-	rv = gck_session_C_DestroyObject (session, handle);
+
+	rv = gkm_session_C_DestroyObject (session, handle);
 	g_assert (rv == CKR_OK);
-	
+
 	g_assert (!check_object_exists (handle));
 }
 
@@ -113,22 +113,22 @@ DEFINE_TEST(object_transient_transacted_fail)
 	CK_OBJECT_CLASS klass = CKO_CERTIFICATE;
 	CK_CERTIFICATE_TYPE type = CKC_X_509;
 	CK_ULONG invalid = 4;
-	
+
 	CK_ATTRIBUTE attrs[] = {
 	        { CKA_TOKEN, &token, sizeof (token) },
 		{ CKA_GNOME_TRANSIENT, &transient, sizeof (transient) },
 		{ CKA_CLASS, &klass, sizeof (klass) },
 		{ CKA_CERTIFICATE_TYPE, &type, sizeof (type) },
 		{ CKA_VALUE, certificate_data, certificate_n_data },
-		
+
 		/* An invalid attribute, should cause transaction to fail */
-		{ CKA_BITS_PER_PIXEL, &invalid, sizeof (invalid) }  
+		{ CKA_BITS_PER_PIXEL, &invalid, sizeof (invalid) }
 	};
-	
+
 	CK_OBJECT_HANDLE handle;
 	CK_RV rv;
-	
-	rv = gck_session_C_CreateObject (session, attrs, G_N_ELEMENTS (attrs), &handle);
+
+	rv = gkm_session_C_CreateObject (session, attrs, G_N_ELEMENTS (attrs), &handle);
 	g_assert (rv == CKR_ATTRIBUTE_TYPE_INVALID);
 }
 
@@ -136,7 +136,7 @@ DEFINE_TEST(object_create_transient_bad_value)
 {
 	CK_OBJECT_CLASS klass = CKO_CERTIFICATE;
 	CK_CERTIFICATE_TYPE type = CKC_X_509;
-	
+
 	CK_ATTRIBUTE attrs[] = {
 		{ CKA_GNOME_TRANSIENT, NULL, 0 },
 		{ CKA_CLASS, &klass, sizeof (klass) },
@@ -146,9 +146,9 @@ DEFINE_TEST(object_create_transient_bad_value)
 
 	CK_OBJECT_HANDLE handle;
 	CK_RV rv;
-	
+
 	/* Can't have a non-transient object that auto-destructs */
-	rv = gck_session_C_CreateObject (session, attrs, G_N_ELEMENTS (attrs), &handle);
+	rv = gkm_session_C_CreateObject (session, attrs, G_N_ELEMENTS (attrs), &handle);
 	g_assert (rv == CKR_ATTRIBUTE_VALUE_INVALID);
 }
 
@@ -167,33 +167,33 @@ DEFINE_TEST(object_create_auto_destruct)
 		{ CKA_CERTIFICATE_TYPE, &type, sizeof (type) },
 		{ CKA_VALUE, certificate_data, certificate_n_data },
 	};
-	
+
 	CK_BBOOL transient;
-	
-	CK_ATTRIBUTE lookups[] = { 
+
+	CK_ATTRIBUTE lookups[] = {
 		{ CKA_G_DESTRUCT_AFTER, &check, sizeof (check) },
 		{ CKA_GNOME_TRANSIENT, &transient, sizeof (transient) }
 	};
-	
+
 	CK_OBJECT_HANDLE handle;
 	CK_RV rv;
 
-	rv = gck_session_C_CreateObject (session, attrs, G_N_ELEMENTS (attrs), &handle);
+	rv = gkm_session_C_CreateObject (session, attrs, G_N_ELEMENTS (attrs), &handle);
 	g_assert (rv == CKR_OK);
 	g_assert (handle != 0);
-	
+
 	g_assert (check_object_exists (handle));
-	
+
 	transient = CK_FALSE;
-	rv = gck_session_C_GetAttributeValue (session, handle, lookups, G_N_ELEMENTS (lookups));
+	rv = gkm_session_C_GetAttributeValue (session, handle, lookups, G_N_ELEMENTS (lookups));
 	g_assert (rv == CKR_OK);
 	g_assert (transient == TRUE);
 	g_assert (memcmp (&lifetime, &check, sizeof (lifetime)) == 0);
-	
+
 	test_module_leave ();
 	test_mainloop_run (2200);
 	test_module_enter ();
-	
+
 	g_assert (!check_object_exists (handle));
 }
 
@@ -214,63 +214,63 @@ DEFINE_TEST(object_create_auto_destruct_not_transient)
 
 	CK_OBJECT_HANDLE handle;
 	CK_RV rv;
-	
+
 	/* Can't have a non-transient object that auto-destructs */
-	rv = gck_session_C_CreateObject (session, attrs, G_N_ELEMENTS (attrs), &handle);
+	rv = gkm_session_C_CreateObject (session, attrs, G_N_ELEMENTS (attrs), &handle);
 	g_assert (rv == CKR_TEMPLATE_INCONSISTENT);
 }
 
 DEFINE_TEST(object_expose)
 {
 	CK_OBJECT_HANDLE handle;
-	GckManager *manager;
-	GckObject *check, *object;
+	GkmManager *manager;
+	GkmObject *check, *object;
 
-	manager = gck_session_get_manager (session);
+	manager = gkm_session_get_manager (session);
 	object = test_module_object_new (session);
 
-	handle = gck_object_get_handle (object);
-	gck_object_expose (object, TRUE);
+	handle = gkm_object_get_handle (object);
+	gkm_object_expose (object, TRUE);
 
 	/* Now it should have a handle, and be visible */
-	check = gck_manager_find_by_handle (manager, handle);
+	check = gkm_manager_find_by_handle (manager, handle);
 	g_assert (check == object);
 
-	gck_object_expose (object, FALSE);
+	gkm_object_expose (object, FALSE);
 
 	/* Now should be invisible */
-	check = gck_manager_find_by_handle (manager, handle);
+	check = gkm_manager_find_by_handle (manager, handle);
 	g_assert (check == NULL);
 }
 
 DEFINE_TEST(object_expose_transaction)
 {
 	CK_OBJECT_HANDLE handle;
-	GckManager *manager;
-	GckObject *check, *object;
-	GckTransaction *transaction;
+	GkmManager *manager;
+	GkmObject *check, *object;
+	GkmTransaction *transaction;
 
-	manager = gck_session_get_manager (session);
+	manager = gkm_session_get_manager (session);
 	object = test_module_object_new (session);
 
-	handle = gck_object_get_handle (object);
-	transaction = gck_transaction_new ();
+	handle = gkm_object_get_handle (object);
+	transaction = gkm_transaction_new ();
 
 	/* Should be hidden */
-	gck_object_expose (object, FALSE);
-	check = gck_manager_find_by_handle (manager, handle);
+	gkm_object_expose (object, FALSE);
+	check = gkm_manager_find_by_handle (manager, handle);
 	g_assert (check == NULL);
 
 	/* Now it should have a handle, and be visible */
-	gck_object_expose_full (object, transaction, TRUE);
-	check = gck_manager_find_by_handle (manager, handle);
+	gkm_object_expose_full (object, transaction, TRUE);
+	check = gkm_manager_find_by_handle (manager, handle);
 	g_assert (check == object);
 
-	gck_transaction_fail (transaction, CKR_GENERAL_ERROR);
-	gck_transaction_complete (transaction);
+	gkm_transaction_fail (transaction, CKR_GENERAL_ERROR);
+	gkm_transaction_complete (transaction);
 
 	/* Now should be invisible */
-	check = gck_manager_find_by_handle (manager, handle);
+	check = gkm_manager_find_by_handle (manager, handle);
 	g_assert (check == NULL);
 
 	g_object_unref (transaction);
diff --git a/pkcs11/gkm/tests/unit-test-secret.c b/pkcs11/gkm/tests/unit-test-secret.c
new file mode 100644
index 0000000..4406cf0
--- /dev/null
+++ b/pkcs11/gkm/tests/unit-test-secret.c
@@ -0,0 +1,178 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* unit-test-secret.c: Test gkm-secret.c
+
+   Copyright (C) 2007 Stefan Walter
+
+   The Gnome Keyring Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The Gnome Keyring Library 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the Gnome Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.
+
+   Author: Stef Walter <stef memberwebs com>
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "run-auto-test.h"
+
+#include "gkm/gkm-secret.h"
+
+DEFINE_TEST(test_secret)
+{
+	GkmSecret *secret;
+	const gchar *password;
+	gsize n_password;
+
+	secret = gkm_secret_new ((guchar*)"test-pin", 8);
+	g_assert (GKM_IS_SECRET (secret));
+
+	password = gkm_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 (gkm_secret_equals (secret, (CK_UTF8CHAR_PTR)"test-pin", 8));
+	g_assert (!gkm_secret_equals (secret, (CK_UTF8CHAR_PTR)"test-pino", 9));
+	g_assert (!gkm_secret_equals (secret, NULL, 0));
+	g_assert (gkm_secret_equals (secret, (CK_UTF8CHAR_PTR)"test-pin", -1));
+	g_assert (!gkm_secret_equals (secret, (CK_UTF8CHAR_PTR)"", 0));
+
+	g_object_unref (secret);
+}
+
+DEFINE_TEST(test_secret_from_login)
+{
+	GkmSecret *secret;
+	const gchar *password;
+	gsize n_password;
+
+	secret = gkm_secret_new_from_login ((guchar*)"test-pin", 8);
+	g_assert (GKM_IS_SECRET (secret));
+	password = gkm_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 = gkm_secret_new_from_login ((guchar*)"test-pin", (CK_ULONG)-1);
+	g_assert (GKM_IS_SECRET (secret));
+	password = gkm_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)
+{
+	GkmSecret *secret;
+	const gchar *password;
+	gsize n_password;
+
+	secret = gkm_secret_new ((CK_UTF8CHAR_PTR)"null-terminated", -1);
+	g_assert (GKM_IS_SECRET (secret));
+
+	password = gkm_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 (gkm_secret_equals (secret, (CK_UTF8CHAR_PTR)"null-terminated", strlen ("null-terminated")));
+	g_assert (!gkm_secret_equals (secret, (CK_UTF8CHAR_PTR)"test-pino", 9));
+	g_assert (!gkm_secret_equals (secret, NULL, 0));
+	g_assert (gkm_secret_equals (secret, (CK_UTF8CHAR_PTR)"null-terminated", -1));
+	g_assert (!gkm_secret_equals (secret, (CK_UTF8CHAR_PTR)"", 0));
+
+	g_object_unref (secret);
+}
+
+DEFINE_TEST(test_always_has_null)
+{
+	GkmSecret *secret;
+	const guchar *memory;
+	gsize n_memory;
+
+	/* A 4 byte 'binary' secret */
+	secret = gkm_secret_new ((guchar*)"barn", 4);
+	g_assert (GKM_IS_SECRET (secret));
+
+	memory = gkm_secret_get (secret, &n_memory);
+	g_assert_cmpuint (n_memory, ==, 4);
+
+	/* But it should be null-terminated anyway */
+	g_assert (memory[4] == 0);
+
+	g_object_unref (secret);
+}
+
+DEFINE_TEST(test_null)
+{
+	GkmSecret *secret;
+	const gchar *password;
+	gsize n_password;
+
+	secret = gkm_secret_new (NULL, 0);
+	g_assert (GKM_IS_SECRET (secret));
+
+	password = gkm_secret_get_password (secret, &n_password);
+	g_assert (password == NULL);
+	g_assert_cmpuint (n_password, ==, 0);
+
+	g_assert (!gkm_secret_equals (secret, (CK_UTF8CHAR_PTR)"null-terminated", strlen ("null-terminated")));
+	g_assert (!gkm_secret_equals (secret, (CK_UTF8CHAR_PTR)"test-pino", 9));
+	g_assert (gkm_secret_equals (secret, NULL, 0));
+	g_assert (!gkm_secret_equals (secret, (CK_UTF8CHAR_PTR)"null-terminated", -1));
+	g_assert (gkm_secret_equals (secret, (CK_UTF8CHAR_PTR)"", 0));
+
+	g_object_unref (secret);
+}
+
+DEFINE_TEST(test_empty)
+{
+	GkmSecret *secret;
+	const gchar *password;
+	gsize n_password;
+
+	secret = gkm_secret_new ((CK_UTF8CHAR_PTR)"", 0);
+	g_assert (GKM_IS_SECRET (secret));
+
+	password = gkm_secret_get_password (secret, &n_password);
+	g_assert_cmpstr (password, ==, "");
+	g_assert_cmpuint (n_password, ==, 0);
+
+	g_assert (!gkm_secret_equals (secret, (CK_UTF8CHAR_PTR)"null-terminated", strlen ("null-terminated")));
+	g_assert (!gkm_secret_equals (secret, (CK_UTF8CHAR_PTR)"test-pino", 9));
+	g_assert (gkm_secret_equals (secret, NULL, 0));
+	g_assert (gkm_secret_equals (secret, (CK_UTF8CHAR_PTR)"", -1));
+	g_assert (gkm_secret_equals (secret, (CK_UTF8CHAR_PTR)"", 0));
+
+	g_object_unref (secret);
+}
+
+DEFINE_TEST(test_equal)
+{
+	GkmSecret *one;
+	GkmSecret *two;
+
+	one = two = gkm_secret_new ((CK_UTF8CHAR_PTR)"funny", 5);
+	g_assert (gkm_secret_equal (one, two));
+
+	two = gkm_secret_new_from_password ("funny");
+	g_assert (gkm_secret_equal (one, two));
+
+	g_object_unref (one);
+	one = gkm_secret_new_from_password ("other");
+	g_assert (!gkm_secret_equal (one, two));
+}
diff --git a/pkcs11/gck/tests/unit-test-sexp.c b/pkcs11/gkm/tests/unit-test-sexp.c
similarity index 93%
rename from pkcs11/gck/tests/unit-test-sexp.c
rename to pkcs11/gkm/tests/unit-test-sexp.c
index 1136fc1..503e2c0 100644
--- a/pkcs11/gck/tests/unit-test-sexp.c
+++ b/pkcs11/gkm/tests/unit-test-sexp.c
@@ -27,8 +27,8 @@
 
 #include "run-auto-test.h"
 
-#include "gck/gck-crypto.h"
-#include "gck/gck-sexp.h"
+#include "gkm/gkm-crypto.h"
+#include "gkm/gkm-sexp.h"
 
 #include <gcrypt.h>
 
@@ -57,7 +57,7 @@ DEFINE_SETUP(crypto_setup)
 {
 	gcry_error_t gcry;
 
-	gck_crypto_initialize ();
+	gkm_crypto_initialize ();
 
 	gcry = gcry_sexp_new (&rsakey, TEST_RSA, strlen (TEST_RSA), 1);
 	g_return_if_fail (gcry == 0);
@@ -82,13 +82,13 @@ DEFINE_TEST(parse_key)
 	int algorithm = 0;
 
 	/* Get the private key out */
-	ret = gck_sexp_parse_key (rsakey, &algorithm, &is_priv, &sexp);
+	ret = gkm_sexp_parse_key (rsakey, &algorithm, &is_priv, &sexp);
 	g_assert (ret);
 	g_assert (algorithm == GCRY_PK_RSA);
 	g_assert (is_priv == TRUE);
 	g_assert (sexp != NULL);
 
-	ret = gck_sexp_extract_mpi (rsakey, &mpi, "p", NULL);
+	ret = gkm_sexp_extract_mpi (rsakey, &mpi, "p", NULL);
 	g_assert (ret);
 	g_assert (mpi != NULL);
 }
@@ -101,7 +101,7 @@ DEFINE_TEST(sexp_key_to_public)
 	guchar *p;
 
 	/* RSA */
-	ret = gck_sexp_key_to_public (rsakey, &pubkey);
+	ret = gkm_sexp_key_to_public (rsakey, &pubkey);
 	g_assert (ret);
 	g_assert (pubkey != NULL);
 
@@ -116,7 +116,7 @@ DEFINE_TEST(sexp_key_to_public)
 
 
 	/* DSA */
-	ret = gck_sexp_key_to_public (dsakey, &pubkey);
+	ret = gkm_sexp_key_to_public (dsakey, &pubkey);
 	g_assert (ret);
 	g_assert (pubkey != NULL);
 
diff --git a/pkcs11/gck/tests/unit-test-store.c b/pkcs11/gkm/tests/unit-test-store.c
similarity index 75%
rename from pkcs11/gck/tests/unit-test-store.c
rename to pkcs11/gkm/tests/unit-test-store.c
index 5096677..d6daabf 100644
--- a/pkcs11/gck/tests/unit-test-store.c
+++ b/pkcs11/gkm/tests/unit-test-store.c
@@ -29,22 +29,22 @@
 #include "run-auto-test.h"
 #include "test-module.h"
 
-#include "gck/gck-store.h"
+#include "gkm/gkm-store.h"
 
-static GckModule *module = NULL;
-static GckStore *store = NULL;
+static GkmModule *module = NULL;
+static GkmStore *store = NULL;
 
 DEFINE_SETUP(store)
 {
 	module = test_module_initialize_and_enter ();
-	store = g_object_new (GCK_TYPE_STORE, NULL);
+	store = g_object_new (GKM_TYPE_STORE, NULL);
 }
 
 DEFINE_TEARDOWN(store)
 {
 	g_object_unref (store);
 	store = NULL;
-	
+
 	test_module_leave_and_finalize ();
 	module = NULL;
 }
@@ -52,34 +52,34 @@ DEFINE_TEARDOWN(store)
 DEFINE_TEST(store_schema)
 {
 	CK_ATTRIBUTE attr;
-	
+
 	attr.type = CKA_LABEL;
 	attr.pValue = "Label";
 	attr.ulValueLen = 5;
-	
-	gck_store_register_schema (store, &attr, NULL, 0);
-	g_assert (gck_store_lookup_schema (store, CKA_LABEL, NULL));
-	
+
+	gkm_store_register_schema (store, &attr, NULL, 0);
+	g_assert (gkm_store_lookup_schema (store, CKA_LABEL, NULL));
+
 	/* Not in the schema */
-	g_assert (!gck_store_lookup_schema (store, CKA_VALUE, NULL));
+	g_assert (!gkm_store_lookup_schema (store, CKA_VALUE, NULL));
 }
 
 DEFINE_TEST(store_schema_flags)
 {
 	CK_ATTRIBUTE attr;
 	guint flags;
-	
+
 	attr.type = CKA_VALUE;
 	attr.pValue = NULL;
 	attr.ulValueLen = 0;
-	
-	gck_store_register_schema (store, &attr, NULL, GCK_STORE_IS_SENSITIVE);
-	g_assert (gck_store_lookup_schema (store, CKA_VALUE, &flags));
-	g_assert (flags == GCK_STORE_IS_SENSITIVE);
+
+	gkm_store_register_schema (store, &attr, NULL, GKM_STORE_IS_SENSITIVE);
+	g_assert (gkm_store_lookup_schema (store, CKA_VALUE, &flags));
+	g_assert (flags == GKM_STORE_IS_SENSITIVE);
 }
 
-/* 
- * That's all we can test in the base class of GckStore without a proper
- * derived class. For more tests see unit-test-memory-store.c and 
+/*
+ * That's all we can test in the base class of GkmStore without a proper
+ * derived class. For more tests see unit-test-memory-store.c and
  * unit-test-file-store.c
  */
diff --git a/pkcs11/gck/tests/unit-test-timer.c b/pkcs11/gkm/tests/unit-test-timer.c
similarity index 72%
rename from pkcs11/gck/tests/unit-test-timer.c
rename to pkcs11/gkm/tests/unit-test-timer.c
index ac50b62..c2a7376 100644
--- a/pkcs11/gck/tests/unit-test-timer.c
+++ b/pkcs11/gkm/tests/unit-test-timer.c
@@ -24,9 +24,9 @@
 #include "run-auto-test.h"
 #include "test-module.h"
 
-#include "gck/gck-timer.h"
+#include "gkm/gkm-timer.h"
 
-static GckModule *module = NULL;
+static GkmModule *module = NULL;
 
 DEFINE_SETUP(timer_setup)
 {
@@ -40,14 +40,14 @@ DEFINE_TEARDOWN(timer_teardown)
 
 DEFINE_TEST(timer_extra_initialize)
 {
-	gck_timer_initialize ();
-	gck_timer_shutdown ();
+	gkm_timer_initialize ();
+	gkm_timer_shutdown ();
 }
 
 static void
-timer_callback (GckTimer *timer, gpointer user_data)
+timer_callback (GkmTimer *timer, gpointer user_data)
 {
-	GckTimer **value = user_data;
+	GkmTimer **value = user_data;
 	g_assert (timer);
 	g_assert (timer == *value);
 	*value = NULL;
@@ -55,28 +55,28 @@ timer_callback (GckTimer *timer, gpointer user_data)
 
 DEFINE_TEST(timer_simple)
 {
-	GckTimer *timer;
+	GkmTimer *timer;
 
-	timer = gck_timer_start (module, 2, timer_callback, &timer);
+	timer = gkm_timer_start (module, 2, timer_callback, &timer);
 
 	test_module_leave ();
 	test_mainloop_run (2200);
 	test_module_enter ();
-	
+
 	g_assert (timer == NULL);
 }
 
 DEFINE_TEST(timer_cancel)
 {
-	GckTimer *timer;
+	GkmTimer *timer;
 
-	timer = gck_timer_start (module, 2, timer_callback, &timer);
+	timer = gkm_timer_start (module, 2, timer_callback, &timer);
 
 	test_module_leave ();
 	test_mainloop_run (500);
 	test_module_enter ();
-	
-	gck_timer_cancel (timer);
+
+	gkm_timer_cancel (timer);
 
 	test_module_leave ();
 	test_mainloop_run (2000);
@@ -88,14 +88,14 @@ DEFINE_TEST(timer_cancel)
 
 DEFINE_TEST(timer_immediate)
 {
-	GckTimer *timer;
+	GkmTimer *timer;
 
 	/* Setup timer in the past, should execute as soon as possible */
-	timer = gck_timer_start (module, -5, timer_callback, &timer);
+	timer = gkm_timer_start (module, -5, timer_callback, &timer);
 
 	/* Should not be called immediately */
 	g_assert (timer != NULL);
-	
+
 	test_module_leave ();
 	test_mainloop_run (50);
 	test_module_enter ();
@@ -104,11 +104,11 @@ DEFINE_TEST(timer_immediate)
 	g_assert (timer == NULL);
 }
 
-static GckTimer *timer_last = NULL;
+static GkmTimer *timer_last = NULL;
 static gint timer_check = 0;
 
 static void
-multiple_callback (GckTimer *timer, gpointer user_data)
+multiple_callback (GkmTimer *timer, gpointer user_data)
 {
 	gint value = GPOINTER_TO_INT (user_data);
 	g_assert (timer);
@@ -123,22 +123,22 @@ DEFINE_TEST(timer_multiple)
 	timer_check = 0;
 
 	/* Multiple timers, add out of order, should be called in order */
-	gck_timer_start (module, 1, multiple_callback, GINT_TO_POINTER (1));
-	gck_timer_start (module, 3, multiple_callback, GINT_TO_POINTER (3));
-	gck_timer_start (module, 2, multiple_callback, GINT_TO_POINTER (2));
-	gck_timer_start (module, 0, multiple_callback, GINT_TO_POINTER (0));
-	
+	gkm_timer_start (module, 1, multiple_callback, GINT_TO_POINTER (1));
+	gkm_timer_start (module, 3, multiple_callback, GINT_TO_POINTER (3));
+	gkm_timer_start (module, 2, multiple_callback, GINT_TO_POINTER (2));
+	gkm_timer_start (module, 0, multiple_callback, GINT_TO_POINTER (0));
+
 	test_module_leave ();
 	test_mainloop_run (3500);
 	test_module_enter ();
-	
+
 	g_assert (timer_check == 4);
 }
 
 DEFINE_TEST(timer_outstanding)
 {
 	/* A timer that can't be called */
-	gck_timer_start (module, 5, timer_callback, NULL);
-	gck_timer_start (module, 10, timer_callback, NULL);
-	gck_timer_start (module, 1, timer_callback, NULL);
+	gkm_timer_start (module, 5, timer_callback, NULL);
+	gkm_timer_start (module, 10, timer_callback, NULL);
+	gkm_timer_start (module, 1, timer_callback, NULL);
 }
diff --git a/pkcs11/gck/tests/unit-test-transaction.c b/pkcs11/gkm/tests/unit-test-transaction.c
similarity index 60%
rename from pkcs11/gck/tests/unit-test-transaction.c
rename to pkcs11/gkm/tests/unit-test-transaction.c
index cb4ccdd..41c9fb8 100644
--- a/pkcs11/gck/tests/unit-test-transaction.c
+++ b/pkcs11/gkm/tests/unit-test-transaction.c
@@ -23,135 +23,135 @@
 
 #include "run-auto-test.h"
 
-#include "gck/gck-transaction.h"
+#include "gkm/gkm-transaction.h"
 
 DEFINE_TEST(transaction_empty)
 {
-	GckTransaction *transaction;
+	GkmTransaction *transaction;
 	gboolean completed, failed;
 	CK_RV result;
-	
-	transaction = gck_transaction_new ();
-	g_assert (GCK_IS_TRANSACTION (transaction));
-	
-	g_assert (gck_transaction_get_failed (transaction) == FALSE);
-	g_assert (gck_transaction_get_completed (transaction) == FALSE);
-	g_assert (gck_transaction_get_result (transaction) == CKR_OK);
-	
-	gck_transaction_complete (transaction);
-	
+
+	transaction = gkm_transaction_new ();
+	g_assert (GKM_IS_TRANSACTION (transaction));
+
+	g_assert (gkm_transaction_get_failed (transaction) == FALSE);
+	g_assert (gkm_transaction_get_completed (transaction) == FALSE);
+	g_assert (gkm_transaction_get_result (transaction) == CKR_OK);
+
+	gkm_transaction_complete (transaction);
+
 	/* Make sure values are actually set */
 	result = (CK_RV)-1;
 	completed = failed = FALSE;
-	
+
 	g_object_get (transaction, "completed", &completed, "failed", &failed, "result", &result, NULL);
 	g_assert (result == CKR_OK);
 	g_assert (completed == TRUE);
 	g_assert (failed == FALSE);
-	
+
 	g_object_unref (transaction);
 }
 
 DEFINE_TEST(transaction_fail)
 {
-	GckTransaction *transaction;
-	
-	transaction = gck_transaction_new ();
-
-	gck_transaction_fail (transaction, CKR_ARGUMENTS_BAD);
-	
-	g_assert (gck_transaction_get_failed (transaction) == TRUE);
-	g_assert (gck_transaction_get_completed (transaction) == FALSE);
-	g_assert (gck_transaction_get_result (transaction) == CKR_ARGUMENTS_BAD);
-	
-	gck_transaction_complete (transaction);
-
-	g_assert (gck_transaction_get_failed (transaction) == TRUE);
-	g_assert (gck_transaction_get_completed (transaction) == TRUE);
-	g_assert (gck_transaction_get_result (transaction) == CKR_ARGUMENTS_BAD);
-	
+	GkmTransaction *transaction;
+
+	transaction = gkm_transaction_new ();
+
+	gkm_transaction_fail (transaction, CKR_ARGUMENTS_BAD);
+
+	g_assert (gkm_transaction_get_failed (transaction) == TRUE);
+	g_assert (gkm_transaction_get_completed (transaction) == FALSE);
+	g_assert (gkm_transaction_get_result (transaction) == CKR_ARGUMENTS_BAD);
+
+	gkm_transaction_complete (transaction);
+
+	g_assert (gkm_transaction_get_failed (transaction) == TRUE);
+	g_assert (gkm_transaction_get_completed (transaction) == TRUE);
+	g_assert (gkm_transaction_get_result (transaction) == CKR_ARGUMENTS_BAD);
+
 	g_object_unref (transaction);
 }
 
 
 static gboolean
-completed_signal (GckTransaction *transaction, gpointer data)
+completed_signal (GkmTransaction *transaction, gpointer data)
 {
-	g_assert (GCK_IS_TRANSACTION (transaction));
+	g_assert (GKM_IS_TRANSACTION (transaction));
 	g_assert (data);
-	
+
 	*((guint*)data) = TRUE;
 	return TRUE;
 }
 
 static gboolean
-completed_callback (GckTransaction *transaction, GObject *object, gpointer data)
+completed_callback (GkmTransaction *transaction, GObject *object, gpointer data)
 {
-	g_assert (GCK_IS_TRANSACTION (transaction));
+	g_assert (GKM_IS_TRANSACTION (transaction));
 	g_assert (data);
-	
+
 	/* In this case we set the object to the transaction for fun */
-	g_assert (GCK_IS_TRANSACTION (transaction));
-	g_assert (transaction == GCK_TRANSACTION (object));
-	
-	*((guint*)data) = gck_transaction_get_failed (transaction);
+	g_assert (GKM_IS_TRANSACTION (transaction));
+	g_assert (transaction == GKM_TRANSACTION (object));
+
+	*((guint*)data) = gkm_transaction_get_failed (transaction);
 	return TRUE;
 }
 
 DEFINE_TEST(transaction_signals_success)
 {
-	GckTransaction *transaction = gck_transaction_new ();
-	
+	GkmTransaction *transaction = gkm_transaction_new ();
+
 	/* Initialize with some invalid values */
 	guint completed = 3;
 	guint failed = 3;
 
 	g_signal_connect (transaction, "complete", G_CALLBACK (completed_signal), &completed);
-	gck_transaction_add (transaction, transaction, completed_callback, &failed);
-	
+	gkm_transaction_add (transaction, transaction, completed_callback, &failed);
+
 	/* No callbacks called yet */
 	g_assert (completed == 3);
 	g_assert (failed == 3);
 
-	gck_transaction_complete (transaction);
+	gkm_transaction_complete (transaction);
 
 	g_assert (completed == TRUE);
 	g_assert (failed == FALSE);
-	
+
 	g_object_unref (transaction);
 }
 
 DEFINE_TEST(transaction_signals_failure)
 {
-	GckTransaction *transaction = gck_transaction_new ();
-	
+	GkmTransaction *transaction = gkm_transaction_new ();
+
 	/* Initialize with some invalid values */
 	guint completed = 3;
 	guint failed = 3;
 
 	g_signal_connect (transaction, "complete", G_CALLBACK (completed_signal), &completed);
-	gck_transaction_add (transaction, transaction, completed_callback, &failed);
+	gkm_transaction_add (transaction, transaction, completed_callback, &failed);
+
+	gkm_transaction_fail (transaction, CKR_ARGUMENTS_BAD);
 
-	gck_transaction_fail (transaction, CKR_ARGUMENTS_BAD);
-	
 	/* No callbacks called yet */
 	g_assert (completed == 3);
 	g_assert (failed == 3);
 
-	gck_transaction_complete (transaction);
+	gkm_transaction_complete (transaction);
 
 	g_assert (completed == TRUE);
 	g_assert (failed == TRUE);
-	
+
 	g_object_unref (transaction);
 }
 
 static guint order_value = 3;
 
 static gboolean
-order_callback (GckTransaction *transaction, GObject *object, gpointer data)
+order_callback (GkmTransaction *transaction, GObject *object, gpointer data)
 {
-	g_assert (GCK_IS_TRANSACTION (transaction));
+	g_assert (GKM_IS_TRANSACTION (transaction));
 	g_assert (data);
 	g_assert (GPOINTER_TO_UINT (data) == order_value);
 	--order_value;
@@ -160,28 +160,28 @@ order_callback (GckTransaction *transaction, GObject *object, gpointer data)
 
 DEFINE_TEST(transaction_order_is_reverse)
 {
-	GckTransaction *transaction = gck_transaction_new ();
-	
+	GkmTransaction *transaction = gkm_transaction_new ();
+
 	order_value = 3;
-	gck_transaction_add (transaction, transaction, order_callback, GUINT_TO_POINTER (1));
-	gck_transaction_add (transaction, transaction, order_callback, GUINT_TO_POINTER (2));
-	gck_transaction_add (transaction, transaction, order_callback, GUINT_TO_POINTER (3));
+	gkm_transaction_add (transaction, transaction, order_callback, GUINT_TO_POINTER (1));
+	gkm_transaction_add (transaction, transaction, order_callback, GUINT_TO_POINTER (2));
+	gkm_transaction_add (transaction, transaction, order_callback, GUINT_TO_POINTER (3));
 
-	gck_transaction_complete (transaction);
-	g_object_unref (transaction);	
+	gkm_transaction_complete (transaction);
+	g_object_unref (transaction);
 }
 
 DEFINE_TEST(transaction_dispose_completes)
 {
-	GckTransaction *transaction = gck_transaction_new ();
-	
+	GkmTransaction *transaction = gkm_transaction_new ();
+
 	/* Initialize with some invalid values */
 	guint completed = 3;
 
 	g_signal_connect (transaction, "complete", G_CALLBACK (completed_signal), &completed);
 
 	g_object_run_dispose (G_OBJECT (transaction));
-	
+
 	g_assert (completed == TRUE);
 
 	g_object_unref (transaction);
@@ -189,51 +189,51 @@ DEFINE_TEST(transaction_dispose_completes)
 
 DEFINE_TEST(remove_file_success)
 {
-	GckTransaction *transaction = gck_transaction_new ();
+	GkmTransaction *transaction = gkm_transaction_new ();
 	gchar *filename = test_scratch_filename ("remove-file");
-	
+
 	g_assert (g_file_set_contents (filename, "xxx", 3, NULL));
 	g_assert (g_file_test (filename, G_FILE_TEST_IS_REGULAR));
-	
-	gck_transaction_remove_file (transaction, filename);
-	g_assert (!gck_transaction_get_failed (transaction));
-	
+
+	gkm_transaction_remove_file (transaction, filename);
+	g_assert (!gkm_transaction_get_failed (transaction));
+
 	g_assert (!g_file_test (filename, G_FILE_TEST_IS_REGULAR));
-	
-	gck_transaction_complete (transaction);
+
+	gkm_transaction_complete (transaction);
 	g_assert (!g_file_test (filename, G_FILE_TEST_IS_REGULAR));
-	
+
 	g_object_unref (transaction);
 	g_free (filename);
 }
 
 DEFINE_TEST(remove_file_abort)
 {
-	GckTransaction *transaction = gck_transaction_new ();
+	GkmTransaction *transaction = gkm_transaction_new ();
 	gchar *filename = test_scratch_filename ("remove-file");
 	gchar *data;
 	gsize n_data;
-	
+
 	g_assert (g_file_set_contents (filename, "xxx", 3, NULL));
 	g_assert (g_file_test (filename, G_FILE_TEST_IS_REGULAR));
-	
-	gck_transaction_remove_file (transaction, filename);
-	g_assert (!gck_transaction_get_failed (transaction));
-	
+
+	gkm_transaction_remove_file (transaction, filename);
+	g_assert (!gkm_transaction_get_failed (transaction));
+
 	g_assert (!g_file_test (filename, G_FILE_TEST_IS_REGULAR));
-	
+
 	/* Fail the transaction */
-	gck_transaction_fail (transaction, CKR_FUNCTION_FAILED);
-	
-	gck_transaction_complete (transaction);
-	g_assert (gck_transaction_get_failed (transaction));
+	gkm_transaction_fail (transaction, CKR_FUNCTION_FAILED);
+
+	gkm_transaction_complete (transaction);
+	g_assert (gkm_transaction_get_failed (transaction));
 	g_assert (g_file_test (filename, G_FILE_TEST_IS_REGULAR));
-	
+
 	g_assert (g_file_get_contents (filename, &data, &n_data, NULL));
 	g_assert_cmpuint (n_data, ==, 3);
 	g_assert_cmpstr (data, ==, "xxx");
 	g_free (data);
-	
+
 	g_unlink (filename);
 	g_object_unref (transaction);
 	g_free (filename);
@@ -241,37 +241,37 @@ DEFINE_TEST(remove_file_abort)
 
 DEFINE_TEST(remove_file_non_exist)
 {
-	GckTransaction *transaction = gck_transaction_new ();
+	GkmTransaction *transaction = gkm_transaction_new ();
 	gchar *filename = test_scratch_filename ("remove-non-existant");
 
 	g_unlink (filename);
-	
+
 	/* Should succeed even though not exist */
-	gck_transaction_remove_file (transaction, filename);
-	g_assert (!gck_transaction_get_failed (transaction));
-	
-	gck_transaction_complete (transaction);
+	gkm_transaction_remove_file (transaction, filename);
+	g_assert (!gkm_transaction_get_failed (transaction));
+
+	gkm_transaction_complete (transaction);
 	g_object_unref (transaction);
 	g_free (filename);
 }
 
 DEFINE_TEST(write_file)
 {
-	GckTransaction *transaction = gck_transaction_new ();
+	GkmTransaction *transaction = gkm_transaction_new ();
 	gchar *filename = test_scratch_filename ("write-test");
 	gchar *data;
 	gsize n_data;
-	
-	gck_transaction_write_file (transaction, filename, (const guchar*)"value", 5);
-	g_assert (!gck_transaction_get_failed (transaction));
+
+	gkm_transaction_write_file (transaction, filename, (const guchar*)"value", 5);
+	g_assert (!gkm_transaction_get_failed (transaction));
 
 	g_assert (g_file_get_contents (filename, &data, &n_data, NULL));
 	g_assert_cmpuint (n_data, ==, 5);
 	g_assert_cmpstr (data, ==, "value");
 	g_free (data);
 
-	gck_transaction_complete (transaction);
-	
+	gkm_transaction_complete (transaction);
+
 	g_assert (g_file_get_contents (filename, &data, &n_data, NULL));
 	g_assert_cmpuint (n_data, ==, 5);
 	g_assert_cmpstr (data, ==, "value");
@@ -283,23 +283,23 @@ DEFINE_TEST(write_file)
 
 DEFINE_TEST(write_file_abort_gone)
 {
-	GckTransaction *transaction = gck_transaction_new ();
+	GkmTransaction *transaction = gkm_transaction_new ();
 	gchar *filename = test_scratch_filename ("write-test");
 	gchar *data;
 	gsize n_data;
-	
+
 	g_unlink (filename);
-	
-	gck_transaction_write_file (transaction, filename, (const guchar*)"value", 5);
-	g_assert (!gck_transaction_get_failed (transaction));
+
+	gkm_transaction_write_file (transaction, filename, (const guchar*)"value", 5);
+	g_assert (!gkm_transaction_get_failed (transaction));
 
 	g_assert (g_file_get_contents (filename, &data, &n_data, NULL));
 	g_assert_cmpuint (n_data, ==, 5);
 	g_assert_cmpstr (data, ==, "value");
 	g_free (data);
 
-	gck_transaction_fail (transaction, CKR_GENERAL_ERROR);
-	gck_transaction_complete (transaction);
+	gkm_transaction_fail (transaction, CKR_GENERAL_ERROR);
+	gkm_transaction_complete (transaction);
 
 	g_assert (!g_file_test (filename, G_FILE_TEST_IS_REGULAR));
 
@@ -309,21 +309,21 @@ DEFINE_TEST(write_file_abort_gone)
 
 DEFINE_TEST(write_file_abort_revert)
 {
-	GckTransaction *transaction = gck_transaction_new ();
+	GkmTransaction *transaction = gkm_transaction_new ();
 	gchar *filename = test_scratch_filename ("write-test");
 	gchar *data;
-	
+
 	g_assert (g_file_set_contents (filename, "my original", -1, NULL));
-	
-	gck_transaction_write_file (transaction, filename, (const guchar*)"new value", 9);
-	g_assert (!gck_transaction_get_failed (transaction));
+
+	gkm_transaction_write_file (transaction, filename, (const guchar*)"new value", 9);
+	g_assert (!gkm_transaction_get_failed (transaction));
 
 	g_assert (g_file_get_contents (filename, &data, NULL, NULL));
 	g_assert_cmpstr (data, ==, "new value");
 	g_free (data);
 
-	gck_transaction_fail (transaction, CKR_GENERAL_ERROR);
-	gck_transaction_complete (transaction);
+	gkm_transaction_fail (transaction, CKR_GENERAL_ERROR);
+	gkm_transaction_complete (transaction);
 
 	g_assert (g_file_get_contents (filename, &data, NULL, NULL));
 	g_assert_cmpstr (data, ==, "my original");
diff --git a/pkcs11/pkcs11g.h b/pkcs11/pkcs11g.h
index f9f0ffc..c01a3c9 100644
--- a/pkcs11/pkcs11g.h
+++ b/pkcs11/pkcs11g.h
@@ -44,37 +44,37 @@
  */
 
 /*
- * Whether the key or certificate is restricted to a set of 
- * purposes (ie: enhanced usages). 
- * 
+ * Whether the key or certificate is restricted to a set of
+ * purposes (ie: enhanced usages).
+ *
  * CK_BBOOL
- * 
+ *
  *  - When CK_TRUE see CKA_PURPOSE_OIDS for the set of purposes.
- *  - When CK_FALSE then is not restricted to any specific purpose. 
+ *  - When CK_FALSE then is not restricted to any specific purpose.
  */
 #define CKA_GNOME_PURPOSE_RESTRICTED             (CKA_GNOME + 12)
 
 /*
- * The available purposes that a certificate or key can be 
- * used for. 
- * 
- * CK_STRING 
- * 
+ * The available purposes that a certificate or key can be
+ * used for.
+ *
+ * CK_STRING
+ *
  *  - This is only relevant if CKA_PURPOSE_RESTRICTED is CK_TRUE.
  *  - Use CKA_TRUSTED and CKA_CERTIFICATE_CATEGORY to validate whether
- *    usage of the certificate for these purposes is directly or 
+ *    usage of the certificate for these purposes is directly or
  *    indirectly trusted by the user.
- *  - The returned string is a space delemited set of OIDs. 
+ *  - The returned string is a space delemited set of OIDs.
  *  - When an empty string is returned then no purposes are valid.
  */
-#define CKA_GNOME_PURPOSE_OIDS                   (CKA_GNOME + 11) 
+#define CKA_GNOME_PURPOSE_OIDS                   (CKA_GNOME + 11)
 
-/* 
- * The key or certificate can be used for the purpose 
+/*
+ * The key or certificate can be used for the purpose
  * indicated
- * 
- * CK_BBOOL 
- * 
+ *
+ * CK_BBOOL
+ *
  *  - These are shortcuts to using CKA_PURPOSE_OIDS
  *  - Use CKA_TRUSTED and CKA_CERTIFICATE_CATEGORY to validate whether
  *    the certificate is directly or indirectly trusted by the user.
diff --git a/pkcs11/pkcs11n.h b/pkcs11/pkcs11n.h
index db7f4c8..612a11e 100644
--- a/pkcs11/pkcs11n.h
+++ b/pkcs11/pkcs11n.h
@@ -1,221 +1,221 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the Netscape security libraries.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1994-2000
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Dr Stephen Henson <stephen henson gemplus com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef _PKCS11N_H_
-#define _PKCS11N_H_
-
-#ifdef DEBUG
-static const char CKT_CVS_ID[] = "@(#) $RCSfile: pkcs11n.h,v $ $Revision: 1.15 $ $Date: 2005/09/28 17:12:17 $";
-#endif /* DEBUG */
-
-/*
- * pkcs11n.h
- *
- * This file contains the NSS-specific type definitions for Cryptoki
- * (PKCS#11).
- */
-
-/*
- * NSSCK_VENDOR_NETSCAPE
- *
- * Cryptoki reserves the high half of all the number spaces for
- * vendor-defined use.  I'd like to keep all of our Netscape-
- * specific values together, but not in the oh-so-obvious
- * 0x80000001, 0x80000002, etc. area.  So I've picked an offset,
- * and constructed values for the beginnings of our spaces.
- *
- * Note that some "historical" Netscape values don't fall within
- * this range.
- */
-#define NSSCK_VENDOR_NETSCAPE 0x4E534350 /* NSCP */
-
-/*
- * Netscape-defined object classes
- * 
- */
-#define CKO_NETSCAPE (CKO_VENDOR_DEFINED|NSSCK_VENDOR_NETSCAPE)
-
-#define CKO_NETSCAPE_CRL                (CKO_NETSCAPE + 1)
-#define CKO_NETSCAPE_SMIME              (CKO_NETSCAPE + 2)
-#define CKO_NETSCAPE_TRUST              (CKO_NETSCAPE + 3)
-#define CKO_NETSCAPE_BUILTIN_ROOT_LIST  (CKO_NETSCAPE + 4)
-#define CKO_NETSCAPE_NEWSLOT            (CKO_NETSCAPE + 5)
-#define CKO_NETSCAPE_DELSLOT            (CKO_NETSCAPE + 6)
-
-/*
- * Netscape-defined key types
- *
- */
-#define CKK_NETSCAPE (CKK_VENDOR_DEFINED|NSSCK_VENDOR_NETSCAPE)
-
-#define CKK_NETSCAPE_PKCS8              (CKK_NETSCAPE + 1)
-/*
- * Netscape-defined certificate types
- *
- */
-#define CKC_NETSCAPE (CKC_VENDOR_DEFINED|NSSCK_VENDOR_NETSCAPE)
-
-/*
- * Netscape-defined object attributes
- *
- */
-#define CKA_NETSCAPE (CKA_VENDOR_DEFINED|NSSCK_VENDOR_NETSCAPE)
-
-#define CKA_NETSCAPE_URL                (CKA_NETSCAPE +  1)
-#define CKA_NETSCAPE_EMAIL              (CKA_NETSCAPE +  2)
-#define CKA_NETSCAPE_SMIME_INFO         (CKA_NETSCAPE +  3)
-#define CKA_NETSCAPE_SMIME_TIMESTAMP    (CKA_NETSCAPE +  4)
-#define CKA_NETSCAPE_PKCS8_SALT         (CKA_NETSCAPE +  5)
-#define CKA_NETSCAPE_PASSWORD_CHECK     (CKA_NETSCAPE +  6)
-#define CKA_NETSCAPE_EXPIRES            (CKA_NETSCAPE +  7)
-#define CKA_NETSCAPE_KRL                (CKA_NETSCAPE +  8)
-
-#define CKA_NETSCAPE_PQG_COUNTER        (CKA_NETSCAPE +  20)
-#define CKA_NETSCAPE_PQG_SEED           (CKA_NETSCAPE +  21)
-#define CKA_NETSCAPE_PQG_H              (CKA_NETSCAPE +  22)
-#define CKA_NETSCAPE_PQG_SEED_BITS      (CKA_NETSCAPE +  23)
-#define CKA_NETSCAPE_MODULE_SPEC        (CKA_NETSCAPE +  24)
-
-/*
- * Trust attributes:
- *
- * If trust goes standard, these probably will too.  So I'll
- * put them all in one place.
- */
-
-#define CKA_TRUST (CKA_NETSCAPE + 0x2000)
-
-/* "Usage" key information */
-#define CKA_TRUST_DIGITAL_SIGNATURE     (CKA_TRUST +  1)
-#define CKA_TRUST_NON_REPUDIATION       (CKA_TRUST +  2)
-#define CKA_TRUST_KEY_ENCIPHERMENT      (CKA_TRUST +  3)
-#define CKA_TRUST_DATA_ENCIPHERMENT     (CKA_TRUST +  4)
-#define CKA_TRUST_KEY_AGREEMENT         (CKA_TRUST +  5)
-#define CKA_TRUST_KEY_CERT_SIGN         (CKA_TRUST +  6)
-#define CKA_TRUST_CRL_SIGN              (CKA_TRUST +  7)
-
-/* "Purpose" trust information */
-#define CKA_TRUST_SERVER_AUTH           (CKA_TRUST +  8)
-#define CKA_TRUST_CLIENT_AUTH           (CKA_TRUST +  9)
-#define CKA_TRUST_CODE_SIGNING          (CKA_TRUST + 10)
-#define CKA_TRUST_EMAIL_PROTECTION      (CKA_TRUST + 11)
-#define CKA_TRUST_IPSEC_END_SYSTEM      (CKA_TRUST + 12)
-#define CKA_TRUST_IPSEC_TUNNEL          (CKA_TRUST + 13)
-#define CKA_TRUST_IPSEC_USER            (CKA_TRUST + 14)
-#define CKA_TRUST_TIME_STAMPING         (CKA_TRUST + 15)
-#define CKA_TRUST_STEP_UP_APPROVED      (CKA_TRUST + 16)
-
-#define CKA_CERT_SHA1_HASH	        (CKA_TRUST + 100)
-#define CKA_CERT_MD5_HASH		(CKA_TRUST + 101)
-
-/* Netscape trust stuff */
-/* XXX fgmr new ones here-- step-up, etc. */
-
-/* HISTORICAL: define used to pass in the database key for DSA private keys */
-#define CKA_NETSCAPE_DB                 0xD5A0DB00L
-#define CKA_NETSCAPE_TRUST              0x80000001L
-
-/*
- * Netscape-defined crypto mechanisms
- *
- */
-#define CKM_NETSCAPE (CKM_VENDOR_DEFINED|NSSCK_VENDOR_NETSCAPE)
-
-#define CKM_NETSCAPE_AES_KEY_WRAP      (CKM_NETSCAPE + 1)
-#define CKM_NETSCAPE_AES_KEY_WRAP_PAD  (CKM_NETSCAPE + 2)
-
-/*
- * HISTORICAL:
- * Do not attempt to use these. They are only used by NETSCAPE's internal
- * PKCS #11 interface. Most of these are place holders for other mechanism
- * and will change in the future.
- */
-#define CKM_NETSCAPE_PBE_SHA1_DES_CBC           0x80000002L
-#define CKM_NETSCAPE_PBE_SHA1_TRIPLE_DES_CBC    0x80000003L
-#define CKM_NETSCAPE_PBE_SHA1_40_BIT_RC2_CBC    0x80000004L
-#define CKM_NETSCAPE_PBE_SHA1_128_BIT_RC2_CBC   0x80000005L
-#define CKM_NETSCAPE_PBE_SHA1_40_BIT_RC4        0x80000006L
-#define CKM_NETSCAPE_PBE_SHA1_128_BIT_RC4       0x80000007L
-#define CKM_NETSCAPE_PBE_SHA1_FAULTY_3DES_CBC   0x80000008L
-#define CKM_NETSCAPE_PBE_SHA1_HMAC_KEY_GEN      0x80000009L
-#define CKM_NETSCAPE_PBE_MD5_HMAC_KEY_GEN       0x8000000aL
-#define CKM_NETSCAPE_PBE_MD2_HMAC_KEY_GEN       0x8000000bL
-
-#define CKM_TLS_PRF_GENERAL                     0x80000373L
-
-/*
- * Netscape-defined return values
- *
- */
-#define CKR_NETSCAPE (CKM_VENDOR_DEFINED|NSSCK_VENDOR_NETSCAPE)
-
-#define CKR_NETSCAPE_CERTDB_FAILED      (CKR_NETSCAPE + 1)
-#define CKR_NETSCAPE_KEYDB_FAILED       (CKR_NETSCAPE + 2)
-
-/*
- * Trust info
- *
- * This isn't part of the Cryptoki standard (yet), so I'm putting
- * all the definitions here.  Some of this would move to nssckt.h
- * if trust info were made part of the standard.  In view of this
- * possibility, I'm putting my (Netscape) values in the netscape
- * vendor space, like everything else.
- */
-
-typedef CK_ULONG          CK_TRUST;
-
-/* The following trust types are defined: */
-#define CKT_VENDOR_DEFINED     0x80000000
-
-#define CKT_NETSCAPE (CKT_VENDOR_DEFINED|NSSCK_VENDOR_NETSCAPE)
-
-/* If trust goes standard, these'll probably drop out of vendor space. */
-#define CKT_NETSCAPE_TRUSTED            (CKT_NETSCAPE + 1)
-#define CKT_NETSCAPE_TRUSTED_DELEGATOR  (CKT_NETSCAPE + 2)
-#define CKT_NETSCAPE_UNTRUSTED          (CKT_NETSCAPE + 3)
-#define CKT_NETSCAPE_MUST_VERIFY        (CKT_NETSCAPE + 4)
-#define CKT_NETSCAPE_TRUST_UNKNOWN      (CKT_NETSCAPE + 5) /* default */
-
-/* 
- * These may well remain Netscape-specific; I'm only using them
- * to cache resolution data.
- */
-#define CKT_NETSCAPE_VALID              (CKT_NETSCAPE + 10)
-#define CKT_NETSCAPE_VALID_DELEGATOR    (CKT_NETSCAPE + 11)
-
-
-#endif /* _PKCS11N_H_ */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Netscape security libraries.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1994-2000
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Dr Stephen Henson <stephen henson gemplus com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef _PKCS11N_H_
+#define _PKCS11N_H_
+
+#ifdef DEBUG
+static const char CKT_CVS_ID[] = "@(#) $RCSfile: pkcs11n.h,v $ $Revision: 1.15 $ $Date: 2005/09/28 17:12:17 $";
+#endif /* DEBUG */
+
+/*
+ * pkcs11n.h
+ *
+ * This file contains the NSS-specific type definitions for Cryptoki
+ * (PKCS#11).
+ */
+
+/*
+ * NSSCK_VENDOR_NETSCAPE
+ *
+ * Cryptoki reserves the high half of all the number spaces for
+ * vendor-defined use.  I'd like to keep all of our Netscape-
+ * specific values together, but not in the oh-so-obvious
+ * 0x80000001, 0x80000002, etc. area.  So I've picked an offset,
+ * and constructed values for the beginnings of our spaces.
+ *
+ * Note that some "historical" Netscape values don't fall within
+ * this range.
+ */
+#define NSSCK_VENDOR_NETSCAPE 0x4E534350 /* NSCP */
+
+/*
+ * Netscape-defined object classes
+ *
+ */
+#define CKO_NETSCAPE (CKO_VENDOR_DEFINED|NSSCK_VENDOR_NETSCAPE)
+
+#define CKO_NETSCAPE_CRL                (CKO_NETSCAPE + 1)
+#define CKO_NETSCAPE_SMIME              (CKO_NETSCAPE + 2)
+#define CKO_NETSCAPE_TRUST              (CKO_NETSCAPE + 3)
+#define CKO_NETSCAPE_BUILTIN_ROOT_LIST  (CKO_NETSCAPE + 4)
+#define CKO_NETSCAPE_NEWSLOT            (CKO_NETSCAPE + 5)
+#define CKO_NETSCAPE_DELSLOT            (CKO_NETSCAPE + 6)
+
+/*
+ * Netscape-defined key types
+ *
+ */
+#define CKK_NETSCAPE (CKK_VENDOR_DEFINED|NSSCK_VENDOR_NETSCAPE)
+
+#define CKK_NETSCAPE_PKCS8              (CKK_NETSCAPE + 1)
+/*
+ * Netscape-defined certificate types
+ *
+ */
+#define CKC_NETSCAPE (CKC_VENDOR_DEFINED|NSSCK_VENDOR_NETSCAPE)
+
+/*
+ * Netscape-defined object attributes
+ *
+ */
+#define CKA_NETSCAPE (CKA_VENDOR_DEFINED|NSSCK_VENDOR_NETSCAPE)
+
+#define CKA_NETSCAPE_URL                (CKA_NETSCAPE +  1)
+#define CKA_NETSCAPE_EMAIL              (CKA_NETSCAPE +  2)
+#define CKA_NETSCAPE_SMIME_INFO         (CKA_NETSCAPE +  3)
+#define CKA_NETSCAPE_SMIME_TIMESTAMP    (CKA_NETSCAPE +  4)
+#define CKA_NETSCAPE_PKCS8_SALT         (CKA_NETSCAPE +  5)
+#define CKA_NETSCAPE_PASSWORD_CHECK     (CKA_NETSCAPE +  6)
+#define CKA_NETSCAPE_EXPIRES            (CKA_NETSCAPE +  7)
+#define CKA_NETSCAPE_KRL                (CKA_NETSCAPE +  8)
+
+#define CKA_NETSCAPE_PQG_COUNTER        (CKA_NETSCAPE +  20)
+#define CKA_NETSCAPE_PQG_SEED           (CKA_NETSCAPE +  21)
+#define CKA_NETSCAPE_PQG_H              (CKA_NETSCAPE +  22)
+#define CKA_NETSCAPE_PQG_SEED_BITS      (CKA_NETSCAPE +  23)
+#define CKA_NETSCAPE_MODULE_SPEC        (CKA_NETSCAPE +  24)
+
+/*
+ * Trust attributes:
+ *
+ * If trust goes standard, these probably will too.  So I'll
+ * put them all in one place.
+ */
+
+#define CKA_TRUST (CKA_NETSCAPE + 0x2000)
+
+/* "Usage" key information */
+#define CKA_TRUST_DIGITAL_SIGNATURE     (CKA_TRUST +  1)
+#define CKA_TRUST_NON_REPUDIATION       (CKA_TRUST +  2)
+#define CKA_TRUST_KEY_ENCIPHERMENT      (CKA_TRUST +  3)
+#define CKA_TRUST_DATA_ENCIPHERMENT     (CKA_TRUST +  4)
+#define CKA_TRUST_KEY_AGREEMENT         (CKA_TRUST +  5)
+#define CKA_TRUST_KEY_CERT_SIGN         (CKA_TRUST +  6)
+#define CKA_TRUST_CRL_SIGN              (CKA_TRUST +  7)
+
+/* "Purpose" trust information */
+#define CKA_TRUST_SERVER_AUTH           (CKA_TRUST +  8)
+#define CKA_TRUST_CLIENT_AUTH           (CKA_TRUST +  9)
+#define CKA_TRUST_CODE_SIGNING          (CKA_TRUST + 10)
+#define CKA_TRUST_EMAIL_PROTECTION      (CKA_TRUST + 11)
+#define CKA_TRUST_IPSEC_END_SYSTEM      (CKA_TRUST + 12)
+#define CKA_TRUST_IPSEC_TUNNEL          (CKA_TRUST + 13)
+#define CKA_TRUST_IPSEC_USER            (CKA_TRUST + 14)
+#define CKA_TRUST_TIME_STAMPING         (CKA_TRUST + 15)
+#define CKA_TRUST_STEP_UP_APPROVED      (CKA_TRUST + 16)
+
+#define CKA_CERT_SHA1_HASH	        (CKA_TRUST + 100)
+#define CKA_CERT_MD5_HASH		(CKA_TRUST + 101)
+
+/* Netscape trust stuff */
+/* XXX fgmr new ones here-- step-up, etc. */
+
+/* HISTORICAL: define used to pass in the database key for DSA private keys */
+#define CKA_NETSCAPE_DB                 0xD5A0DB00L
+#define CKA_NETSCAPE_TRUST              0x80000001L
+
+/*
+ * Netscape-defined crypto mechanisms
+ *
+ */
+#define CKM_NETSCAPE (CKM_VENDOR_DEFINED|NSSCK_VENDOR_NETSCAPE)
+
+#define CKM_NETSCAPE_AES_KEY_WRAP      (CKM_NETSCAPE + 1)
+#define CKM_NETSCAPE_AES_KEY_WRAP_PAD  (CKM_NETSCAPE + 2)
+
+/*
+ * HISTORICAL:
+ * Do not attempt to use these. They are only used by NETSCAPE's internal
+ * PKCS #11 interface. Most of these are place holders for other mechanism
+ * and will change in the future.
+ */
+#define CKM_NETSCAPE_PBE_SHA1_DES_CBC           0x80000002L
+#define CKM_NETSCAPE_PBE_SHA1_TRIPLE_DES_CBC    0x80000003L
+#define CKM_NETSCAPE_PBE_SHA1_40_BIT_RC2_CBC    0x80000004L
+#define CKM_NETSCAPE_PBE_SHA1_128_BIT_RC2_CBC   0x80000005L
+#define CKM_NETSCAPE_PBE_SHA1_40_BIT_RC4        0x80000006L
+#define CKM_NETSCAPE_PBE_SHA1_128_BIT_RC4       0x80000007L
+#define CKM_NETSCAPE_PBE_SHA1_FAULTY_3DES_CBC   0x80000008L
+#define CKM_NETSCAPE_PBE_SHA1_HMAC_KEY_GEN      0x80000009L
+#define CKM_NETSCAPE_PBE_MD5_HMAC_KEY_GEN       0x8000000aL
+#define CKM_NETSCAPE_PBE_MD2_HMAC_KEY_GEN       0x8000000bL
+
+#define CKM_TLS_PRF_GENERAL                     0x80000373L
+
+/*
+ * Netscape-defined return values
+ *
+ */
+#define CKR_NETSCAPE (CKM_VENDOR_DEFINED|NSSCK_VENDOR_NETSCAPE)
+
+#define CKR_NETSCAPE_CERTDB_FAILED      (CKR_NETSCAPE + 1)
+#define CKR_NETSCAPE_KEYDB_FAILED       (CKR_NETSCAPE + 2)
+
+/*
+ * Trust info
+ *
+ * This isn't part of the Cryptoki standard (yet), so I'm putting
+ * all the definitions here.  Some of this would move to nssckt.h
+ * if trust info were made part of the standard.  In view of this
+ * possibility, I'm putting my (Netscape) values in the netscape
+ * vendor space, like everything else.
+ */
+
+typedef CK_ULONG          CK_TRUST;
+
+/* The following trust types are defined: */
+#define CKT_VENDOR_DEFINED     0x80000000
+
+#define CKT_NETSCAPE (CKT_VENDOR_DEFINED|NSSCK_VENDOR_NETSCAPE)
+
+/* If trust goes standard, these'll probably drop out of vendor space. */
+#define CKT_NETSCAPE_TRUSTED            (CKT_NETSCAPE + 1)
+#define CKT_NETSCAPE_TRUSTED_DELEGATOR  (CKT_NETSCAPE + 2)
+#define CKT_NETSCAPE_UNTRUSTED          (CKT_NETSCAPE + 3)
+#define CKT_NETSCAPE_MUST_VERIFY        (CKT_NETSCAPE + 4)
+#define CKT_NETSCAPE_TRUST_UNKNOWN      (CKT_NETSCAPE + 5) /* default */
+
+/*
+ * These may well remain Netscape-specific; I'm only using them
+ * to cache resolution data.
+ */
+#define CKT_NETSCAPE_VALID              (CKT_NETSCAPE + 10)
+#define CKT_NETSCAPE_VALID_DELEGATOR    (CKT_NETSCAPE + 11)
+
+
+#endif /* _PKCS11N_H_ */
diff --git a/pkcs11/plex-layer/Makefile.am b/pkcs11/plex-layer/Makefile.am
index 06afd4f..7c97345 100644
--- a/pkcs11/plex-layer/Makefile.am
+++ b/pkcs11/plex-layer/Makefile.am
@@ -1,22 +1,21 @@
 
 noinst_LTLIBRARIES = \
-	libgck-plex-layer.la
+	libgkm-plex-layer.la
 
 INCLUDES = -I. \
 	-I$(top_srcdir) \
 	-I$(top_builddir)
-	
+
 # ------------------------------------------------------------------------------
 # The code
 
-libgck_plex_layer_la_SOURCES = \
-	gck-plex-layer.c gck-plex-layer.h 
+libgkm_plex_layer_la_SOURCES = \
+	gkm-plex-layer.c gkm-plex-layer.h
 
-libgck_plex_layer_la_LIBADD = \
+libgkm_plex_layer_la_LIBADD = \
     	$(GTHREAD_LIBS) \
-	$(GLIB_LIBS) 
+	$(GLIB_LIBS)
 
-libgck_plex_layer_la_CFLAGS = \
+libgkm_plex_layer_la_CFLAGS = \
     	$(GTHREAD_CFLAGS) \
 	$(GLIB_CFLAGS)
-	 
\ No newline at end of file
diff --git a/pkcs11/plex-layer/gck-plex-layer.c b/pkcs11/plex-layer/gkm-plex-layer.c
similarity index 97%
rename from pkcs11/plex-layer/gck-plex-layer.c
rename to pkcs11/plex-layer/gkm-plex-layer.c
index db221e7..06e2231 100644
--- a/pkcs11/plex-layer/gck-plex-layer.c
+++ b/pkcs11/plex-layer/gkm-plex-layer.c
@@ -1,27 +1,27 @@
-/* 
+/*
  * 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  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  License for more details.
- *  
- * You should have received a copy of the GNU Lesser General 
+ *
+ * You should have received a copy of the GNU Lesser General
  * 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"
 
-#include "gck-plex-layer.h"
+#include "gkm-plex-layer.h"
 
 #include "pkcs11/pkcs11.h"
 #include "pkcs11/pkcs11g.h"
@@ -52,7 +52,7 @@ static guint n_plex_mappings = 0;
 #define PLEX_MAPPING_OFFSET 0x10
 
 #define HANDLE_SLOT_BITS ((sizeof (CK_ULONG) * 8) - 10)
-#define HANDLE_REAL_MASK (((CK_ULONG)-1) >> 10) 
+#define HANDLE_REAL_MASK (((CK_ULONG)-1) >> 10)
 
 
 static gboolean
@@ -64,11 +64,11 @@ map_slot_down (CK_SLOT_ID_PTR slot, Mapping *mapping)
 	if (id < PLEX_MAPPING_OFFSET)
 		return FALSE;
 	id -= PLEX_MAPPING_OFFSET;
-	
+
 	g_assert (mapping);
-	
+
 	G_LOCK (plex_layer);
-	
+
 		if (id > n_plex_mappings) {
 			ret = FALSE;
 		} else {
@@ -82,7 +82,7 @@ map_slot_down (CK_SLOT_ID_PTR slot, Mapping *mapping)
 }
 
 #define MAP_SLOT_UP(slot, map) G_STMT_START { \
-	
+
 
 
 #define MAP_SLOT_DOWN(slot, map) G_STMT_START { \
@@ -100,7 +100,7 @@ map_slot_down (CK_SLOT_ID_PTR slot, Mapping *mapping)
 	if (!map_slot_down (&slot, &map)) \
 		return CKR_SESSION_HANDLE_INVALID; \
 	session &= HANDLE_REAL_MASK; \
-	} G_STMT_END 
+	} G_STMT_END
 
 static CK_RV
 plex_C_Initialize (CK_VOID_PTR init_args)
@@ -112,24 +112,24 @@ plex_C_Initialize (CK_VOID_PTR init_args)
 	CK_ULONG i, count;
 	CK_RV rv = CKR_OK;
 	GList *l;
-	
+
 	mappings = g_array_new (FALSE, TRUE, sizeof (Mapping));
-	
+
 	G_LOCK (plex_layer);
-	
+
 		if (plex_mappings)
 			rv = CKR_CRYPTOKI_ALREADY_INITIALIZED;
-	
+
 		for (l = plex_modules; rv == CKR_OK && l != NULL; l = g_list_next (l)) {
 			funcs = l->data;
-			
+
 			/* Initialize each module */
 			rv = (funcs->C_Initialize) (init_args);
 			if (rv == CKR_CRYPTOKI_ALREADY_INITIALIZED)
 				rv = CKR_OK;
 			if (rv != CKR_OK)
 				break;
-			
+
 			/* And then ask it for its slots */
 			rv = (funcs->C_GetSlotList) (FALSE, NULL, &count);
 			if (rv != CKR_OK)
@@ -142,7 +142,7 @@ plex_C_Initialize (CK_VOID_PTR init_args)
 				 g_free (slots);
 				 break;
 			}
-			
+
 			/* And now add a mapping for each of those slots */
 			for (i = 0; i < count; ++i) {
 				memset (&mapping, 0, sizeof (mapping));
@@ -151,10 +151,10 @@ plex_C_Initialize (CK_VOID_PTR init_args)
 				mapping.funcs = funcs;
 				g_array_append_val (mappings, mapping);
 			}
-			
+
 			g_free (slots);
 		}
-		
+
 		/* If failed, then finalize all the ones that succeeded */
 		if (rv != CKR_OK && l != NULL) {
 			for (l = g_list_previous (l); l; l = g_list_previous (l)) {
@@ -162,7 +162,7 @@ plex_C_Initialize (CK_VOID_PTR init_args)
 				(funcs->C_Finalize) (NULL);
 			}
 		}
-		
+
 		/* If succeeded then swap in mappings */
 		if (rv == CKR_OK) {
 			g_assert (!plex_mappings);
@@ -170,13 +170,13 @@ plex_C_Initialize (CK_VOID_PTR init_args)
 			plex_mappings = (Mapping*)g_array_free (mappings, FALSE);
 			mappings = NULL;
 		}
-	
+
 	G_UNLOCK (plex_layer);
-	
+
 	/* If failed or somehow unused then free */
-	if (mappings) 
+	if (mappings)
 		g_array_free (mappings, TRUE);
-	
+
 	return rv;
 }
 
@@ -184,16 +184,16 @@ static CK_RV
 plex_C_Finalize (CK_VOID_PTR reserved)
 {
 	guint i;
-	
+
 	G_LOCK (plex_layer);
 
 		for (i = 0; i < n_plex_mappings; ++i)
 			(plex_mappings[i].funcs->C_Finalize) (NULL);
 		g_free (plex_mappings);
 		plex_mappings = NULL;
-	
+
 	G_UNLOCK (plex_layer);
-	
+
 	return CKR_OK;
 }
 
@@ -202,7 +202,7 @@ plex_C_GetInfo (CK_INFO_PTR info)
 {
 	if (info == NULL)
 		return CKR_ARGUMENTS_BAD;
-	
+
 	info->cryptokiVersion.major = CRYPTOKI_VERSION_MAJOR;
 	info->cryptokiVersion.minor = CRYPTOKI_VERSION_MINOR;
 	info->libraryVersion.major = LIBRARY_VERSION_MAJOR;
@@ -218,7 +218,7 @@ plex_C_GetFunctionList (CK_FUNCTION_LIST_PTR_PTR list)
 {
 	if (!list)
 		return CKR_ARGUMENTS_BAD;
-	*list = gck_plex_layer_get_functions ();
+	*list = gkm_plex_layer_get_functions ();
 	return CKR_OK;
 }
 
@@ -229,12 +229,12 @@ plex_C_GetSlotList (CK_BBOOL token_present, CK_SLOT_ID_PTR slot_list, CK_ULONG_P
 	Mapping *mapping;
 	CK_ULONG index;
 	CK_RV rv;
-	
+
 	guint i;
-	
+
 	if (!count)
 		return CKR_ARGUMENTS_BAD;
-	
+
 	G_LOCK (plex_layer);
 
 		rv = CKR_OK;
@@ -243,7 +243,7 @@ plex_C_GetSlotList (CK_BBOOL token_present, CK_SLOT_ID_PTR slot_list, CK_ULONG_P
 		/* Go through and build up a map */
 		for (i = 0; i < n_plex_mappings; ++i) {
 			mapping = &plex_mappings[i];
-		
+
 			/* Skip ones without a token if requested */
 			if (token_present) {
 				rv = (mapping->funcs->C_GetSlotInfo) (mapping->real_slot, &info);
@@ -252,21 +252,21 @@ plex_C_GetSlotList (CK_BBOOL token_present, CK_SLOT_ID_PTR slot_list, CK_ULONG_P
 				if (!(info.flags & CKF_TOKEN_PRESENT))
 					continue;
 			}
-		
+
 			/* Fill in the slot if we can */
 			if (slot_list && *count > index)
 				slot_list[index] = mapping->plex_slot;
-			
+
 			++index;
 		}
-		
+
 		if (slot_list && *count < index)
 			rv = CKR_BUFFER_TOO_SMALL;
 
 		*count = index;
-		
+
 	G_UNLOCK (plex_layer);
-	
+
 	return rv;
 }
 
@@ -322,15 +322,15 @@ plex_C_OpenSession (CK_SLOT_ID id, CK_FLAGS flags, CK_VOID_PTR user_data, CK_NOT
 {
 	Mapping map;
 	CK_RV rv;
-	
+
 	if (handle == NULL)
 		return CKR_ARGUMENTS_BAD;
-	
+
 	MAP_SLOT_DOWN (id, map);
 	rv = (map.funcs->C_OpenSession) (id, flags, user_data, callback, handle);
 	if (rv == CKR_OK)
 		MAP_SESSION_UP (map, *handle);
-	
+
 	return rv;
 }
 
@@ -373,15 +373,15 @@ plex_C_GetSessionInfo (CK_SESSION_HANDLE handle, CK_SESSION_INFO_PTR info)
 {
 	Mapping map;
 	CK_RV rv;
-	
+
 	if (info == NULL)
 		return CKR_ARGUMENTS_BAD;
-	
+
 	MAP_SESSION_DOWN (handle, map);
 	rv = (map.funcs->C_GetSessionInfo) (handle, info);
 	if (rv == CKR_OK)
 		info->slotID = map.plex_slot;
-	
+
 	return rv;
 }
 
@@ -676,7 +676,7 @@ plex_C_SignRecoverInit (CK_SESSION_HANDLE handle, CK_MECHANISM_PTR mechanism,
 }
 
 static CK_RV
-plex_C_SignRecover (CK_SESSION_HANDLE handle, CK_BYTE_PTR data, CK_ULONG data_len, 
+plex_C_SignRecover (CK_SESSION_HANDLE handle, CK_BYTE_PTR data, CK_ULONG data_len,
                     CK_BYTE_PTR signature, CK_ULONG_PTR signature_len)
 {
 	Mapping map;
@@ -749,7 +749,7 @@ plex_C_DigestEncryptUpdate (CK_SESSION_HANDLE handle, CK_BYTE_PTR part,
 
 static CK_RV
 plex_C_DecryptDigestUpdate (CK_SESSION_HANDLE handle, CK_BYTE_PTR enc_part,
-                            CK_ULONG enc_part_len, CK_BYTE_PTR part, 
+                            CK_ULONG enc_part_len, CK_BYTE_PTR part,
                             CK_ULONG_PTR part_len)
 {
 	Mapping map;
@@ -769,7 +769,7 @@ plex_C_SignEncryptUpdate (CK_SESSION_HANDLE handle, CK_BYTE_PTR part,
 
 static CK_RV
 plex_C_DecryptVerifyUpdate (CK_SESSION_HANDLE handle, CK_BYTE_PTR enc_part,
-                            CK_ULONG enc_part_len, CK_BYTE_PTR part, 
+                            CK_ULONG enc_part_len, CK_BYTE_PTR part,
                             CK_ULONG_PTR part_len)
 {
 	Mapping map;
@@ -779,7 +779,7 @@ plex_C_DecryptVerifyUpdate (CK_SESSION_HANDLE handle, CK_BYTE_PTR enc_part,
 
 static CK_RV
 plex_C_GenerateKey (CK_SESSION_HANDLE handle, CK_MECHANISM_PTR mechanism,
-                    CK_ATTRIBUTE_PTR template, CK_ULONG count, 
+                    CK_ATTRIBUTE_PTR template, CK_ULONG count,
                     CK_OBJECT_HANDLE_PTR key)
 {
 	Mapping map;
@@ -927,19 +927,19 @@ static CK_FUNCTION_LIST plex_function_list = {
  */
 
 CK_FUNCTION_LIST_PTR
-gck_plex_layer_get_functions (void)
+gkm_plex_layer_get_functions (void)
 {
 	return &plex_function_list;
 }
 
 void
-gck_plex_layer_add_module (CK_FUNCTION_LIST_PTR funcs)
+gkm_plex_layer_add_module (CK_FUNCTION_LIST_PTR funcs)
 {
 	g_assert (funcs);
-	
+
 	G_LOCK (plex_layer);
-	
+
 		plex_modules = g_list_append (plex_modules, funcs);
-		
+
 	G_UNLOCK (plex_layer);
 }
diff --git a/pkcs11/plex-layer/gck-plex-layer.h b/pkcs11/plex-layer/gkm-plex-layer.h
similarity index 75%
rename from pkcs11/plex-layer/gck-plex-layer.h
rename to pkcs11/plex-layer/gkm-plex-layer.h
index 6bb880b..1b5055e 100644
--- a/pkcs11/plex-layer/gck-plex-layer.h
+++ b/pkcs11/plex-layer/gkm-plex-layer.h
@@ -1,31 +1,31 @@
-/* 
+/*
  * 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.
  */
 
-#ifndef __GCK_PLEX_LAYER_H__
-#define __GCK_PLEX_LAYER_H__
+#ifndef __GKM_PLEX_LAYER_H__
+#define __GKM_PLEX_LAYER_H__
 
 #include "pkcs11/pkcs11.h"
 
-CK_FUNCTION_LIST_PTR    gck_plex_layer_get_functions     (void);
+CK_FUNCTION_LIST_PTR    gkm_plex_layer_get_functions     (void);
 
-void                    gck_plex_layer_add_module        (CK_FUNCTION_LIST_PTR funcs);
+void                    gkm_plex_layer_add_module        (CK_FUNCTION_LIST_PTR funcs);
 
-#endif /* __GCK_PLEX_LAYER_H__ */
+#endif /* __GKM_PLEX_LAYER_H__ */
diff --git a/pkcs11/roots-store/Makefile.am b/pkcs11/roots-store/Makefile.am
index 68dda72..ed0e26c 100644
--- a/pkcs11/roots-store/Makefile.am
+++ b/pkcs11/roots-store/Makefile.am
@@ -6,37 +6,37 @@ INCLUDES = \
     	$(GOBJECT_CFLAGS) \
 	$(LIBGCRYPT_CFLAGS) \
 	$(GLIB_CFLAGS)
-	
-			
+
+
 # ------------------------------------------------------------------------------
 # The roots component code
 
 noinst_LTLIBRARIES = \
-	libgck-roots-store.la
+	libgkm-roots-store.la
 
-libgck_roots_store_la_SOURCES = \
-	gck-roots-store.h \
-	gck-roots-module.c gck-roots-module.h \
-	gck-roots-certificate.c gck-roots-certificate.h
+libgkm_roots_store_la_SOURCES = \
+	gkm-roots-store.h \
+	gkm-roots-module.c gkm-roots-module.h \
+	gkm-roots-certificate.c gkm-roots-certificate.h
 
 # ------------------------------------------------------------------------------
-# The standalone module 
+# The standalone module
 
 moduledir = $(libdir)/gnome-keyring/standalone/
 
 module_LTLIBRARIES = \
-	gck-roots-store-standalone.la
+	gkm-roots-store-standalone.la
 
-gck_roots_store_standalone_la_LDFLAGS = \
+gkm_roots_store_standalone_la_LDFLAGS = \
 	-module -avoid-version \
 	-no-undefined -export-symbols-regex 'C_GetFunctionList'
 
-gck_roots_store_standalone_la_SOURCES = \
-	gck-roots-standalone.c
+gkm_roots_store_standalone_la_SOURCES = \
+	gkm-roots-standalone.c
 
-gck_roots_store_standalone_la_LIBADD = \
-	libgck-roots-store.la \
-	$(top_builddir)/pkcs11/gck/libgck.la \
+gkm_roots_store_standalone_la_LIBADD = \
+	libgkm-roots-store.la \
+	$(top_builddir)/pkcs11/gkm/libgkm.la \
 	$(GOBJECT_LIBS) \
 	$(GTHREAD_LIBS) \
 	$(GLIB_LIBS) \
@@ -49,7 +49,7 @@ gck_roots_store_standalone_la_LIBADD = \
 if WITH_TESTS
 TESTS_DIR = tests
 else
-TESTS_DIR = 
+TESTS_DIR =
 endif
 
 SUBDIRS = . $(TESTS_DIR)
diff --git a/pkcs11/roots-store/gkm-roots-certificate.c b/pkcs11/roots-store/gkm-roots-certificate.c
new file mode 100644
index 0000000..fcb3f96
--- /dev/null
+++ b/pkcs11/roots-store/gkm-roots-certificate.c
@@ -0,0 +1,216 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+
+#include "gkm-roots-certificate.h"
+
+#include "gkm/gkm-attributes.h"
+#include "gkm/gkm-certificate-trust.h"
+#include "gkm/gkm-manager.h"
+#include "gkm/gkm-module.h"
+#include "gkm/gkm-object.h"
+#include "gkm/gkm-sexp.h"
+#include "gkm/gkm-util.h"
+
+#include <glib/gi18n.h>
+
+enum {
+	PROP_0,
+	PROP_PATH,
+	PROP_NETSCAPE_TRUST,
+};
+
+struct _GkmRootsCertificate {
+	GkmCertificate parent;
+	GkmCertificateTrust *trust;
+	gchar *path;
+};
+
+G_DEFINE_TYPE (GkmRootsCertificate, gkm_roots_certificate, GKM_TYPE_CERTIFICATE);
+
+/* -----------------------------------------------------------------------------
+ * INTERNAL
+ */
+
+
+/* -----------------------------------------------------------------------------
+ * OBJECT
+ */
+
+static CK_RV
+gkm_roots_certificate_get_attribute (GkmObject *base, GkmSession *session, CK_ATTRIBUTE_PTR attr)
+{
+	GkmRootsCertificate *self = GKM_ROOTS_CERTIFICATE (base);
+	CK_ULONG category;
+
+	switch (attr->type) {
+	case CKA_TRUSTED:
+		return gkm_attribute_set_bool (attr, TRUE);
+
+	case CKA_CERTIFICATE_CATEGORY:
+		if (!gkm_certificate_calc_category (GKM_CERTIFICATE (self), &category))
+			return CKR_FUNCTION_FAILED;
+		/* Unknown category, is CA by default in this slot */
+		if (category == 0)
+			category = 2;
+		return gkm_attribute_set_ulong (attr, category);
+	}
+
+	return GKM_OBJECT_CLASS (gkm_roots_certificate_parent_class)->get_attribute (base, session, attr);
+}
+
+static void
+gkm_roots_certificate_expose_object (GkmObject *obj, gboolean expose)
+{
+	GKM_OBJECT_CLASS (gkm_roots_certificate_parent_class)->expose_object (obj, expose);
+	gkm_object_expose (GKM_OBJECT (GKM_ROOTS_CERTIFICATE (obj)->trust), expose);
+}
+
+static void
+gkm_roots_certificate_init (GkmRootsCertificate *self)
+{
+
+}
+
+static GObject*
+gkm_roots_certificate_constructor (GType type, guint n_props, GObjectConstructParam *props)
+{
+	GkmRootsCertificate *self = GKM_ROOTS_CERTIFICATE (G_OBJECT_CLASS (gkm_roots_certificate_parent_class)->constructor(type, n_props, props));
+	g_return_val_if_fail (self, NULL);
+
+	self->trust = gkm_certificate_trust_new (gkm_object_get_module (GKM_OBJECT (self)),
+	                                         gkm_object_get_manager (GKM_OBJECT (self)),
+	                                         GKM_CERTIFICATE (self));
+
+	return G_OBJECT (self);
+}
+
+static void
+gkm_roots_certificate_set_property (GObject *obj, guint prop_id, const GValue *value,
+                                    GParamSpec *pspec)
+{
+	GkmRootsCertificate *self = GKM_ROOTS_CERTIFICATE (obj);
+
+	switch (prop_id) {
+	case PROP_PATH:
+		g_return_if_fail (!self->path);
+		self->path = g_value_dup_string (value);
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+gkm_roots_certificate_get_property (GObject *obj, guint prop_id, GValue *value,
+                                    GParamSpec *pspec)
+{
+	GkmRootsCertificate *self = GKM_ROOTS_CERTIFICATE (obj);
+
+	switch (prop_id) {
+	case PROP_PATH:
+		g_value_set_string (value, gkm_roots_certificate_get_path (self));
+		break;
+	case PROP_NETSCAPE_TRUST:
+		g_value_set_object (value, gkm_roots_certificate_get_netscape_trust (self));
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+gkm_roots_certificate_dispose (GObject *obj)
+{
+	GkmRootsCertificate *self = GKM_ROOTS_CERTIFICATE (obj);
+
+	if (self->trust)
+		g_object_unref (self->trust);
+	self->trust = NULL;
+
+	G_OBJECT_CLASS (gkm_roots_certificate_parent_class)->dispose (obj);
+}
+
+static void
+gkm_roots_certificate_finalize (GObject *obj)
+{
+	GkmRootsCertificate *self = GKM_ROOTS_CERTIFICATE (obj);
+
+	g_free (self->path);
+	g_assert (!self->trust);
+
+	G_OBJECT_CLASS (gkm_roots_certificate_parent_class)->finalize (obj);
+}
+
+static void
+gkm_roots_certificate_class_init (GkmRootsCertificateClass *klass)
+{
+	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+	GkmObjectClass *gkm_class = GKM_OBJECT_CLASS (klass);
+
+	gkm_roots_certificate_parent_class = g_type_class_peek_parent (klass);
+
+	gobject_class->constructor = gkm_roots_certificate_constructor;
+	gobject_class->dispose = gkm_roots_certificate_dispose;
+	gobject_class->finalize = gkm_roots_certificate_finalize;
+	gobject_class->set_property = gkm_roots_certificate_set_property;
+	gobject_class->get_property = gkm_roots_certificate_get_property;
+
+	gkm_class->get_attribute = gkm_roots_certificate_get_attribute;
+	gkm_class->expose_object = gkm_roots_certificate_expose_object;
+
+	g_object_class_install_property (gobject_class, PROP_PATH,
+	           g_param_spec_string ("path", "Path", "Certificate origin path",
+	                                "", G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+	g_object_class_install_property (gobject_class, PROP_NETSCAPE_TRUST,
+	           g_param_spec_object ("netscape-trust", "Netscape Trust", "Netscape trust object",
+	                                GKM_TYPE_CERTIFICATE_TRUST, G_PARAM_READABLE));
+}
+
+/* -----------------------------------------------------------------------------
+ * PUBLIC
+ */
+
+GkmRootsCertificate*
+gkm_roots_certificate_new (GkmModule *module, const gchar *unique, const gchar *path)
+{
+	return g_object_new (GKM_TYPE_ROOTS_CERTIFICATE, "unique", unique, "path", path,
+	                     "module", module, "manager", gkm_module_get_manager (module), NULL);
+}
+
+const gchar*
+gkm_roots_certificate_get_path (GkmRootsCertificate *self)
+{
+	g_return_val_if_fail (GKM_IS_ROOTS_CERTIFICATE (self), "");
+	return self->path;
+}
+
+GkmCertificateTrust*
+gkm_roots_certificate_get_netscape_trust (GkmRootsCertificate *self)
+{
+	g_return_val_if_fail (GKM_IS_ROOTS_CERTIFICATE (self), NULL);
+	g_return_val_if_fail (GKM_IS_CERTIFICATE_TRUST (self->trust), NULL);
+	return self->trust;
+}
diff --git a/pkcs11/roots-store/gkm-roots-certificate.h b/pkcs11/roots-store/gkm-roots-certificate.h
new file mode 100644
index 0000000..8938425
--- /dev/null
+++ b/pkcs11/roots-store/gkm-roots-certificate.h
@@ -0,0 +1,55 @@
+/*
+ * 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 __GKM_ROOTS_CERTIFICATE_H__
+#define __GKM_ROOTS_CERTIFICATE_H__
+
+#include <glib-object.h>
+
+#include "gkm/gkm-certificate.h"
+
+#define GKM_TYPE_ROOTS_CERTIFICATE               (gkm_roots_certificate_get_type ())
+#define GKM_ROOTS_CERTIFICATE(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_ROOTS_CERTIFICATE, GkmRootsCertificate))
+#define GKM_ROOTS_CERTIFICATE_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_ROOTS_CERTIFICATE, GkmRootsCertificateClass))
+#define GKM_IS_ROOTS_CERTIFICATE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_ROOTS_CERTIFICATE))
+#define GKM_IS_ROOTS_CERTIFICATE_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_ROOTS_CERTIFICATE))
+#define GKM_ROOTS_CERTIFICATE_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_ROOTS_CERTIFICATE, GkmRootsCertificateClass))
+
+typedef struct _GkmRootsCertificate GkmRootsCertificate;
+typedef struct _GkmRootsCertificateClass GkmRootsCertificateClass;
+
+struct _GkmRootsCertificateClass {
+	GkmCertificateClass parent_class;
+};
+
+GType                 gkm_roots_certificate_get_type               (void);
+
+GkmRootsCertificate*  gkm_roots_certificate_new                    (GkmModule *module,
+                                                                    const gchar *hash,
+                                                                    const gchar *path);
+
+const gchar*          gkm_roots_certificate_get_unique             (GkmRootsCertificate *self);
+
+const gchar*          gkm_roots_certificate_get_path               (GkmRootsCertificate *self);
+
+GkmCertificateTrust*  gkm_roots_certificate_get_netscape_trust     (GkmRootsCertificate *self);
+
+#endif /* __GKM_ROOTS_CERTIFICATE_H__ */
diff --git a/pkcs11/roots-store/gck-roots-module.c b/pkcs11/roots-store/gkm-roots-module.c
similarity index 62%
rename from pkcs11/roots-store/gck-roots-module.c
rename to pkcs11/roots-store/gkm-roots-module.c
index f6418e8..c3b7a64 100644
--- a/pkcs11/roots-store/gck-roots-module.c
+++ b/pkcs11/roots-store/gkm-roots-module.c
@@ -1,46 +1,46 @@
-/* 
+/*
  * 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"
 
-#include "gck-roots-store.h"
-#include "gck-roots-module.h"
-#include "gck-roots-certificate.h"
+#include "gkm-roots-store.h"
+#include "gkm-roots-module.h"
+#include "gkm-roots-certificate.h"
 
-#include "gck/gck-file-tracker.h"
-#include "gck/gck-serializable.h"
+#include "gkm/gkm-file-tracker.h"
+#include "gkm/gkm-serializable.h"
 
 #include "egg/egg-error.h"
 #include "egg/egg-openssl.h"
 
 #include <string.h>
 
-struct _GckRootsModule {
-	GckModule parent;
-	GckFileTracker *tracker;
+struct _GkmRootsModule {
+	GkmModule parent;
+	GkmFileTracker *tracker;
 	GHashTable *certificates;
 	gchar *directory;
 };
 
-static const CK_SLOT_INFO gck_roots_module_slot_info = {
+static const CK_SLOT_INFO gkm_roots_module_slot_info = {
 	"Root CA Certificates",
 	"Gnome Keyring",
 	CKF_TOKEN_PRESENT,
@@ -48,7 +48,7 @@ static const CK_SLOT_INFO gck_roots_module_slot_info = {
 	{ 0, 0 }
 };
 
-static const CK_TOKEN_INFO gck_roots_module_token_info = {
+static const CK_TOKEN_INFO gkm_roots_module_token_info = {
 	"Root CA Certificates",
 	"Gnome Keyring",
 	"1.0",
@@ -70,65 +70,65 @@ static const CK_TOKEN_INFO gck_roots_module_token_info = {
 };
 
 typedef struct _ParsePrivate {
-	GckRootsModule *module;
+	GkmRootsModule *module;
 	GHashTable *checks;
 	const gchar *path;
 	guint count;
 } ParsePrivate;
 
-G_DEFINE_TYPE (GckRootsModule, gck_roots_module, GCK_TYPE_MODULE);
+G_DEFINE_TYPE (GkmRootsModule, gkm_roots_module, GKM_TYPE_MODULE);
 
 /* -----------------------------------------------------------------------------
- * ACTUAL PKCS#11 Module Implementation 
+ * ACTUAL PKCS#11 Module Implementation
  */
 
 /* Include all the module entry points */
-#include "gck/gck-module-ep.h"
-GCK_DEFINE_MODULE (gck_roots_module, GCK_TYPE_ROOTS_MODULE);
+#include "gkm/gkm-module-ep.h"
+GKM_DEFINE_MODULE (gkm_roots_module, GKM_TYPE_ROOTS_MODULE);
 
 /* -----------------------------------------------------------------------------
- * INTERNAL 
+ * INTERNAL
  */
 
-static GckCertificate*
-add_certificate_for_data (GckRootsModule *self, const guchar *data, 
+static GkmCertificate*
+add_certificate_for_data (GkmRootsModule *self, const guchar *data,
                           gsize n_data, const gchar *path)
 {
-	GckCertificate *cert;
-	GckManager *manager;
+	GkmCertificate *cert;
+	GkmManager *manager;
 	gchar *hash, *unique;
-	
-	g_assert (GCK_IS_ROOTS_MODULE (self));
+
+	g_assert (GKM_IS_ROOTS_MODULE (self));
 	g_assert (data);
 	g_assert (path);
-	
-	manager = gck_module_get_manager (GCK_MODULE (self));
+
+	manager = gkm_module_get_manager (GKM_MODULE (self));
 	g_return_val_if_fail (manager, NULL);
 
 	/* Hash the certificate */
 	hash = g_compute_checksum_for_data (G_CHECKSUM_MD5, data, n_data);
 	unique = g_strdup_printf ("%s:%s", path, hash);
 	g_free (hash);
-	
+
 	/* Try and find a certificate */
-	cert = GCK_CERTIFICATE (gck_manager_find_one_by_string_property (manager, "unique", unique));
+	cert = GKM_CERTIFICATE (gkm_manager_find_one_by_string_property (manager, "unique", unique));
 	if (cert != NULL) {
 		g_free (unique);
 		return cert;
 	}
 
 	/* Create a new certificate object */
-	cert = GCK_CERTIFICATE (gck_roots_certificate_new (GCK_MODULE (self), unique, path));
+	cert = GKM_CERTIFICATE (gkm_roots_certificate_new (GKM_MODULE (self), unique, path));
 
-	if (!gck_serializable_load (GCK_SERIALIZABLE (cert), NULL, data, n_data)) {
+	if (!gkm_serializable_load (GKM_SERIALIZABLE (cert), NULL, data, n_data)) {
 		g_message ("couldn't parse certificate(s): %s", path);
 		g_object_unref (cert);
 		return NULL;
 	}
-	
+
 	/* Make the certificate show up */
-	gck_object_expose (GCK_OBJECT (cert), TRUE);
-	
+	gkm_object_expose (GKM_OBJECT (cert), TRUE);
+
 	/* And add to our wonderful table */
 	g_hash_table_insert (self->certificates, cert, cert);
 	return cert;
@@ -140,18 +140,18 @@ parsed_pem_block (GQuark type, const guchar *data, gsize n_data,
 {
 	static GQuark PEM_CERTIFICATE;
 	static volatile gsize quarks_inited = 0;
-	
+
 	ParsePrivate *ctx = (ParsePrivate*)user_data;
-	GckCertificate *cert;
-	
+	GkmCertificate *cert;
+
 	g_assert (ctx);
-	
+
 	/* Initialize the first time through */
 	if (g_once_init_enter (&quarks_inited)) {
 		PEM_CERTIFICATE = g_quark_from_static_string ("CERTIFICATE");
 		g_once_init_leave (&quarks_inited, 1);
 	}
-	
+
 	if (type == PEM_CERTIFICATE) {
 		cert = add_certificate_for_data (ctx->module, data, n_data, ctx->path);
 		if (cert != NULL) {
@@ -164,25 +164,25 @@ parsed_pem_block (GQuark type, const guchar *data, gsize n_data,
 static void
 remove_each_certificate (gpointer key, gpointer value, gpointer user_data)
 {
-	GckRootsModule *self = user_data;
-	g_assert (GCK_IS_ROOTS_MODULE (self));
+	GkmRootsModule *self = user_data;
+	g_assert (GKM_IS_ROOTS_MODULE (self));
 	if (!g_hash_table_remove (self->certificates, value))
-		g_return_if_reached ();	
+		g_return_if_reached ();
 }
 
 static void
-file_load (GckFileTracker *tracker, const gchar *path, GckRootsModule *self)
+file_load (GkmFileTracker *tracker, const gchar *path, GkmRootsModule *self)
 {
 	ParsePrivate ctx;
-	GckManager *manager;
-	GckCertificate *cert;
+	GkmManager *manager;
+	GkmCertificate *cert;
 	guchar *data;
 	GList *objects, *l;
 	GError *error = NULL;
 	gsize n_data;
 	guint num;
 
-	manager = gck_module_get_manager (GCK_MODULE (self));
+	manager = gkm_module_get_manager (GKM_MODULE (self));
 	g_return_if_fail (manager);
 
 	/* Read in the public key */
@@ -191,19 +191,19 @@ file_load (GckFileTracker *tracker, const gchar *path, GckRootsModule *self)
 		           path, egg_error_message (error));
 		return;
 	}
-	
+
 	memset (&ctx, 0, sizeof (ctx));
 	ctx.path = path;
 	ctx.module = self;
 	ctx.count = 0;
-	
+
 	/* Checks for what was at this path */
 	ctx.checks = g_hash_table_new (g_direct_hash, g_direct_equal);
-	objects = gck_manager_find_by_string_property (manager, "path", path);
+	objects = gkm_manager_find_by_string_property (manager, "path", path);
 	for (l = objects; l; l = g_list_next (l))
 		g_hash_table_insert (ctx.checks, l->data, l->data);
 	g_list_free (objects);
-	
+
 	/* Try and parse the PEM */
 	num = egg_openssl_pem_parse (data, n_data, parsed_pem_block, &ctx);
 
@@ -213,26 +213,26 @@ file_load (GckFileTracker *tracker, const gchar *path, GckRootsModule *self)
 		if (cert != NULL)
 			g_hash_table_remove (ctx.checks, cert);
 	}
-	
+
 	g_hash_table_foreach (ctx.checks, remove_each_certificate, self);
 	g_hash_table_destroy (ctx.checks);
-	
+
 	g_free (data);
 }
 
 static void
-file_remove (GckFileTracker *tracker, const gchar *path, GckRootsModule *self)
+file_remove (GkmFileTracker *tracker, const gchar *path, GkmRootsModule *self)
 {
 	GList *objects, *l;
-	GckManager *manager;
-	
+	GkmManager *manager;
+
 	g_return_if_fail (path);
-	g_return_if_fail (GCK_IS_ROOTS_MODULE (self));
+	g_return_if_fail (GKM_IS_ROOTS_MODULE (self));
 
-	manager = gck_module_get_manager (GCK_MODULE (self));
+	manager = gkm_module_get_manager (GKM_MODULE (self));
 	g_return_if_fail (manager);
 
-	objects = gck_manager_find_by_string_property (manager, "path", path);
+	objects = gkm_manager_find_by_string_property (manager, "path", path);
 	for (l = objects; l; l = g_list_next (l))
 		if (!g_hash_table_remove (self->certificates, l->data))
 			g_return_if_reached ();
@@ -240,25 +240,25 @@ file_remove (GckFileTracker *tracker, const gchar *path, GckRootsModule *self)
 }
 
 /* -----------------------------------------------------------------------------
- * OBJECT 
+ * OBJECT
  */
 
-static const CK_SLOT_INFO* 
-gck_roots_module_real_get_slot_info (GckModule *self)
+static const CK_SLOT_INFO*
+gkm_roots_module_real_get_slot_info (GkmModule *self)
 {
-	return &gck_roots_module_slot_info;
+	return &gkm_roots_module_slot_info;
 }
 
 static const CK_TOKEN_INFO*
-gck_roots_module_real_get_token_info (GckModule *self)
+gkm_roots_module_real_get_token_info (GkmModule *self)
 {
-	return &gck_roots_module_token_info;
+	return &gkm_roots_module_token_info;
 }
 
-static void 
-gck_roots_module_real_parse_argument (GckModule *base, const gchar *name, const gchar *value)
+static void
+gkm_roots_module_real_parse_argument (GkmModule *base, const gchar *name, const gchar *value)
 {
-	GckRootsModule *self = GCK_ROOTS_MODULE (base);
+	GkmRootsModule *self = GKM_ROOTS_MODULE (base);
 	if (g_str_equal (name, "directory")) {
 		g_free (self->directory);
 		self->directory = g_strdup (value);
@@ -266,100 +266,100 @@ gck_roots_module_real_parse_argument (GckModule *base, const gchar *name, const
 }
 
 static CK_RV
-gck_roots_module_real_refresh_token (GckModule *base)
+gkm_roots_module_real_refresh_token (GkmModule *base)
 {
-	GckRootsModule *self = GCK_ROOTS_MODULE (base);
+	GkmRootsModule *self = GKM_ROOTS_MODULE (base);
 	if (self->tracker)
-		gck_file_tracker_refresh (self->tracker, FALSE);
+		gkm_file_tracker_refresh (self->tracker, FALSE);
 	return CKR_OK;
 }
 
-static GObject* 
-gck_roots_module_constructor (GType type, guint n_props, GObjectConstructParam *props) 
+static GObject*
+gkm_roots_module_constructor (GType type, guint n_props, GObjectConstructParam *props)
 {
-	GckRootsModule *self = GCK_ROOTS_MODULE (G_OBJECT_CLASS (gck_roots_module_parent_class)->constructor(type, n_props, props));
-	GckManager *manager;
+	GkmRootsModule *self = GKM_ROOTS_MODULE (G_OBJECT_CLASS (gkm_roots_module_parent_class)->constructor(type, n_props, props));
+	GkmManager *manager;
 
-	g_return_val_if_fail (self, NULL);	
+	g_return_val_if_fail (self, NULL);
 
 #ifdef ROOT_CERTIFICATES
 	if (!self->directory)
 		self->directory = g_strdup (ROOT_CERTIFICATES);
 #endif
 	if (self->directory) {
-		self->tracker = gck_file_tracker_new (self->directory, "*", "*.0");
+		self->tracker = gkm_file_tracker_new (self->directory, "*", "*.0");
 		g_signal_connect (self->tracker, "file-added", G_CALLBACK (file_load), self);
 		g_signal_connect (self->tracker, "file-changed", G_CALLBACK (file_load), self);
 		g_signal_connect (self->tracker, "file-removed", G_CALLBACK (file_remove), self);
 	}
-	
-	manager = gck_module_get_manager (GCK_MODULE (self));
-	gck_manager_add_property_index (manager, "unique", TRUE);
-	gck_manager_add_property_index (manager, "path", FALSE);
-	
+
+	manager = gkm_module_get_manager (GKM_MODULE (self));
+	gkm_manager_add_property_index (manager, "unique", TRUE);
+	gkm_manager_add_property_index (manager, "path", FALSE);
+
 	return G_OBJECT (self);
 }
 
 static void
-gck_roots_module_init (GckRootsModule *self)
+gkm_roots_module_init (GkmRootsModule *self)
 {
 	self->certificates = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, NULL);
-	
+
 }
 
 static void
-gck_roots_module_dispose (GObject *obj)
+gkm_roots_module_dispose (GObject *obj)
 {
-	GckRootsModule *self = GCK_ROOTS_MODULE (obj);
-	
+	GkmRootsModule *self = GKM_ROOTS_MODULE (obj);
+
 	if (self->tracker)
 		g_object_unref (self->tracker);
 	self->tracker = NULL;
-	
+
 	g_hash_table_remove_all (self->certificates);
-    
-	G_OBJECT_CLASS (gck_roots_module_parent_class)->dispose (obj);
+
+	G_OBJECT_CLASS (gkm_roots_module_parent_class)->dispose (obj);
 }
 
 static void
-gck_roots_module_finalize (GObject *obj)
+gkm_roots_module_finalize (GObject *obj)
 {
-	GckRootsModule *self = GCK_ROOTS_MODULE (obj);
-	
+	GkmRootsModule *self = GKM_ROOTS_MODULE (obj);
+
 	g_assert (self->tracker == NULL);
-	
+
 	g_hash_table_destroy (self->certificates);
 	self->certificates = NULL;
-	
+
 	g_free (self->directory);
 	self->directory = NULL;
 
-	G_OBJECT_CLASS (gck_roots_module_parent_class)->finalize (obj);
+	G_OBJECT_CLASS (gkm_roots_module_parent_class)->finalize (obj);
 }
 
 static void
-gck_roots_module_class_init (GckRootsModuleClass *klass)
+gkm_roots_module_class_init (GkmRootsModuleClass *klass)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	GckModuleClass *module_class = GCK_MODULE_CLASS (klass);
-	
-	gobject_class->constructor = gck_roots_module_constructor;
-	gobject_class->dispose = gck_roots_module_dispose;
-	gobject_class->finalize = gck_roots_module_finalize;
-	
-	module_class->get_slot_info = gck_roots_module_real_get_slot_info;
-	module_class->get_token_info = gck_roots_module_real_get_token_info;
-	module_class->parse_argument = gck_roots_module_real_parse_argument;
-	module_class->refresh_token = gck_roots_module_real_refresh_token;
+	GkmModuleClass *module_class = GKM_MODULE_CLASS (klass);
+
+	gobject_class->constructor = gkm_roots_module_constructor;
+	gobject_class->dispose = gkm_roots_module_dispose;
+	gobject_class->finalize = gkm_roots_module_finalize;
+
+	module_class->get_slot_info = gkm_roots_module_real_get_slot_info;
+	module_class->get_token_info = gkm_roots_module_real_get_token_info;
+	module_class->parse_argument = gkm_roots_module_real_parse_argument;
+	module_class->refresh_token = gkm_roots_module_real_refresh_token;
 }
 
 /* ---------------------------------------------------------------------------------------
- * PUBLIC 
+ * PUBLIC
  */
 
 CK_FUNCTION_LIST_PTR
-gck_roots_store_get_functions (void)
+gkm_roots_store_get_functions (void)
 {
-	gck_crypto_initialize ();
-	return gck_roots_module_function_list;
+	gkm_crypto_initialize ();
+	return gkm_roots_module_function_list;
 }
diff --git a/pkcs11/roots-store/gkm-roots-module.h b/pkcs11/roots-store/gkm-roots-module.h
new file mode 100644
index 0000000..fc1580b
--- /dev/null
+++ b/pkcs11/roots-store/gkm-roots-module.h
@@ -0,0 +1,45 @@
+/*
+ * 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 __GKM_ROOTS_MODULE_H__
+#define __GKM_ROOTS_MODULE_H__
+
+#include <glib-object.h>
+
+#include "gkm/gkm-module.h"
+
+#define GKM_TYPE_ROOTS_MODULE               (gkm_roots_module_get_type ())
+#define GKM_ROOTS_MODULE(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_ROOTS_MODULE, GkmRootsModule))
+#define GKM_ROOTS_MODULE_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_ROOTS_MODULE, GkmRootsModuleClass))
+#define GKM_IS_ROOTS_MODULE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_ROOTS_MODULE))
+#define GKM_IS_ROOTS_MODULE_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_ROOTS_MODULE))
+#define GKM_ROOTS_MODULE_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_ROOTS_MODULE, GkmRootsModuleClass))
+
+typedef struct _GkmRootsModule GkmRootsModule;
+typedef struct _GkmRootsModuleClass GkmRootsModuleClass;
+
+struct _GkmRootsModuleClass {
+	GkmModuleClass parent_class;
+};
+
+GType               gkm_roots_module_get_type               (void);
+
+#endif /* __GKM_ROOTS_MODULE_H__ */
diff --git a/pkcs11/roots-store/gck-roots-standalone.c b/pkcs11/roots-store/gkm-roots-standalone.c
similarity index 82%
rename from pkcs11/roots-store/gck-roots-standalone.c
rename to pkcs11/roots-store/gkm-roots-standalone.c
index 191c598..946571a 100644
--- a/pkcs11/roots-store/gck-roots-standalone.c
+++ b/pkcs11/roots-store/gkm-roots-standalone.c
@@ -1,5 +1,5 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* gck-roots-standalone.h - The Roots PKCS#11 code as a standalone module
+/* gkm-roots-standalone.h - The Roots PKCS#11 code as a standalone module
 
    Copyright (C) 2008, Stef Walter
 
@@ -23,9 +23,9 @@
 
 #include "config.h"
 
-#include "gck-roots-store.h"
+#include "gkm-roots-store.h"
 
-#include "gck/gck-crypto.h"
+#include "gkm/gkm-crypto.h"
 
 #include "egg/egg-secure-memory.h"
 
@@ -35,11 +35,11 @@
 
 /* Module callbacks for secure memory */
 static GStaticMutex memory_mutex = G_STATIC_MUTEX_INIT;
-void egg_memory_lock (void) 
+void egg_memory_lock (void)
 	{ g_static_mutex_lock (&memory_mutex); }
-void egg_memory_unlock (void) 
+void egg_memory_unlock (void)
 	{ g_static_mutex_unlock (&memory_mutex); }
-void* egg_memory_fallback (void *p, size_t sz) 
+void* egg_memory_fallback (void *p, size_t sz)
 	{ return g_realloc (p, sz); }
 
 CK_RV
@@ -47,14 +47,14 @@ C_GetFunctionList (CK_FUNCTION_LIST_PTR_PTR list)
 {
 	if (!list)
 		return CKR_ARGUMENTS_BAD;
-	
+
 	g_type_init ();
-	
+
 	if (!g_thread_supported ())
 		g_thread_init (NULL);
-	
-	gck_crypto_initialize ();
-	
-	*list = gck_roots_store_get_functions ();
+
+	gkm_crypto_initialize ();
+
+	*list = gkm_roots_store_get_functions ();
 	return CKR_OK;
 }
diff --git a/pkcs11/ssh-store/gck-ssh-store.h b/pkcs11/roots-store/gkm-roots-store.h
similarity index 79%
rename from pkcs11/ssh-store/gck-ssh-store.h
rename to pkcs11/roots-store/gkm-roots-store.h
index 8ddc510..40894c1 100644
--- a/pkcs11/ssh-store/gck-ssh-store.h
+++ b/pkcs11/roots-store/gkm-roots-store.h
@@ -1,29 +1,29 @@
-/* 
+/*
  * 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.
  */
 
-#ifndef __GCK_SSH_STORE_H__
-#define __GCK_SSH_STORE_H__
+#ifndef __GKM_ROOTS_STORE_H__
+#define __GKM_ROOTS_STORE_H__
 
 #include "pkcs11/pkcs11.h"
 
-CK_FUNCTION_LIST_PTR  gck_ssh_store_get_functions  (void);
+CK_FUNCTION_LIST_PTR  gkm_roots_store_get_functions  (void);
 
-#endif /* __GCK_SSH_STORE_H__ */
+#endif /* __GKM_ROOTS_STORE_H__ */
diff --git a/pkcs11/roots-store/tests/Makefile.am b/pkcs11/roots-store/tests/Makefile.am
index 8f0c7ef..89ed910 100644
--- a/pkcs11/roots-store/tests/Makefile.am
+++ b/pkcs11/roots-store/tests/Makefile.am
@@ -5,8 +5,8 @@ UNIT_AUTO = \
 UNIT_PROMPT =
 
 UNIT_LIBS = \
-	$(top_builddir)/pkcs11/roots-store/libgck-roots-store.la \
-	$(top_builddir)/pkcs11/gck/libgck.la \
+	$(top_builddir)/pkcs11/roots-store/libgkm-roots-store.la \
+	$(top_builddir)/pkcs11/gkm/libgkm.la \
 	$(top_builddir)/egg/libegg.la
 
 include $(top_srcdir)/tests/gtest.make
diff --git a/pkcs11/roots-store/tests/p11-tests.conf b/pkcs11/roots-store/tests/p11-tests.conf
index f81687e..fda5f0d 100644
--- a/pkcs11/roots-store/tests/p11-tests.conf
+++ b/pkcs11/roots-store/tests/p11-tests.conf
@@ -1,2 +1,2 @@
-# Configuration for running p11-tests on this module 
-init-string = directory='test-data' 
+# Configuration for running p11-tests on this module
+init-string = directory='test-data'
diff --git a/pkcs11/roots-store/tests/test-module.c b/pkcs11/roots-store/tests/test-module.c
index 885a968..ec0bebe 100644
--- a/pkcs11/roots-store/tests/test-module.c
+++ b/pkcs11/roots-store/tests/test-module.c
@@ -23,12 +23,12 @@
 
 #include "config.h"
 
-#include "roots-store/gck-roots-store.h"
+#include "roots-store/gkm-roots-store.h"
 
 #include "run-auto-test.h"
 
 DEFINE_EXTERNAL(roots_module)
 {
-	CK_FUNCTION_LIST_PTR funcs = gck_roots_store_get_functions ();
+	CK_FUNCTION_LIST_PTR funcs = gkm_roots_store_get_functions ();
 	test_p11_module (funcs, "p11-tests.conf");
 }
diff --git a/pkcs11/rpc-layer/.gitignore b/pkcs11/rpc-layer/.gitignore
index 5fba35e..8e1614e 100644
--- a/pkcs11/rpc-layer/.gitignore
+++ b/pkcs11/rpc-layer/.gitignore
@@ -2,4 +2,4 @@
 /Makefile.in
 /.*
 /p11-rpc-test-daemon
-/gck-rpc-daemon-standalone
+/gkm-rpc-daemon-standalone
diff --git a/pkcs11/rpc-layer/Makefile.am b/pkcs11/rpc-layer/Makefile.am
index aa74bbf..3dcd17c 100644
--- a/pkcs11/rpc-layer/Makefile.am
+++ b/pkcs11/rpc-layer/Makefile.am
@@ -1,35 +1,35 @@
 
 noinst_LTLIBRARIES = \
-	libgck-rpc-layer.la
+	libgkm-rpc-layer.la
 
 noinst_PROGRAMS = \
-	gck-rpc-daemon-standalone
-	
+	gkm-rpc-daemon-standalone
+
 INCLUDES = -I. \
 	-I$(top_srcdir) \
 	-I$(top_builddir)
-	
+
 # ------------------------------------------------------------------------------
 # The dispatch code
 
-libgck_rpc_layer_la_SOURCES = \
-	gck-rpc-dispatch.c \
-	gck-rpc-layer.h \
-	gck-rpc-message.c \
-	gck-rpc-private.h \
-	gck-rpc-util.c
+libgkm_rpc_layer_la_SOURCES = \
+	gkm-rpc-dispatch.c \
+	gkm-rpc-layer.h \
+	gkm-rpc-message.c \
+	gkm-rpc-private.h \
+	gkm-rpc-util.c
 
-libgck_rpc_layer_la_LIBADD = \
+libgkm_rpc_layer_la_LIBADD = \
 	$(top_builddir)/egg/libegg-buffer.la \
 	$(top_builddir)/egg/libegg-creds.la \
 	$(GOBJECT_LIBS) \
     	$(GTHREAD_LIBS) \
-	$(GLIB_LIBS) 
+	$(GLIB_LIBS)
 
-libgck_rpc_layer_la_CFLAGS = \
+libgkm_rpc_layer_la_CFLAGS = \
 	$(GOBJECT_CFLAGS) \
     	$(GTHREAD_CFLAGS) \
-	$(GLIB_CFLAGS) 
+	$(GLIB_CFLAGS)
 
 # ------------------------------------------------------------------------------
 # The module code, built as the public gnome-keyring module
@@ -40,25 +40,24 @@ module_LTLIBRARIES = \
 	gnome-keyring-pkcs11.la
 
 gnome_keyring_pkcs11_la_SOURCES = \
-	gck-rpc-private.h \
-	gck-rpc-module.c \
-	gck-rpc-message.c \
-	gck-rpc-util.c
+	gkm-rpc-private.h \
+	gkm-rpc-module.c \
+	gkm-rpc-message.c \
+	gkm-rpc-util.c
 
 gnome_keyring_pkcs11_la_LIBADD = \
 	$(top_builddir)/egg/libegg-buffer.la \
-	$(top_builddir)/egg/libegg-creds.la 
+	$(top_builddir)/egg/libegg-creds.la
 
 gnome_keyring_pkcs11_la_LDFLAGS = \
 	-module -avoid-version \
 	-no-undefined -export-symbols-regex 'C_GetFunctionList'
 
 # -----------------------------------------------------------------------------
-# The test daemon 
-
-gck_rpc_daemon_standalone_SOURCES = \
-	gck-rpc-daemon-standalone.c
-	
-gck_rpc_daemon_standalone_LDADD = \
-	$(DL_LIBS) libgck-rpc-layer.la
-	
+# The test daemon
+
+gkm_rpc_daemon_standalone_SOURCES = \
+	gkm-rpc-daemon-standalone.c
+
+gkm_rpc_daemon_standalone_LDADD = \
+	$(DL_LIBS) libgkm-rpc-layer.la
diff --git a/pkcs11/rpc-layer/gck-rpc-daemon-standalone.c b/pkcs11/rpc-layer/gkm-rpc-daemon-standalone.c
similarity index 88%
rename from pkcs11/rpc-layer/gck-rpc-daemon-standalone.c
rename to pkcs11/rpc-layer/gkm-rpc-daemon-standalone.c
index c806d53..84d9abc 100644
--- a/pkcs11/rpc-layer/gck-rpc-daemon-standalone.c
+++ b/pkcs11/rpc-layer/gkm-rpc-daemon-standalone.c
@@ -1,5 +1,5 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* gck-rpc-daemon-standalone.c - A sample daemon.
+/* gkm-rpc-daemon-standalone.c - A sample daemon.
 
    Copyright (C) 2008, Stef Walter
 
@@ -25,7 +25,7 @@
 
 #include "pkcs11/pkcs11.h"
 
-#include "gck-rpc-layer.h"
+#include "gkm-rpc-layer.h"
 
 #include <stdio.h>
 #include <errno.h>
@@ -36,7 +36,7 @@
 #include <dlfcn.h>
 #include <pthread.h>
 
-#define SOCKET_PATH "/tmp/gck-rpc-daemon.sock"
+#define SOCKET_PATH "/tmp/gkm-rpc-daemon.sock"
 
 /* Sample configuration for loading NSS remotely */
 static CK_C_INITIALIZE_ARGS p11_init_args = {
@@ -50,10 +50,10 @@ static CK_C_INITIALIZE_ARGS p11_init_args = {
 
 static int is_running = 1;
 
-static int 
+static int
 usage (void)
 {
-	fprintf (stderr, "usage: gck-rpc-daemon pkcs11-module\n");
+	fprintf (stderr, "usage: gkm-rpc-daemon pkcs11-module\n");
 	exit (2);
 }
 
@@ -66,7 +66,7 @@ main (int argc, char *argv[])
 	fd_set read_fds;
 	int sock, ret;
 	CK_RV rv;
-	
+
 	/* The module to load is the argument */
 	if (argc != 2)
 		usage();
@@ -84,27 +84,27 @@ main (int argc, char *argv[])
 		fprintf (stderr, "couldn't find C_GetFunctionList in library: %s: %s\n", argv[1], dlerror());
 		exit (1);
 	}
-	
+
 	/* Get the function list */
 	rv = (func_get_list) (&funcs);
 	if (rv != CKR_OK || !funcs) {
-		fprintf (stderr, "couldn't get function list from C_GetFunctionList in libary: %s: 0x%08x\n", 
+		fprintf (stderr, "couldn't get function list from C_GetFunctionList in libary: %s: 0x%08x\n",
 		         argv[1], (int)rv);
 		exit (1);
 	}
-	
+
 	/* RPC layer expects initialized module */
 	rv = (funcs->C_Initialize) (&p11_init_args);
 	if (rv != CKR_OK) {
 		fprintf (stderr, "couldn't initialize module: %s: 0x%08x\n", argv[1], (int)rv);
 		exit (1);
 	}
-	
-	gck_rpc_layer_initialize (funcs);
-	sock = gck_rpc_layer_startup (SOCKET_PATH);
+
+	gkm_rpc_layer_initialize (funcs);
+	sock = gkm_rpc_layer_startup (SOCKET_PATH);
 	if (sock == -1)
 		exit (1);
-	
+
 	is_running = 1;
 	while (is_running) {
 		FD_ZERO (&read_fds);
@@ -116,18 +116,18 @@ main (int argc, char *argv[])
 			fprintf (stderr, "error watching socket: %s\n", strerror (errno));
 			exit (1);
 		}
-		
+
 		if (FD_ISSET (sock, &read_fds))
-			gck_rpc_layer_accept ();
+			gkm_rpc_layer_accept ();
 	}
-	
-	gck_rpc_layer_shutdown ();
-	gck_rpc_layer_uninitialize ();
-	
+
+	gkm_rpc_layer_shutdown ();
+	gkm_rpc_layer_uninitialize ();
+
 	rv = (funcs->C_Finalize) (NULL);
 	if (rv != CKR_OK)
 		fprintf (stderr, "couldn't finalize module: %s: 0x%08x\n", argv[1], (int)rv);
-	
+
 	dlclose(module);
 
 	return 0;
diff --git a/pkcs11/rpc-layer/gck-rpc-dispatch.c b/pkcs11/rpc-layer/gkm-rpc-dispatch.c
similarity index 87%
rename from pkcs11/rpc-layer/gck-rpc-dispatch.c
rename to pkcs11/rpc-layer/gkm-rpc-dispatch.c
index e70dd8e..09e80eb 100644
--- a/pkcs11/rpc-layer/gck-rpc-dispatch.c
+++ b/pkcs11/rpc-layer/gkm-rpc-dispatch.c
@@ -1,5 +1,5 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* gck-rpc-dispatch.h - receiver of our PKCS#11 protocol.
+/* gkm-rpc-dispatch.h - receiver of our PKCS#11 protocol.
 
    Copyright (C) 2008, Stef Walter
 
@@ -23,8 +23,8 @@
 
 #include "config.h"
 
-#include "gck-rpc-layer.h"
-#include "gck-rpc-private.h"
+#include "gkm-rpc-layer.h"
+#include "gkm-rpc-private.h"
 
 #include "pkcs11/pkcs11.h"
 #include "pkcs11/pkcs11g.h"
@@ -59,18 +59,18 @@ static CK_FUNCTION_LIST_PTR pkcs11_module = NULL;
  */
 
 #if DEBUG_OUTPUT
-#define debug(x) gck_rpc_debug x
+#define debug(x) gkm_rpc_debug x
 #else
-#define debug(x)	
+#define debug(x)
 #endif
 
-#define warning(x) gck_rpc_warn x
+#define warning(x) gkm_rpc_warn x
 
 #define return_val_if_fail(x, v) \
-	if (!(x)) { rpc_warn ("'%s' not true at %s", #x, __func__); return v; } 
+	if (!(x)) { rpc_warn ("'%s' not true at %s", #x, __func__); return v; }
 
 void
-gck_rpc_log (const char *line)
+gkm_rpc_log (const char *line)
 {
 	g_message ("%s", line);
 }
@@ -80,8 +80,8 @@ gck_rpc_log (const char *line)
  */
 
 typedef struct _CallState {
-	GckRpcMessage *req;
-	GckRpcMessage *resp;
+	GkmRpcMessage *req;
+	GkmRpcMessage *resp;
 	void *allocated;
 	CK_G_APPLICATION application;
 } CallState;
@@ -90,12 +90,12 @@ static int
 call_init (CallState *cs)
 {
 	assert (cs);
-	
-	cs->req = gck_rpc_message_new ((EggBufferAllocator)realloc);
-	cs->resp = gck_rpc_message_new ((EggBufferAllocator)realloc);
+
+	cs->req = gkm_rpc_message_new ((EggBufferAllocator)realloc);
+	cs->resp = gkm_rpc_message_new ((EggBufferAllocator)realloc);
 	if (!cs->req || !cs->resp) {
-		gck_rpc_message_free (cs->req);
-		gck_rpc_message_free (cs->resp);
+		gkm_rpc_message_free (cs->req);
+		gkm_rpc_message_free (cs->resp);
 		return 0;
 	}
 
@@ -110,19 +110,19 @@ static void*
 call_alloc (CallState *cs, size_t length)
 {
 	void **data;
-	
+
 	assert (cs);
-	
+
 	if (length > 0x7fffffff)
 		return NULL;
-	
+
 	data = malloc (sizeof (void*) + length);
 	if (!data)
 		return NULL;
-	
+
 	/* Munch up the memory to help catch bugs */
 	memset (data, 0xff, sizeof (void*) + length);
-	
+
 	/* Store pointer to next allocated block at beginning */
 	*data = cs->allocated;
 	cs->allocated = data;
@@ -136,32 +136,32 @@ call_reset (CallState *cs)
 {
 	void *allocated;
 	void **data;
-	
+
 	assert (cs);
 
 	allocated = cs->allocated;
 	while (allocated) {
 		data = (void**)allocated;
-		
+
 		/* Pointer to the next allocation */
 		allocated = *data;
 		free (data);
 	}
-	
+
 	cs->allocated = NULL;
-	gck_rpc_message_reset (cs->req);
-	gck_rpc_message_reset (cs->resp);
+	gkm_rpc_message_reset (cs->req);
+	gkm_rpc_message_reset (cs->resp);
 }
 
 static void
 call_uninit (CallState *cs)
 {
 	assert (cs);
-	
+
 	call_reset (cs);
-	
-	gck_rpc_message_free (cs->req);
-	gck_rpc_message_free (cs->resp);
+
+	gkm_rpc_message_free (cs->req);
+	gkm_rpc_message_free (cs->resp);
 }
 
 /* -------------------------------------------------------------------
@@ -171,29 +171,29 @@ call_uninit (CallState *cs)
 static CK_RV
 proto_read_byte_buffer (CallState *cs, CK_BYTE_PTR* buffer, CK_ULONG* n_buffer)
 {
-	GckRpcMessage *msg;
+	GkmRpcMessage *msg;
 	uint32_t length;
-	
+
 	assert (cs);
 	assert (buffer);
 	assert (n_buffer);
-	
+
 	msg = cs->req;
-	
+
 	/* Check that we're supposed to be reading this at this point */
-	assert (!msg->signature || gck_rpc_message_verify_part (msg, "fy"));
+	assert (!msg->signature || gkm_rpc_message_verify_part (msg, "fy"));
 
 	/* The number of ulongs there's room for on the other end */
 	if (!egg_buffer_get_uint32 (&msg->buffer, msg->parsed, &msg->parsed, &length))
-		return PARSE_ERROR; 
+		return PARSE_ERROR;
 
 	*n_buffer = length;
 	*buffer = NULL;
-	
-	/* If set to zero, then they just want the length */ 
+
+	/* If set to zero, then they just want the length */
 	if (!length)
 		return CKR_OK;
-	
+
 	*buffer = call_alloc (cs, length * sizeof (CK_BYTE));
 	if (!*buffer)
 		return CKR_DEVICE_MEMORY;
@@ -204,22 +204,22 @@ proto_read_byte_buffer (CallState *cs, CK_BYTE_PTR* buffer, CK_ULONG* n_buffer)
 static CK_RV
 proto_read_byte_array (CallState *cs, CK_BYTE_PTR* array, CK_ULONG* n_array)
 {
-	GckRpcMessage *msg;
+	GkmRpcMessage *msg;
 	const unsigned char *data;
 	unsigned char valid;
 	size_t n_data;
-	
+
 	assert (cs);
-	
+
 	msg = cs->req;
-	
+
 	/* Check that we're supposed to have this at this point */
-	assert (!msg->signature || gck_rpc_message_verify_part (msg, "ay"));
+	assert (!msg->signature || gkm_rpc_message_verify_part (msg, "ay"));
 
 	/* Read out the byte which says whether data is present or not */
 	if (!egg_buffer_get_byte (&msg->buffer, msg->parsed, &msg->parsed, &valid))
 		return PARSE_ERROR;
-	
+
 	if (!valid) {
 		*array = NULL;
 		*n_array = 0;
@@ -230,7 +230,7 @@ proto_read_byte_array (CallState *cs, CK_BYTE_PTR* array, CK_ULONG* n_array)
 	if (!egg_buffer_get_byte_array (&msg->buffer, msg->parsed, &msg->parsed,
 	                                &data, &n_data))
 		return PARSE_ERROR;
-	
+
 	*array = (CK_BYTE_PTR)data;
 	*n_array = n_data;
 	return CKR_OK;
@@ -241,24 +241,24 @@ proto_write_byte_array (CallState *cs, CK_BYTE_PTR array, CK_ULONG len, CK_RV re
 {
 	assert (cs);
 
-	/* 
+	/*
 	 * When returning an byte array, in many cases we need to pass
 	 * an invalid array along with a length, which signifies CKR_BUFFER_TOO_SMALL.
 	 */
-	
+
 	switch (ret) {
 	case CKR_BUFFER_TOO_SMALL:
 		array = NULL;
 		/* fall through */
 	case CKR_OK:
 		break;
-		
+
 	/* Pass all other errors straight through */
 	default:
 		return ret;
 	};
-	
-	if (!gck_rpc_message_write_byte_array (cs->resp, array, len))
+
+	if (!gkm_rpc_message_write_byte_array (cs->resp, array, len))
 		return PREP_ERROR;
 
 	return CKR_OK;
@@ -267,29 +267,29 @@ proto_write_byte_array (CallState *cs, CK_BYTE_PTR array, CK_ULONG len, CK_RV re
 static CK_RV
 proto_read_ulong_buffer (CallState *cs, CK_ULONG_PTR* buffer, CK_ULONG* n_buffer)
 {
-	GckRpcMessage *msg;
+	GkmRpcMessage *msg;
 	uint32_t length;
-	
+
 	assert (cs);
 	assert (buffer);
 	assert (n_buffer);
-	
+
 	msg = cs->req;
-	
+
 	/* Check that we're supposed to be reading this at this point */
-	assert (!msg->signature || gck_rpc_message_verify_part (msg, "fu"));
+	assert (!msg->signature || gkm_rpc_message_verify_part (msg, "fu"));
 
 	/* The number of ulongs there's room for on the other end */
 	if (!egg_buffer_get_uint32 (&msg->buffer, msg->parsed, &msg->parsed, &length))
-		return PARSE_ERROR; 
+		return PARSE_ERROR;
 
 	*n_buffer = length;
 	*buffer = NULL;
-	
-	/* If set to zero, then they just want the length */ 
+
+	/* If set to zero, then they just want the length */
 	if (!length)
 		return CKR_OK;
-	
+
 	*buffer = call_alloc (cs, length * sizeof (CK_ULONG));
 	if (!*buffer)
 		return CKR_DEVICE_MEMORY;
@@ -302,24 +302,24 @@ proto_write_ulong_array (CallState *cs, CK_ULONG_PTR array, CK_ULONG len, CK_RV
 {
 	assert (cs);
 
-	/* 
+	/*
 	 * When returning an ulong array, in many cases we need to pass
 	 * an invalid array along with a length, which signifies CKR_BUFFER_TOO_SMALL.
 	 */
-	
+
 	switch (ret) {
 	case CKR_BUFFER_TOO_SMALL:
 		array = NULL;
 		/* fall through */
 	case CKR_OK:
 		break;
-		
+
 	/* Pass all other errors straight through */
 	default:
 		return ret;
 	};
-	
-	if (!gck_rpc_message_write_ulong_array (cs->resp, array, len))
+
+	if (!gkm_rpc_message_write_ulong_array (cs->resp, array, len))
 		return PREP_ERROR;
 
 	return CKR_OK;
@@ -329,41 +329,41 @@ static CK_RV
 proto_read_attribute_buffer (CallState *cs, CK_ATTRIBUTE_PTR* result, CK_ULONG* n_result)
 {
 	CK_ATTRIBUTE_PTR attrs;
-	GckRpcMessage *msg;
+	GkmRpcMessage *msg;
 	uint32_t n_attrs, i;
 	uint32_t value;
-	
+
 	assert (cs);
 	assert (result);
 	assert (n_result);
-	
+
 	msg = cs->req;
-	
+
 	/* Make sure this is in the rigth order */
-	assert (!msg->signature || gck_rpc_message_verify_part (msg, "fA"));
+	assert (!msg->signature || gkm_rpc_message_verify_part (msg, "fA"));
 
 	/* Read the number of attributes */
 	if (!egg_buffer_get_uint32 (&msg->buffer, msg->parsed, &msg->parsed, &n_attrs))
-		return PARSE_ERROR; 
+		return PARSE_ERROR;
 
 	/* Allocate memory for the attribute structures */
 	attrs = call_alloc (cs, n_attrs * sizeof (CK_ATTRIBUTE));
 	if (!attrs)
 		return CKR_DEVICE_MEMORY;
-	
+
 	/* Now go through and fill in each one */
 	for (i = 0; i < n_attrs; ++i) {
-		
+
 		/* The attribute type */
 		if (!egg_buffer_get_uint32 (&msg->buffer, msg->parsed, &msg->parsed, &value))
 			return PARSE_ERROR;
-		
+
 		attrs[i].type = value;
-		
+
 		/* The number of bytes to allocate */
 		if (!egg_buffer_get_uint32 (&msg->buffer, msg->parsed, &msg->parsed, &value))
 			return PARSE_ERROR;
-		
+
 		if (value == 0) {
 			attrs[i].pValue = NULL;
 			attrs[i].ulValueLen = 0;
@@ -374,7 +374,7 @@ proto_read_attribute_buffer (CallState *cs, CK_ATTRIBUTE_PTR* result, CK_ULONG*
 			attrs[i].ulValueLen = value;
 		}
 	}
-	
+
 	*result = attrs;
 	*n_result = n_attrs;
 	return CKR_OK;
@@ -386,32 +386,32 @@ proto_read_attribute_array (CallState *cs, CK_ATTRIBUTE_PTR* result, CK_ULONG* n
 	CK_ATTRIBUTE_PTR attrs;
 	const unsigned char *data;
 	unsigned char valid;
-	GckRpcMessage *msg;
+	GkmRpcMessage *msg;
 	uint32_t n_attrs, i;
 	uint32_t value;
 	size_t n_data;
-	
+
 	assert (cs);
 	assert (result);
 	assert (n_result);
-	
+
 	msg = cs->req;
-	
+
 	/* Make sure this is in the rigth order */
-	assert (!msg->signature || gck_rpc_message_verify_part (msg, "aA"));
+	assert (!msg->signature || gkm_rpc_message_verify_part (msg, "aA"));
 
 	/* Read the number of attributes */
 	if (!egg_buffer_get_uint32 (&msg->buffer, msg->parsed, &msg->parsed, &n_attrs))
-		return PARSE_ERROR; 
+		return PARSE_ERROR;
 
 	/* Allocate memory for the attribute structures */
 	attrs = call_alloc (cs, n_attrs * sizeof (CK_ATTRIBUTE));
 	if (!attrs)
 		return CKR_DEVICE_MEMORY;
-	
+
 	/* Now go through and fill in each one */
 	for (i = 0; i < n_attrs; ++i) {
-		
+
 		/* The attribute type */
 		if (!egg_buffer_get_uint32 (&msg->buffer, msg->parsed, &msg->parsed, &value))
 			return PARSE_ERROR;
@@ -421,13 +421,13 @@ proto_read_attribute_array (CallState *cs, CK_ATTRIBUTE_PTR* result, CK_ULONG* n
 		/* Whether this one is valid or not */
 		if (!egg_buffer_get_byte (&msg->buffer, msg->parsed, &msg->parsed, &valid))
 			return PARSE_ERROR;
-		
+
 		if (valid) {
 			if (!egg_buffer_get_uint32 (&msg->buffer, msg->parsed, &msg->parsed, &value))
 				return PARSE_ERROR;
 			if (!egg_buffer_get_byte_array (&msg->buffer, msg->parsed, &msg->parsed, &data, &n_data))
 				return PARSE_ERROR;
-			
+
 			if (data != NULL && n_data != value) {
 				g_warning ("attribute length and data do not match");
 				return PARSE_ERROR;
@@ -440,7 +440,7 @@ proto_read_attribute_array (CallState *cs, CK_ATTRIBUTE_PTR* result, CK_ULONG* n
 			attrs[i].ulValueLen = -1;
 		}
 	}
-	
+
 	*result = attrs;
 	*n_result = n_attrs;
 	return CKR_OK;
@@ -451,26 +451,26 @@ proto_write_attribute_array (CallState *cs, CK_ATTRIBUTE_PTR array, CK_ULONG len
 {
 	assert (cs);
 
-	/* 
-	 * When returning an attribute array, certain errors aren't 
-	 * actually real errors, these are passed through to the other 
+	/*
+	 * When returning an attribute array, certain errors aren't
+	 * actually real errors, these are passed through to the other
 	 * side along with the attribute array.
 	 */
-	
+
 	switch (ret) {
 	case CKR_ATTRIBUTE_SENSITIVE:
 	case CKR_ATTRIBUTE_TYPE_INVALID:
 	case CKR_BUFFER_TOO_SMALL:
 	case CKR_OK:
 		break;
-		
+
 	/* Pass all other errors straight through */
 	default:
 		return ret;
 	};
-	
-	if (!gck_rpc_message_write_attribute_array (cs->resp, array, len) ||
-	    !gck_rpc_message_write_ulong (cs->resp, ret))
+
+	if (!gkm_rpc_message_write_attribute_array (cs->resp, array, len) ||
+	    !gkm_rpc_message_write_ulong (cs->resp, ret))
 		return PREP_ERROR;
 
 	return CKR_OK;
@@ -479,56 +479,56 @@ proto_write_attribute_array (CallState *cs, CK_ATTRIBUTE_PTR array, CK_ULONG len
 static CK_RV
 proto_read_null_string (CallState *cs, CK_UTF8CHAR_PTR* val)
 {
-	GckRpcMessage *msg;
+	GkmRpcMessage *msg;
 	const unsigned char *data;
 	size_t n_data;
-	
+
 	assert (cs);
 	assert (val);
-	
+
 	msg = cs->req;
-	
+
 	/* Check that we're supposed to have this at this point */
-	assert (!msg->signature || gck_rpc_message_verify_part (msg, "z"));
+	assert (!msg->signature || gkm_rpc_message_verify_part (msg, "z"));
 
 	if (!egg_buffer_get_byte_array (&msg->buffer, msg->parsed, &msg->parsed, &data, &n_data))
 		return PARSE_ERROR;
-	
+
 	/* Allocate a block of memory for it */
 	*val = call_alloc (cs, n_data);
 	if (!*val)
 		return CKR_DEVICE_MEMORY;
-	
+
 	memcpy (*val, data, n_data);
 	(*val)[n_data] = 0;
-	
+
 	return CKR_OK;
 }
 
 static CK_RV
 proto_read_mechanism (CallState *cs, CK_MECHANISM_PTR mech)
 {
-	GckRpcMessage *msg;
+	GkmRpcMessage *msg;
 	const unsigned char *data;
 	uint32_t value;
 	size_t n_data;
-	
+
 	assert (cs);
 	assert (mech);
-	
+
 	msg = cs->req;
 
 	/* Make sure this is in the right order */
-	assert (!msg->signature || gck_rpc_message_verify_part (msg, "M"));
-	
+	assert (!msg->signature || gkm_rpc_message_verify_part (msg, "M"));
+
 	/* The mechanism type */
 	if (!egg_buffer_get_uint32 (&msg->buffer, msg->parsed, &msg->parsed, &value))
 		return PARSE_ERROR;
-	
+
 	/* The mechanism data */
 	if (!egg_buffer_get_byte_array (&msg->buffer, msg->parsed, &msg->parsed, &data, &n_data))
 		return PARSE_ERROR;
-	
+
 	mech->mechanism = value;
 	mech->pParameter = (CK_VOID_PTR)data;
 	mech->ulParameterLen = n_data;
@@ -538,18 +538,18 @@ proto_read_mechanism (CallState *cs, CK_MECHANISM_PTR mech)
 static CK_RV
 proto_write_info (CallState *cs, CK_INFO_PTR info)
 {
-	GckRpcMessage *msg;
-	
+	GkmRpcMessage *msg;
+
 	assert (cs);
 	assert (info);
-	
+
 	msg = cs->resp;
 
-	if (!gck_rpc_message_write_version (msg, &info->cryptokiVersion) ||
-	    !gck_rpc_message_write_space_string (msg, info->manufacturerID, 32) ||
-	    !gck_rpc_message_write_ulong (msg, info->flags) ||
-	    !gck_rpc_message_write_space_string (msg, info->libraryDescription, 32) ||
-	    !gck_rpc_message_write_version (msg, &info->libraryVersion))
+	if (!gkm_rpc_message_write_version (msg, &info->cryptokiVersion) ||
+	    !gkm_rpc_message_write_space_string (msg, info->manufacturerID, 32) ||
+	    !gkm_rpc_message_write_ulong (msg, info->flags) ||
+	    !gkm_rpc_message_write_space_string (msg, info->libraryDescription, 32) ||
+	    !gkm_rpc_message_write_version (msg, &info->libraryVersion))
 		return PREP_ERROR;
 
 	return CKR_OK;
@@ -558,51 +558,51 @@ proto_write_info (CallState *cs, CK_INFO_PTR info)
 static CK_RV
 proto_write_slot_info (CallState *cs, CK_SLOT_INFO_PTR info)
 {
-	GckRpcMessage *msg;
-	
+	GkmRpcMessage *msg;
+
 	assert (cs);
 	assert (info);
-	
+
 	msg = cs->resp;
 
-	if (!gck_rpc_message_write_space_string (msg, info->slotDescription, 64) ||
-	    !gck_rpc_message_write_space_string (msg, info->manufacturerID, 32) ||
-	    !gck_rpc_message_write_ulong (msg, info->flags) ||
-	    !gck_rpc_message_write_version (msg, &info->hardwareVersion) ||
-	    !gck_rpc_message_write_version (msg, &info->firmwareVersion))
+	if (!gkm_rpc_message_write_space_string (msg, info->slotDescription, 64) ||
+	    !gkm_rpc_message_write_space_string (msg, info->manufacturerID, 32) ||
+	    !gkm_rpc_message_write_ulong (msg, info->flags) ||
+	    !gkm_rpc_message_write_version (msg, &info->hardwareVersion) ||
+	    !gkm_rpc_message_write_version (msg, &info->firmwareVersion))
 		return PREP_ERROR;
-	
+
 	return CKR_OK;
 }
 
 static CK_RV
 proto_write_token_info (CallState *cs, CK_TOKEN_INFO_PTR info)
 {
-	GckRpcMessage *msg;
-	
+	GkmRpcMessage *msg;
+
 	assert (cs);
 	assert (info);
-	
+
 	msg = cs->resp;
 
-	if (!gck_rpc_message_write_space_string (msg, info->label, 32) ||
-	    !gck_rpc_message_write_space_string (msg, info->manufacturerID, 32) ||
-	    !gck_rpc_message_write_space_string (msg, info->model, 16) ||
-	    !gck_rpc_message_write_space_string (msg, info->serialNumber, 16) ||
-	    !gck_rpc_message_write_ulong (msg, info->flags) ||
-	    !gck_rpc_message_write_ulong (msg, info->ulMaxSessionCount) ||
-	    !gck_rpc_message_write_ulong (msg, info->ulSessionCount) ||
-	    !gck_rpc_message_write_ulong (msg, info->ulMaxRwSessionCount) ||
-	    !gck_rpc_message_write_ulong (msg, info->ulRwSessionCount) ||
-	    !gck_rpc_message_write_ulong (msg, info->ulMaxPinLen) ||
-	    !gck_rpc_message_write_ulong (msg, info->ulMinPinLen) ||
-	    !gck_rpc_message_write_ulong (msg, info->ulTotalPublicMemory) ||
-	    !gck_rpc_message_write_ulong (msg, info->ulFreePublicMemory) ||
-	    !gck_rpc_message_write_ulong (msg, info->ulTotalPrivateMemory) ||
-	    !gck_rpc_message_write_ulong (msg, info->ulFreePrivateMemory) ||
-	    !gck_rpc_message_write_version (msg, &info->hardwareVersion) ||
-	    !gck_rpc_message_write_version (msg, &info->firmwareVersion) ||
-	    !gck_rpc_message_write_space_string (msg, info->utcTime, 16))
+	if (!gkm_rpc_message_write_space_string (msg, info->label, 32) ||
+	    !gkm_rpc_message_write_space_string (msg, info->manufacturerID, 32) ||
+	    !gkm_rpc_message_write_space_string (msg, info->model, 16) ||
+	    !gkm_rpc_message_write_space_string (msg, info->serialNumber, 16) ||
+	    !gkm_rpc_message_write_ulong (msg, info->flags) ||
+	    !gkm_rpc_message_write_ulong (msg, info->ulMaxSessionCount) ||
+	    !gkm_rpc_message_write_ulong (msg, info->ulSessionCount) ||
+	    !gkm_rpc_message_write_ulong (msg, info->ulMaxRwSessionCount) ||
+	    !gkm_rpc_message_write_ulong (msg, info->ulRwSessionCount) ||
+	    !gkm_rpc_message_write_ulong (msg, info->ulMaxPinLen) ||
+	    !gkm_rpc_message_write_ulong (msg, info->ulMinPinLen) ||
+	    !gkm_rpc_message_write_ulong (msg, info->ulTotalPublicMemory) ||
+	    !gkm_rpc_message_write_ulong (msg, info->ulFreePublicMemory) ||
+	    !gkm_rpc_message_write_ulong (msg, info->ulTotalPrivateMemory) ||
+	    !gkm_rpc_message_write_ulong (msg, info->ulFreePrivateMemory) ||
+	    !gkm_rpc_message_write_version (msg, &info->hardwareVersion) ||
+	    !gkm_rpc_message_write_version (msg, &info->firmwareVersion) ||
+	    !gkm_rpc_message_write_space_string (msg, info->utcTime, 16))
 		return PREP_ERROR;
 
 	return CKR_OK;
@@ -611,42 +611,42 @@ proto_write_token_info (CallState *cs, CK_TOKEN_INFO_PTR info)
 static CK_RV
 proto_write_mechanism_info (CallState *cs, CK_MECHANISM_INFO_PTR info)
 {
-	GckRpcMessage *msg;
-	
+	GkmRpcMessage *msg;
+
 	assert (cs);
 	assert (info);
-	
+
 	msg = cs->resp;
 
-	if (!gck_rpc_message_write_ulong (msg, info->ulMinKeySize) ||
-	    !gck_rpc_message_write_ulong (msg, info->ulMaxKeySize) ||
-	    !gck_rpc_message_write_ulong (msg, info->flags))
+	if (!gkm_rpc_message_write_ulong (msg, info->ulMinKeySize) ||
+	    !gkm_rpc_message_write_ulong (msg, info->ulMaxKeySize) ||
+	    !gkm_rpc_message_write_ulong (msg, info->flags))
 		return PREP_ERROR;
-	
+
 	return CKR_OK;
 }
 
 static CK_RV
 proto_write_session_info (CallState *cs, CK_SESSION_INFO_PTR info)
 {
-	GckRpcMessage *msg;
-	
+	GkmRpcMessage *msg;
+
 	assert (cs);
 	assert (info);
-	
+
 	msg = cs->resp;
 
-	if (!gck_rpc_message_write_ulong (msg, info->slotID) ||
-	    !gck_rpc_message_write_ulong (msg, info->state) ||
-	    !gck_rpc_message_write_ulong (msg, info->flags) ||
-	    !gck_rpc_message_write_ulong (msg, info->ulDeviceError))
+	if (!gkm_rpc_message_write_ulong (msg, info->slotID) ||
+	    !gkm_rpc_message_write_ulong (msg, info->state) ||
+	    !gkm_rpc_message_write_ulong (msg, info->flags) ||
+	    !gkm_rpc_message_write_ulong (msg, info->ulDeviceError))
 		return PREP_ERROR;
 
 	return CKR_OK;
 }
 
 /* -------------------------------------------------------------------
- * CALL MACROS 
+ * CALL MACROS
  */
 
 #define BEGIN_CALL(call_id) \
@@ -656,12 +656,12 @@ proto_write_session_info (CallState *cs, CK_SESSION_INFO_PTR info)
 	{  \
 		CK_ ## call_id _func = pkcs11_module-> call_id; \
 		CK_RV _ret = CKR_OK; \
-		if (!_func) { _ret = CKR_GENERAL_ERROR; goto _cleanup; } 
-		
+		if (!_func) { _ret = CKR_GENERAL_ERROR; goto _cleanup; }
+
 #define PROCESS_CALL(args)\
-	assert (gck_rpc_message_is_verified (cs->req)); \
-	_ret = _func args 
-	
+	assert (gkm_rpc_message_is_verified (cs->req)); \
+	_ret = _func args
+
 #define END_CALL \
 	_cleanup: \
 		debug (("ret: %d", _ret)); \
@@ -669,11 +669,11 @@ proto_write_session_info (CallState *cs, CK_SESSION_INFO_PTR info)
 	}
 
 #define IN_BYTE(val) \
-	if (!gck_rpc_message_read_byte (cs->req, &val)) \
+	if (!gkm_rpc_message_read_byte (cs->req, &val)) \
 		{ _ret = PARSE_ERROR; goto _cleanup; }
 
 #define IN_ULONG(val) \
-	if (!gck_rpc_message_read_ulong (cs->req, &val)) \
+	if (!gkm_rpc_message_read_ulong (cs->req, &val)) \
 		{ _ret = PARSE_ERROR; goto _cleanup; }
 
 #define IN_STRING(val) \
@@ -706,7 +706,7 @@ proto_write_session_info (CallState *cs, CK_SESSION_INFO_PTR info)
 
 
 #define OUT_ULONG(val) \
-	if (_ret == CKR_OK && !gck_rpc_message_write_ulong (cs->resp, val)) \
+	if (_ret == CKR_OK && !gkm_rpc_message_write_ulong (cs->resp, val)) \
 		_ret = PREP_ERROR;
 
 #define OUT_BYTE_ARRAY(array, len) \
@@ -732,15 +732,15 @@ proto_write_session_info (CallState *cs, CK_SESSION_INFO_PTR info)
 #define OUT_TOKEN_INFO(val) \
 	if (_ret == CKR_OK) \
 		_ret = proto_write_token_info (cs, &val);
-	
+
 #define OUT_MECHANISM_INFO(val) \
 	if (_ret == CKR_OK) \
 		_ret = proto_write_mechanism_info (cs, &val);
-	
+
 #define OUT_SESSION_INFO(val) \
 	if (_ret == CKR_OK) \
 		_ret = proto_write_session_info (cs, &val);
-	
+
 /* ---------------------------------------------------------------------------
  * DISPATCH SPECIFIC CALLS
  */
@@ -751,30 +751,30 @@ rpc_C_Initialize (CallState *cs)
 	CK_BYTE_PTR handshake;
 	CK_ULONG n_handshake;
 	CK_RV ret = CKR_OK;
-	
+
 	debug (("C_Initialize: enter"));
-	
+
 	assert (cs);
 	assert (pkcs11_module);
 
 	ret = proto_read_byte_array (cs, &handshake, &n_handshake);
 	if (ret == CKR_OK) {
-		
+
 		/* Check to make sure the header matches */
-		if (n_handshake != GCK_RPC_HANDSHAKE_LEN ||
-		    memcmp (handshake, GCK_RPC_HANDSHAKE, n_handshake) != 0) {
-			gck_rpc_warn ("invalid handshake received from connecting module");
+		if (n_handshake != GKM_RPC_HANDSHAKE_LEN ||
+		    memcmp (handshake, GKM_RPC_HANDSHAKE, n_handshake) != 0) {
+			gkm_rpc_warn ("invalid handshake received from connecting module");
 			ret = CKR_GENERAL_ERROR;
 		}
 
-		assert (gck_rpc_message_is_verified (cs->req));
+		assert (gkm_rpc_message_is_verified (cs->req));
 	}
-	
-	/* 
+
+	/*
 	 * We don't actually C_Initialize lower layers. It's assumed
-	 * that they'll already be initialzied by the code that loaded us. 
+	 * that they'll already be initialzied by the code that loaded us.
 	 */
-	
+
 	debug (("ret: %d", ret));
 	return ret;
 }
@@ -790,10 +790,10 @@ rpc_C_Finalize (CallState *cs)
 
 	assert (cs);
 	assert (pkcs11_module);
-	
-	/* 
+
+	/*
 	 * We don't actually C_Finalize lower layers, since this would finalize
-	 * for all appartments, client applications. Anyway this is done by 
+	 * for all appartments, client applications. Anyway this is done by
 	 * the code that loaded us.
 	 *
 	 * But we do need to cleanup resources used by this client, so instead
@@ -823,7 +823,7 @@ static CK_RV
 rpc_C_GetInfo (CallState *cs)
 {
 	CK_INFO info;
-	
+
 	BEGIN_CALL (C_GetInfo);
 	PROCESS_CALL ((&info));
 		OUT_INFO (info);
@@ -836,7 +836,7 @@ rpc_C_GetSlotList (CallState *cs)
 	CK_BBOOL token_present;
 	CK_SLOT_ID_PTR slot_list;
 	CK_ULONG count;
-	
+
 	BEGIN_CALL (C_GetSlotList);
 		IN_BYTE (token_present);
 		IN_ULONG_BUFFER (slot_list, count);
@@ -865,9 +865,9 @@ rpc_C_GetTokenInfo (CallState *cs)
 {
 	CK_SLOT_ID slot_id;
 	CK_TOKEN_INFO info;
-	
+
 	/* Slot id becomes appartment so lower layers can tell clients apart. */
-	
+
 	BEGIN_CALL (C_GetTokenInfo);
 		IN_ULONG (slot_id);
 	PROCESS_CALL ((slot_id, &info));
@@ -898,9 +898,9 @@ rpc_C_GetMechanismInfo (CallState *cs)
 	CK_SLOT_ID slot_id;
 	CK_MECHANISM_TYPE type;
 	CK_MECHANISM_INFO info;
-	
+
 	/* Slot id becomes appartment so lower layers can tell clients apart. */
-	
+
 	BEGIN_CALL (C_GetMechanismInfo);
 		IN_ULONG (slot_id);
 		IN_ULONG (type);
@@ -1008,12 +1008,12 @@ rpc_C_CancelFunction (CallState *cs)
 	END_CALL;
 }
 
-static CK_RV 
+static CK_RV
 rpc_C_GetSessionInfo (CallState *cs)
 {
 	CK_SESSION_HANDLE session;
 	CK_SESSION_INFO info;
-	
+
 	/* Get slot id from appartment lower layers use. */
 
 	BEGIN_CALL (C_GetSessionInfo);
@@ -1045,7 +1045,7 @@ rpc_C_SetPIN (CallState *cs)
 	CK_ULONG old_len;
 	CK_UTF8CHAR_PTR new_pin;
 	CK_ULONG new_len;
-	
+
 	BEGIN_CALL (C_SetPIN);
 		IN_ULONG (session);
 		IN_BYTE_ARRAY (old_pin, old_len);
@@ -1060,7 +1060,7 @@ rpc_C_GetOperationState (CallState *cs)
 	CK_SESSION_HANDLE session;
 	CK_BYTE_PTR operation_state;
 	CK_ULONG operation_state_len;
-	
+
 	BEGIN_CALL (C_GetOperationState);
 		IN_ULONG (session);
 		IN_BYTE_BUFFER (operation_state, operation_state_len);
@@ -1204,7 +1204,7 @@ rpc_C_SetAttributeValue (CallState *cs)
 	CK_OBJECT_HANDLE object;
 	CK_ATTRIBUTE_PTR template;
 	CK_ULONG count;
-	
+
 	BEGIN_CALL (C_SetAttributeValue);
 		IN_ULONG (session);
 		IN_ULONG (object);
@@ -1260,7 +1260,7 @@ rpc_C_EncryptInit (CallState *cs)
 	CK_SESSION_HANDLE session;
 	CK_MECHANISM mechanism;
 	CK_OBJECT_HANDLE key;
-	
+
 	BEGIN_CALL (C_EncryptInit);
 		IN_ULONG (session);
 		IN_MECHANISM (mechanism);
@@ -1278,7 +1278,7 @@ rpc_C_Encrypt (CallState *cs)
 	CK_ULONG data_len;
 	CK_BYTE_PTR encrypted_data;
 	CK_ULONG encrypted_data_len;
-	
+
 	BEGIN_CALL (C_Encrypt);
 		IN_ULONG (session);
 		IN_BYTE_ARRAY (data, data_len);
@@ -1296,7 +1296,7 @@ rpc_C_EncryptUpdate (CallState *cs)
 	CK_ULONG part_len;
 	CK_BYTE_PTR encrypted_part;
 	CK_ULONG encrypted_part_len;
-	
+
 	BEGIN_CALL (C_EncryptUpdate);
 		IN_ULONG (session);
 		IN_BYTE_ARRAY (part, part_len);
@@ -1312,7 +1312,7 @@ rpc_C_EncryptFinal (CallState *cs)
 	CK_SESSION_HANDLE session;
 	CK_BYTE_PTR last_encrypted_part;
 	CK_ULONG last_encrypted_part_len;
-	
+
 	BEGIN_CALL (C_EncryptFinal);
 		IN_ULONG (session);
 		IN_BYTE_BUFFER (last_encrypted_part, last_encrypted_part_len);
@@ -1327,7 +1327,7 @@ rpc_C_DecryptInit (CallState *cs)
 	CK_SESSION_HANDLE session;
 	CK_MECHANISM mechanism;
 	CK_OBJECT_HANDLE key;
-	
+
 	BEGIN_CALL (C_DecryptInit);
 		IN_ULONG (session);
 		IN_MECHANISM (mechanism);
@@ -1392,7 +1392,7 @@ rpc_C_DigestInit (CallState *cs)
 {
 	CK_SESSION_HANDLE session;
 	CK_MECHANISM mechanism;
-	
+
 	BEGIN_CALL (C_DigestInit);
 		IN_ULONG (session);
 		IN_MECHANISM (mechanism);
@@ -1408,7 +1408,7 @@ rpc_C_Digest (CallState *cs)
 	CK_ULONG data_len;
 	CK_BYTE_PTR digest;
 	CK_ULONG digest_len;
-	
+
 	BEGIN_CALL (C_Digest);
 		IN_ULONG (session);
 		IN_BYTE_ARRAY (data, data_len);
@@ -1437,7 +1437,7 @@ rpc_C_DigestKey (CallState *cs)
 {
 	CK_SESSION_HANDLE session;
 	CK_OBJECT_HANDLE key;
-	
+
 	BEGIN_CALL (C_DigestKey);
 		IN_ULONG (session);
 		IN_ULONG (key);
@@ -1451,7 +1451,7 @@ rpc_C_DigestFinal (CallState *cs)
 	CK_SESSION_HANDLE session;
 	CK_BYTE_PTR digest;
 	CK_ULONG digest_len;
-	
+
 	BEGIN_CALL (C_DigestFinal);
 		IN_ULONG (session);
 		IN_BYTE_BUFFER (digest, digest_len);
@@ -1466,7 +1466,7 @@ rpc_C_SignInit (CallState *cs)
 	CK_SESSION_HANDLE session;
 	CK_MECHANISM mechanism;
 	CK_OBJECT_HANDLE key;
-	
+
 	BEGIN_CALL (C_SignInit);
 		IN_ULONG (session);
 		IN_MECHANISM (mechanism);
@@ -1514,7 +1514,7 @@ rpc_C_SignFinal (CallState *cs)
 	CK_SESSION_HANDLE session;
 	CK_BYTE_PTR signature;
 	CK_ULONG signature_len;
-	
+
 	BEGIN_CALL (C_SignFinal);
 		IN_ULONG (session);
 		IN_BYTE_BUFFER (signature, signature_len);
@@ -1529,7 +1529,7 @@ rpc_C_SignRecoverInit (CallState *cs)
 	CK_SESSION_HANDLE session;
 	CK_MECHANISM mechanism;
 	CK_OBJECT_HANDLE key;
-	
+
 	BEGIN_CALL (C_SignRecoverInit);
 		IN_ULONG (session);
 		IN_MECHANISM (mechanism);
@@ -1546,7 +1546,7 @@ rpc_C_SignRecover (CallState *cs)
 	CK_ULONG data_len;
 	CK_BYTE_PTR signature;
 	CK_ULONG signature_len;
-	
+
 	BEGIN_CALL (C_SignRecover);
 		IN_ULONG (session);
 		IN_BYTE_ARRAY (data, data_len);
@@ -1562,7 +1562,7 @@ rpc_C_VerifyInit (CallState *cs)
 	CK_SESSION_HANDLE session;
 	CK_MECHANISM mechanism;
 	CK_OBJECT_HANDLE key;
-	
+
 	BEGIN_CALL (C_VerifyInit);
 		IN_ULONG (session);
 		IN_MECHANISM (mechanism);
@@ -1579,7 +1579,7 @@ rpc_C_Verify (CallState *cs)
 	CK_ULONG data_len;
 	CK_BYTE_PTR signature;
 	CK_ULONG signature_len;
-	
+
 	BEGIN_CALL (C_Verify);
 		IN_ULONG (session);
 		IN_BYTE_ARRAY (data, data_len);
@@ -1594,7 +1594,7 @@ rpc_C_VerifyUpdate (CallState *cs)
 	CK_SESSION_HANDLE session;
 	CK_BYTE_PTR part;
 	CK_ULONG part_len;
-	
+
 	BEGIN_CALL (C_VerifyUpdate);
 		IN_ULONG (session);
 		IN_BYTE_ARRAY (part, part_len);
@@ -1608,7 +1608,7 @@ rpc_C_VerifyFinal (CallState *cs)
 	CK_SESSION_HANDLE session;
 	CK_BYTE_PTR signature;
 	CK_ULONG signature_len;
-	
+
 	BEGIN_CALL (C_VerifyFinal);
 		IN_ULONG (session);
 		IN_BYTE_ARRAY (signature, signature_len);
@@ -1622,7 +1622,7 @@ rpc_C_VerifyRecoverInit (CallState *cs)
 	CK_SESSION_HANDLE session;
 	CK_MECHANISM mechanism;
 	CK_OBJECT_HANDLE key;
-	
+
 	BEGIN_CALL (C_VerifyRecoverInit);
 		IN_ULONG (session);
 		IN_MECHANISM (mechanism);
@@ -1639,7 +1639,7 @@ rpc_C_VerifyRecover (CallState *cs)
 	CK_ULONG signature_len;
 	CK_BYTE_PTR data;
 	CK_ULONG data_len;
-	
+
 	BEGIN_CALL (C_VerifyRecover);
 		IN_ULONG (session);
 		IN_BYTE_ARRAY (signature, signature_len);
@@ -1675,7 +1675,7 @@ rpc_C_DecryptDigestUpdate (CallState *cs)
 	CK_ULONG encrypted_part_len;
 	CK_BYTE_PTR part;
 	CK_ULONG part_len;
-	
+
 	BEGIN_CALL (C_DecryptDigestUpdate);
 		IN_ULONG (session);
 		IN_BYTE_ARRAY (encrypted_part, encrypted_part_len);
@@ -1711,7 +1711,7 @@ rpc_C_DecryptVerifyUpdate (CallState *cs)
 	CK_ULONG encrypted_part_len;
 	CK_BYTE_PTR part;
 	CK_ULONG part_len;
-	
+
 	BEGIN_CALL (C_DecryptVerifyUpdate);
 		IN_ULONG (session);
 		IN_BYTE_ARRAY (encrypted_part, encrypted_part_len);
@@ -1733,7 +1733,7 @@ rpc_C_GenerateKey (CallState *cs)
 	CK_ATTRIBUTE_PTR template;
 	CK_ULONG count;
 	CK_OBJECT_HANDLE key;
-	
+
 	BEGIN_CALL (C_GenerateKey);
 		IN_ULONG (session);
 		IN_MECHANISM (mechanism);
@@ -1754,7 +1754,7 @@ rpc_C_GenerateKeyPair (CallState *cs)
 	CK_ULONG private_key_attribute_count;
 	CK_OBJECT_HANDLE public_key;
 	CK_OBJECT_HANDLE private_key;
-	
+
 	BEGIN_CALL (C_GenerateKeyPair);
 		IN_ULONG (session);
 		IN_MECHANISM (mechanism);
@@ -1764,7 +1764,7 @@ rpc_C_GenerateKeyPair (CallState *cs)
 		OUT_ULONG (public_key);
 		OUT_ULONG (private_key);
 	END_CALL;
-	
+
 }
 
 static CK_RV
@@ -1776,7 +1776,7 @@ rpc_C_WrapKey (CallState *cs)
 	CK_OBJECT_HANDLE key;
 	CK_BYTE_PTR wrapped_key;
 	CK_ULONG wrapped_key_len;
-	
+
 	BEGIN_CALL (C_WrapKey);
 		IN_ULONG (session);
 		IN_MECHANISM (mechanism);
@@ -1799,7 +1799,7 @@ rpc_C_UnwrapKey (CallState *cs)
 	CK_ATTRIBUTE_PTR template;
 	CK_ULONG attribute_count;
 	CK_OBJECT_HANDLE key;
-	
+
 	BEGIN_CALL (C_UnwrapKey);
 		IN_ULONG (session);
 		IN_MECHANISM (mechanism);
@@ -1820,7 +1820,7 @@ rpc_C_DeriveKey (CallState *cs)
 	CK_ATTRIBUTE_PTR template;
 	CK_ULONG attribute_count;
 	CK_OBJECT_HANDLE key;
-	
+
 	BEGIN_CALL (C_DeriveKey);
 		IN_ULONG (session);
 		IN_MECHANISM (mechanism);
@@ -1837,7 +1837,7 @@ rpc_C_SeedRandom (CallState *cs)
 	CK_SESSION_HANDLE session;
 	CK_BYTE_PTR seed;
 	CK_ULONG seed_len;
-	
+
 	BEGIN_CALL (C_SeedRandom);
 		IN_ULONG (session);
 		IN_BYTE_ARRAY (seed, seed_len);
@@ -1851,7 +1851,7 @@ rpc_C_GenerateRandom (CallState *cs)
 	CK_SESSION_HANDLE session;
 	CK_BYTE_PTR random_data;
 	CK_ULONG random_len;
-	
+
 	BEGIN_CALL (C_GenerateRandom);
 		IN_ULONG (session);
 		IN_BYTE_BUFFER (random_data, random_len);
@@ -1867,30 +1867,30 @@ rpc_C_GenerateRandom (CallState *cs)
 static int
 dispatch_call (CallState *cs)
 {
-	GckRpcMessage *req, *resp;
+	GkmRpcMessage *req, *resp;
 	CK_RV ret = CKR_OK;
 
 	assert (cs);
-	
+
 	req = cs->req;
 	resp = cs->resp;
 
 	/* This should have been checked by the parsing code */
-	assert (req->call_id > GCK_RPC_CALL_ERROR);
-	assert (req->call_id < GCK_RPC_CALL_MAX);
-	
+	assert (req->call_id > GKM_RPC_CALL_ERROR);
+	assert (req->call_id < GKM_RPC_CALL_MAX);
+
 	/* Prepare a response for the function to fill in */
-	if (!gck_rpc_message_prep (resp, req->call_id, GCK_RPC_RESPONSE)) {
-		gck_rpc_warn ("couldn't prepare message");
+	if (!gkm_rpc_message_prep (resp, req->call_id, GKM_RPC_RESPONSE)) {
+		gkm_rpc_warn ("couldn't prepare message");
 		return 0;
 	}
-	
+
 	switch(req->call_id) {
-	
+
 	#define CASE_CALL(name) \
-		case GCK_RPC_CALL_##name: \
+		case GKM_RPC_CALL_##name: \
 			ret = rpc_##name (cs); \
-			break; 
+			break;
 	CASE_CALL(C_Initialize)
 	CASE_CALL(C_Finalize)
 	CASE_CALL(C_GetInfo)
@@ -1959,7 +1959,7 @@ dispatch_call (CallState *cs)
 	CASE_CALL(C_SeedRandom)
 	CASE_CALL(C_GenerateRandom)
 	#undef CASE_CALL
-	
+
 	default:
 		/* This should have been caught by the parse code */
 		assert (0 && "Unchecked call");
@@ -1967,46 +1967,46 @@ dispatch_call (CallState *cs)
 	};
 
 	if (ret == CKR_OK) {
-		
+
 		/* Parsing errors? */
-		if (gck_rpc_message_buffer_error (req)) {
-			gck_rpc_warn ("invalid request from module, probably too short");
+		if (gkm_rpc_message_buffer_error (req)) {
+			gkm_rpc_warn ("invalid request from module, probably too short");
 			ret = PARSE_ERROR;
 		}
 
 		/* Out of memory errors? */
-		if (gck_rpc_message_buffer_error (resp)) {
-			gck_rpc_warn ("out of memory error putting together message");
+		if (gkm_rpc_message_buffer_error (resp)) {
+			gkm_rpc_warn ("out of memory error putting together message");
 			ret = PREP_ERROR;
 		}
 	}
-	
+
 	/* A filled in response */
 	if (ret == CKR_OK) {
-		
+
 		/*
 		 * Since we're dealing with many many functions above generating
 		 * these messages we want to make sure each of them actually
 		 * does what it's supposed to.
 		 */
 
-		assert (gck_rpc_message_is_verified (resp));
-		assert (resp->call_type == GCK_RPC_RESPONSE);
+		assert (gkm_rpc_message_is_verified (resp));
+		assert (resp->call_type == GKM_RPC_RESPONSE);
 		assert (resp->call_id == req->call_id);
-		assert (gck_rpc_calls[resp->call_id].response);
-		assert (strcmp (gck_rpc_calls[resp->call_id].response, 
+		assert (gkm_rpc_calls[resp->call_id].response);
+		assert (strcmp (gkm_rpc_calls[resp->call_id].response,
 		                resp->signature) == 0);
-		
+
 	/* Fill in an error respnose */
 	} else {
-		if (!gck_rpc_message_prep (resp, GCK_RPC_CALL_ERROR, GCK_RPC_RESPONSE) ||
-		    !gck_rpc_message_write_ulong (resp, (uint32_t)ret) ||
-		    gck_rpc_message_buffer_error (resp)) {
-			gck_rpc_warn ("out of memory responding with error");
+		if (!gkm_rpc_message_prep (resp, GKM_RPC_CALL_ERROR, GKM_RPC_RESPONSE) ||
+		    !gkm_rpc_message_write_ulong (resp, (uint32_t)ret) ||
+		    gkm_rpc_message_buffer_error (resp)) {
+			gkm_rpc_warn ("out of memory responding with error");
 			return 0;
-		}	
+		}
 	}
-	
+
 	return 1;
 }
 
@@ -2014,21 +2014,21 @@ static int
 read_all (int sock, unsigned char* data, size_t len)
 {
 	int r;
-	
+
 	assert (sock >= 0);
 	assert (data);
 	assert (len > 0);
 
 	while (len > 0) {
-	
+
 		r = read (sock, data, len);
-			
+
 		if (r == 0) {
 			/* Connection was closed on client */
 			return 0;
 		} else if (r == -1) {
 			if (errno != EAGAIN && errno != EINTR) {
-				gck_rpc_warn ("couldn't receive data: %s", strerror (errno));
+				gkm_rpc_warn ("couldn't receive data: %s", strerror (errno));
 				return 0;
 			}
 		} else {
@@ -2036,7 +2036,7 @@ read_all (int sock, unsigned char* data, size_t len)
 			len -= r;
 		}
 	}
-	
+
 	return 1;
 }
 
@@ -2050,15 +2050,15 @@ write_all (int sock, unsigned char* data, size_t len)
 	assert (len > 0);
 
 	while (len > 0) {
-	
+
 		r = write (sock, data, len);
-		
+
 		if (r == -1) {
 			if (errno == EPIPE) {
 				/* Connection closed from client */
 				return 0;
 			} else if (errno != EAGAIN && errno != EINTR) {
-				gck_rpc_warn ("couldn't send data: %s", strerror (errno));
+				gkm_rpc_warn ("couldn't send data: %s", strerror (errno));
 				return 0;
 			}
 		} else {
@@ -2066,11 +2066,11 @@ write_all (int sock, unsigned char* data, size_t len)
 			len -= r;
 		}
 	}
-	
+
 	return 1;
 }
 
-static void 
+static void
 run_dispatch_loop (int sock)
 {
 	CallState cs;
@@ -2078,56 +2078,56 @@ run_dispatch_loop (int sock)
 	uid_t uid;
 	unsigned char buf[4];
 	uint32_t len;
-	
+
 	assert (sock != -1);
 
 	if (!egg_unix_credentials_read (sock, &pid, &uid) < 0) {
-		gck_rpc_warn ("couldn't read socket credentials");
+		gkm_rpc_warn ("couldn't read socket credentials");
 		return;
 	}
 
 	/* Setup our buffers */
 	if (!call_init (&cs)) {
-		gck_rpc_warn ("out of memory");
+		gkm_rpc_warn ("out of memory");
 		return;
 	}
-	
+
 	/* The main thread loop */
 	while (TRUE) {
-	
+
 		call_reset (&cs);
-		
+
 		/* Read the number of bytes ... */
 		if (!read_all (sock, buf, 4))
 			break;
 
 		/* Calculate the number of bytes */
 		len = egg_buffer_decode_uint32 (buf);
-		if (len >= 0x0FFFFFFF) { 
-			gck_rpc_warn ("invalid message size from module: %u bytes", len); 
+		if (len >= 0x0FFFFFFF) {
+			gkm_rpc_warn ("invalid message size from module: %u bytes", len);
 			break;
 		}
-		
+
 		/* Allocate memory */
-		egg_buffer_reserve (&cs.req->buffer, cs.req->buffer.len + len); 
+		egg_buffer_reserve (&cs.req->buffer, cs.req->buffer.len + len);
 		if (egg_buffer_has_error (&cs.req->buffer)) {
-			gck_rpc_warn ("error allocating buffer for message");
+			gkm_rpc_warn ("error allocating buffer for message");
 			break;
 		}
-		
+
 		/* ... and read/parse in the actual message */
 		if (!read_all (sock, cs.req->buffer.buf, len))
 			break;
-		
+
 		egg_buffer_add_empty (&cs.req->buffer, len);
-		
-		if (!gck_rpc_message_parse (cs.req, GCK_RPC_REQUEST))
+
+		if (!gkm_rpc_message_parse (cs.req, GKM_RPC_REQUEST))
 			break;
-		
+
 		/* ... send for processing ... */
-		if (!dispatch_call (&cs)) 
+		if (!dispatch_call (&cs))
 			break;
-		
+
 		/* .. send back response length, and then response data */
 		egg_buffer_encode_uint32 (buf, cs.resp->buffer.len);
 		if(!write_all (sock, buf, 4) ||
@@ -2156,14 +2156,14 @@ run_dispatch_thread (void *arg)
 	assert (*sock != -1);
 
 	run_dispatch_loop (*sock);
-	
+
 	/* The thread closes the socket and marks as done */
 	assert (*sock != -1);
 	close (*sock);
 	*sock = -1;
-	
+
 	return NULL;
-}	
+}
 
 /* ---------------------------------------------------------------------------
  * MAIN THREAD
@@ -2184,8 +2184,8 @@ static char *pkcs11_socket_path = NULL;
 /* A linked list of dispatcher threads */
 static DispatchState *pkcs11_dispatchers = NULL;
 
-void 
-gck_rpc_layer_accept (void)
+void
+gkm_rpc_layer_accept (void)
 {
 	struct sockaddr_un addr;
 	DispatchState *ds, **here;
@@ -2199,43 +2199,43 @@ gck_rpc_layer_accept (void)
 	for (here = &pkcs11_dispatchers, ds = *here; ds != NULL; ds = *here) {
 		if (ds->socket == -1) {
 			g_thread_join (ds->thread);
-			*here = ds->next; 
+			*here = ds->next;
 			free (ds);
 		} else {
 			here = &ds->next;
 		}
 	}
-	
+
 	addrlen = sizeof (addr);
 	new_fd = accept (pkcs11_socket, (struct sockaddr*) &addr, &addrlen);
 	if (new_fd < 0) {
-		gck_rpc_warn ("cannot accept pkcs11 connection: %s", strerror (errno));
+		gkm_rpc_warn ("cannot accept pkcs11 connection: %s", strerror (errno));
 		return;
 	}
-	
+
 	ds = calloc (1, sizeof (DispatchState));
 	if (ds == NULL) {
-		gck_rpc_warn ("out of memory");
+		gkm_rpc_warn ("out of memory");
 		close (new_fd);
 		return;
 	}
-	
+
 	ds->socket = new_fd;
-	
+
 	ds->thread = g_thread_create (run_dispatch_thread, &(ds->socket), TRUE, &error);
 	if (!ds->thread) {
-		gck_rpc_warn ("couldn't start thread: %s", egg_error_message (error));
+		gkm_rpc_warn ("couldn't start thread: %s", egg_error_message (error));
 		close (new_fd);
 		free (ds);
 		return;
 	}
-	
+
 	ds->next = pkcs11_dispatchers;
 	pkcs11_dispatchers = ds;
 }
 
 int
-gck_rpc_layer_initialize (CK_FUNCTION_LIST_PTR module)
+gkm_rpc_layer_initialize (CK_FUNCTION_LIST_PTR module)
 {
 	assert (module);
 
@@ -2246,7 +2246,7 @@ gck_rpc_layer_initialize (CK_FUNCTION_LIST_PTR module)
 }
 
 void
-gck_rpc_layer_uninitialize (void)
+gkm_rpc_layer_uninitialize (void)
 {
 	DispatchState *ds, *next;
 
@@ -2286,13 +2286,13 @@ gck_rpc_layer_uninitialize (void)
 }
 
 int
-gck_rpc_layer_startup (const char *prefix)
+gkm_rpc_layer_startup (const char *prefix)
 {
 	struct sockaddr_un addr;
 	int sock;
 
 #ifdef _DEBUG
-	GCK_RPC_CHECK_CALLS ();
+	GKM_RPC_CHECK_CALLS ();
 #endif
 
 	assert (prefix);
@@ -2304,14 +2304,14 @@ gck_rpc_layer_startup (const char *prefix)
 	free (pkcs11_socket_path);
 	pkcs11_socket_path = malloc (strlen (prefix) + strlen ("/pkcs11") + 1);
 	if (pkcs11_socket_path == NULL) {
-		gck_rpc_warn ("couldn't allocate memory");
+		gkm_rpc_warn ("couldn't allocate memory");
 		return -1;
 	}
 	sprintf (pkcs11_socket_path, "%s/pkcs11", prefix);
 
 	sock = socket(AF_UNIX, SOCK_STREAM, 0);
 	if (sock < 0) {
-		gck_rpc_warn ("couldn't create pkcs11 socket: %s", strerror (errno));
+		gkm_rpc_warn ("couldn't create pkcs11 socket: %s", strerror (errno));
 		return -1;
 	}
 
@@ -2320,13 +2320,13 @@ gck_rpc_layer_startup (const char *prefix)
 	unlink (pkcs11_socket_path);
 	strncpy (addr.sun_path, pkcs11_socket_path, sizeof (addr.sun_path));
 	if (bind (sock, (struct sockaddr*)&addr, sizeof (addr)) < 0) {
-		gck_rpc_warn ("couldn't bind to pkcs11 socket: %s: %s", 
+		gkm_rpc_warn ("couldn't bind to pkcs11 socket: %s: %s",
 		                  pkcs11_socket_path, strerror (errno));
 		return -1;
 	}
 
 	if (listen (sock, 128) < 0) {
-		gck_rpc_warn ("couldn't listen on pkcs11 socket: %s: %s", 
+		gkm_rpc_warn ("couldn't listen on pkcs11 socket: %s: %s",
 		                  pkcs11_socket_path, strerror (errno));
 		return -1;
 	}
@@ -2338,12 +2338,12 @@ gck_rpc_layer_startup (const char *prefix)
 }
 
 void
-gck_rpc_layer_shutdown (void)
+gkm_rpc_layer_shutdown (void)
 {
 	DispatchState *ds, *next;
 
 	/* Close our main listening socket */
-	if (pkcs11_socket != -1) 
+	if (pkcs11_socket != -1)
 		close (pkcs11_socket);
 	pkcs11_socket = -1;
 
@@ -2360,12 +2360,12 @@ gck_rpc_layer_shutdown (void)
 	/* Stop all of the dispatch threads */
 	for (; ds; ds = next) {
 		next = ds->next;
-		
+
 		/* Forcibly shutdown the connection */
 		if (ds->socket)
 			shutdown (ds->socket, SHUT_RDWR);
 		g_thread_join (ds->thread);
-		
+
 		/* This is always closed by dispatch thread */
 		assert (ds->socket == -1);
 		free (ds);
diff --git a/pkcs11/rpc-layer/gkm-rpc-layer.h b/pkcs11/rpc-layer/gkm-rpc-layer.h
new file mode 100644
index 0000000..fbaf739
--- /dev/null
+++ b/pkcs11/rpc-layer/gkm-rpc-layer.h
@@ -0,0 +1,25 @@
+#ifndef GKM_RPC_LAYER_H_
+#define GKM_RPC_LAYER_H_
+
+#include "pkcs11/pkcs11.h"
+
+/* ------------------------------------------------------------------
+ * DISPATCHER
+ */
+
+/* Call to initialize the module */
+int                gkm_rpc_layer_initialize             (CK_FUNCTION_LIST_PTR funcs);
+
+/* Should be called to cleanup dispatcher */
+void               gkm_rpc_layer_uninitialize           (void);
+
+/* Call to start listening, returns socket or -1 */
+int                gkm_rpc_layer_startup                (const char *prefix);
+
+/* Accept a new connection. Should be called when above fd has read */
+void               gkm_rpc_layer_accept                 (void);
+
+/* Call to shutdown socket */
+void               gkm_rpc_layer_shutdown               (void);
+
+#endif /* GKM_RPC_LAYER_H_ */
diff --git a/pkcs11/rpc-layer/gck-rpc-message.c b/pkcs11/rpc-layer/gkm-rpc-message.c
similarity index 67%
rename from pkcs11/rpc-layer/gck-rpc-message.c
rename to pkcs11/rpc-layer/gkm-rpc-message.c
index 9312553..b14914d 100644
--- a/pkcs11/rpc-layer/gck-rpc-message.c
+++ b/pkcs11/rpc-layer/gkm-rpc-message.c
@@ -23,8 +23,8 @@
 
 #include "config.h"
 
-#include "gck-rpc-layer.h"
-#include "gck-rpc-private.h"
+#include "gkm-rpc-layer.h"
+#include "gkm-rpc-private.h"
 
 #include <string.h>
 
@@ -34,81 +34,81 @@
 #include <assert.h>
 #endif
 
-GckRpcMessage*
-gck_rpc_message_new (EggBufferAllocator allocator)
+GkmRpcMessage*
+gkm_rpc_message_new (EggBufferAllocator allocator)
 {
-	GckRpcMessage *msg;
-	
+	GkmRpcMessage *msg;
+
 	assert (allocator);
-	
-	msg = (GckRpcMessage*) (allocator)(NULL, sizeof (GckRpcMessage));
+
+	msg = (GkmRpcMessage*) (allocator)(NULL, sizeof (GkmRpcMessage));
 	if (!msg)
 		return NULL;
 	memset (msg, 0, sizeof (*msg));
-	
+
 	if (!egg_buffer_init_full (&msg->buffer, 64, allocator)) {
 		(allocator) (msg, 0); /* Frees allocation */
 		return NULL;
 	}
-	
-	gck_rpc_message_reset (msg);
-	
+
+	gkm_rpc_message_reset (msg);
+
 	return msg;
 }
 
-void 
-gck_rpc_message_free (GckRpcMessage *msg)
+void
+gkm_rpc_message_free (GkmRpcMessage *msg)
 {
 	EggBufferAllocator allocator;
-	
+
 	if (msg) {
 		assert (msg->buffer.allocator);
-		allocator = msg->buffer.allocator; 
+		allocator = msg->buffer.allocator;
 		egg_buffer_uninit (&msg->buffer);
-		
+
 		/* frees data buffer */
 		(allocator) (msg, 0);
 	}
 }
 
-void 
-gck_rpc_message_reset (GckRpcMessage *msg)
+void
+gkm_rpc_message_reset (GkmRpcMessage *msg)
 {
 	assert (msg);
-	
+
 	msg->call_id = 0;
 	msg->call_type = 0;
 	msg->signature = NULL;
 	msg->sigverify = NULL;
 	msg->parsed = 0;
-	
+
 	egg_buffer_reset (&msg->buffer);
 }
 
 int
-gck_rpc_message_prep (GckRpcMessage *msg, int call_id, GckRpcMessageType type)
+gkm_rpc_message_prep (GkmRpcMessage *msg, int call_id, GkmRpcMessageType type)
 {
 	int len;
 
 	assert (type);
-	assert (call_id >= GCK_RPC_CALL_ERROR);
-	assert (call_id < GCK_RPC_CALL_MAX);
-	
-	gck_rpc_message_reset (msg);
+	assert (call_id >= GKM_RPC_CALL_ERROR);
+	assert (call_id < GKM_RPC_CALL_MAX);
 
-	if (call_id != GCK_RPC_CALL_ERROR) {
+	gkm_rpc_message_reset (msg);
+
+	if (call_id != GKM_RPC_CALL_ERROR) {
 
 		/* The call id and signature */
-		if (type == GCK_RPC_REQUEST) 
-			msg->signature = gck_rpc_calls[call_id].request;
-		else if (type == GCK_RPC_RESPONSE)
-			msg->signature = gck_rpc_calls[call_id].response;
+		if (type == GKM_RPC_REQUEST)
+			msg->signature = gkm_rpc_calls[call_id].request;
+		else if (type == GKM_RPC_RESPONSE)
+			msg->signature = gkm_rpc_calls[call_id].response;
 		else
 			assert (0 && "invalid message type");
 		assert (msg->signature);
 		msg->sigverify = msg->signature;
 	}
-	
+
 	msg->call_id = call_id;
 	msg->call_type = type;
 
@@ -123,8 +123,8 @@ gck_rpc_message_prep (GckRpcMessage *msg, int call_id, GckRpcMessageType type)
 	return !egg_buffer_has_error (&msg->buffer);
 }
 
-int 
-gck_rpc_message_parse (GckRpcMessage *msg, GckRpcMessageType type)
+int
+gkm_rpc_message_parse (GkmRpcMessage *msg, GkmRpcMessageType type)
 {
 	const unsigned char *val;
 	size_t len;
@@ -134,31 +134,31 @@ gck_rpc_message_parse (GckRpcMessage *msg, GckRpcMessageType type)
 
 	/* Pull out the call identifier */
 	if (!egg_buffer_get_uint32 (&msg->buffer, msg->parsed, &(msg->parsed), &call_id)) {
-		gck_rpc_warn ("invalid message: couldn't read call identifier");
+		gkm_rpc_warn ("invalid message: couldn't read call identifier");
 		return 0;
 	}
 
 	msg->signature = msg->sigverify = NULL;
 
 	/* If it's an error code then no more processing */
-	if (call_id == GCK_RPC_CALL_ERROR) {
-		if (type == GCK_RPC_REQUEST) {
-			gck_rpc_warn ("invalid message: error code in request");
+	if (call_id == GKM_RPC_CALL_ERROR) {
+		if (type == GKM_RPC_REQUEST) {
+			gkm_rpc_warn ("invalid message: error code in request");
 			return 0;
 		}
-		
+
 		return 1;
 	}
 
 	/* The call id and signature */
-	if (call_id <= 0 || call_id >= GCK_RPC_CALL_MAX) {
-		gck_rpc_warn ("invalid message: bad call id: %d", call_id);
+	if (call_id <= 0 || call_id >= GKM_RPC_CALL_MAX) {
+		gkm_rpc_warn ("invalid message: bad call id: %d", call_id);
 		return 0;
 	}
-	if (type == GCK_RPC_REQUEST) 
-		msg->signature = gck_rpc_calls[call_id].request;
-	else if (type == GCK_RPC_RESPONSE)
-		msg->signature = gck_rpc_calls[call_id].response;
+	if (type == GKM_RPC_REQUEST)
+		msg->signature = gkm_rpc_calls[call_id].request;
+	else if (type == GKM_RPC_RESPONSE)
+		msg->signature = gkm_rpc_calls[call_id].response;
 	else
 		assert (0 && "invalid message type");
 	msg->call_id = call_id;
@@ -167,29 +167,29 @@ gck_rpc_message_parse (GckRpcMessage *msg, GckRpcMessageType type)
 
 	/* Verify the incoming signature */
 	if (!egg_buffer_get_byte_array (&msg->buffer, msg->parsed, &(msg->parsed), &val, &len)) {
-		gck_rpc_warn ("invalid message: couldn't read signature");
+		gkm_rpc_warn ("invalid message: couldn't read signature");
 		return 0;
 	}
-	
+
 	if ((strlen (msg->signature) != len) || (memcmp (val, msg->signature, len) != 0)) {
-		gck_rpc_warn ("invalid message: signature doesn't match");
+		gkm_rpc_warn ("invalid message: signature doesn't match");
 		return 0;
 	}
-	
+
 	return 1;
 }
 
 int
-gck_rpc_message_equals (GckRpcMessage *m1, GckRpcMessage *m2)
+gkm_rpc_message_equals (GkmRpcMessage *m1, GkmRpcMessage *m2)
 {
 	assert (m1 && m2);
-	
+
 	/* Any errors and messages are never equal */
-	if (egg_buffer_has_error (&m1->buffer) || 
+	if (egg_buffer_has_error (&m1->buffer) ||
 	    egg_buffer_has_error (&m2->buffer))
 		return 0;
 
-	/* Calls and signatures must be identical */	
+	/* Calls and signatures must be identical */
 	if (m1->call_id != m2->call_id)
 		return 0;
 	if (m1->call_type != m2->call_type)
@@ -200,16 +200,16 @@ gck_rpc_message_equals (GckRpcMessage *m1, GckRpcMessage *m2)
 	} else if (m1->signature != m2->signature) {
 		return 0;
 	}
-		
+
 	/* Data in buffer must be identical */
 	return egg_buffer_equal (&m1->buffer, &m2->buffer);
 }
 
-int 
-gck_rpc_message_verify_part (GckRpcMessage *msg, const char* part)
+int
+gkm_rpc_message_verify_part (GkmRpcMessage *msg, const char* part)
 {
 	int len, ok;
-	
+
 	if (!msg->sigverify)
 		return 1;
 
@@ -221,7 +221,7 @@ gck_rpc_message_verify_part (GckRpcMessage *msg, const char* part)
 }
 
 int
-gck_rpc_message_write_attribute_buffer (GckRpcMessage *msg, CK_ATTRIBUTE_PTR arr, 
+gkm_rpc_message_write_attribute_buffer (GkmRpcMessage *msg, CK_ATTRIBUTE_PTR arr,
                                         CK_ULONG num)
 {
 	CK_ATTRIBUTE_PTR attr;
@@ -231,11 +231,11 @@ gck_rpc_message_write_attribute_buffer (GckRpcMessage *msg, CK_ATTRIBUTE_PTR arr
 	assert (msg);
 
 	/* Make sure this is in the rigth order */
-	assert (!msg->signature || gck_rpc_message_verify_part (msg, "fA"));
-	
+	assert (!msg->signature || gkm_rpc_message_verify_part (msg, "fA"));
+
 	/* Write the number of items */
 	egg_buffer_add_uint32 (&msg->buffer, num);
-	
+
 	for (i = 0; i < num; ++i) {
 		attr = &(arr[i]);
 
@@ -246,11 +246,11 @@ gck_rpc_message_write_attribute_buffer (GckRpcMessage *msg, CK_ATTRIBUTE_PTR arr
 		egg_buffer_add_uint32 (&msg->buffer, attr->pValue ? attr->ulValueLen : 0);
 	}
 
-	return !egg_buffer_has_error (&msg->buffer);	
+	return !egg_buffer_has_error (&msg->buffer);
 }
 
 int
-gck_rpc_message_write_attribute_array (GckRpcMessage *msg, 
+gkm_rpc_message_write_attribute_array (GkmRpcMessage *msg,
                                        CK_ATTRIBUTE_PTR arr, CK_ULONG num)
 {
 	CK_ULONG i;
@@ -261,11 +261,11 @@ gck_rpc_message_write_attribute_array (GckRpcMessage *msg,
 	assert (msg);
 
 	/* Make sure this is in the rigth order */
-	assert (!msg->signature || gck_rpc_message_verify_part (msg, "aA"));
-	
+	assert (!msg->signature || gkm_rpc_message_verify_part (msg, "aA"));
+
 	/* Write the number of items */
 	egg_buffer_add_uint32 (&msg->buffer, num);
-	
+
 	for (i = 0; i < num; ++i) {
 		attr = &(arr[i]);
 
@@ -287,33 +287,33 @@ gck_rpc_message_write_attribute_array (GckRpcMessage *msg,
 }
 
 int
-gck_rpc_message_read_byte (GckRpcMessage *msg, CK_BYTE *val)
+gkm_rpc_message_read_byte (GkmRpcMessage *msg, CK_BYTE *val)
 {
 	assert (msg);
 
 	/* Make sure this is in the right order */
-	assert (!msg->signature || gck_rpc_message_verify_part (msg, "y"));
+	assert (!msg->signature || gkm_rpc_message_verify_part (msg, "y"));
 	return egg_buffer_get_byte (&msg->buffer, msg->parsed, &msg->parsed, val);
 }
 
 int
-gck_rpc_message_write_byte (GckRpcMessage *msg, CK_BYTE val)
+gkm_rpc_message_write_byte (GkmRpcMessage *msg, CK_BYTE val)
 {
 	assert (msg);
 
 	/* Make sure this is in the right order */
-	assert (!msg->signature || gck_rpc_message_verify_part (msg, "y"));
+	assert (!msg->signature || gkm_rpc_message_verify_part (msg, "y"));
 	return egg_buffer_add_byte (&msg->buffer, val);
 }
 
 int
-gck_rpc_message_read_ulong (GckRpcMessage *msg, CK_ULONG *val)
+gkm_rpc_message_read_ulong (GkmRpcMessage *msg, CK_ULONG *val)
 {
 	uint64_t v;
 	assert (msg);
-	
+
 	/* Make sure this is in the right order */
-	assert (!msg->signature || gck_rpc_message_verify_part (msg, "u"));
+	assert (!msg->signature || gkm_rpc_message_verify_part (msg, "u"));
 
 	if (!egg_buffer_get_uint64 (&msg->buffer, msg->parsed, &msg->parsed, &v))
 		return 0;
@@ -323,33 +323,33 @@ gck_rpc_message_read_ulong (GckRpcMessage *msg, CK_ULONG *val)
 }
 
 int
-gck_rpc_message_write_ulong (GckRpcMessage *msg, CK_ULONG val)
+gkm_rpc_message_write_ulong (GkmRpcMessage *msg, CK_ULONG val)
 {
 	assert (msg);
 
 	/* Make sure this is in the rigth order */
-	assert (!msg->signature || gck_rpc_message_verify_part (msg, "u"));
+	assert (!msg->signature || gkm_rpc_message_verify_part (msg, "u"));
 	return egg_buffer_add_uint64 (&msg->buffer, val);
 }
 
 int
-gck_rpc_message_write_byte_buffer (GckRpcMessage *msg, CK_ULONG count)
+gkm_rpc_message_write_byte_buffer (GkmRpcMessage *msg, CK_ULONG count)
 {
 	assert (msg);
 
 	/* Make sure this is in the right order */
-	assert (!msg->signature || gck_rpc_message_verify_part (msg, "fy"));
+	assert (!msg->signature || gkm_rpc_message_verify_part (msg, "fy"));
 	return egg_buffer_add_uint32 (&msg->buffer, count);
 }
 
 int
-gck_rpc_message_write_byte_array (GckRpcMessage *msg, CK_BYTE_PTR arr, CK_ULONG num)
+gkm_rpc_message_write_byte_array (GkmRpcMessage *msg, CK_BYTE_PTR arr, CK_ULONG num)
 {
 	assert (msg);
 
 	/* Make sure this is in the right order */
-	assert (!msg->signature || gck_rpc_message_verify_part (msg, "ay"));
-	
+	assert (!msg->signature || gkm_rpc_message_verify_part (msg, "ay"));
+
 	/* No array, no data, just length */
 	if (!arr) {
 		egg_buffer_add_byte (&msg->buffer, 0);
@@ -358,114 +358,114 @@ gck_rpc_message_write_byte_array (GckRpcMessage *msg, CK_BYTE_PTR arr, CK_ULONG
 		egg_buffer_add_byte (&msg->buffer, 1);
 		egg_buffer_add_byte_array (&msg->buffer, arr, num);
 	}
-	
+
 	return !egg_buffer_has_error (&msg->buffer);
 }
 
 int
-gck_rpc_message_write_ulong_buffer (GckRpcMessage *msg, CK_ULONG count)
+gkm_rpc_message_write_ulong_buffer (GkmRpcMessage *msg, CK_ULONG count)
 {
 	assert (msg);
 
 	/* Make sure this is in the right order */
-	assert (!msg->signature || gck_rpc_message_verify_part (msg, "fu"));
+	assert (!msg->signature || gkm_rpc_message_verify_part (msg, "fu"));
 	return egg_buffer_add_uint32 (&msg->buffer, count);
 }
 
 int
-gck_rpc_message_write_ulong_array (GckRpcMessage *msg, CK_ULONG_PTR array, CK_ULONG n_array)
+gkm_rpc_message_write_ulong_array (GkmRpcMessage *msg, CK_ULONG_PTR array, CK_ULONG n_array)
 {
 	CK_ULONG i;
-	
+
 	assert (msg);
-	
+
 	/* Check that we're supposed to have this at this point */
-	assert (!msg->signature || gck_rpc_message_verify_part (msg, "au"));
+	assert (!msg->signature || gkm_rpc_message_verify_part (msg, "au"));
 
 	/* We send a byte which determines whether there's actual data present or not */
 	egg_buffer_add_byte (&msg->buffer, array ? 1 : 0);
 	egg_buffer_add_uint32 (&msg->buffer, n_array);
-	
+
 	/* Now send the data if valid */
 	if (array) {
 		for (i = 0; i < n_array; ++i)
-			egg_buffer_add_uint64 (&msg->buffer, array[i]); 
+			egg_buffer_add_uint64 (&msg->buffer, array[i]);
 	}
-	
+
 	return !egg_buffer_has_error (&msg->buffer);
 }
 
 int
-gck_rpc_message_read_version (GckRpcMessage *msg, CK_VERSION* version)
+gkm_rpc_message_read_version (GkmRpcMessage *msg, CK_VERSION* version)
 {
 	assert (msg);
 	assert (version);
-	
+
 	/* Check that we're supposed to have this at this point */
-	assert (!msg->signature || gck_rpc_message_verify_part (msg, "v"));
+	assert (!msg->signature || gkm_rpc_message_verify_part (msg, "v"));
 
 	return egg_buffer_get_byte (&msg->buffer, msg->parsed, &msg->parsed, &version->major) &&
 	       egg_buffer_get_byte (&msg->buffer, msg->parsed, &msg->parsed, &version->minor);
 }
 
 int
-gck_rpc_message_write_version (GckRpcMessage *msg, CK_VERSION* version)
+gkm_rpc_message_write_version (GkmRpcMessage *msg, CK_VERSION* version)
 {
 	assert (msg);
 	assert (version);
-	
+
 	/* Check that we're supposed to have this at this point */
-	assert (!msg->signature || gck_rpc_message_verify_part (msg, "v"));
+	assert (!msg->signature || gkm_rpc_message_verify_part (msg, "v"));
 
 	egg_buffer_add_byte (&msg->buffer, version->major);
 	egg_buffer_add_byte (&msg->buffer, version->minor);
 
-	return !egg_buffer_has_error (&msg->buffer);	
+	return !egg_buffer_has_error (&msg->buffer);
 }
 
 int
-gck_rpc_message_read_space_string (GckRpcMessage *msg, CK_UTF8CHAR* buffer, CK_ULONG length)
+gkm_rpc_message_read_space_string (GkmRpcMessage *msg, CK_UTF8CHAR* buffer, CK_ULONG length)
 {
 	const unsigned char *data;
 	size_t n_data;
-	
+
 	assert (msg);
 	assert (buffer);
 	assert (length);
-	
-	assert (!msg->signature || gck_rpc_message_verify_part (msg, "s"));
-	
+
+	assert (!msg->signature || gkm_rpc_message_verify_part (msg, "s"));
+
 	if (!egg_buffer_get_byte_array (&msg->buffer, msg->parsed, &msg->parsed, &data, &n_data))
 		return 0;
-	
+
 	if (n_data != length) {
-		gck_rpc_warn ("invalid length space padded string received: %d != %d", length, n_data);
+		gkm_rpc_warn ("invalid length space padded string received: %d != %d", length, n_data);
 		return 0;
 	}
-	
+
 	memcpy (buffer, data, length);
 	return 1;
 }
 
 int
-gck_rpc_message_write_space_string (GckRpcMessage *msg, CK_UTF8CHAR* buffer, CK_ULONG length)
+gkm_rpc_message_write_space_string (GkmRpcMessage *msg, CK_UTF8CHAR* buffer, CK_ULONG length)
 {
 	assert (msg);
 	assert (buffer);
 	assert (length);
-	
-	assert (!msg->signature || gck_rpc_message_verify_part (msg, "s"));
-	
+
+	assert (!msg->signature || gkm_rpc_message_verify_part (msg, "s"));
+
 	return egg_buffer_add_byte_array (&msg->buffer, buffer, length);
 }
 
 int
-gck_rpc_message_write_zero_string (GckRpcMessage *msg, CK_UTF8CHAR* string)
+gkm_rpc_message_write_zero_string (GkmRpcMessage *msg, CK_UTF8CHAR* string)
 {
 	assert (msg);
 	assert (string);
 
-	assert (!msg->signature || gck_rpc_message_verify_part (msg, "z"));
-	
+	assert (!msg->signature || gkm_rpc_message_verify_part (msg, "z"));
+
 	return egg_buffer_add_string (&msg->buffer, (const char*)string);
 }
diff --git a/pkcs11/rpc-layer/gck-rpc-module.c b/pkcs11/rpc-layer/gkm-rpc-module.c
similarity index 87%
rename from pkcs11/rpc-layer/gck-rpc-module.c
rename to pkcs11/rpc-layer/gkm-rpc-module.c
index f3c1c60..5172988 100644
--- a/pkcs11/rpc-layer/gck-rpc-module.c
+++ b/pkcs11/rpc-layer/gkm-rpc-module.c
@@ -23,8 +23,8 @@
 
 #include "config.h"
 
-#include "gck-rpc-layer.h"
-#include "gck-rpc-private.h"
+#include "gkm-rpc-layer.h"
+#include "gkm-rpc-private.h"
 
 #include "pkcs11/pkcs11.h"
 
@@ -69,17 +69,17 @@ static char *pkcs11_socket_path = NULL;
  */
 
 #if DEBUG_OUTPUT
-#define debug(x) gck_rpc_debug x
+#define debug(x) gkm_rpc_debug x
 #else
-#define debug(x)	
-#endif 
-#define warning(x) gck_rpc_warn x
+#define debug(x)
+#endif
+#define warning(x) gkm_rpc_warn x
 
 #define return_val_if_fail(x, v) \
-	if (!(x)) { gck_rpc_warn ("'%s' not true at %s", #x, __func__); return v; } 
+	if (!(x)) { gkm_rpc_warn ("'%s' not true at %s", #x, __func__); return v; }
 
-void 
-gck_rpc_log (const char *line)
+void
+gkm_rpc_log (const char *line)
 {
 	fprintf (stderr, "%s\n", line);
 }
@@ -92,11 +92,11 @@ static void
 parse_argument (char *arg)
 {
 	char *value;
-	
+
 	value = arg + strcspn (arg, ":=");
 	if (!*value)
 		value = NULL;
-	else 
+	else
 		*(value++) = 0;
 
 	/* Setup the socket path from the arguments */
@@ -109,14 +109,14 @@ parse_argument (char *arg)
 }
 
 static void
-parse_arguments (const char *string) 
+parse_arguments (const char *string)
 {
 	char quote = '\0';
 	char *src, *dup, *at, *arg;
-	
+
 	if (!string)
 		return;
-	
+
 	src = dup = strdup (string);
 	if (!dup) {
 		warning (("couldn't allocate memory for argument string"));
@@ -125,11 +125,11 @@ parse_arguments (const char *string)
 
 	arg = at = src;
 	for (src = dup; *src; src++) {
-		
+
 		/* Matching quote */
 		if (quote == *src) {
 			quote = '\0';
-			
+
 		/* Inside of quotes */
 		} else if (quote != '\0') {
 			if (*src == '\\') {
@@ -138,17 +138,17 @@ parse_arguments (const char *string)
 					warning (("couldn't parse argument string: %s", string));
 					goto done;
 				}
-				if (*src != quote) 
+				if (*src != quote)
 					*at++ = '\\';
 			}
 			*at++ = *src;
-			
+
 		/* Space, not inside of quotes */
 		} else if (isspace(*src)) {
 			*at = 0;
 			parse_argument (arg);
 			arg = at;
-			
+
 		/* Other character outside of quotes */
 		} else {
 			switch (*src) {
@@ -170,10 +170,10 @@ parse_arguments (const char *string)
 		}
 	}
 
-	
-	if (at != arg) 
+
+	if (at != arg)
 		parse_argument (arg);
-	
+
 done:
 	free (dup);
 }
@@ -192,8 +192,8 @@ enum CallStatus {
 
 typedef struct _CallState {
 	int socket;                  /* The connection we're sending on */
-	GckRpcMessage *req;          /* The current request */
-	GckRpcMessage *resp;         /* The current response */
+	GkmRpcMessage *req;          /* The current request */
+	GkmRpcMessage *resp;         /* The current response */
 	int call_status;
 	struct _CallState *next;     /* For pooling of completed sockets */
 } CallState;
@@ -215,7 +215,7 @@ call_allocator (void* p, size_t sz)
 	void* res = realloc (p, (size_t)sz);
 	if (!res && sz)
 		warning (("memory allocation of %lu bytes failed", sz));
-	return res;	
+	return res;
 }
 
 static CK_RV
@@ -234,10 +234,10 @@ call_connect (CallState *cs)
 	}
 
 	debug (("connecting to: %s", pkcs11_socket_path));
-		
+
 	addr.sun_family = AF_UNIX;
 	strncpy (addr.sun_path, pkcs11_socket_path, sizeof (addr.sun_path));
-	
+
 	sock = socket (AF_UNIX, SOCK_STREAM, 0);
 	if (sock < 0) {
 		warning (("couldn't open socket: %s", strerror (errno)));
@@ -266,7 +266,7 @@ call_connect (CallState *cs)
 	cs->socket = sock;
 	cs->call_status = CALL_READY;
 	debug (("connected socket"));
-	
+
 	return CKR_OK;
 }
 
@@ -274,7 +274,7 @@ static void
 call_disconnect (CallState *cs)
 {
 	assert (cs);
-	
+
 	if (cs->socket != -1) {
 		debug (("disconnected socket"));
 		close (cs->socket);
@@ -286,16 +286,16 @@ static void
 call_destroy (void *value)
 {
 	CallState *cs = value;
-	
+
 	if (value) {
 		call_disconnect (cs);
 		assert (cs->socket == -1);
 
-		gck_rpc_message_free (cs->req);
-		gck_rpc_message_free (cs->resp);
-		
+		gkm_rpc_message_free (cs->req);
+		gkm_rpc_message_free (cs->resp);
+
 		free (cs);
-		
+
 		debug (("destroyed state"));
 	}
 }
@@ -305,7 +305,7 @@ call_lookup (CallState **ret)
 {
 	CallState *cs = NULL;
 	CK_RV rv;
-	
+
 	assert (ret);
 
 	pthread_mutex_lock (&call_state_mutex);
@@ -316,11 +316,11 @@ call_lookup (CallState **ret)
 			call_state_pool = cs->next;
 			cs->next = NULL;
 			assert (n_call_state_pool > 0);
-			--n_call_state_pool; 
+			--n_call_state_pool;
 		}
-	
+
 	pthread_mutex_unlock (&call_state_mutex);
-	
+
 	if (cs == NULL) {
 		cs = calloc(1, sizeof (CallState));
 		if (cs == NULL)
@@ -335,7 +335,7 @@ call_lookup (CallState **ret)
 			return rv;
 		}
 	}
-	
+
 	assert (cs->call_status == CALL_READY);
 	assert (cs->socket != -1);
 	assert (cs->next == NULL);
@@ -352,18 +352,18 @@ call_prepare (CallState *cs, int call_id)
 
 	/* Allocate a new request if we've lost the old one */
 	if (!cs->req) {
-		cs->req = gck_rpc_message_new (call_allocator);
+		cs->req = gkm_rpc_message_new (call_allocator);
 		if (!cs->req) {
 			warning (("cannot allocate request buffer: out of memory"));
 			return CKR_HOST_MEMORY;
 		}
 	}
-	
+
 	/* Put in the Call ID and signature */
-	gck_rpc_message_reset (cs->req);
-	if (!gck_rpc_message_prep (cs->req, call_id, GCK_RPC_REQUEST))
+	gkm_rpc_message_reset (cs->req);
+	if (!gkm_rpc_message_prep (cs->req, call_id, GKM_RPC_REQUEST))
 		return CKR_HOST_MEMORY;
-	
+
 	debug (("prepared call: %d", call_id));
 
 	/* Ready to fill in arguments */
@@ -382,15 +382,15 @@ call_write (CallState *cs, unsigned char* data, size_t len)
 	assert (len > 0);
 
 	while (len > 0) {
-	
+
 		fd = cs->socket;
 		if (fd == -1) {
 			warning (("couldn't send data: socket has been closed"));
 			return CKR_DEVICE_ERROR;
 		}
-		
+
 		r = write (fd, data, len);
-		
+
 		if (r == -1) {
 			if (errno == EPIPE) {
 				warning (("couldn't send data: daemon closed connection"));
@@ -406,7 +406,7 @@ call_write (CallState *cs, unsigned char* data, size_t len)
 			len -= r;
 		}
 	}
-	
+
 	return CKR_OK;
 }
 
@@ -421,15 +421,15 @@ call_read (CallState *cs, unsigned char* data, size_t len)
 	assert (len > 0);
 
 	while (len > 0) {
-	
+
 		fd = cs->socket;
 		if (fd == -1) {
 			warning (("couldn't receive data: session socket has been closed"));
 			return CKR_DEVICE_ERROR;
 		}
-		
+
 		r = read (fd, data, len);
-		
+
 		if (r == 0) {
 			warning (("couldn't receive data: daemon closed connection"));
 			call_disconnect (cs);
@@ -445,42 +445,42 @@ call_read (CallState *cs, unsigned char* data, size_t len)
 			len -= r;
 		}
 	}
-	
+
 	return CKR_OK;
 }
 
-/* 
+/*
  * Used by call_session_do_call() to actually send the message to the daemon.
- * Note how we unlock and relock the session during the call. 
+ * Note how we unlock and relock the session during the call.
  */
 static CK_RV
 call_send_recv (CallState *cs)
 {
-	GckRpcMessage *req, *resp;
+	GkmRpcMessage *req, *resp;
 	unsigned char buf[4];
 	uint32_t len;
 	CK_RV ret;
-	
+
 	assert (cs);
 	assert (cs->req);
 	assert (cs->call_status == CALL_PREP);
-	
+
 	cs->call_status = CALL_TRANSIT;
-	
+
 	/* Setup the response buffer properly */
 	if (!cs->resp) {
 		/* TODO: Do secrets or passwords ever flow through here? */
-		cs->resp = gck_rpc_message_new (call_allocator);
+		cs->resp = gkm_rpc_message_new (call_allocator);
 		if (!cs->resp) {
 			warning (("couldn't allocate response buffer: out of memory"));
 			return CKR_HOST_MEMORY;
 		}
 	}
-	gck_rpc_message_reset (cs->resp);
-	
-	/* 
+	gkm_rpc_message_reset (cs->resp);
+
+	/*
 	 * Now as an additional check to make sure nothing nasty will
-	 * happen while we are unlocked, we remove the request and 
+	 * happen while we are unlocked, we remove the request and
 	 * response from the session during the action.
 	 */
 	req = cs->req;
@@ -495,10 +495,10 @@ call_send_recv (CallState *cs)
 	ret = call_write (cs, req->buffer.buf, req->buffer.len);
 	if (ret != CKR_OK)
 		goto cleanup;
-	
+
 	/* Now read out the number of bytes, and then the data */
 	ret = call_read (cs, buf, 4);
-	if (ret != CKR_OK) 
+	if (ret != CKR_OK)
 		goto cleanup;
 	len = egg_buffer_decode_uint32 (buf);
 	if (!egg_buffer_reserve (&resp->buffer, len + resp->buffer.len)) {
@@ -509,13 +509,13 @@ call_send_recv (CallState *cs)
 	ret = call_read (cs, resp->buffer.buf, len);
 	if (ret != CKR_OK)
 		goto cleanup;
-	
+
 	egg_buffer_add_empty (&resp->buffer, len);
-	if (!gck_rpc_message_parse (resp, GCK_RPC_RESPONSE))
+	if (!gkm_rpc_message_parse (resp, GKM_RPC_RESPONSE))
 		goto cleanup;
-	
+
 	debug (("received response from daemon"));
-	
+
 cleanup:
 	/* Make sure nobody else used this thread while unlocked */
 	assert (cs->call_status == CALL_TRANSIT);
@@ -523,13 +523,13 @@ cleanup:
 	cs->resp = resp;
 	assert (cs->req == NULL);
 	cs->req = req;
-	
+
 	return ret;
 }
 
-/* 
- * At this point the request is ready. So we validate it, and we send it to 
- * the daemon for a response. 
+/*
+ * At this point the request is ready. So we validate it, and we send it to
+ * the daemon for a response.
  */
 static CK_RV
 call_run (CallState *cs)
@@ -543,26 +543,26 @@ call_run (CallState *cs)
 	assert (cs->socket != -1);
 
 	/* Did building the call fail? */
-	if (gck_rpc_message_buffer_error (cs->req)) {
+	if (gkm_rpc_message_buffer_error (cs->req)) {
 		warning (("couldn't allocate request area: out of memory"));
 		return CKR_HOST_MEMORY;
 	}
 
 	/* Make sure that the signature is valid */
-	assert (gck_rpc_message_is_verified (cs->req));
+	assert (gkm_rpc_message_is_verified (cs->req));
 
 	/* Do the dialog with daemon */
 	ret = call_send_recv (cs);
-	
+
 	cs->call_status = CALL_PARSE;
-	
+
 	if (ret != CKR_OK)
 		return ret;
 
 	/* If it's an error code then return it */
-	if (cs->resp->call_id == GCK_RPC_CALL_ERROR) {
+	if (cs->resp->call_id == GKM_RPC_CALL_ERROR) {
 
-		if (!gck_rpc_message_read_ulong (cs->resp, &ckerr)) {
+		if (!gkm_rpc_message_read_ulong (cs->resp, &ckerr)) {
 			warning (("invalid error response from gnome-keyring-daemon: too short"));
 			return CKR_DEVICE_ERROR;
 		}
@@ -575,14 +575,14 @@ call_run (CallState *cs)
 		/* An error code from the daemon */
 		return (CK_RV)ckerr;
 	}
-	
+
 	/* Make sure daemon answered the right call */
 	if (cs->req->call_id != cs->resp->call_id) {
 		warning (("invalid response from gnome-keyring-daemon: call mismatch"));
 		return CKR_DEVICE_ERROR;
 	}
 
-	assert (!gck_rpc_message_buffer_error (cs->resp));
+	assert (!gkm_rpc_message_buffer_error (cs->resp));
 	debug (("parsing response values"));
 
 	return CKR_OK;
@@ -599,14 +599,14 @@ call_done (CallState *cs, CK_RV ret)
 		/* Check for parsing errors that were not caught elsewhere */
 		if (ret == CKR_OK) {
 
-			if (gck_rpc_message_buffer_error (cs->resp)) {
+			if (gkm_rpc_message_buffer_error (cs->resp)) {
 				warning (("invalid response from gnome-keyring-daemon: bad argument data"));
 				ret = CKR_GENERAL_ERROR;
 			} else {
 				/* Double check that the signature matched our decoding */
-				assert (gck_rpc_message_is_verified (cs->resp));
+				assert (gkm_rpc_message_is_verified (cs->resp));
 			}
-		} 
+		}
 	}
 
 	/* Certain error codes cause us to discard the conenction */
@@ -614,7 +614,7 @@ call_done (CallState *cs, CK_RV ret)
 
 		/* Try and stash it away for later use */
 		pthread_mutex_lock (&call_state_mutex);
-		
+
 			if (n_call_state_pool < MAX_CALL_STATE_POOL) {
 				cs->call_status = CALL_READY;
 				assert (cs->next == NULL);
@@ -623,10 +623,10 @@ call_done (CallState *cs, CK_RV ret)
 				++n_call_state_pool;
 				cs = NULL;
 			}
-		
+
 		pthread_mutex_unlock (&call_state_mutex);
 	}
-	
+
 	if (cs != NULL)
 		call_destroy (cs);
 
@@ -638,7 +638,7 @@ call_done (CallState *cs, CK_RV ret)
  */
 
 static CK_RV
-proto_read_attribute_array (GckRpcMessage *msg, CK_ATTRIBUTE_PTR arr, CK_ULONG len)
+proto_read_attribute_array (GkmRpcMessage *msg, CK_ATTRIBUTE_PTR arr, CK_ULONG len)
 {
 	uint32_t i, num, value, type;
 	CK_ATTRIBUTE_PTR attr;
@@ -651,16 +651,16 @@ proto_read_attribute_array (GckRpcMessage *msg, CK_ATTRIBUTE_PTR arr, CK_ULONG l
 	assert (msg);
 
 	/* Make sure this is in the right order */
-	assert (!msg->signature || gck_rpc_message_verify_part (msg, "aA"));
-	
+	assert (!msg->signature || gkm_rpc_message_verify_part (msg, "aA"));
+
 	/* Get the number of items. We need this value to be correct */
 	if (!egg_buffer_get_uint32 (&msg->buffer, msg->parsed, &msg->parsed, &num))
-		return PARSE_ERROR; 
+		return PARSE_ERROR;
 
 	if (len != num) {
-		
+
 		/*
-		 * This should never happen in normal operation. It denotes a goof up 
+		 * This should never happen in normal operation. It denotes a goof up
 		 * on the other side of our RPC. We should be indicating the exact number
 		 * of attributes to the other side. And it should respond with the same
 		 * number.
@@ -674,7 +674,7 @@ proto_read_attribute_array (GckRpcMessage *msg, CK_ATTRIBUTE_PTR arr, CK_ULONG l
 
 	/* We need to go ahead and read everything in all cases */
 	for (i = 0; i < num; ++i) {
-	
+
 		/* The attribute type */
 		egg_buffer_get_uint32 (&msg->buffer, msg->parsed,
 		                       &msg->parsed, &type);
@@ -694,7 +694,7 @@ proto_read_attribute_array (GckRpcMessage *msg, CK_ATTRIBUTE_PTR arr, CK_ULONG l
 				attrlen = value;
 			}
 		}
-			
+
 		/* Don't act on this data unless no errors */
 		if (egg_buffer_has_error (&msg->buffer))
 			break;
@@ -733,19 +733,19 @@ proto_read_attribute_array (GckRpcMessage *msg, CK_ATTRIBUTE_PTR arr, CK_ULONG l
 			}
 		}
 	}
-	
+
 	if (egg_buffer_has_error (&msg->buffer))
 		return PARSE_ERROR;
-	
+
 	/* Read in the code that goes along with these attributes */
-	if (!gck_rpc_message_read_ulong (msg, &ret))
+	if (!gkm_rpc_message_read_ulong (msg, &ret))
 		return PARSE_ERROR;
 
 	return ret;
 }
 
 static CK_RV
-proto_read_byte_array (GckRpcMessage *msg, CK_BYTE_PTR arr,
+proto_read_byte_array (GkmRpcMessage *msg, CK_BYTE_PTR arr,
                        CK_ULONG_PTR len, CK_ULONG max)
 {
 	const unsigned char *val;
@@ -756,28 +756,28 @@ proto_read_byte_array (GckRpcMessage *msg, CK_BYTE_PTR arr,
 	assert (msg);
 
 	/* Make sure this is in the right order */
-	assert (!msg->signature || gck_rpc_message_verify_part (msg, "ay"));
+	assert (!msg->signature || gkm_rpc_message_verify_part (msg, "ay"));
 
 	/* A single byte which determines whether valid or not */
 	if (!egg_buffer_get_byte (&msg->buffer, msg->parsed, &msg->parsed, &valid))
 		return PARSE_ERROR;
-	
+
 	/* If not valid, then just the length is encoded, this can signify CKR_BUFFER_TOO_SMALL */
 	if (!valid) {
 		if (!egg_buffer_get_uint32 (&msg->buffer, msg->parsed, &msg->parsed, (uint32_t *)&vlen))
 			return PARSE_ERROR;
-		
+
 		*len = vlen;
-		
+
 		if (arr)
 			return CKR_BUFFER_TOO_SMALL;
 		else
 			return CKR_OK;
-	} 
+	}
 
 	/* Get the actual bytes */
 	if (!egg_buffer_get_byte_array (&msg->buffer, msg->parsed, &msg->parsed, &val, &vlen))
-		return PARSE_ERROR; 
+		return PARSE_ERROR;
 
 	*len = vlen;
 
@@ -794,7 +794,7 @@ proto_read_byte_array (GckRpcMessage *msg, CK_BYTE_PTR arr,
 }
 
 static CK_RV
-proto_read_ulong_array (GckRpcMessage *msg, CK_ULONG_PTR arr,
+proto_read_ulong_array (GkmRpcMessage *msg, CK_ULONG_PTR arr,
                         CK_ULONG_PTR len, CK_ULONG max)
 {
 	uint32_t i, num;
@@ -805,7 +805,7 @@ proto_read_ulong_array (GckRpcMessage *msg, CK_ULONG_PTR arr,
 	assert (msg);
 
 	/* Make sure this is in the right order */
-	assert (!msg->signature || gck_rpc_message_verify_part (msg, "au"));
+	assert (!msg->signature || gkm_rpc_message_verify_part (msg, "au"));
 
 	/* A single byte which determines whether valid or not */
 	if (!egg_buffer_get_byte (&msg->buffer, msg->parsed, &msg->parsed, &valid))
@@ -819,7 +819,7 @@ proto_read_ulong_array (GckRpcMessage *msg, CK_ULONG_PTR arr,
 
 	/* If not valid, then just the length is encoded, this can signify CKR_BUFFER_TOO_SMALL */
 	if (!valid) {
-		if (arr) 
+		if (arr)
 			return CKR_BUFFER_TOO_SMALL;
 		else
 			return CKR_OK;
@@ -839,132 +839,132 @@ proto_read_ulong_array (GckRpcMessage *msg, CK_ULONG_PTR arr,
 }
 
 static CK_RV
-proto_write_mechanism (GckRpcMessage *msg, CK_MECHANISM_PTR mech)
+proto_write_mechanism (GkmRpcMessage *msg, CK_MECHANISM_PTR mech)
 {
 	assert (msg);
 	assert (mech);
 
 	/* Make sure this is in the right order */
-	assert (!msg->signature || gck_rpc_message_verify_part (msg, "M"));
-	
+	assert (!msg->signature || gkm_rpc_message_verify_part (msg, "M"));
+
 	/* The mechanism type */
 	egg_buffer_add_uint32 (&msg->buffer, mech->mechanism);
-	
+
 	/*
-	 * PKCS#11 mechanism parameters are not easy to serialize. They're 
-	 * completely different for so many mechanisms, they contain 
+	 * PKCS#11 mechanism parameters are not easy to serialize. They're
+	 * completely different for so many mechanisms, they contain
 	 * pointers to arbitrary memory, and many callers don't initialize
-	 * them completely or properly. 
-	 * 
-	 * We only support certain mechanisms. 
-	 * 
+	 * them completely or properly.
+	 *
+	 * We only support certain mechanisms.
+	 *
 	 * Also callers do yucky things like leaving parts of the structure
 	 * pointing to garbage if they don't think it's going to be used.
 	 */
 
-	if (gck_rpc_mechanism_has_no_parameters (mech->mechanism))
+	if (gkm_rpc_mechanism_has_no_parameters (mech->mechanism))
 		egg_buffer_add_byte_array (&msg->buffer, NULL, 0);
-	else if (gck_rpc_mechanism_has_sane_parameters (mech->mechanism))
-		egg_buffer_add_byte_array (&msg->buffer, mech->pParameter, 
+	else if (gkm_rpc_mechanism_has_sane_parameters (mech->mechanism))
+		egg_buffer_add_byte_array (&msg->buffer, mech->pParameter,
 		                           mech->ulParameterLen);
 	else
-		return CKR_MECHANISM_INVALID; 
+		return CKR_MECHANISM_INVALID;
 
 	return egg_buffer_has_error (&msg->buffer) ? CKR_HOST_MEMORY : CKR_OK;
 }
 
 static CK_RV
-proto_read_info (GckRpcMessage *msg, CK_INFO_PTR info)
+proto_read_info (GkmRpcMessage *msg, CK_INFO_PTR info)
 {
 	assert (msg);
 	assert (info);
 
-	if (!gck_rpc_message_read_version (msg, &info->cryptokiVersion) || 
-	    !gck_rpc_message_read_space_string (msg, info->manufacturerID, 32) ||
-	    !gck_rpc_message_read_ulong (msg, &info->flags) ||
-	    !gck_rpc_message_read_space_string (msg, info->libraryDescription, 32) ||
-	    !gck_rpc_message_read_version (msg, &info->libraryVersion))
+	if (!gkm_rpc_message_read_version (msg, &info->cryptokiVersion) ||
+	    !gkm_rpc_message_read_space_string (msg, info->manufacturerID, 32) ||
+	    !gkm_rpc_message_read_ulong (msg, &info->flags) ||
+	    !gkm_rpc_message_read_space_string (msg, info->libraryDescription, 32) ||
+	    !gkm_rpc_message_read_version (msg, &info->libraryVersion))
 		return PARSE_ERROR;
 
 	return CKR_OK;
 }
 
 static CK_RV
-proto_read_slot_info (GckRpcMessage *msg, CK_SLOT_INFO_PTR info)
+proto_read_slot_info (GkmRpcMessage *msg, CK_SLOT_INFO_PTR info)
 {
 	assert (msg);
 	assert (info);
 
-	if (!gck_rpc_message_read_space_string (msg, info->slotDescription, 64) ||
-	    !gck_rpc_message_read_space_string (msg, info->manufacturerID, 32) ||
-	    !gck_rpc_message_read_ulong (msg, &info->flags) ||
-	    !gck_rpc_message_read_version (msg, &info->hardwareVersion) ||
-	    !gck_rpc_message_read_version (msg, &info->firmwareVersion))
+	if (!gkm_rpc_message_read_space_string (msg, info->slotDescription, 64) ||
+	    !gkm_rpc_message_read_space_string (msg, info->manufacturerID, 32) ||
+	    !gkm_rpc_message_read_ulong (msg, &info->flags) ||
+	    !gkm_rpc_message_read_version (msg, &info->hardwareVersion) ||
+	    !gkm_rpc_message_read_version (msg, &info->firmwareVersion))
 		return PARSE_ERROR;
 
 	return CKR_OK;
 }
 
 static CK_RV
-proto_read_token_info (GckRpcMessage *msg, CK_TOKEN_INFO_PTR info)
+proto_read_token_info (GkmRpcMessage *msg, CK_TOKEN_INFO_PTR info)
 {
 	assert (msg);
 	assert (info);
 
-	if (!gck_rpc_message_read_space_string (msg, info->label, 32) ||
-	    !gck_rpc_message_read_space_string (msg, info->manufacturerID, 32) ||
-	    !gck_rpc_message_read_space_string (msg, info->model, 16) ||
-	    !gck_rpc_message_read_space_string (msg, info->serialNumber, 16) ||
-	    !gck_rpc_message_read_ulong (msg, &info->flags) ||
-	    !gck_rpc_message_read_ulong (msg, &info->ulMaxSessionCount) ||
-	    !gck_rpc_message_read_ulong (msg, &info->ulSessionCount) ||
-	    !gck_rpc_message_read_ulong (msg, &info->ulMaxRwSessionCount) ||
-	    !gck_rpc_message_read_ulong (msg, &info->ulRwSessionCount) ||
-	    !gck_rpc_message_read_ulong (msg, &info->ulMaxPinLen) ||
-	    !gck_rpc_message_read_ulong (msg, &info->ulMinPinLen) ||
-	    !gck_rpc_message_read_ulong (msg, &info->ulTotalPublicMemory) ||
-	    !gck_rpc_message_read_ulong (msg, &info->ulFreePublicMemory) ||
-	    !gck_rpc_message_read_ulong (msg, &info->ulTotalPrivateMemory) ||
-	    !gck_rpc_message_read_ulong (msg, &info->ulFreePrivateMemory) ||
-	    !gck_rpc_message_read_version (msg, &info->hardwareVersion) ||
-	    !gck_rpc_message_read_version (msg, &info->firmwareVersion) ||
-	    !gck_rpc_message_read_space_string (msg, info->utcTime, 16))
+	if (!gkm_rpc_message_read_space_string (msg, info->label, 32) ||
+	    !gkm_rpc_message_read_space_string (msg, info->manufacturerID, 32) ||
+	    !gkm_rpc_message_read_space_string (msg, info->model, 16) ||
+	    !gkm_rpc_message_read_space_string (msg, info->serialNumber, 16) ||
+	    !gkm_rpc_message_read_ulong (msg, &info->flags) ||
+	    !gkm_rpc_message_read_ulong (msg, &info->ulMaxSessionCount) ||
+	    !gkm_rpc_message_read_ulong (msg, &info->ulSessionCount) ||
+	    !gkm_rpc_message_read_ulong (msg, &info->ulMaxRwSessionCount) ||
+	    !gkm_rpc_message_read_ulong (msg, &info->ulRwSessionCount) ||
+	    !gkm_rpc_message_read_ulong (msg, &info->ulMaxPinLen) ||
+	    !gkm_rpc_message_read_ulong (msg, &info->ulMinPinLen) ||
+	    !gkm_rpc_message_read_ulong (msg, &info->ulTotalPublicMemory) ||
+	    !gkm_rpc_message_read_ulong (msg, &info->ulFreePublicMemory) ||
+	    !gkm_rpc_message_read_ulong (msg, &info->ulTotalPrivateMemory) ||
+	    !gkm_rpc_message_read_ulong (msg, &info->ulFreePrivateMemory) ||
+	    !gkm_rpc_message_read_version (msg, &info->hardwareVersion) ||
+	    !gkm_rpc_message_read_version (msg, &info->firmwareVersion) ||
+	    !gkm_rpc_message_read_space_string (msg, info->utcTime, 16))
 		return PARSE_ERROR;
-	
+
 	return CKR_OK;
 }
 
 static CK_RV
-proto_read_mechanism_info (GckRpcMessage *msg, CK_MECHANISM_INFO_PTR info)
+proto_read_mechanism_info (GkmRpcMessage *msg, CK_MECHANISM_INFO_PTR info)
 {
 	assert (msg);
 	assert (info);
-	
-	if (!gck_rpc_message_read_ulong (msg, &info->ulMinKeySize) ||
-	    !gck_rpc_message_read_ulong (msg, &info->ulMaxKeySize) ||
-	    !gck_rpc_message_read_ulong (msg, &info->flags))
+
+	if (!gkm_rpc_message_read_ulong (msg, &info->ulMinKeySize) ||
+	    !gkm_rpc_message_read_ulong (msg, &info->ulMaxKeySize) ||
+	    !gkm_rpc_message_read_ulong (msg, &info->flags))
 		return PARSE_ERROR;
-	
+
 	return CKR_OK;
 }
 
 static CK_RV
-proto_read_sesssion_info (GckRpcMessage *msg, CK_SESSION_INFO_PTR info)
+proto_read_sesssion_info (GkmRpcMessage *msg, CK_SESSION_INFO_PTR info)
 {
 	assert (msg);
 	assert (info);
 
-	if (!gck_rpc_message_read_ulong (msg, &info->slotID) ||
-	    !gck_rpc_message_read_ulong (msg, &info->state) ||
-	    !gck_rpc_message_read_ulong (msg, &info->flags) ||
-	    !gck_rpc_message_read_ulong (msg, &info->ulDeviceError))
+	if (!gkm_rpc_message_read_ulong (msg, &info->slotID) ||
+	    !gkm_rpc_message_read_ulong (msg, &info->state) ||
+	    !gkm_rpc_message_read_ulong (msg, &info->flags) ||
+	    !gkm_rpc_message_read_ulong (msg, &info->ulDeviceError))
 		return PARSE_ERROR;
 
 	return CKR_OK;
 }
 
 /* -------------------------------------------------------------------
- * CALL MACROS 
+ * CALL MACROS
  */
 
 #define BEGIN_CALL(call_id) \
@@ -975,7 +975,7 @@ proto_read_sesssion_info (GckRpcMessage *msg, CK_SESSION_INFO_PTR info)
 		CK_RV _ret = CKR_OK; \
 		_ret = call_lookup (&_cs); \
 		if (_ret != CKR_OK) return _ret; \
-		_ret = call_prepare (_cs, GCK_RPC_CALL_##call_id); \
+		_ret = call_prepare (_cs, GKM_RPC_CALL_##call_id); \
 		if (_ret != CKR_OK) goto _cleanup;
 
 #define PROCESS_CALL \
@@ -985,66 +985,66 @@ proto_read_sesssion_info (GckRpcMessage *msg, CK_SESSION_INFO_PTR info)
 #define RETURN(ret) \
 		_ret = ret; \
 		goto _cleanup;
-		
+
 #define END_CALL \
 	_cleanup: \
 		_ret = call_done (_cs, _ret); \
 		debug (("ret: %d", _ret)); \
 		return _ret; \
-	} 
+	}
 
 #define IN_BYTE(val) \
-	if (!gck_rpc_message_write_byte (_cs->req, val)) \
+	if (!gkm_rpc_message_write_byte (_cs->req, val)) \
 		{ _ret = CKR_HOST_MEMORY; goto _cleanup; }
 
 #define IN_ULONG(val) \
-	if (!gck_rpc_message_write_ulong (_cs->req, val)) \
+	if (!gkm_rpc_message_write_ulong (_cs->req, val)) \
 		{ _ret = CKR_HOST_MEMORY; goto _cleanup; }
-	
+
 #define IN_STRING(val) \
-	if (!gck_rpc_message_write_zero_string (_cs->req, val)) \
+	if (!gkm_rpc_message_write_zero_string (_cs->req, val)) \
 		{ _ret = CKR_HOST_MEMORY; goto _cleanup; }
 
 #define IN_BYTE_BUFFER(arr, len) \
 	if (len == NULL) \
 		{ _ret = CKR_ARGUMENTS_BAD; goto _cleanup; } \
-	if (!gck_rpc_message_write_byte_buffer (_cs->req, arr ? *len : 0)) \
+	if (!gkm_rpc_message_write_byte_buffer (_cs->req, arr ? *len : 0)) \
 		{ _ret = CKR_HOST_MEMORY; goto _cleanup; }
-	
+
 #define IN_BYTE_ARRAY(arr, len) \
 	if (len != 0 && arr == NULL) \
 		{ _ret = CKR_ARGUMENTS_BAD; goto _cleanup; } \
-	if (!gck_rpc_message_write_byte_array (_cs->req, arr, len)) \
+	if (!gkm_rpc_message_write_byte_array (_cs->req, arr, len)) \
 		{ _ret = CKR_HOST_MEMORY; goto _cleanup; }
 
 #define IN_ULONG_BUFFER(arr, len) \
 	if (len == NULL) \
 		{ _ret = CKR_ARGUMENTS_BAD; goto _cleanup; } \
-	if (!gck_rpc_message_write_ulong_buffer (_cs->req, arr ? *len : 0)) \
+	if (!gkm_rpc_message_write_ulong_buffer (_cs->req, arr ? *len : 0)) \
 		{ _ret = CKR_HOST_MEMORY; goto _cleanup; }
-	
+
 #define IN_ULONG_ARRAY(arr, len) \
 	if (len != 0 && arr == NULL) \
 		{ _ret = CKR_ARGUMENTS_BAD; goto _cleanup; }\
-	if (!gck_rpc_message_write_ulong_array (_cs->req, arr, len)) \
+	if (!gkm_rpc_message_write_ulong_array (_cs->req, arr, len)) \
 		{ _ret = CKR_HOST_MEMORY; goto _cleanup; }
 
 #define IN_ATTRIBUTE_BUFFER(arr, num) \
 	if (num != 0 && arr == NULL) \
 		{ _ret = CKR_ARGUMENTS_BAD; goto _cleanup; } \
-	if (!gck_rpc_message_write_attribute_buffer (_cs->req, (arr), (num))) \
+	if (!gkm_rpc_message_write_attribute_buffer (_cs->req, (arr), (num))) \
 		{ _ret = CKR_HOST_MEMORY; goto _cleanup; }
 
 #define IN_ATTRIBUTE_ARRAY(arr, num) \
 	if (num != 0 && arr == NULL) \
 		{ _ret = CKR_ARGUMENTS_BAD; goto _cleanup; } \
-	if (!gck_rpc_message_write_attribute_array (_cs->req, (arr), (num))) \
+	if (!gkm_rpc_message_write_attribute_array (_cs->req, (arr), (num))) \
 		{ _ret = CKR_HOST_MEMORY; goto _cleanup; }
 
 #define IN_MECHANISM_TYPE(val) \
-	if(!gck_rpc_mechanism_is_supported (val)) \
+	if(!gkm_rpc_mechanism_is_supported (val)) \
 		{ _ret = CKR_MECHANISM_INVALID; goto _cleanup; } \
-	if (!gck_rpc_message_write_ulong (_cs->req, val)) \
+	if (!gkm_rpc_message_write_ulong (_cs->req, val)) \
 		{ _ret = CKR_HOST_MEMORY; goto _cleanup; }
 
 #define IN_MECHANISM(val) \
@@ -1058,20 +1058,20 @@ proto_read_sesssion_info (GckRpcMessage *msg, CK_SESSION_INFO_PTR info)
 #define OUT_ULONG(val) \
 	if (val == NULL) \
 		_ret = CKR_ARGUMENTS_BAD; \
-	if (_ret == CKR_OK && !gck_rpc_message_read_ulong (_cs->resp, val)) \
+	if (_ret == CKR_OK && !gkm_rpc_message_read_ulong (_cs->resp, val)) \
 		_ret = PARSE_ERROR;
 
 #define OUT_BYTE_ARRAY(arr, len)  \
 	if (len == NULL) \
 		_ret = CKR_ARGUMENTS_BAD; \
 	if (_ret == CKR_OK) \
-		_ret = proto_read_byte_array (_cs->resp, (arr), (len), *(len)); 
+		_ret = proto_read_byte_array (_cs->resp, (arr), (len), *(len));
 
 #define OUT_ULONG_ARRAY(a, len) \
 	if (len == NULL) \
 		_ret = CKR_ARGUMENTS_BAD; \
 	if (_ret == CKR_OK) \
-		_ret = proto_read_ulong_array (_cs->resp, (a), (len), *(len)); 
+		_ret = proto_read_ulong_array (_cs->resp, (a), (len), *(len));
 
 #define OUT_ATTRIBUTE_ARRAY(arr, num) \
 	if (_ret == CKR_OK) \
@@ -1081,7 +1081,7 @@ proto_read_sesssion_info (GckRpcMessage *msg, CK_SESSION_INFO_PTR info)
 	if (info == NULL) \
 		_ret = CKR_ARGUMENTS_BAD; \
 	if (_ret == CKR_OK) \
-		_ret = proto_read_info (_cs->resp, info); 
+		_ret = proto_read_info (_cs->resp, info);
 
 #define OUT_SLOT_INFO(info) \
 	if (info == NULL) \
@@ -1099,7 +1099,7 @@ proto_read_sesssion_info (GckRpcMessage *msg, CK_SESSION_INFO_PTR info)
 	if (info == NULL) \
 		_ret = CKR_ARGUMENTS_BAD; \
 	if (_ret == CKR_OK) \
-		_ret = proto_read_sesssion_info (_cs->resp, info); 
+		_ret = proto_read_sesssion_info (_cs->resp, info);
 
 #define OUT_MECHANISM_TYPE_ARRAY(arr, len) \
 	if (len == NULL) \
@@ -1107,14 +1107,14 @@ proto_read_sesssion_info (GckRpcMessage *msg, CK_SESSION_INFO_PTR info)
 	if (_ret == CKR_OK) \
 		_ret = proto_read_ulong_array (_cs->resp, (arr), (len), *(len)); \
 	if (_ret == CKR_OK && arr) \
-		gck_rpc_mechanism_list_purge (arr, len);
-	
+		gkm_rpc_mechanism_list_purge (arr, len);
+
 #define OUT_MECHANISM_INFO(info) \
 	if (info == NULL) \
 		_ret = CKR_ARGUMENTS_BAD; \
 	if (_ret == CKR_OK) \
-		_ret = proto_read_mechanism_info (_cs->resp, info); 
-	
+		_ret = proto_read_mechanism_info (_cs->resp, info);
+
 
 /* -------------------------------------------------------------------
  * INITIALIZATION and 'GLOBAL' CALLS
@@ -1131,8 +1131,8 @@ rpc_C_Initialize (CK_VOID_PTR init_args)
 
 	debug (("C_Initialize: enter"));
 
-#ifdef _DEBUG 
-	GCK_RPC_CHECK_CALLS();
+#ifdef _DEBUG
+	GKM_RPC_CHECK_CALLS();
 #endif
 
 	pthread_mutex_lock (&init_mutex);
@@ -1155,7 +1155,7 @@ rpc_C_Initialize (CK_VOID_PTR init_args)
 			}
 
 			/*
-			 * When the CKF_OS_LOCKING_OK flag isn't set return an error.  
+			 * When the CKF_OS_LOCKING_OK flag isn't set return an error.
 			 * We must be able to use our pthread functionality.
 			 */
 			if (!(args->flags & CKF_OS_LOCKING_OK)) {
@@ -1163,15 +1163,15 @@ rpc_C_Initialize (CK_VOID_PTR init_args)
 				ret = CKR_CANT_LOCK;
 				goto done;
 			}
-			
-			/* 
-			 * We support setting the socket path and other arguments from from the 
-			 * pReserved pointer, similar to how NSS PKCS#11 components are initialized. 
-			 */ 
-			if (args->pReserved) 
-				parse_arguments ((const char*)args->pReserved);	
+
+			/*
+			 * We support setting the socket path and other arguments from from the
+			 * pReserved pointer, similar to how NSS PKCS#11 components are initialized.
+			 */
+			if (args->pReserved)
+				parse_arguments ((const char*)args->pReserved);
 		}
-	
+
 		pid = getpid ();
 		if (pkcs11_initialized) {
 
@@ -1182,7 +1182,7 @@ rpc_C_Initialize (CK_VOID_PTR init_args)
 				goto done;
 			}
 		}
-		
+
 		/* Lookup the socket path, append '/pkcs11' */
 		if (pkcs11_socket_path == NULL) {
 			path = getenv ("GNOME_KEYRING_CONTROL");
@@ -1199,10 +1199,10 @@ rpc_C_Initialize (CK_VOID_PTR init_args)
 
 		/* Call through and initialize the daemon */
 		ret = call_lookup (&cs);
-		if (ret == CKR_OK) { 
-			ret = call_prepare (cs, GCK_RPC_CALL_C_Initialize);
+		if (ret == CKR_OK) {
+			ret = call_prepare (cs, GKM_RPC_CALL_C_Initialize);
 			if (ret == CKR_OK)
-				if (!gck_rpc_message_write_byte_array (cs->req, GCK_RPC_HANDSHAKE, GCK_RPC_HANDSHAKE_LEN))
+				if (!gkm_rpc_message_write_byte_array (cs->req, GKM_RPC_HANDSHAKE, GKM_RPC_HANDSHAKE_LEN))
 					ret = CKR_HOST_MEMORY;
 			if (ret == CKR_OK)
 				ret = call_run (cs);
@@ -1220,7 +1220,7 @@ done:
 			free (pkcs11_socket_path);
 			pkcs11_socket_path = NULL;
 		}
-			
+
 	pthread_mutex_unlock (&init_mutex);
 
 	debug (("C_Initialize: %d", ret));
@@ -1232,7 +1232,7 @@ rpc_C_Finalize (CK_VOID_PTR reserved)
 {
 	CallState *cs;
 	CK_RV ret;
-	
+
 	debug (("C_Finalize: enter"));
 	return_val_if_fail (pkcs11_initialized, CKR_CRYPTOKI_NOT_INITIALIZED);
 	return_val_if_fail (!reserved, CKR_ARGUMENTS_BAD);
@@ -1240,17 +1240,17 @@ rpc_C_Finalize (CK_VOID_PTR reserved)
 	pthread_mutex_lock (&init_mutex);
 
 		ret = call_lookup (&cs);
-		if (ret == CKR_OK) { 
-			ret = call_prepare (cs, GCK_RPC_CALL_C_Finalize);
+		if (ret == CKR_OK) {
+			ret = call_prepare (cs, GKM_RPC_CALL_C_Finalize);
 			if (ret == CKR_OK) {
 				ret = call_run (cs);
 			}
 			call_done (cs, ret);
 		}
-		
+
 		if (ret != CKR_OK)
 			warning (("finalizing the daemon returned an error: %d", ret));
-		
+
 		/* This should stop all other calls in */
 		pkcs11_initialized = 0;
 		pkcs11_initialized_pid = 0;
@@ -1258,7 +1258,7 @@ rpc_C_Finalize (CK_VOID_PTR reserved)
 		pkcs11_socket_path = NULL;
 
 	pthread_mutex_unlock (&init_mutex);
-	
+
 	debug (("C_Finalize: %d", CKR_OK));
 	return CKR_OK;
 }
@@ -1334,7 +1334,7 @@ rpc_C_GetMechanismList (CK_SLOT_ID id, CK_MECHANISM_TYPE_PTR mechanism_list,
 }
 
 static CK_RV
-rpc_C_GetMechanismInfo (CK_SLOT_ID id, CK_MECHANISM_TYPE type, 
+rpc_C_GetMechanismInfo (CK_SLOT_ID id, CK_MECHANISM_TYPE type,
                         CK_MECHANISM_INFO_PTR info)
 {
 	return_val_if_fail (info, CKR_ARGUMENTS_BAD);
@@ -1348,7 +1348,7 @@ rpc_C_GetMechanismInfo (CK_SLOT_ID id, CK_MECHANISM_TYPE type,
 }
 
 static CK_RV
-rpc_C_InitToken (CK_SLOT_ID id, CK_UTF8CHAR_PTR pin, CK_ULONG pin_len, 
+rpc_C_InitToken (CK_SLOT_ID id, CK_UTF8CHAR_PTR pin, CK_ULONG pin_len,
                  CK_UTF8CHAR_PTR label)
 {
 	BEGIN_CALL (C_InitToken);
@@ -1434,7 +1434,7 @@ rpc_C_GetSessionInfo(CK_SESSION_HANDLE session, CK_SESSION_INFO_PTR info)
 }
 
 static CK_RV
-rpc_C_InitPIN (CK_SESSION_HANDLE session, CK_UTF8CHAR_PTR pin, 
+rpc_C_InitPIN (CK_SESSION_HANDLE session, CK_UTF8CHAR_PTR pin,
                CK_ULONG pin_len)
 {
 	BEGIN_CALL (C_InitPIN);
@@ -1858,7 +1858,7 @@ rpc_C_SignRecoverInit (CK_SESSION_HANDLE session, CK_MECHANISM_PTR mechanism,
 }
 
 static CK_RV
-rpc_C_SignRecover (CK_SESSION_HANDLE session, CK_BYTE_PTR data, CK_ULONG data_len, 
+rpc_C_SignRecover (CK_SESSION_HANDLE session, CK_BYTE_PTR data, CK_ULONG data_len,
                    CK_BYTE_PTR signature, CK_ULONG_PTR signature_len)
 {
 	return_val_if_fail (signature_len, CKR_ARGUMENTS_BAD);
@@ -1962,7 +1962,7 @@ rpc_C_DigestEncryptUpdate (CK_SESSION_HANDLE session, CK_BYTE_PTR part,
 
 static CK_RV
 rpc_C_DecryptDigestUpdate (CK_SESSION_HANDLE session, CK_BYTE_PTR enc_part,
-                           CK_ULONG enc_part_len, CK_BYTE_PTR part, 
+                           CK_ULONG enc_part_len, CK_BYTE_PTR part,
                            CK_ULONG_PTR part_len)
 {
 	return_val_if_fail (part_len, CKR_ARGUMENTS_BAD);
@@ -1994,7 +1994,7 @@ rpc_C_SignEncryptUpdate (CK_SESSION_HANDLE session, CK_BYTE_PTR part,
 
 static CK_RV
 rpc_C_DecryptVerifyUpdate (CK_SESSION_HANDLE session, CK_BYTE_PTR enc_part,
-                           CK_ULONG enc_part_len, CK_BYTE_PTR part, 
+                           CK_ULONG enc_part_len, CK_BYTE_PTR part,
                            CK_ULONG_PTR part_len)
 {
 	return_val_if_fail (part_len, CKR_ARGUMENTS_BAD);
@@ -2010,7 +2010,7 @@ rpc_C_DecryptVerifyUpdate (CK_SESSION_HANDLE session, CK_BYTE_PTR enc_part,
 
 static CK_RV
 rpc_C_GenerateKey (CK_SESSION_HANDLE session, CK_MECHANISM_PTR mechanism,
-                   CK_ATTRIBUTE_PTR template, CK_ULONG count, 
+                   CK_ATTRIBUTE_PTR template, CK_ULONG count,
                    CK_OBJECT_HANDLE_PTR key)
 {
 	BEGIN_CALL (C_GenerateKey);
@@ -2045,7 +2045,7 @@ rpc_C_WrapKey (CK_SESSION_HANDLE session, CK_MECHANISM_PTR mechanism,
                CK_BYTE_PTR wrapped_key, CK_ULONG_PTR wrapped_key_len)
 {
 	return_val_if_fail (wrapped_key_len, CKR_ARGUMENTS_BAD);
-	
+
 	BEGIN_CALL (C_WrapKey);
 		IN_ULONG (session);
 		IN_MECHANISM (mechanism);
@@ -2115,10 +2115,10 @@ rpc_C_GenerateRandom (CK_SESSION_HANDLE session, CK_BYTE_PTR random_data,
  * MODULE ENTRY POINT
  */
 
-/* 
- * PKCS#11 is broken here. It states that Unix compilers automatically byte 
- * pack structures. This is wrong. GCC on Linux aligns to 4 by default. 
- * 
+/*
+ * PKCS#11 is broken here. It states that Unix compilers automatically byte
+ * pack structures. This is wrong. GCC on Linux aligns to 4 by default.
+ *
  * This results in incompatibilities. Where this structure's first version
  * members take up too much or too little space depending on how this module
  * is compiled.
diff --git a/pkcs11/rpc-layer/gkm-rpc-private.h b/pkcs11/rpc-layer/gkm-rpc-private.h
new file mode 100644
index 0000000..ce02deb
--- /dev/null
+++ b/pkcs11/rpc-layer/gkm-rpc-private.h
@@ -0,0 +1,342 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* p11-rpc-private.h - various ids and signatures for our protocol
+
+   Copyright (C) 2008, Stef Walter
+
+   The Gnome Keyring Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The Gnome Keyring Library 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the Gnome Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.
+
+   Author: Stef Walter <stef memberwebs com>
+*/
+
+#ifndef GKM_RPC_CALLS_H
+#define GKM_RPC_CALLS_H
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdarg.h>
+
+#include "egg/egg-buffer.h"
+
+#include "pkcs11/pkcs11.h"
+
+
+/* Whether to print debug output or not */
+#define DEBUG_OUTPUT 0
+
+
+/* The calls, must be in sync with array below */
+enum {
+	GKM_RPC_CALL_ERROR = 0,
+
+	GKM_RPC_CALL_C_Initialize,
+	GKM_RPC_CALL_C_Finalize,
+	GKM_RPC_CALL_C_GetInfo,
+	GKM_RPC_CALL_C_GetSlotList,
+	GKM_RPC_CALL_C_GetSlotInfo,
+	GKM_RPC_CALL_C_GetTokenInfo,
+	GKM_RPC_CALL_C_GetMechanismList,
+	GKM_RPC_CALL_C_GetMechanismInfo,
+	GKM_RPC_CALL_C_InitToken,
+	GKM_RPC_CALL_C_WaitForSlotEvent,
+
+	GKM_RPC_CALL_C_OpenSession,
+
+	GKM_RPC_CALL_C_CloseSession,
+	GKM_RPC_CALL_C_CloseAllSessions,
+	GKM_RPC_CALL_C_GetFunctionStatus,
+	GKM_RPC_CALL_C_CancelFunction,
+
+	GKM_RPC_CALL_C_GetSessionInfo,
+	GKM_RPC_CALL_C_InitPIN,
+	GKM_RPC_CALL_C_SetPIN,
+	GKM_RPC_CALL_C_GetOperationState,
+	GKM_RPC_CALL_C_SetOperationState,
+	GKM_RPC_CALL_C_Login,
+	GKM_RPC_CALL_C_Logout,
+	GKM_RPC_CALL_C_CreateObject,
+	GKM_RPC_CALL_C_CopyObject,
+	GKM_RPC_CALL_C_DestroyObject,
+	GKM_RPC_CALL_C_GetObjectSize,
+	GKM_RPC_CALL_C_GetAttributeValue,
+	GKM_RPC_CALL_C_SetAttributeValue,
+	GKM_RPC_CALL_C_FindObjectsInit,
+	GKM_RPC_CALL_C_FindObjects,
+	GKM_RPC_CALL_C_FindObjectsFinal,
+	GKM_RPC_CALL_C_EncryptInit,
+	GKM_RPC_CALL_C_Encrypt,
+	GKM_RPC_CALL_C_EncryptUpdate,
+	GKM_RPC_CALL_C_EncryptFinal,
+	GKM_RPC_CALL_C_DecryptInit,
+	GKM_RPC_CALL_C_Decrypt,
+	GKM_RPC_CALL_C_DecryptUpdate,
+	GKM_RPC_CALL_C_DecryptFinal,
+	GKM_RPC_CALL_C_DigestInit,
+	GKM_RPC_CALL_C_Digest,
+	GKM_RPC_CALL_C_DigestUpdate,
+	GKM_RPC_CALL_C_DigestKey,
+	GKM_RPC_CALL_C_DigestFinal,
+	GKM_RPC_CALL_C_SignInit,
+	GKM_RPC_CALL_C_Sign,
+	GKM_RPC_CALL_C_SignUpdate,
+	GKM_RPC_CALL_C_SignFinal,
+	GKM_RPC_CALL_C_SignRecoverInit,
+	GKM_RPC_CALL_C_SignRecover,
+	GKM_RPC_CALL_C_VerifyInit,
+	GKM_RPC_CALL_C_Verify,
+	GKM_RPC_CALL_C_VerifyUpdate,
+	GKM_RPC_CALL_C_VerifyFinal,
+	GKM_RPC_CALL_C_VerifyRecoverInit,
+	GKM_RPC_CALL_C_VerifyRecover,
+	GKM_RPC_CALL_C_DigestEncryptUpdate,
+	GKM_RPC_CALL_C_DecryptDigestUpdate,
+	GKM_RPC_CALL_C_SignEncryptUpdate,
+	GKM_RPC_CALL_C_DecryptVerifyUpdate,
+	GKM_RPC_CALL_C_GenerateKey,
+	GKM_RPC_CALL_C_GenerateKeyPair,
+	GKM_RPC_CALL_C_WrapKey,
+	GKM_RPC_CALL_C_UnwrapKey,
+	GKM_RPC_CALL_C_DeriveKey,
+	GKM_RPC_CALL_C_SeedRandom,
+	GKM_RPC_CALL_C_GenerateRandom,
+
+	GKM_RPC_CALL_MAX
+};
+
+typedef struct _GkmRpcCall {
+	int call_id;
+	const char* name;
+	const char* request;
+	const char* response;
+} GkmRpcCall;
+
+/*
+ *  a_ = prefix denotes array of _
+ *  A  = CK_ATTRIBUTE
+ *  f_ = prefix denotes buffer for _
+ *  M  = CK_MECHANISM
+ *  u  = CK_ULONG
+ *  s  = space padded string
+ *  v  = CK_VERSION
+ *  y  = CK_BYTE
+ *  z  = null terminated string
+ */
+
+static const GkmRpcCall gkm_rpc_calls[] = {
+	{ GKM_RPC_CALL_ERROR,                  "ERROR",                  NULL,      NULL                   },
+	{ GKM_RPC_CALL_C_Initialize,           "C_Initialize",           "ay",      ""                     },
+	{ GKM_RPC_CALL_C_Finalize,             "C_Finalize",             "",        ""                     },
+	{ GKM_RPC_CALL_C_GetInfo,              "C_GetInfo",              "",        "vsusv"                },
+	{ GKM_RPC_CALL_C_GetSlotList,          "C_GetSlotList",          "yfu",     "au"                   },
+	{ GKM_RPC_CALL_C_GetSlotInfo,          "C_GetSlotInfo",          "u",       "ssuvv"                },
+	{ GKM_RPC_CALL_C_GetTokenInfo,         "C_GetTokenInfo",         "u",       "ssssuuuuuuuuuuuvvs"   },
+	{ GKM_RPC_CALL_C_GetMechanismList,     "C_GetMechanismList",     "ufu",     "au"                   },
+	{ GKM_RPC_CALL_C_GetMechanismInfo,     "C_GetMechanismInfo",     "uu",      "uuu"                  },
+	{ GKM_RPC_CALL_C_InitToken,            "C_InitToken",            "uayz",    ""                     },
+	{ GKM_RPC_CALL_C_WaitForSlotEvent,     "C_WaitForSlotEvent",     "u",       "u"                    },
+	{ GKM_RPC_CALL_C_OpenSession,          "C_OpenSession",          "uu",      "u"                    },
+	{ GKM_RPC_CALL_C_CloseSession,         "C_CloseSession",         "u",       ""                     },
+	{ GKM_RPC_CALL_C_CloseAllSessions,     "C_CloseAllSessions",     "u",       ""                     },
+	{ GKM_RPC_CALL_C_GetFunctionStatus,    "C_GetFunctionStatus",    "u",       ""                     },
+	{ GKM_RPC_CALL_C_CancelFunction,       "C_CancelFunction",       "u",       ""                     },
+	{ GKM_RPC_CALL_C_GetSessionInfo,       "C_GetSessionInfo",       "u",       "uuuu"                 },
+	{ GKM_RPC_CALL_C_InitPIN,              "C_InitPIN",              "uay",     ""                     },
+	{ GKM_RPC_CALL_C_SetPIN,               "C_SetPIN",               "uayay",   ""                     },
+	{ GKM_RPC_CALL_C_GetOperationState,    "C_GetOperationState",    "ufy",     "ay"                   },
+	{ GKM_RPC_CALL_C_SetOperationState,    "C_SetOperationState",    "uayuu",   ""                     },
+	{ GKM_RPC_CALL_C_Login,                "C_Login",                "uuay",    ""                     },
+	{ GKM_RPC_CALL_C_Logout,               "C_Logout",               "u",       ""                     },
+	{ GKM_RPC_CALL_C_CreateObject,         "C_CreateObject",         "uaA",     "u"                    },
+	{ GKM_RPC_CALL_C_CopyObject,           "C_CopyObject",           "uuaA",    "u"                    },
+	{ GKM_RPC_CALL_C_DestroyObject,        "C_DestroyObject",        "uu",      ""                     },
+	{ GKM_RPC_CALL_C_GetObjectSize,        "C_GetObjectSize",        "uu",      "u"                    },
+	{ GKM_RPC_CALL_C_GetAttributeValue,    "C_GetAttributeValue",    "uufA",    "aAu"                  },
+	{ GKM_RPC_CALL_C_SetAttributeValue,    "C_SetAttributeValue",    "uuaA",    ""                     },
+	{ GKM_RPC_CALL_C_FindObjectsInit,      "C_FindObjectsInit",      "uaA",     ""                     },
+	{ GKM_RPC_CALL_C_FindObjects,          "C_FindObjects",          "ufu",     "au"                   },
+	{ GKM_RPC_CALL_C_FindObjectsFinal,     "C_FindObjectsFinal",     "u",       ""                     },
+	{ GKM_RPC_CALL_C_EncryptInit,          "C_EncryptInit",          "uMu",     ""                     },
+	{ GKM_RPC_CALL_C_Encrypt,              "C_Encrypt",              "uayfy",   "ay"                   },
+	{ GKM_RPC_CALL_C_EncryptUpdate,        "C_EncryptUpdate",        "uayfy",   "ay"                   },
+	{ GKM_RPC_CALL_C_EncryptFinal,         "C_EncryptFinal",         "ufy",     "ay"                   },
+	{ GKM_RPC_CALL_C_DecryptInit,          "C_DecryptInit",          "uMu",     ""                     },
+	{ GKM_RPC_CALL_C_Decrypt,              "C_Decrypt",              "uayfy",   "ay"                   },
+	{ GKM_RPC_CALL_C_DecryptUpdate,        "C_DecryptUpdate",        "uayfy",   "ay"                   },
+	{ GKM_RPC_CALL_C_DecryptFinal,         "C_DecryptFinal",         "ufy",     "ay"                   },
+	{ GKM_RPC_CALL_C_DigestInit,           "C_DigestInit",           "uM",      ""                     },
+	{ GKM_RPC_CALL_C_Digest,               "C_Digest",               "uayfy",   "ay"                   },
+	{ GKM_RPC_CALL_C_DigestUpdate,         "C_DigestUpdate",         "uay",     ""                     },
+	{ GKM_RPC_CALL_C_DigestKey,            "C_DigestKey",            "uu",      ""                     },
+	{ GKM_RPC_CALL_C_DigestFinal,          "C_DigestFinal",          "ufy",     "ay"                   },
+	{ GKM_RPC_CALL_C_SignInit,             "C_SignInit",             "uMu",     ""                     },
+	{ GKM_RPC_CALL_C_Sign,                 "C_Sign",                 "uayfy",   "ay"                   },
+	{ GKM_RPC_CALL_C_SignUpdate,           "C_SignUpdate",           "uay",     ""                     },
+	{ GKM_RPC_CALL_C_SignFinal,            "C_SignFinal",            "ufy",     "ay"                   },
+	{ GKM_RPC_CALL_C_SignRecoverInit,      "C_SignRecoverInit",      "uMu",     ""                     },
+	{ GKM_RPC_CALL_C_SignRecover,          "C_SignRecover",          "uayfy",   "ay"                   },
+	{ GKM_RPC_CALL_C_VerifyInit,           "C_VerifyInit",           "uMu",     ""                     },
+	{ GKM_RPC_CALL_C_Verify,               "C_Verify",               "uayay",   ""                     },
+	{ GKM_RPC_CALL_C_VerifyUpdate,         "C_VerifyUpdate",         "uay",     ""                     },
+	{ GKM_RPC_CALL_C_VerifyFinal,          "C_VerifyFinal",          "uay",     ""                     },
+	{ GKM_RPC_CALL_C_VerifyRecoverInit,    "C_VerifyRecoverInit",    "uMu",     ""                     },
+	{ GKM_RPC_CALL_C_VerifyRecover,        "C_VerifyRecover",        "uayfy",   "ay"                   },
+	{ GKM_RPC_CALL_C_DigestEncryptUpdate,  "C_DigestEncryptUpdate",  "uayfy",   "ay"                   },
+	{ GKM_RPC_CALL_C_DecryptDigestUpdate,  "C_DecryptDigestUpdate",  "uayfy",   "ay"                   },
+	{ GKM_RPC_CALL_C_SignEncryptUpdate,    "C_SignEncryptUpdate",    "uayfy",   "ay"                   },
+	{ GKM_RPC_CALL_C_DecryptVerifyUpdate,  "C_DecryptVerifyUpdate",  "uayfy",   "ay"                   },
+	{ GKM_RPC_CALL_C_GenerateKey,          "C_GenerateKey",          "uMaA",    "u"                    },
+	{ GKM_RPC_CALL_C_GenerateKeyPair,      "C_GenerateKeyPair",      "uMaAaA",  "uu"                   },
+	{ GKM_RPC_CALL_C_WrapKey,              "C_WrapKey",              "uMuufy",  "ay"                   },
+	{ GKM_RPC_CALL_C_UnwrapKey,            "C_UnwrapKey",            "uMuayaA", "u"                    },
+	{ GKM_RPC_CALL_C_DeriveKey,            "C_DeriveKey",            "uMuaA",   "u"                    },
+	{ GKM_RPC_CALL_C_SeedRandom,           "C_SeedRandom",           "uay",     ""                     },
+	{ GKM_RPC_CALL_C_GenerateRandom,       "C_GenerateRandom",       "ufy",     "ay"                   },
+};
+
+#ifdef _DEBUG
+#define GKM_RPC_CHECK_CALLS() \
+	{ int i; for (i = 0; i < GKM_RPC_CALL_MAX; ++i) assert (gkm_rpc_calls[i].call_id == i); }
+#endif
+
+#define GKM_RPC_HANDSHAKE \
+	((unsigned char*)"PRIVATE-GNOME-KEYRING-PKCS11-PROTOCOL-V-1")
+#define GKM_RPC_HANDSHAKE_LEN \
+	(sizeof (GKM_RPC_HANDSHAKE) - 1)
+
+#define GKM_RPC_SOCKET_EXT 	"pkcs11"
+
+typedef enum _GkmRpcMessageType {
+	GKM_RPC_REQUEST = 1,
+	GKM_RPC_RESPONSE
+} GkmRpcMessageType;
+
+typedef struct _GkmRpcMessage {
+	int call_id;
+	GkmRpcMessageType call_type;
+	const char *signature;
+	EggBuffer buffer;
+
+	size_t parsed;
+	const char *sigverify;
+} GkmRpcMessage;
+
+GkmRpcMessage*           gkm_rpc_message_new                     (EggBufferAllocator allocator);
+
+void                     gkm_rpc_message_free                    (GkmRpcMessage *msg);
+
+void                     gkm_rpc_message_reset                   (GkmRpcMessage *msg);
+
+int                      gkm_rpc_message_equals                  (GkmRpcMessage *m1,
+                                                                  GkmRpcMessage *m2);
+
+#define                  gkm_rpc_message_is_verified(msg)        (!(msg)->sigverify || (msg)->sigverify[0] == 0)
+
+#define                  gkm_rpc_message_buffer_error(msg)       (egg_buffer_has_error(&(msg)->buffer))
+
+int                      gkm_rpc_message_prep                    (GkmRpcMessage *msg,
+                                                                  int call_id,
+                                                                  GkmRpcMessageType type);
+
+int                      gkm_rpc_message_parse                   (GkmRpcMessage *msg,
+                                                                  GkmRpcMessageType type);
+
+int                      gkm_rpc_message_verify_part             (GkmRpcMessage *msg,
+                                                                  const char* part);
+
+int                      gkm_rpc_message_write_byte              (GkmRpcMessage *msg,
+                                                                  CK_BYTE val);
+
+int                      gkm_rpc_message_write_ulong             (GkmRpcMessage *msg,
+                                                                  CK_ULONG val);
+
+int                      gkm_rpc_message_write_zero_string       (GkmRpcMessage *msg,
+                                                                  CK_UTF8CHAR* string);
+
+int                      gkm_rpc_message_write_space_string      (GkmRpcMessage *msg,
+                                                                  CK_UTF8CHAR* buffer,
+                                                                  CK_ULONG length);
+
+int                      gkm_rpc_message_write_byte_buffer       (GkmRpcMessage *msg,
+                                                                  CK_ULONG count);
+
+int                      gkm_rpc_message_write_byte_array        (GkmRpcMessage *msg,
+                                                                  CK_BYTE_PTR arr,
+                                                                  CK_ULONG num);
+
+int                      gkm_rpc_message_write_ulong_buffer      (GkmRpcMessage *msg,
+                                                                  CK_ULONG count);
+
+int                      gkm_rpc_message_write_ulong_array       (GkmRpcMessage *msg,
+                                                                  CK_ULONG_PTR arr,
+                                                                  CK_ULONG num);
+
+int                      gkm_rpc_message_write_attribute_buffer  (GkmRpcMessage *msg,
+                                                                  CK_ATTRIBUTE_PTR arr,
+                                                                  CK_ULONG num);
+
+int                      gkm_rpc_message_write_attribute_array   (GkmRpcMessage *msg,
+                                                                  CK_ATTRIBUTE_PTR arr,
+                                                                  CK_ULONG num);
+
+int                      gkm_rpc_message_write_version           (GkmRpcMessage *msg,
+                                                                  CK_VERSION* version);
+
+
+int                      gkm_rpc_message_read_byte               (GkmRpcMessage *msg,
+                                                                  CK_BYTE* val);
+
+int                      gkm_rpc_message_read_ulong              (GkmRpcMessage *msg,
+                                                                  CK_ULONG* val);
+
+int                      gkm_rpc_message_read_space_string       (GkmRpcMessage *msg,
+                                                                  CK_UTF8CHAR* buffer,
+                                                                  CK_ULONG length);
+
+int                      gkm_rpc_message_read_version            (GkmRpcMessage *msg,
+                                                                  CK_VERSION* version);
+
+
+
+void                     gkm_rpc_log                             (const char *line);
+
+void                     gkm_rpc_warn                            (const char* msg, ...);
+
+void                     gkm_rpc_debug                           (const char* msg, ...);
+
+#ifdef G_DISABLE_ASSERT
+#define assert(x)
+#else
+#include <assert.h>
+#endif
+
+/*
+ * PKCS#11 mechanism parameters are not easy to serialize. They're
+ * completely different for so many mechanisms, they contain
+ * pointers to arbitrary memory, and many callers don't initialize
+ * them completely or properly.
+ *
+ * We only support certain mechanisms.
+ *
+ * Also callers do yucky things like leaving parts of the structure
+ * pointing to garbage if they don't think it's going to be used.
+ */
+
+int    gkm_rpc_mechanism_is_supported        (CK_MECHANISM_TYPE mech);
+void   gkm_rpc_mechanism_list_purge          (CK_MECHANISM_TYPE_PTR mechs, CK_ULONG_PTR n_mechs);
+int    gkm_rpc_mechanism_has_sane_parameters (CK_MECHANISM_TYPE type);
+int    gkm_rpc_mechanism_has_no_parameters   (CK_MECHANISM_TYPE mech);
+
+#endif /* GKM_RPC_CALLS_H */
diff --git a/pkcs11/rpc-layer/gck-rpc-util.c b/pkcs11/rpc-layer/gkm-rpc-util.c
similarity index 86%
rename from pkcs11/rpc-layer/gck-rpc-util.c
rename to pkcs11/rpc-layer/gkm-rpc-util.c
index dfbea97..42e16f7 100644
--- a/pkcs11/rpc-layer/gck-rpc-util.c
+++ b/pkcs11/rpc-layer/gkm-rpc-util.c
@@ -23,8 +23,8 @@
 
 #include "config.h"
 
-#include "gck-rpc-layer.h"
-#include "gck-rpc-private.h"
+#include "gkm-rpc-layer.h"
+#include "gkm-rpc-private.h"
 
 #include <stdarg.h>
 #include <string.h>
@@ -35,18 +35,18 @@ do_log (const char *pref, const char *msg, va_list va)
 {
 	char buffer[1024];
 	size_t len = 0;
-	
+
 	if (pref) {
 		snprintf (buffer, sizeof (buffer), "%s: ", pref);
 		len = strlen (buffer);
 	}
-	
+
 	vsnprintf (buffer + len, sizeof (buffer) - len, msg, va);
-	gck_rpc_log (buffer);
+	gkm_rpc_log (buffer);
 }
 
-void 
-gck_rpc_warn (const char* msg, ...)
+void
+gkm_rpc_warn (const char* msg, ...)
 {
 	va_list va;
 	va_start (va, msg);
@@ -54,8 +54,8 @@ gck_rpc_warn (const char* msg, ...)
 	va_end (va);
 }
 
-void 
-gck_rpc_debug (const char* msg, ...)
+void
+gkm_rpc_debug (const char* msg, ...)
 {
 	va_list va;
 	va_start (va, msg);
@@ -63,37 +63,37 @@ gck_rpc_debug (const char* msg, ...)
 	va_end (va);
 }
 
-int 
-gck_rpc_mechanism_is_supported (CK_MECHANISM_TYPE mech)
+int
+gkm_rpc_mechanism_is_supported (CK_MECHANISM_TYPE mech)
 {
-	if (gck_rpc_mechanism_has_no_parameters (mech) ||
-	    gck_rpc_mechanism_has_sane_parameters (mech))
+	if (gkm_rpc_mechanism_has_no_parameters (mech) ||
+	    gkm_rpc_mechanism_has_sane_parameters (mech))
 		return 1;
 	return 0;
 }
 void
-gck_rpc_mechanism_list_purge (CK_MECHANISM_TYPE_PTR mechs, CK_ULONG* n_mechs)
+gkm_rpc_mechanism_list_purge (CK_MECHANISM_TYPE_PTR mechs, CK_ULONG* n_mechs)
 {
 	int i;
 
 	assert (mechs);
 	assert (n_mechs);
-	
+
 	for (i = 0; i < (int)(*mechs); ++i) {
-		if (!gck_rpc_mechanism_has_no_parameters (mechs[i]) &&
-		    !gck_rpc_mechanism_has_sane_parameters (mechs[i])) {
-			
+		if (!gkm_rpc_mechanism_has_no_parameters (mechs[i]) &&
+		    !gkm_rpc_mechanism_has_sane_parameters (mechs[i])) {
+
 			/* Remove the mechanism from the list */
 			memmove (&mechs[i], &mechs[i + 1], (*n_mechs - i) * sizeof (CK_MECHANISM_TYPE));
-			
+
 			--(*n_mechs);
 			--i;
 		}
 	}
 }
 
-int 
-gck_rpc_mechanism_has_sane_parameters (CK_MECHANISM_TYPE type)
+int
+gkm_rpc_mechanism_has_sane_parameters (CK_MECHANISM_TYPE type)
 {
 	/* This list is incomplete */
 	switch (type) {
@@ -105,11 +105,11 @@ gck_rpc_mechanism_has_sane_parameters (CK_MECHANISM_TYPE type)
 	}
 }
 
-int 
-gck_rpc_mechanism_has_no_parameters (CK_MECHANISM_TYPE mech)
+int
+gkm_rpc_mechanism_has_no_parameters (CK_MECHANISM_TYPE mech)
 {
 	/* This list is incomplete */
-	
+
 	switch (mech) {
 	case CKM_RSA_PKCS_KEY_PAIR_GEN:
 	case CKM_RSA_X9_31_KEY_PAIR_GEN:
diff --git a/pkcs11/secret-store/Makefile.am b/pkcs11/secret-store/Makefile.am
index e56c31a..5341f3c 100644
--- a/pkcs11/secret-store/Makefile.am
+++ b/pkcs11/secret-store/Makefile.am
@@ -10,21 +10,21 @@ INCLUDES = \
 # The secret store component code
 
 noinst_LTLIBRARIES = \
-	libgck-secret-store.la
-
-libgck_secret_store_la_SOURCES = \
-	gck-secret-binary.c gck-secret-binary.h \
-	gck-secret-collection.h gck-secret-collection.c \
-	gck-secret-compat.h gck-secret-compat.c \
-	gck-secret-data.h gck-secret-data.c \
-	gck-secret-fields.h gck-secret-fields.c \
-	gck-secret-item.h gck-secret-item.c \
-	gck-secret-module.h gck-secret-module.c \
-	gck-secret-object.h gck-secret-object.c \
-	gck-secret-search.h gck-secret-search.c \
-	gck-secret-store.h \
-	gck-secret-types.h \
-	gck-secret-textual.c gck-secret-textual.h
+	libgkm-secret-store.la
+
+libgkm_secret_store_la_SOURCES = \
+	gkm-secret-binary.c gkm-secret-binary.h \
+	gkm-secret-collection.h gkm-secret-collection.c \
+	gkm-secret-compat.h gkm-secret-compat.c \
+	gkm-secret-data.h gkm-secret-data.c \
+	gkm-secret-fields.h gkm-secret-fields.c \
+	gkm-secret-item.h gkm-secret-item.c \
+	gkm-secret-module.h gkm-secret-module.c \
+	gkm-secret-object.h gkm-secret-object.c \
+	gkm-secret-search.h gkm-secret-search.c \
+	gkm-secret-store.h \
+	gkm-secret-types.h \
+	gkm-secret-textual.c gkm-secret-textual.h
 
 # ------------------------------------------------------------------------------
 # The standalone module
@@ -32,18 +32,18 @@ libgck_secret_store_la_SOURCES = \
 moduledir = $(libdir)/gnome-keyring/standalone/
 
 module_LTLIBRARIES = \
-	gck-secret-store-standalone.la
+	gkm-secret-store-standalone.la
 
-gck_secret_store_standalone_la_LDFLAGS = \
+gkm_secret_store_standalone_la_LDFLAGS = \
 	-module -avoid-version \
 	-no-undefined -export-symbols-regex 'C_GetFunctionList'
 
-gck_secret_store_standalone_la_SOURCES = \
-	gck-secret-standalone.c
+gkm_secret_store_standalone_la_SOURCES = \
+	gkm-secret-standalone.c
 
-gck_secret_store_standalone_la_LIBADD = \
-	libgck-secret-store.la \
-	$(top_builddir)/pkcs11/gck/libgck.la \
+gkm_secret_store_standalone_la_LIBADD = \
+	libgkm-secret-store.la \
+	$(top_builddir)/pkcs11/gkm/libgkm.la \
 	$(GOBJECT_LIBS) \
 	$(GTHREAD_LIBS) \
 	$(GLIB_LIBS) \
@@ -55,7 +55,7 @@ gck_secret_store_standalone_la_LIBADD = \
 if WITH_TESTS
 TESTS_DIR = tests
 else
-TESTS_DIR = 
+TESTS_DIR =
 endif
 
 SUBDIRS = . $(TESTS_DIR)
diff --git a/pkcs11/secret-store/gck-secret-binary.c b/pkcs11/secret-store/gkm-secret-binary.c
similarity index 78%
rename from pkcs11/secret-store/gck-secret-binary.c
rename to pkcs11/secret-store/gkm-secret-binary.c
index 99a0085..942ffe7 100644
--- a/pkcs11/secret-store/gck-secret-binary.c
+++ b/pkcs11/secret-store/gkm-secret-binary.c
@@ -1,5 +1,5 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* gck-secret-binary.c - The binary encrypted format of a keyring
+/* gkm-secret-binary.c - The binary encrypted format of a keyring
 
    Copyright (C) 2003 Red Hat, Inc
    Copyright (C) 2007, 2009 Stefan Walter
@@ -8,12 +8,12 @@
    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.
-  
+
    Gnome keyring 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., 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -24,18 +24,18 @@
 
 #include "config.h"
 
-#include "gck-secret-binary.h"
-#include "gck-secret-collection.h"
-#include "gck-secret-compat.h"
-#include "gck-secret-data.h"
-#include "gck-secret-fields.h"
-#include "gck-secret-item.h"
+#include "gkm-secret-binary.h"
+#include "gkm-secret-collection.h"
+#include "gkm-secret-compat.h"
+#include "gkm-secret-data.h"
+#include "gkm-secret-fields.h"
+#include "gkm-secret-item.h"
 
 #include "egg/egg-buffer.h"
 #include "egg/egg-symkey.h"
 #include "egg/egg-secure-memory.h"
 
-#include "gck/gck-secret.h"
+#include "gkm/gkm-secret.h"
 
 #include <glib.h>
 
@@ -85,10 +85,10 @@ typedef struct {
  */
 
 static gboolean
-buffer_get_bytes (EggBuffer *buffer, gsize offset, gsize *next_offset, 
+buffer_get_bytes (EggBuffer *buffer, gsize offset, gsize *next_offset,
                   guchar *out, gsize n_bytes)
 {
-	if (buffer->len < n_bytes || offset > buffer->len - n_bytes) 
+	if (buffer->len < n_bytes || offset > buffer->len - n_bytes)
 		return FALSE;
 	memcpy (out, buffer->buf + offset, n_bytes);
 	*next_offset = offset + n_bytes;
@@ -99,7 +99,7 @@ static gboolean
 buffer_add_time (EggBuffer *buffer, glong time)
 {
 	guint64 val = time;
-	return egg_buffer_add_uint32 (buffer, ((val >> 32) & 0xffffffff)) && 
+	return egg_buffer_add_uint32 (buffer, ((val >> 32) & 0xffffffff)) &&
 	       egg_buffer_add_uint32 (buffer, (val & 0xffffffff));
 }
 
@@ -109,7 +109,7 @@ buffer_get_time (EggBuffer *buffer, gsize offset, gsize *next_offset, glong *tim
 	guint32 a, b;
 	guint64 val;
 
-	if (!egg_buffer_get_uint32 (buffer, offset, &offset, &a) || 
+	if (!egg_buffer_get_uint32 (buffer, offset, &offset, &a) ||
 	    !egg_buffer_get_uint32 (buffer, offset, &offset, &b))
 		return FALSE;
 
@@ -133,8 +133,8 @@ buffer_get_utf8_string (EggBuffer *buffer, gsize offset, gsize *next_offset,
 {
 	gsize len;
 	char *str;
-	
-	if (!egg_buffer_get_string (buffer, offset, &offset, &str, 
+
+	if (!egg_buffer_get_string (buffer, offset, &offset, &str,
 	                            (EggBufferAllocator)g_realloc))
 		return FALSE;
 	len = str ? strlen (str) : 0;
@@ -158,12 +158,12 @@ buffer_get_utf8_string (EggBuffer *buffer, gsize offset, gsize *next_offset,
 }
 
 static gboolean
-buffer_add_secret (EggBuffer *buffer, GckSecret *secret)
+buffer_add_secret (EggBuffer *buffer, GkmSecret *secret)
 {
 	const guchar *data = NULL;
 	gsize n_data = 0;
 	if (secret != NULL)
-		data = gck_secret_get (secret, &n_data);
+		data = gkm_secret_get (secret, &n_data);
 	return egg_buffer_add_byte_array (buffer, data, n_data);
 }
 
@@ -171,29 +171,29 @@ static void
 buffer_add_attribute (EggBuffer *buffer, GHashTable *attributes, const gchar *key)
 {
 	guint32 number;
-	
+
 	buffer_add_utf8_string (buffer, key);
-	
-	/* 
+
+	/*
 	 * COMPATIBILITY:
-	 * 
-	 * Our new Secrets API doesn't support integer attributes. However, to have 
-	 * compatibility with old keyring code reading this file, we need to set 
-	 * the uint32 type attribute appropriately where expected. 
-	 * 
+	 *
+	 * Our new Secrets API doesn't support integer attributes. However, to have
+	 * compatibility with old keyring code reading this file, we need to set
+	 * the uint32 type attribute appropriately where expected.
+	 *
 	 * If there's an extra compat-uint32 attribute and the name of this attribute
 	 * is contained in that list, then write as a uint32.
 	 */
-	
+
 	/* Determine if it's a uint32 compatible value, and store as such if it is */
-	if (gck_secret_fields_get_compat_uint32 (attributes, key, &number)) {
+	if (gkm_secret_fields_get_compat_uint32 (attributes, key, &number)) {
 		egg_buffer_add_uint32 (buffer, 1);
 		egg_buffer_add_uint32 (buffer, number);
 
 	/* A normal string attribute */
 	} else {
 		egg_buffer_add_uint32 (buffer, 0);
-		buffer_add_utf8_string (buffer, gck_secret_fields_get (attributes, key));
+		buffer_add_utf8_string (buffer, gkm_secret_fields_get (attributes, key));
 	}
 }
 
@@ -208,13 +208,13 @@ buffer_add_hashed_attribute (EggBuffer *buffer, GHashTable *attributes, const gc
 	/* See comments in buffer_add_attribute. */
 
 	/* Determine if it's a uint32 compatible value, and store as such if it is */
-	if (gck_secret_fields_get_compat_hashed_uint32 (attributes, key, &number)) {
+	if (gkm_secret_fields_get_compat_hashed_uint32 (attributes, key, &number)) {
 		egg_buffer_add_uint32 (buffer, 1);
 		egg_buffer_add_uint32 (buffer, number);
 
 	/* A standard string attribute */
 	} else {
-		if (!gck_secret_fields_get_compat_hashed_string (attributes, key, &value))
+		if (!gkm_secret_fields_get_compat_hashed_string (attributes, key, &value))
 			g_return_if_reached ();
 		egg_buffer_add_uint32 (buffer, 0);
 		buffer_add_utf8_string (buffer, value);
@@ -226,13 +226,13 @@ static gboolean
 buffer_add_attributes (EggBuffer *buffer, GHashTable *attributes, gboolean hashed)
 {
 	GList *names, *l;
-	
+
 	g_assert (buffer);
-	
+
 	if (attributes == NULL) {
 		egg_buffer_add_uint32 (buffer, 0);
 	} else {
-		names = gck_secret_fields_get_names (attributes);
+		names = gkm_secret_fields_get_names (attributes);
 		egg_buffer_add_uint32 (buffer, g_list_length (names));
 		for (l = names; l; l = g_list_next (l)) {
 			if (hashed)
@@ -242,7 +242,7 @@ buffer_add_attributes (EggBuffer *buffer, GHashTable *attributes, gboolean hashe
 		}
 		g_list_free (names);
 	}
-	
+
 	return !egg_buffer_has_error (buffer);
 }
 
@@ -259,11 +259,11 @@ buffer_get_attributes (EggBuffer *buffer, gsize offset, gsize *next_offset,
 	int i;
 
 	attributes = NULL;
-	
+
 	if (!egg_buffer_get_uint32 (buffer, offset, &offset, &list_size))
 		goto bail;
 
-	attributes = gck_secret_fields_new ();
+	attributes = gkm_secret_fields_new ();
 	for (i = 0; i < list_size; i++) {
 		if (!buffer_get_utf8_string (buffer, offset, &offset, &name))
 			goto bail;
@@ -278,11 +278,11 @@ buffer_get_attributes (EggBuffer *buffer, gsize offset, gsize *next_offset,
 				goto bail;
 			}
 			if (hashed) {
-				gck_secret_fields_add_compat_hashed_string (attributes, name, str);
+				gkm_secret_fields_add_compat_hashed_string (attributes, name, str);
 				g_free (name);
 				g_free (str);
 			} else {
-				gck_secret_fields_take (attributes, name, str);
+				gkm_secret_fields_take (attributes, name, str);
 			}
 			break;
 		case 1: /* A uint32 */
@@ -291,9 +291,9 @@ buffer_get_attributes (EggBuffer *buffer, gsize offset, gsize *next_offset,
 				goto bail;
 			}
 			if (hashed)
-				gck_secret_fields_add_compat_hashed_uint32 (attributes, name, val);
+				gkm_secret_fields_add_compat_hashed_uint32 (attributes, name, val);
 			else
-				gck_secret_fields_add_compat_uint32 (attributes, name, val);
+				gkm_secret_fields_add_compat_uint32 (attributes, name, val);
 			g_free (name);
 			break;
 		default:
@@ -301,12 +301,12 @@ buffer_get_attributes (EggBuffer *buffer, gsize offset, gsize *next_offset,
 			goto bail;
 		}
 	}
-	
+
 	*attributes_out = attributes;
 	*next_offset = offset;
-	
+
 	return TRUE;
-	
+
 bail:
 	g_hash_table_unref (attributes);
 	return FALSE;
@@ -325,7 +325,7 @@ convert_to_integer (const gchar *string, guint32 *result)
  */
 
 static gboolean
-encrypt_buffer (EggBuffer *buffer, GckSecret *master,
+encrypt_buffer (EggBuffer *buffer, GkmSecret *master,
 		guchar salt[8], int iterations)
 {
 	const gchar *password;
@@ -338,15 +338,15 @@ encrypt_buffer (EggBuffer *buffer, GckSecret *master,
 	g_assert (buffer->len % 16 == 0);
 	g_assert (16 == gcry_cipher_get_algo_blklen (GCRY_CIPHER_AES128));
 	g_assert (16 == gcry_cipher_get_algo_keylen (GCRY_CIPHER_AES128));
-	
-	password = gck_secret_get_password (master, &n_password);
-	if (!egg_symkey_generate_simple (GCRY_CIPHER_AES128, GCRY_MD_SHA256, 
+
+	password = gkm_secret_get_password (master, &n_password);
+	if (!egg_symkey_generate_simple (GCRY_CIPHER_AES128, GCRY_MD_SHA256,
 	                                 password, n_password, salt, 8, iterations, &key, &iv))
 		return FALSE;
 
 	gerr = gcry_cipher_open (&cih, GCRY_CIPHER_AES128, GCRY_CIPHER_MODE_CBC, 0);
 	if (gerr) {
-		g_warning ("couldn't create aes cipher context: %s", 
+		g_warning ("couldn't create aes cipher context: %s",
 			   gcry_strerror (gerr));
 		egg_secure_free (key);
 		g_free (iv);
@@ -370,12 +370,12 @@ encrypt_buffer (EggBuffer *buffer, GckSecret *master,
 	}
 
 	gcry_cipher_close (cih);
-	
+
 	return TRUE;
 }
 
 static gboolean
-decrypt_buffer (EggBuffer *buffer, GckSecret *master,
+decrypt_buffer (EggBuffer *buffer, GkmSecret *master,
 		guchar salt[8], int iterations)
 {
 	const gchar *password = NULL;
@@ -388,22 +388,22 @@ decrypt_buffer (EggBuffer *buffer, GckSecret *master,
 	g_assert (buffer->len % 16 == 0);
 	g_assert (16 == gcry_cipher_get_algo_blklen (GCRY_CIPHER_AES128));
 	g_assert (16 == gcry_cipher_get_algo_keylen (GCRY_CIPHER_AES128));
-	
+
 	/* No password is set, try an null password */
 	if (master == NULL) {
 		password = NULL;
 		n_password = 0;
 	} else {
-		password = gck_secret_get_password (master, &n_password);
+		password = gkm_secret_get_password (master, &n_password);
 	}
 
-	if (!egg_symkey_generate_simple (GCRY_CIPHER_AES128, GCRY_MD_SHA256, 
+	if (!egg_symkey_generate_simple (GCRY_CIPHER_AES128, GCRY_MD_SHA256,
 	                                 password, n_password, salt, 8, iterations, &key, &iv))
 		return FALSE;
-	
+
 	gerr = gcry_cipher_open (&cih, GCRY_CIPHER_AES128, GCRY_CIPHER_MODE_CBC, 0);
 	if (gerr) {
-		g_warning ("couldn't create aes cipher context: %s", 
+		g_warning ("couldn't create aes cipher context: %s",
 			   gcry_strerror (gerr));
 		egg_secure_free (key);
 		g_free (iv);
@@ -427,7 +427,7 @@ decrypt_buffer (EggBuffer *buffer, GckSecret *master,
 	}
 
 	gcry_cipher_close (cih);
-	
+
 	return TRUE;
 }
 
@@ -435,29 +435,29 @@ static gboolean
 verify_decrypted_buffer (EggBuffer *buffer)
 {
         guchar digest[16];
-	
+
 	/* In case the world changes on us... */
 	g_return_val_if_fail (gcry_md_get_algo_dlen (GCRY_MD_MD5) == sizeof (digest), 0);
-	
-	gcry_md_hash_buffer (GCRY_MD_MD5, (void*)digest, 
+
+	gcry_md_hash_buffer (GCRY_MD_MD5, (void*)digest,
 			     (guchar*)buffer->buf + 16, buffer->len - 16);
-	
+
 	return memcmp (buffer->buf, digest, 16) == 0;
 }
 
-static gboolean 
+static gboolean
 generate_acl_data (EggBuffer *buffer, GList *acl)
 {
 	GList *l;
-	GckSecretAccess *ac;
-	
+	GkmSecretAccess *ac;
+
 	egg_buffer_add_uint32 (buffer, g_list_length (acl));
 
 	for (l = acl; l != NULL; l = l->next) {
 		ac = l->data;
-		
+
 		egg_buffer_add_uint32 (buffer, ac->types_allowed);
-		if (!buffer_add_utf8_string (buffer, ac->display_name) || 
+		if (!buffer_add_utf8_string (buffer, ac->display_name) ||
 		    !buffer_add_utf8_string (buffer, ac->pathname))
 			return FALSE;
 
@@ -466,43 +466,43 @@ generate_acl_data (EggBuffer *buffer, GList *acl)
 			return FALSE;
 		egg_buffer_add_uint32 (buffer, 0);
 	}
-	
+
 	return TRUE;
 }
 
 static gboolean
-generate_encrypted_data (EggBuffer *buffer, GckSecretCollection *collection,
-                         GckSecretData *data)
+generate_encrypted_data (EggBuffer *buffer, GkmSecretCollection *collection,
+                         GkmSecretData *data)
 {
-	GckSecretObject *obj;
-	GckSecretItem *item;
+	GkmSecretObject *obj;
+	GkmSecretItem *item;
 	GList *items, *l;
 	GHashTable *attributes;
 	const gchar *label;
-	GckSecret *secret;
+	GkmSecret *secret;
 	GList *acl;
 	int i;
 
 	g_assert (buffer);
-	g_assert (GCK_IS_SECRET_COLLECTION (collection));
-	g_assert (GCK_IS_SECRET_DATA (data));
+	g_assert (GKM_IS_SECRET_COLLECTION (collection));
+	g_assert (GKM_IS_SECRET_DATA (data));
 
 	/* Make sure we're using non-pageable memory */
 	egg_buffer_set_allocator (buffer, egg_secure_realloc);
-	
-	items = gck_secret_collection_get_items (collection);
+
+	items = gkm_secret_collection_get_items (collection);
 	for (l = items; l && !egg_buffer_has_error(buffer); l = g_list_next (l)) {
-		item = GCK_SECRET_ITEM (l->data);
-		obj = GCK_SECRET_OBJECT (l->data);
-		
-		label = gck_secret_object_get_label (obj);
+		item = GKM_SECRET_ITEM (l->data);
+		obj = GKM_SECRET_OBJECT (l->data);
+
+		label = gkm_secret_object_get_label (obj);
 		buffer_add_utf8_string (buffer, label);
 
-		secret = gck_secret_data_get_secret (data, gck_secret_object_get_identifier (obj));
+		secret = gkm_secret_data_get_secret (data, gkm_secret_object_get_identifier (obj));
 		buffer_add_secret (buffer, secret);
 
-		if (!buffer_add_time (buffer, gck_secret_object_get_created (obj)) || 
-		    !buffer_add_time (buffer, gck_secret_object_get_modified (obj)))
+		if (!buffer_add_time (buffer, gkm_secret_object_get_created (obj)) ||
+		    !buffer_add_time (buffer, gkm_secret_object_get_modified (obj)))
 			break;
 
 		/* reserved: */
@@ -511,7 +511,7 @@ generate_encrypted_data (EggBuffer *buffer, GckSecretCollection *collection,
 		for (i = 0; i < 4; i++)
 			egg_buffer_add_uint32 (buffer, 0);
 
-		attributes = gck_secret_item_get_fields (item);
+		attributes = gkm_secret_item_get_fields (item);
 		if (!buffer_add_attributes (buffer, attributes, FALSE))
 			break;
 
@@ -519,27 +519,27 @@ generate_encrypted_data (EggBuffer *buffer, GckSecretCollection *collection,
 		if (!generate_acl_data (buffer, acl))
 			break;
 	}
-	
+
 	g_list_free (items);
-	
+
 	/* Iteration completed prematurely == fail */
-	return (l == NULL); 
+	return (l == NULL);
 }
 
 static gboolean
-generate_hashed_items (GckSecretCollection *collection, EggBuffer *buffer)
+generate_hashed_items (GkmSecretCollection *collection, EggBuffer *buffer)
 {
 	GHashTable *attributes;
 	const gchar *value;
 	GList *items, *l;
 	guint32 id, type;
-	
-	items = gck_secret_collection_get_items (collection);
+
+	items = gkm_secret_collection_get_items (collection);
 	egg_buffer_add_uint32 (buffer, g_list_length (items));
 
 	for (l = items; l; l = g_list_next (l)) {
-		
-		value = gck_secret_object_get_identifier (l->data);
+
+		value = gkm_secret_object_get_identifier (l->data);
 		if (!convert_to_integer (value, &id)) {
 			g_warning ("trying to save a non-numeric item identifier '%s' into "
 			           "the keyring file format which only supports numeric.", value);
@@ -547,25 +547,25 @@ generate_hashed_items (GckSecretCollection *collection, EggBuffer *buffer)
 		}
 		egg_buffer_add_uint32 (buffer, id);
 
-		value = gck_secret_item_get_schema (l->data);
-		type = gck_secret_compat_parse_item_type (value);
+		value = gkm_secret_item_get_schema (l->data);
+		type = gkm_secret_compat_parse_item_type (value);
 		egg_buffer_add_uint32 (buffer, type);
 
-		attributes = gck_secret_item_get_fields (l->data);
+		attributes = gkm_secret_item_get_fields (l->data);
 		buffer_add_attributes (buffer, attributes, TRUE);
 	}
-	
+
 	g_list_free (items);
 	return !egg_buffer_has_error (buffer);
 }
 
-GckDataResult 
-gck_secret_binary_write (GckSecretCollection *collection, GckSecretData *sdata,
+GkmDataResult
+gkm_secret_binary_write (GkmSecretCollection *collection, GkmSecretData *sdata,
                          guchar **data, gsize *n_data)
 {
-	GckSecretObject *obj;
+	GkmSecretObject *obj;
 	EggBuffer to_encrypt;
-	GckSecret *master;
+	GkmSecret *master;
         guchar digest[16];
         EggBuffer buffer;
         gint hash_iterations;
@@ -574,34 +574,34 @@ gck_secret_binary_write (GckSecretCollection *collection, GckSecretData *sdata,
 	guint flags = 0;
 	int i;
 
-	g_return_val_if_fail (GCK_IS_SECRET_COLLECTION (collection), GCK_DATA_FAILURE);
-	g_return_val_if_fail (GCK_IS_SECRET_DATA (sdata), GCK_DATA_LOCKED);
-	g_return_val_if_fail (data && n_data, GCK_DATA_FAILURE);
-	g_return_val_if_fail (gcry_md_get_algo_dlen (GCRY_MD_MD5) == sizeof (digest), GCK_DATA_FAILURE);
+	g_return_val_if_fail (GKM_IS_SECRET_COLLECTION (collection), GKM_DATA_FAILURE);
+	g_return_val_if_fail (GKM_IS_SECRET_DATA (sdata), GKM_DATA_LOCKED);
+	g_return_val_if_fail (data && n_data, GKM_DATA_FAILURE);
+	g_return_val_if_fail (gcry_md_get_algo_dlen (GCRY_MD_MD5) == sizeof (digest), GKM_DATA_FAILURE);
 
-	obj = GCK_SECRET_OBJECT (collection);
+	obj = GKM_SECRET_OBJECT (collection);
 
 	egg_buffer_init_full (&buffer, 256, g_realloc);
-	
+
 	/* Prepare the keyring for encryption */
 	hash_iterations = 1000 + (int) (1000.0 * rand() / (RAND_MAX + 1.0));
 	gcry_create_nonce (salt, sizeof (salt));
-		
+
 	egg_buffer_append (&buffer, (guchar*)KEYRING_FILE_HEADER, KEYRING_FILE_HEADER_LEN);
 	egg_buffer_add_byte (&buffer, 0); /* Major version */
 	egg_buffer_add_byte (&buffer, 0); /* Minor version */
 	egg_buffer_add_byte (&buffer, 0); /* crypto (0 == AES) */
 	egg_buffer_add_byte (&buffer, 0); /* hash (0 == MD5) */
 
-	buffer_add_utf8_string (&buffer, gck_secret_object_get_label (obj));
-	buffer_add_time (&buffer, gck_secret_object_get_modified (obj));
-	buffer_add_time (&buffer, gck_secret_object_get_created (obj));
+	buffer_add_utf8_string (&buffer, gkm_secret_object_get_label (obj));
+	buffer_add_time (&buffer, gkm_secret_object_get_modified (obj));
+	buffer_add_time (&buffer, gkm_secret_object_get_created (obj));
 
-	lock_timeout = gck_secret_collection_get_lock_idle (collection);
+	lock_timeout = gkm_secret_collection_get_lock_idle (collection);
 	if (lock_timeout) {
 		flags |= LOCK_ON_IDLE_FLAG;
 	} else {
-		lock_timeout = gck_secret_collection_get_lock_after (collection);
+		lock_timeout = gkm_secret_collection_get_lock_after (collection);
 		if (lock_timeout)
 			flags |= LOCK_AFTER_FLAG;
 	}
@@ -621,45 +621,45 @@ gck_secret_binary_write (GckSecretCollection *collection, GckSecretData *sdata,
 
 	/* Encrypted data. Use non-pageable memory */
 	egg_buffer_init_full (&to_encrypt, 4096, egg_secure_realloc);
-	
+
 	egg_buffer_append (&to_encrypt, (guchar*)digest, 16); /* Space for hash */
 
 	if (!generate_encrypted_data (&to_encrypt, collection, sdata)) {
 		egg_buffer_uninit (&to_encrypt);
 		egg_buffer_uninit (&buffer);
-		return GCK_DATA_FAILURE;
+		return GKM_DATA_FAILURE;
 	}
 
 	/* Pad with zeros to multiple of 16 bytes */
 	while (to_encrypt.len % 16 != 0)
 		egg_buffer_add_byte (&to_encrypt, 0);
 
-	gcry_md_hash_buffer (GCRY_MD_MD5, (void*)digest, 
+	gcry_md_hash_buffer (GCRY_MD_MD5, (void*)digest,
 			     (guchar*)to_encrypt.buf + 16, to_encrypt.len - 16);
 	memcpy (to_encrypt.buf, digest, 16);
-	
+
 	/* If no master password is set, we shouldn't be writing binary... */
-	master = gck_secret_data_get_master (sdata);
-	g_return_val_if_fail (master, GCK_DATA_FAILURE);
+	master = gkm_secret_data_get_master (sdata);
+	g_return_val_if_fail (master, GKM_DATA_FAILURE);
 
 	if (!encrypt_buffer (&to_encrypt, master, salt, hash_iterations)) {
 		egg_buffer_uninit (&buffer);
 		egg_buffer_uninit (&to_encrypt);
-		return GCK_DATA_FAILURE;
+		return GKM_DATA_FAILURE;
 	}
-	
+
 	if (egg_buffer_has_error (&to_encrypt) || egg_buffer_has_error (&buffer)) {
 		egg_buffer_uninit (&buffer);
 		egg_buffer_uninit (&to_encrypt);
-		return GCK_DATA_FAILURE;
+		return GKM_DATA_FAILURE;
 	}
 
 	egg_buffer_add_uint32 (&buffer, to_encrypt.len);
 	egg_buffer_append (&buffer, to_encrypt.buf, to_encrypt.len);
 	egg_buffer_uninit (&to_encrypt);
 	*data = egg_buffer_uninit_steal (&buffer, n_data);
-	
-	return GCK_DATA_SUCCESS;
+
+	return GKM_DATA_SUCCESS;
 }
 
 static gboolean
@@ -669,9 +669,9 @@ decode_acl (EggBuffer *buffer, gsize offset, gsize *offset_out, GList **out)
 	guint32 num_acs;
 	guint32 x, y;
 	int i;
-	GckSecretAccess *ac;
+	GkmSecretAccess *ac;
 	char *name, *path, *reserved;
-	
+
 	acl = NULL;
 
 	if (!egg_buffer_get_uint32 (buffer, offset, &offset, &num_acs))
@@ -700,62 +700,62 @@ decode_acl (EggBuffer *buffer, gsize offset, gsize *offset_out, GList **out)
 			goto bail;
 		}
 
-		ac = g_new0 (GckSecretAccess, 1);
+		ac = g_new0 (GkmSecretAccess, 1);
 		ac->display_name = name;
 		ac->pathname = path;
 		ac->types_allowed = x;
-		
+
 		acl = g_list_prepend (acl, ac);
 	}
 
 	*offset_out = offset;
 	*out = g_list_reverse (acl);
 	return TRUE;
-	
+
 bail:
-	gck_secret_compat_acl_free (acl);
+	gkm_secret_compat_acl_free (acl);
 	return FALSE;
 }
 
-static void 
+static void
 remove_unavailable_item (gpointer key, gpointer dummy, gpointer user_data)
 {
 	/* Called to remove items from a keyring that no longer exist */
-	
-	GckSecretCollection *collection = user_data;
-	GckSecretItem *item;
-	
-	g_assert (GCK_IS_SECRET_COLLECTION (collection));
-	
-	item = gck_secret_collection_get_item (collection, key);
+
+	GkmSecretCollection *collection = user_data;
+	GkmSecretItem *item;
+
+	g_assert (GKM_IS_SECRET_COLLECTION (collection));
+
+	item = gkm_secret_collection_get_item (collection, key);
 	if (item != NULL)
-		gck_secret_collection_remove_item (collection, item);
+		gkm_secret_collection_remove_item (collection, item);
 }
 
 static void
-setup_item_from_info (GckSecretItem *item, GckSecretData *data, ItemInfo *info)
+setup_item_from_info (GkmSecretItem *item, GkmSecretData *data, ItemInfo *info)
 {
-	GckSecretObject *obj = GCK_SECRET_OBJECT (item);
-	GckSecret *secret;
+	GkmSecretObject *obj = GKM_SECRET_OBJECT (item);
+	GkmSecret *secret;
 	const gchar *type;
-	
-	gck_secret_object_set_label (obj, info->display_name);
-	gck_secret_object_set_created (obj, info->ctime);
-	gck_secret_object_set_modified (obj, info->mtime);
-	
-	type = gck_secret_compat_format_item_type (info->type);
-	gck_secret_item_set_schema (item, type);
-	gck_secret_item_set_fields (item, info->attributes);
+
+	gkm_secret_object_set_label (obj, info->display_name);
+	gkm_secret_object_set_created (obj, info->ctime);
+	gkm_secret_object_set_modified (obj, info->mtime);
+
+	type = gkm_secret_compat_format_item_type (info->type);
+	gkm_secret_item_set_schema (item, type);
+	gkm_secret_item_set_fields (item, info->attributes);
 
 	/* Collection is locked */
 	if (!data) {
 		g_object_set_data (G_OBJECT (item), "compat-acl", NULL);
-		
+
 	} else {
-		secret = gck_secret_new (info->ptr_secret, info->n_secret);
-		gck_secret_data_set_secret (data, gck_secret_object_get_identifier (obj), secret);
+		secret = gkm_secret_new (info->ptr_secret, info->n_secret);
+		gkm_secret_data_set_secret (data, gkm_secret_object_get_identifier (obj), secret);
 		g_object_unref (secret);
-		g_object_set_data_full (G_OBJECT (item), "compat-acl", info->acl, gck_secret_compat_acl_free);
+		g_object_set_data_full (G_OBJECT (item), "compat-acl", info->acl, gkm_secret_compat_acl_free);
 		info->acl = NULL;
 	}
 }
@@ -805,7 +805,7 @@ read_full_item_info (EggBuffer *buffer, gsize *offset, ItemInfo *items, guint n_
 
 		/* The item times */
 		if (!buffer_get_time (buffer, *offset, offset, &items[i].ctime) ||
-		    !buffer_get_time (buffer, *offset, offset, &items[i].mtime)) 
+		    !buffer_get_time (buffer, *offset, offset, &items[i].mtime))
 			return FALSE;
 
 		/* Reserved data */
@@ -838,11 +838,11 @@ free_item_info (ItemInfo *info)
 	g_free (info->identifier);
 	g_free (info->display_name);
 	g_hash_table_unref (info->attributes);
-	gck_secret_compat_acl_free (info->acl);
+	gkm_secret_compat_acl_free (info->acl);
 }
 
 gint
-gck_secret_binary_read (GckSecretCollection *collection, GckSecretData *sdata,
+gkm_secret_binary_read (GkmSecretCollection *collection, GkmSecretData *sdata,
                         const guchar *data, gsize n_data)
 {
 	gsize offset;
@@ -857,29 +857,29 @@ gck_secret_binary_read (GckSecretCollection *collection, GckSecretData *sdata,
 	guint32 hash_iterations;
 	guchar salt[8];
 	ItemInfo *items;
-	GckSecret* master;
-	GckSecretObject *obj;
+	GkmSecret* master;
+	GkmSecretObject *obj;
 	EggBuffer to_decrypt = EGG_BUFFER_EMPTY;
-	GckDataResult res = GCK_DATA_FAILURE;
+	GkmDataResult res = GKM_DATA_FAILURE;
 	GHashTable *checks = NULL;
-	GckSecretItem *item;
+	GkmSecretItem *item;
 	EggBuffer buffer;
 	GList *l, *iteml;
 	int i;
 
 	display_name = NULL;
 	items = 0;
-	obj = GCK_SECRET_OBJECT (collection);
+	obj = GKM_SECRET_OBJECT (collection);
 
 	/* The buffer we read from */
 	egg_buffer_init_static (&buffer, data, n_data);
 
-	if (buffer.len < KEYRING_FILE_HEADER_LEN || 
+	if (buffer.len < KEYRING_FILE_HEADER_LEN ||
 	    memcmp (buffer.buf, KEYRING_FILE_HEADER, KEYRING_FILE_HEADER_LEN) != 0) {
 		egg_buffer_uninit (&buffer);
-		return GCK_DATA_UNRECOGNIZED;
+		return GKM_DATA_UNRECOGNIZED;
 	}
-	
+
 	offset = KEYRING_FILE_HEADER_LEN;
 	major = buffer.buf[offset++];
 	minor = buffer.buf[offset++];
@@ -888,18 +888,18 @@ gck_secret_binary_read (GckSecretCollection *collection, GckSecretData *sdata,
 
 	if (major != 0 || minor != 0 || crypto != 0 || hash != 0) {
 		egg_buffer_uninit (&buffer);
-		return GCK_DATA_UNRECOGNIZED;
+		return GKM_DATA_UNRECOGNIZED;
 	}
-	
-	if (!buffer_get_utf8_string (&buffer, offset, &offset, &display_name) || 
-	    !buffer_get_time (&buffer, offset, &offset, &ctime) ||		
+
+	if (!buffer_get_utf8_string (&buffer, offset, &offset, &display_name) ||
+	    !buffer_get_time (&buffer, offset, &offset, &ctime) ||
 	    !buffer_get_time (&buffer, offset, &offset, &mtime) ||
 	    !egg_buffer_get_uint32 (&buffer, offset, &offset, &flags) ||
 	    !egg_buffer_get_uint32 (&buffer, offset, &offset, &lock_timeout) ||
 	    !egg_buffer_get_uint32 (&buffer, offset, &offset, &hash_iterations) ||
 	    !buffer_get_bytes (&buffer, offset, &offset, salt, 8))
 		goto bail;
-	
+
 	for (i = 0; i < 4; i++) {
 		if (!egg_buffer_get_uint32 (&buffer, offset, &offset, &tmp))
 			goto bail;
@@ -920,7 +920,7 @@ gck_secret_binary_read (GckSecretCollection *collection, GckSecretData *sdata,
 	/* Make the crypted part is the right size */
 	if (crypto_size % 16 != 0)
 		goto bail;
-	
+
 	/* Copy the data into to_decrypt into non-pageable memory */
 	egg_buffer_set_allocator (&to_decrypt, egg_secure_realloc);
 	egg_buffer_reserve (&to_decrypt, crypto_size);
@@ -928,11 +928,11 @@ gck_secret_binary_read (GckSecretCollection *collection, GckSecretData *sdata,
 	to_decrypt.len = crypto_size;
 
 	if (sdata != NULL) {
-		master = gck_secret_data_get_master (sdata);
+		master = gkm_secret_data_get_master (sdata);
 		if (!decrypt_buffer (&to_decrypt, master, salt, hash_iterations))
 			goto bail;
 		if (!verify_decrypted_buffer (&to_decrypt)) {
-			res = GCK_DATA_LOCKED;
+			res = GKM_DATA_LOCKED;
 			goto bail;
 		} else {
 			offset = 16; /* Skip hash */
@@ -944,35 +944,35 @@ gck_secret_binary_read (GckSecretCollection *collection, GckSecretData *sdata,
 	/* Correctly read all data, possibly including the decrypted data.
 	 * Now update the keyring and items: */
 
-	gck_secret_object_set_label (obj, display_name);
-	gck_secret_object_set_modified (obj, mtime);
-	gck_secret_object_set_created (obj, ctime);
+	gkm_secret_object_set_label (obj, display_name);
+	gkm_secret_object_set_modified (obj, mtime);
+	gkm_secret_object_set_created (obj, ctime);
 	if (flags & LOCK_ON_IDLE_FLAG)
-		gck_secret_collection_set_lock_idle (collection, lock_timeout);
+		gkm_secret_collection_set_lock_idle (collection, lock_timeout);
 	else if (flags & LOCK_AFTER_FLAG)
-		gck_secret_collection_set_lock_after (collection, lock_timeout);
+		gkm_secret_collection_set_lock_after (collection, lock_timeout);
 
 	/* Build a Hash table where we can track ids we haven't yet seen */
 	checks = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
-	iteml = gck_secret_collection_get_items (collection);
+	iteml = gkm_secret_collection_get_items (collection);
 	for (l = iteml; l; l = g_list_next (l))
-		g_hash_table_insert (checks, g_strdup (gck_secret_object_get_identifier (l->data)), "unused");
+		g_hash_table_insert (checks, g_strdup (gkm_secret_object_get_identifier (l->data)), "unused");
 	g_list_free (iteml);
 
 	for (i = 0; i < num_items; i++) {
-		
+
 		/* We've seen this id */
 		g_hash_table_remove (checks, items[i].identifier);
-		
-		item = gck_secret_collection_get_item (collection, items[i].identifier);
+
+		item = gkm_secret_collection_get_item (collection, items[i].identifier);
 		if (item == NULL)
-			item = gck_secret_collection_new_item (collection, items[i].identifier);
-		
+			item = gkm_secret_collection_new_item (collection, items[i].identifier);
+
 		setup_item_from_info (item, sdata, &items[i]);
 	}
 
 	g_hash_table_foreach (checks, remove_unavailable_item, collection);
-	res = GCK_DATA_SUCCESS;
+	res = GKM_DATA_SUCCESS;
 
 bail:
 	egg_buffer_uninit (&to_decrypt);
diff --git a/pkcs11/secret-store/gck-secret-binary.h b/pkcs11/secret-store/gkm-secret-binary.h
similarity index 67%
rename from pkcs11/secret-store/gck-secret-binary.h
rename to pkcs11/secret-store/gkm-secret-binary.h
index 04d5d81..05cc064 100644
--- a/pkcs11/secret-store/gck-secret-binary.h
+++ b/pkcs11/secret-store/gkm-secret-binary.h
@@ -1,40 +1,40 @@
-/* 
+/*
  * gnome-keyring
- * 
+ *
  * Copyright (C) 2009 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.
  */
 
-#ifndef __GCK_SECRET_BINARY_H__
-#define __GCK_SECRET_BINARY_H__
+#ifndef __GKM_SECRET_BINARY_H__
+#define __GKM_SECRET_BINARY_H__
 
-#include "gck-secret-collection.h"
+#include "gkm-secret-collection.h"
 
-#include "gck/gck-data-types.h"
-#include "gck/gck-types.h"
+#include "gkm/gkm-data-types.h"
+#include "gkm/gkm-types.h"
 
-GckDataResult          gck_secret_binary_read        (GckSecretCollection *collection,
-                                                      GckSecretData *sdata,
+GkmDataResult          gkm_secret_binary_read        (GkmSecretCollection *collection,
+                                                      GkmSecretData *sdata,
                                                       const guchar *data,
                                                       gsize n_data);
 
-GckDataResult          gck_secret_binary_write       (GckSecretCollection *collection, 
-                                                      GckSecretData *sdata,
+GkmDataResult          gkm_secret_binary_write       (GkmSecretCollection *collection,
+                                                      GkmSecretData *sdata,
                                                       guchar **data,
                                                       gsize *n_data);
 
-#endif /* __GCK_SECRET_BINARY_H__ */
+#endif /* __GKM_SECRET_BINARY_H__ */
diff --git a/pkcs11/secret-store/gkm-secret-collection.c b/pkcs11/secret-store/gkm-secret-collection.c
new file mode 100644
index 0000000..04e7718
--- /dev/null
+++ b/pkcs11/secret-store/gkm-secret-collection.c
@@ -0,0 +1,967 @@
+/*
+ * gnome-keyring
+ *
+ * Copyright (C) 2009 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.
+ */
+
+#include "config.h"
+
+#include "gkm-secret-binary.h"
+#include "gkm-secret-collection.h"
+#include "gkm-secret-data.h"
+#include "gkm-secret-item.h"
+#include "gkm-secret-textual.h"
+
+#include "egg/egg-error.h"
+
+#include "gkm/gkm-attributes.h"
+#include "gkm/gkm-credential.h"
+#include "gkm/gkm-secret.h"
+#include "gkm/gkm-session.h"
+#include "gkm/gkm-transaction.h"
+
+#include <glib/gi18n.h>
+
+#include "pkcs11/pkcs11i.h"
+
+enum {
+	PROP_0,
+	PROP_FILENAME
+};
+
+struct _GkmSecretCollection {
+	GkmSecretObject parent;
+	GkmSecretData *sdata;
+	GHashTable *items;
+	gchar *filename;
+	guint32 watermark;
+	GArray *template;
+};
+
+G_DEFINE_TYPE (GkmSecretCollection, gkm_secret_collection, GKM_TYPE_SECRET_OBJECT);
+
+/* Forward declarations */
+static void add_item (GkmSecretCollection *, GkmTransaction *, GkmSecretItem *);
+static void remove_item (GkmSecretCollection *, GkmTransaction *, GkmSecretItem *);
+
+/* -----------------------------------------------------------------------------
+ * INTERNAL
+ */
+
+static GkmDataResult
+load_collection_and_secret_data (GkmSecretCollection *self, GkmSecretData *sdata,
+                                 const gchar *path)
+{
+	GkmDataResult res;
+	GError *error = NULL;
+	guchar *data;
+	gsize n_data;
+
+	/* Read in the keyring */
+	if (!g_file_get_contents (path, (gchar**)&data, &n_data, &error)) {
+		g_message ("problem reading keyring: %s: %s",
+		           path, egg_error_message (error));
+		g_clear_error (&error);
+		return GKM_DATA_FAILURE;
+	}
+
+	/* Try to load from an encrypted file, and otherwise plain text */
+	res = gkm_secret_binary_read (self, sdata, data, n_data);
+	if (res == GKM_DATA_UNRECOGNIZED)
+		res = gkm_secret_textual_read (self, sdata, data, n_data);
+
+	g_free (data);
+
+	return res;
+}
+
+static GkmCredential*
+lookup_unassociated_credential (GkmSession *session, CK_OBJECT_HANDLE handle)
+{
+	GkmObject *object;
+
+	if (gkm_session_lookup_readable_object (session, handle, &object) != CKR_OK)
+		return NULL;
+
+	if (gkm_credential_get_object (GKM_CREDENTIAL (object)) != NULL)
+		return NULL;
+
+	return GKM_CREDENTIAL (object);
+}
+
+static gboolean
+find_unlocked_credential (GkmCredential *cred, GkmObject *object, gpointer user_data)
+{
+	CK_OBJECT_HANDLE *result = user_data;
+
+	g_return_val_if_fail (!*result, FALSE);
+
+	if (gkm_credential_peek_data (cred, GKM_TYPE_SECRET_DATA)) {
+		*result = gkm_object_get_handle (GKM_OBJECT (cred));
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+static gboolean
+find_unlocked_secret_data (GkmCredential *cred, GkmObject *object, gpointer user_data)
+{
+	GkmSecretCollection *self = GKM_SECRET_COLLECTION (object);
+	GkmSecretData **result = user_data;
+
+	g_return_val_if_fail (!*result, FALSE);
+
+	*result = gkm_credential_pop_data (cred, GKM_TYPE_SECRET_DATA);
+	if (*result) {
+		g_return_val_if_fail (*result == self->sdata, FALSE);
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+static void
+track_secret_data (GkmSecretCollection *self, GkmSecretData *data)
+{
+	g_return_if_fail (GKM_IS_SECRET_COLLECTION (self));
+
+	if (self->sdata)
+		g_object_remove_weak_pointer (G_OBJECT (self->sdata),
+		                              (gpointer*)&(self->sdata));
+	self->sdata = data;
+	if (self->sdata)
+		g_object_add_weak_pointer (G_OBJECT (self->sdata),
+		                           (gpointer*)&(self->sdata));
+}
+
+static void
+each_value_to_list (gpointer key, gpointer value, gpointer user_data)
+{
+	GList **list = user_data;
+	*list = g_list_prepend (*list, value);
+}
+
+static void
+expose_each_item (gpointer key, gpointer value, gpointer user_data)
+{
+	gboolean expose = GPOINTER_TO_INT (user_data);
+	gkm_object_expose (value, expose);
+}
+
+static gboolean
+complete_add (GkmTransaction *transaction, GkmSecretCollection *self, GkmSecretItem *item)
+{
+	if (gkm_transaction_get_failed (transaction))
+		remove_item (self, NULL, item);
+	g_object_unref (item);
+	return TRUE;
+}
+
+static void
+add_item (GkmSecretCollection *self, GkmTransaction *transaction, GkmSecretItem *item)
+{
+	const gchar *identifier;
+	guint32 number;
+
+	g_assert (GKM_IS_SECRET_COLLECTION (self));
+	g_assert (GKM_IS_SECRET_ITEM (item));
+
+	identifier = gkm_secret_object_get_identifier (GKM_SECRET_OBJECT (item));
+	g_return_if_fail (identifier);
+
+	/* Make note of the highest numeric identifier, for later use */
+	number = strtoul (identifier, NULL, 10);
+	if (number > self->watermark)
+		self->watermark = number;
+
+	g_hash_table_replace (self->items, g_strdup (identifier), g_object_ref (item));
+
+	if (gkm_object_is_exposed (GKM_OBJECT (self)))
+		gkm_object_expose_full (GKM_OBJECT (item), transaction, TRUE);
+	if (transaction)
+		gkm_transaction_add (transaction, self, (GkmTransactionFunc)complete_add,
+		                     g_object_ref (item));
+
+}
+
+static gboolean
+complete_remove (GkmTransaction *transaction, GkmSecretCollection *self, GkmSecretItem *item)
+{
+	if (gkm_transaction_get_failed (transaction))
+		add_item (self, NULL, item);
+	g_object_unref (item);
+	return TRUE;
+}
+
+static void
+remove_item (GkmSecretCollection *self, GkmTransaction *transaction, GkmSecretItem *item)
+{
+	const gchar *identifier;
+
+	g_assert (GKM_IS_SECRET_COLLECTION (self));
+	g_assert (GKM_IS_SECRET_ITEM (item));
+
+	identifier = gkm_secret_object_get_identifier (GKM_SECRET_OBJECT (item));
+	g_return_if_fail (identifier);
+
+	g_object_ref (item);
+
+	g_hash_table_remove (self->items, identifier);
+
+	gkm_object_expose_full (GKM_OBJECT (item), transaction, FALSE);
+	if (transaction)
+		gkm_transaction_add (transaction, self, (GkmTransactionFunc)complete_remove,
+		                     g_object_ref (item));
+
+	g_object_unref (item);
+}
+
+static GkmObject*
+factory_create_collection (GkmSession *session, GkmTransaction *transaction,
+                           CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
+{
+	GkmSecretCollection *collection = NULL;
+	CK_OBJECT_HANDLE handle;
+	CK_ATTRIBUTE *attr;
+	GkmManager *manager;
+	GkmModule *module;
+	gchar *identifier = NULL;
+	GkmSecretData *sdata;
+	gchar *label = NULL;
+	GkmCredential *cred;
+	gboolean is_token;
+	CK_RV rv;
+
+	g_return_val_if_fail (GKM_IS_TRANSACTION (transaction), NULL);
+	g_return_val_if_fail (attrs || !n_attrs, NULL);
+
+	manager = gkm_manager_for_template (attrs, n_attrs, session);
+	module = gkm_session_get_module (session);
+
+	/* Must have a credential, which is not associated with an object yet */
+	if (!gkm_attributes_find_ulong (attrs, n_attrs, CKA_G_CREDENTIAL, &handle)) {
+		gkm_transaction_fail (transaction, CKR_TEMPLATE_INCOMPLETE);
+		return NULL;
+	}
+
+	cred = lookup_unassociated_credential (session, handle);
+	if (cred == NULL) {
+		gkm_transaction_fail (transaction, CKR_ATTRIBUTE_VALUE_INVALID);
+		return NULL;
+	}
+
+	/* The identifier */
+	attr = gkm_attributes_find (attrs, n_attrs, CKA_ID);
+	if (attr != NULL) {
+		gkm_attribute_consume (attr);
+		rv = gkm_attribute_get_string (attr, &identifier);
+		if (rv != CKR_OK) {
+			gkm_transaction_fail (transaction, rv);
+			return NULL;
+		}
+
+		/* Try to find the collection with that identifier */
+		if (!gkm_attributes_find_boolean (attrs, n_attrs, CKA_TOKEN, &is_token))
+			collection = gkm_secret_collection_find (attr, gkm_module_get_manager (module),
+			                                         gkm_session_get_manager (session), NULL);
+		else if (is_token)
+			collection = gkm_secret_collection_find (attr, gkm_module_get_manager (module), NULL);
+		else
+			collection = gkm_secret_collection_find (attr, gkm_session_get_manager (session), NULL);
+
+		/* Already have one with this identifier? Just return that */
+		if (collection != NULL) {
+			gkm_session_complete_object_creation (session, transaction, GKM_OBJECT (collection),
+			                                      FALSE, attrs, n_attrs);
+			return g_object_ref (collection);
+		}
+	}
+
+	/* The label  */
+	attr = gkm_attributes_find (attrs, n_attrs, CKA_LABEL);
+	if (attr != NULL) {
+		gkm_attribute_consume (attr);
+		rv = gkm_attribute_get_string (attr, &label);
+		if (rv != CKR_OK) {
+			gkm_transaction_fail (transaction, rv);
+			return NULL;
+		}
+
+		/* No identifier? Try to use label */
+		if (identifier == NULL)
+			identifier = g_utf8_strdown (label, -1);
+	}
+
+	if (!identifier || !identifier[0]) {
+		g_free (identifier);
+		identifier = g_strdup ("unnamed");
+	}
+
+	if (!label || !label[0]) {
+		g_free (label);
+		if (identifier) {
+			label = g_strdup (identifier);
+		} else {
+			/* TRANSLATORS: This is the label for an keyring created without a label */
+			label = g_strdup (_("Unnamed"));
+		}
+	}
+
+	g_strdelimit (identifier, ":/\\<>|\t\n\r\v ", '_');
+	collection = g_object_new (GKM_TYPE_SECRET_COLLECTION,
+	                           "module", gkm_session_get_module (session),
+	                           "identifier", identifier,
+	                           "manager", manager,
+	                           "label", label,
+	                           NULL);
+
+	g_free (identifier);
+	g_free (label);
+
+	gkm_credential_connect (cred, GKM_OBJECT (collection));
+	sdata = g_object_new (GKM_TYPE_SECRET_DATA, NULL);
+	gkm_credential_set_data (cred, GKM_TYPE_SECRET_DATA, sdata);
+	gkm_secret_data_set_master (sdata, gkm_credential_get_secret (cred));
+	track_secret_data (collection, sdata);
+	g_object_unref (sdata);
+
+	gkm_attributes_consume (attrs, n_attrs, CKA_G_CREDENTIAL, G_MAXULONG);
+	gkm_session_complete_object_creation (session, transaction, GKM_OBJECT (collection),
+	                                      TRUE, attrs, n_attrs);
+	return GKM_OBJECT (collection);
+}
+
+static gboolean
+complete_master_password (GkmTransaction *transaction, GObject *object, gpointer user_data)
+{
+	GkmSecretCollection *self = GKM_SECRET_COLLECTION (object);
+	GkmSecret *previous = user_data;
+
+	if (gkm_transaction_get_failed (transaction)) {
+		if (self->sdata)
+			gkm_secret_data_set_master (self->sdata, previous);
+	}
+
+	if (previous)
+		g_object_unref (previous);
+
+	return TRUE;
+}
+
+static void
+change_master_password (GkmSecretCollection *self, GkmTransaction *transaction,
+                        GkmCredential *cred)
+{
+	GkmSecret *previous;
+
+	g_assert (GKM_IS_SECRET_COLLECTION (self));
+	g_assert (GKM_IS_TRANSACTION (transaction));
+	g_assert (GKM_IS_CREDENTIAL (cred));
+
+	if (!self->sdata) {
+		gkm_transaction_fail (transaction, CKR_USER_NOT_LOGGED_IN);
+		return;
+	}
+
+	previous = gkm_secret_data_get_master (self->sdata);
+	if (previous != NULL)
+		g_object_ref (previous);
+
+	gkm_credential_connect (cred, GKM_OBJECT (self));
+	gkm_credential_set_data (cred, GKM_TYPE_SECRET_DATA, self->sdata);
+	gkm_secret_data_set_master (self->sdata, gkm_credential_get_secret (cred));
+
+	gkm_transaction_add (transaction, self, complete_master_password, previous);
+}
+
+/* -----------------------------------------------------------------------------
+ * OBJECT
+ */
+
+static CK_RV
+gkm_secret_collection_get_attribute (GkmObject *base, GkmSession *session, CK_ATTRIBUTE_PTR attr)
+{
+	GkmSecretCollection *self = GKM_SECRET_COLLECTION (base);
+
+	switch (attr->type) {
+	case CKA_CLASS:
+		return gkm_attribute_set_ulong (attr, CKO_G_COLLECTION);
+	case CKA_G_CREDENTIAL_TEMPLATE:
+		return gkm_attribute_set_template (attr, self->template);
+	}
+	return GKM_OBJECT_CLASS (gkm_secret_collection_parent_class)->get_attribute (base, session, attr);
+}
+
+static void
+gkm_secret_collection_set_attribute (GkmObject *object, GkmSession *session,
+                                     GkmTransaction *transaction, CK_ATTRIBUTE *attr)
+{
+	GkmSecretCollection *self = GKM_SECRET_COLLECTION (object);
+	CK_OBJECT_HANDLE handle = 0;
+	GkmCredential *cred;
+	GArray *template;
+	CK_RV rv;
+
+	switch (attr->type) {
+	case CKA_G_CREDENTIAL:
+		gkm_credential_for_each (session, GKM_OBJECT (self),
+		                         find_unlocked_credential, &handle);
+		if (handle == 0) {
+			gkm_transaction_fail (transaction, CKR_USER_NOT_LOGGED_IN);
+			return;
+		}
+		rv = gkm_attribute_get_ulong (attr, &handle);
+		if (rv != CKR_OK) {
+			gkm_transaction_fail (transaction, rv);
+			return;
+		}
+		cred = lookup_unassociated_credential (session, handle);
+		if (cred == NULL) {
+			gkm_transaction_fail (transaction, CKR_ATTRIBUTE_VALUE_INVALID);
+			return;
+		}
+		change_master_password (self, transaction, cred);
+		return;
+	case CKA_G_CREDENTIAL_TEMPLATE:
+		rv = gkm_attribute_get_template (attr, &template);
+		if (rv != CKR_OK) {
+			gkm_transaction_fail (transaction, rv);
+			return;
+		}
+		gkm_template_free (self->template);
+		self->template = template;
+		return;
+	};
+
+	GKM_OBJECT_CLASS (gkm_secret_collection_parent_class)->set_attribute (object, session, transaction, attr);
+}
+
+static CK_RV
+gkm_secret_collection_real_unlock (GkmObject *obj, GkmCredential *cred)
+{
+	GkmSecretCollection *self = GKM_SECRET_COLLECTION (obj);
+	GkmDataResult res;
+	GkmSecretData *sdata;
+	GkmSecret *master;
+	CK_RV rv;
+
+	master = gkm_credential_get_secret (cred);
+
+	/* Already unlocked, make sure pin matches */
+	if (self->sdata) {
+		if (!gkm_secret_equal (gkm_secret_data_get_master (self->sdata), master))
+			return CKR_PIN_INCORRECT;
+
+		/* Credential now tracks our secret data */
+		gkm_credential_set_data (cred, GKM_TYPE_SECRET_DATA, self->sdata);
+		return CKR_OK;
+	}
+
+	/* New secret data object, setup master password */
+	sdata = g_object_new (GKM_TYPE_SECRET_DATA, NULL);
+	gkm_secret_data_set_master (sdata, master);
+
+	/* Load the data from a file, and decrypt if necessary */
+	if (self->filename) {
+		res = load_collection_and_secret_data (self, sdata, self->filename);
+
+	/* No filename, password must be null */
+	} else {
+		if (gkm_secret_equals (master, NULL, 0))
+			res = GKM_DATA_SUCCESS;
+		else
+			res = GKM_DATA_LOCKED;
+	}
+
+	switch (res) {
+	case GKM_DATA_SUCCESS:
+		gkm_credential_set_data (cred, GKM_TYPE_SECRET_DATA, sdata);
+		track_secret_data (self, sdata);
+		rv = CKR_OK;
+		break;
+	case GKM_DATA_LOCKED:
+		rv = CKR_PIN_INCORRECT;
+		break;
+	case GKM_DATA_UNRECOGNIZED:
+		g_message ("unrecognized or invalid keyring: %s", self->filename);
+		rv = CKR_FUNCTION_FAILED;
+		break;
+	case GKM_DATA_FAILURE:
+		g_message ("failed to read or parse keyring: %s", self->filename);
+		rv = CKR_GENERAL_ERROR;
+		break;
+	default:
+		g_assert_not_reached ();
+	}
+
+	g_object_unref (sdata);
+	return rv;
+}
+
+static void
+gkm_secret_collection_expose (GkmObject *base, gboolean expose)
+{
+	GKM_OBJECT_CLASS (gkm_secret_collection_parent_class)->expose_object (base, expose);
+	g_hash_table_foreach (GKM_SECRET_COLLECTION (base)->items, expose_each_item, GINT_TO_POINTER (expose));
+}
+
+static gboolean
+gkm_secret_collection_real_is_locked (GkmSecretObject *obj, GkmSession *session)
+{
+	GkmSecretCollection *self = GKM_SECRET_COLLECTION (obj);
+	return !gkm_secret_collection_unlocked_have (self, session);
+}
+
+static void
+gkm_secret_collection_init (GkmSecretCollection *self)
+{
+	CK_ULONG idle = 0;
+	CK_ULONG after = 0;
+	CK_BBOOL token = CK_TRUE;
+	CK_ATTRIBUTE attrs[] = {
+		{ CKA_TOKEN, &token, sizeof (token) },
+		{ CKA_GNOME_TRANSIENT, &token, sizeof (token) },
+		{ CKA_G_DESTRUCT_IDLE, &idle, sizeof (idle) },
+		{ CKA_G_DESTRUCT_AFTER, &after, sizeof (after) },
+	};
+
+	self->items = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
+	self->template = gkm_template_new (attrs, G_N_ELEMENTS (attrs));
+}
+
+static void
+gkm_secret_collection_set_property (GObject *obj, guint prop_id, const GValue *value,
+                                    GParamSpec *pspec)
+{
+	GkmSecretCollection *self = GKM_SECRET_COLLECTION (obj);
+
+	switch (prop_id) {
+	case PROP_FILENAME:
+		gkm_secret_collection_set_filename (self, g_value_get_string (value));
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+gkm_secret_collection_get_property (GObject *obj, guint prop_id, GValue *value,
+                                    GParamSpec *pspec)
+{
+	GkmSecretCollection *self = GKM_SECRET_COLLECTION (obj);
+
+	switch (prop_id) {
+	case PROP_FILENAME:
+		g_value_set_string (value, gkm_secret_collection_get_filename (self));
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+gkm_secret_collection_dispose (GObject *obj)
+{
+	GkmSecretCollection *self = GKM_SECRET_COLLECTION (obj);
+
+	track_secret_data (self, NULL);
+	g_hash_table_remove_all (self->items);
+
+	G_OBJECT_CLASS (gkm_secret_collection_parent_class)->dispose (obj);
+}
+
+static void
+gkm_secret_collection_finalize (GObject *obj)
+{
+	GkmSecretCollection *self = GKM_SECRET_COLLECTION (obj);
+
+	g_assert (self->sdata == NULL);
+
+	g_hash_table_destroy (self->items);
+	self->items = NULL;
+
+	g_free (self->filename);
+	self->filename = NULL;
+
+	gkm_template_free (self->template);
+	self->template = NULL;
+
+	G_OBJECT_CLASS (gkm_secret_collection_parent_class)->finalize (obj);
+}
+
+static void
+gkm_secret_collection_class_init (GkmSecretCollectionClass *klass)
+{
+	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+	GkmObjectClass *gkm_class = GKM_OBJECT_CLASS (klass);
+	GkmSecretObjectClass *secret_class = GKM_SECRET_OBJECT_CLASS (klass);
+
+	gkm_secret_collection_parent_class = g_type_class_peek_parent (klass);
+
+	gobject_class->set_property = gkm_secret_collection_set_property;
+	gobject_class->get_property = gkm_secret_collection_get_property;
+	gobject_class->dispose = gkm_secret_collection_dispose;
+	gobject_class->finalize = gkm_secret_collection_finalize;
+
+	gkm_class->get_attribute = gkm_secret_collection_get_attribute;
+	gkm_class->set_attribute = gkm_secret_collection_set_attribute;
+	gkm_class->unlock = gkm_secret_collection_real_unlock;
+	gkm_class->expose_object = gkm_secret_collection_expose;
+
+	secret_class->is_locked = gkm_secret_collection_real_is_locked;
+
+	g_object_class_install_property (gobject_class, PROP_FILENAME,
+	           g_param_spec_string ("filename", "Filename", "Collection filename (without path)",
+	                                NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
+	gkm_secret_object_class_unique_identifiers (secret_class);
+}
+
+/* -----------------------------------------------------------------------------
+ * PUBLIC
+ */
+
+GkmFactory*
+gkm_secret_collection_get_factory (void)
+{
+	static CK_OBJECT_CLASS klass = CKO_G_COLLECTION;
+
+	static CK_ATTRIBUTE attributes[] = {
+		{ CKA_CLASS, &klass, sizeof (klass) },
+	};
+
+	static GkmFactory factory = {
+		attributes,
+		G_N_ELEMENTS (attributes),
+		factory_create_collection
+	};
+
+	return &factory;
+}
+
+const gchar*
+gkm_secret_collection_get_filename (GkmSecretCollection *self)
+{
+	g_return_val_if_fail (GKM_IS_SECRET_COLLECTION (self), NULL);
+	return self->filename;
+}
+
+void
+gkm_secret_collection_set_filename (GkmSecretCollection *self, const gchar *filename)
+{
+	g_return_if_fail (GKM_IS_SECRET_COLLECTION (self));
+
+	if (self->filename == filename)
+		return;
+	g_free (self->filename);
+	self->filename = g_strdup (filename);
+	g_object_notify (G_OBJECT (self), "filename");
+}
+
+GList*
+gkm_secret_collection_get_items (GkmSecretCollection *self)
+{
+	GList *items = NULL;
+	g_return_val_if_fail (GKM_IS_SECRET_COLLECTION (self), NULL);
+	g_hash_table_foreach (self->items, each_value_to_list, &items);
+	return items;
+}
+
+GkmSecretItem*
+gkm_secret_collection_get_item (GkmSecretCollection *self, const gchar *identifier)
+{
+	g_return_val_if_fail (GKM_IS_SECRET_COLLECTION (self), NULL);
+	g_return_val_if_fail (identifier, NULL);
+	return g_hash_table_lookup (self->items, identifier);
+}
+
+gboolean
+gkm_secret_collection_has_item (GkmSecretCollection *self, GkmSecretItem *item)
+{
+	const gchar *identifier;
+
+	g_return_val_if_fail (GKM_IS_SECRET_COLLECTION (self), FALSE);
+	g_return_val_if_fail (GKM_IS_SECRET_ITEM (item), FALSE);
+
+	identifier = gkm_secret_object_get_identifier (GKM_SECRET_OBJECT (item));
+	return g_hash_table_lookup (self->items, identifier) == item;
+}
+
+GkmSecretCollection*
+gkm_secret_collection_find (CK_ATTRIBUTE_PTR attr, ...)
+{
+	CK_OBJECT_CLASS klass = CKO_G_COLLECTION;
+	GkmSecretCollection *result = NULL;
+	GkmManager *manager;
+	CK_ATTRIBUTE attrs[2];
+	GList *objects;
+	va_list va;
+
+	g_assert (attr);
+
+	attrs[0].type = CKA_CLASS;
+	attrs[0].ulValueLen = sizeof (klass);
+	attrs[0].pValue = &klass;
+	attrs[1].type = CKA_ID;
+	attrs[1].ulValueLen = attr->ulValueLen;
+	attrs[1].pValue = attr->pValue;
+
+	va_start (va, attr);
+	while (!result && (manager = va_arg (va, GkmManager*)) != NULL) {
+		objects = gkm_manager_find_by_attributes (manager, attrs, 2);
+		if (objects && GKM_IS_SECRET_COLLECTION (objects->data))
+			result = objects->data;
+		g_list_free (objects);
+	}
+	va_end (va);
+
+	return result;
+}
+
+GkmSecretItem*
+gkm_secret_collection_new_item (GkmSecretCollection *self, const gchar *identifier)
+{
+	GkmSecretItem *item;
+
+	g_return_val_if_fail (GKM_IS_SECRET_COLLECTION (self), NULL);
+	g_return_val_if_fail (identifier, NULL);
+	g_return_val_if_fail (!g_hash_table_lookup (self->items, identifier), NULL);
+
+	item = g_object_new (GKM_TYPE_SECRET_ITEM,
+	                     "module", gkm_object_get_module (GKM_OBJECT (self)),
+	                     "manager", gkm_object_get_manager (GKM_OBJECT (self)),
+	                     "collection", self,
+	                     "identifier", identifier,
+	                     NULL);
+
+	add_item (self, NULL, item);
+	g_object_unref (item);
+	return item;
+}
+
+GkmSecretItem*
+gkm_secret_collection_create_item (GkmSecretCollection *self, GkmTransaction *transaction)
+{
+	GkmSecretItem *item;
+	gchar *identifier = NULL;
+
+	g_return_val_if_fail (GKM_IS_SECRET_COLLECTION (self), NULL);
+	g_return_val_if_fail (transaction, NULL);
+	g_return_val_if_fail (!gkm_transaction_get_failed (transaction), NULL);
+
+	do {
+		g_free (identifier);
+		identifier = g_strdup_printf ("%d", ++(self->watermark));
+	} while (g_hash_table_lookup (self->items, identifier));
+
+	item = g_object_new (GKM_TYPE_SECRET_ITEM,
+	                     "module", gkm_object_get_module (GKM_OBJECT (self)),
+	                     "manager", gkm_object_get_manager (GKM_OBJECT (self)),
+	                     "collection", self,
+	                     "identifier", identifier,
+	                     NULL);
+
+	g_free (identifier);
+	add_item (self, transaction, item);
+	g_object_unref (item);
+	return item;
+}
+
+void
+gkm_secret_collection_remove_item (GkmSecretCollection *self, GkmSecretItem *item)
+{
+	g_return_if_fail (GKM_IS_SECRET_COLLECTION (self));
+	g_return_if_fail (GKM_IS_SECRET_ITEM (item));
+	g_return_if_fail (gkm_secret_collection_has_item (self, item));
+
+	remove_item (self, NULL, item);
+}
+
+void
+gkm_secret_collection_destroy_item (GkmSecretCollection *self, GkmTransaction *transaction,
+                                    GkmSecretItem *item)
+{
+	g_return_if_fail (GKM_IS_SECRET_COLLECTION (self));
+	g_return_if_fail (GKM_IS_TRANSACTION (transaction));
+	g_return_if_fail (GKM_IS_SECRET_ITEM (item));
+	g_return_if_fail (gkm_secret_collection_has_item (self, item));
+
+	remove_item (self, transaction, item);
+}
+
+gboolean
+gkm_secret_collection_unlocked_have (GkmSecretCollection *self, GkmSession *session)
+{
+	CK_OBJECT_HANDLE handle = 0;
+
+	g_return_val_if_fail (GKM_IS_SECRET_COLLECTION (self), FALSE);
+	g_return_val_if_fail (GKM_IS_SESSION (session), FALSE);
+
+	/*
+	 * Look for credential objects that this session has access
+	 * to, and use those to find the secret data. If a secret data is
+	 * found, it should match the one we are tracking in self->sdata.
+	 */
+
+	gkm_credential_for_each (session, GKM_OBJECT (self), find_unlocked_credential, &handle);
+	return handle != 0;
+}
+
+GkmSecretData*
+gkm_secret_collection_unlocked_use (GkmSecretCollection *self, GkmSession *session)
+{
+	GkmSecretData *sdata = NULL;
+
+	g_return_val_if_fail (GKM_IS_SECRET_COLLECTION (self), NULL);
+	g_return_val_if_fail (GKM_IS_SESSION (session), NULL);
+
+	/*
+	 * Look for credential objects that this session has access
+	 * to, and use those to find the secret data. If a secret data is
+	 * found, it should match the one we are tracking in self->sdata.
+	 */
+
+	gkm_credential_for_each (session, GKM_OBJECT (self),
+	                         find_unlocked_secret_data, &sdata);
+
+	return sdata;
+}
+
+void
+gkm_secret_collection_unlocked_clear (GkmSecretCollection *self)
+{
+	/*
+	 * TODO: This is a tough one to implement. I'm holding off and wondering
+	 * if we don't need it, perhaps? As it currently stands, what needs to happen
+	 * here is we need to find each and every credential that references the
+	 * secret data for this collection and completely delete those objects.
+	 */
+	g_warning ("Clearing of secret data needs implementing");
+	track_secret_data (self, NULL);
+}
+
+GkmDataResult
+gkm_secret_collection_load (GkmSecretCollection *self)
+{
+	g_return_val_if_fail (GKM_IS_SECRET_COLLECTION (self), GKM_DATA_FAILURE);
+
+	if (!self->filename)
+		return GKM_DATA_SUCCESS;
+
+	return load_collection_and_secret_data (self, self->sdata, self->filename);
+}
+
+void
+gkm_secret_collection_save (GkmSecretCollection *self, GkmTransaction *transaction)
+{
+	GkmSecret *master;
+	GkmDataResult res;
+	guchar *data;
+	gsize n_data;
+
+	g_return_if_fail (GKM_IS_SECRET_COLLECTION (self));
+	g_return_if_fail (GKM_IS_TRANSACTION (transaction));
+	g_return_if_fail (!gkm_transaction_get_failed (transaction));
+
+	/* HACK: We can't save unless the secret data was loaded */
+	if (!self->sdata) {
+		gkm_transaction_fail (transaction, CKR_USER_NOT_LOGGED_IN);
+		return;
+	}
+
+	/* Don't save ourselves if no filename */
+	if (!self->filename)
+		return;
+
+	master = gkm_secret_data_get_master (self->sdata);
+	if (master == NULL || gkm_secret_equals (master, NULL, 0))
+		res = gkm_secret_textual_write (self, self->sdata, &data, &n_data);
+	else
+		res = gkm_secret_binary_write (self, self->sdata, &data, &n_data);
+
+	switch (res) {
+	case GKM_DATA_FAILURE:
+	case GKM_DATA_UNRECOGNIZED:
+		g_warning ("couldn't prepare to write out keyring: %s", self->filename);
+		gkm_transaction_fail (transaction, CKR_GENERAL_ERROR);
+		break;
+	case GKM_DATA_LOCKED:
+		g_warning ("locked error while writing out keyring: %s", self->filename);
+		gkm_transaction_fail (transaction, CKR_GENERAL_ERROR);
+		break;
+	case GKM_DATA_SUCCESS:
+		gkm_transaction_write_file (transaction, self->filename, data, n_data);
+		g_free (data);
+		break;
+	default:
+		g_assert_not_reached ();
+	};
+}
+
+void
+gkm_secret_collection_destroy (GkmSecretCollection *self, GkmTransaction *transaction)
+{
+	g_return_if_fail (GKM_IS_SECRET_COLLECTION (self));
+	g_return_if_fail (GKM_IS_TRANSACTION (transaction));
+	g_return_if_fail (!gkm_transaction_get_failed (transaction));
+
+	gkm_object_expose_full (GKM_OBJECT (self), transaction, FALSE);
+	if (self->filename)
+		gkm_transaction_remove_file (transaction, self->filename);
+}
+
+gint
+gkm_secret_collection_get_lock_idle (GkmSecretCollection *self)
+{
+	gulong value;
+	g_return_val_if_fail (GKM_IS_SECRET_COLLECTION (self), 0);
+	if (!gkm_template_find_ulong (self->template, CKA_G_DESTRUCT_IDLE, &value))
+		value = 0;
+	return (gint)value;
+}
+
+void
+gkm_secret_collection_set_lock_idle (GkmSecretCollection *self, gint lock_timeout)
+{
+	CK_ULONG value = (lock_timeout < 0) ? 0 : lock_timeout;
+	CK_ATTRIBUTE attr = { CKA_G_DESTRUCT_IDLE, &value, sizeof (value) };
+	g_return_if_fail (GKM_IS_SECRET_COLLECTION (self));
+	gkm_template_set (self->template, &attr);
+}
+
+gint
+gkm_secret_collection_get_lock_after (GkmSecretCollection *self)
+{
+	gulong value;
+	g_return_val_if_fail (GKM_IS_SECRET_COLLECTION (self), 0);
+	if (!gkm_template_find_ulong (self->template, CKA_G_DESTRUCT_AFTER, &value))
+		value = 0;
+	return (gint)value;
+}
+
+void
+gkm_secret_collection_set_lock_after (GkmSecretCollection *self, gint lock_timeout)
+{
+	CK_ULONG value = (lock_timeout < 0) ? 0 : lock_timeout;
+	CK_ATTRIBUTE attr = { CKA_G_DESTRUCT_AFTER, &value, sizeof (value) };
+	g_return_if_fail (GKM_IS_SECRET_COLLECTION (self));
+	gkm_template_set (self->template, &attr);
+}
diff --git a/pkcs11/secret-store/gkm-secret-collection.h b/pkcs11/secret-store/gkm-secret-collection.h
new file mode 100644
index 0000000..983d637
--- /dev/null
+++ b/pkcs11/secret-store/gkm-secret-collection.h
@@ -0,0 +1,104 @@
+/*
+ * gnome-keyring
+ *
+ * Copyright (C) 2009 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 __GKM_SECRET_COLLECTION_H__
+#define __GKM_SECRET_COLLECTION_H__
+
+#include <glib-object.h>
+
+#include "gkm-secret-object.h"
+
+#define GKM_FACTORY_SECRET_COLLECTION            (gkm_secret_collection_get_factory ())
+
+#define GKM_TYPE_SECRET_COLLECTION               (gkm_secret_collection_get_type ())
+#define GKM_SECRET_COLLECTION(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_SECRET_COLLECTION, GkmSecretCollection))
+#define GKM_SECRET_COLLECTION_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_SECRET_COLLECTION, GkmSecretCollectionClass))
+#define GKM_IS_SECRET_COLLECTION(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_SECRET_COLLECTION))
+#define GKM_IS_SECRET_COLLECTION_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_SECRET_COLLECTION))
+#define GKM_SECRET_COLLECTION_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_SECRET_COLLECTION, GkmSecretCollectionClass))
+
+typedef struct _GkmSecretCollectionClass GkmSecretCollectionClass;
+
+struct _GkmSecretCollectionClass {
+	GkmSecretObjectClass parent_class;
+	GHashTable *identifiers;
+};
+
+GType                gkm_secret_collection_get_type        (void);
+
+GkmFactory*          gkm_secret_collection_get_factory     (void) G_GNUC_CONST;
+
+GkmSecretCollection* gkm_secret_collection_find            (CK_ATTRIBUTE_PTR attr,
+                                                            ...) G_GNUC_NULL_TERMINATED;
+
+GkmDataResult        gkm_secret_collection_load            (GkmSecretCollection *self);
+
+void                 gkm_secret_collection_save            (GkmSecretCollection *self,
+                                                            GkmTransaction *transaction);
+
+void                 gkm_secret_collection_destroy         (GkmSecretCollection *self,
+                                                            GkmTransaction *transaction);
+
+const gchar*         gkm_secret_collection_get_filename    (GkmSecretCollection *self);
+
+void                 gkm_secret_collection_set_filename    (GkmSecretCollection *self,
+                                                            const gchar *filename);
+
+GList*               gkm_secret_collection_get_items       (GkmSecretCollection *self);
+
+GkmSecretItem*       gkm_secret_collection_get_item        (GkmSecretCollection *self,
+                                                            const gchar *identifier);
+
+gboolean             gkm_secret_collection_has_item        (GkmSecretCollection *self,
+                                                            GkmSecretItem *item);
+
+GkmSecretItem*       gkm_secret_collection_new_item        (GkmSecretCollection *self,
+                                                            const gchar *identifier);
+
+void                 gkm_secret_collection_remove_item     (GkmSecretCollection *self,
+                                                            GkmSecretItem *item);
+
+GkmSecretItem*       gkm_secret_collection_create_item     (GkmSecretCollection *self,
+                                                            GkmTransaction *transaction);
+
+void                 gkm_secret_collection_destroy_item    (GkmSecretCollection *self,
+                                                            GkmTransaction *transaction,
+                                                            GkmSecretItem *item);
+
+void                 gkm_secret_collection_unlocked_clear  (GkmSecretCollection *self);
+
+GkmSecretData*       gkm_secret_collection_unlocked_use    (GkmSecretCollection *self,
+                                                            GkmSession *session);
+
+gboolean             gkm_secret_collection_unlocked_have   (GkmSecretCollection *self,
+                                                            GkmSession *session);
+
+gint                 gkm_secret_collection_get_lock_idle   (GkmSecretCollection *self);
+
+void                 gkm_secret_collection_set_lock_idle   (GkmSecretCollection *self,
+                                                            gint lock_timeout);
+
+gint                 gkm_secret_collection_get_lock_after  (GkmSecretCollection *self);
+
+void                 gkm_secret_collection_set_lock_after  (GkmSecretCollection *self,
+                                                            gint lock_timeout);
+
+#endif /* __GKM_SECRET_COLLECTION_H__ */
diff --git a/pkcs11/secret-store/gck-secret-compat.c b/pkcs11/secret-store/gkm-secret-compat.c
similarity index 86%
rename from pkcs11/secret-store/gck-secret-compat.c
rename to pkcs11/secret-store/gkm-secret-compat.c
index 17837fc..d586755 100644
--- a/pkcs11/secret-store/gck-secret-compat.c
+++ b/pkcs11/secret-store/gkm-secret-compat.c
@@ -1,34 +1,34 @@
-/* 
+/*
  * gnome-keyring
- * 
+ *
  * Copyright (C) 2009 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"
 
-#include "gck-secret-compat.h"
+#include "gkm-secret-compat.h"
 
 #include <string.h>
 
 void
-gck_secret_compat_access_free (gpointer data)
+gkm_secret_compat_access_free (gpointer data)
 {
-	GckSecretAccess *ac = data;
+	GkmSecretAccess *ac = data;
 	if (ac) {
 		g_free (ac->display_name);
 		g_free (ac->pathname);
@@ -37,16 +37,16 @@ gck_secret_compat_access_free (gpointer data)
 }
 
 void
-gck_secret_compat_acl_free (gpointer acl)
+gkm_secret_compat_acl_free (gpointer acl)
 {
 	GList *l;
-	for (l = acl; l; l = g_list_next (l)) 
-		gck_secret_compat_access_free (l->data);
+	for (l = acl; l; l = g_list_next (l))
+		gkm_secret_compat_access_free (l->data);
 	g_list_free (acl);
 }
 
 guint
-gck_secret_compat_parse_item_type (const gchar *value)
+gkm_secret_compat_parse_item_type (const gchar *value)
 {
 	if (value == NULL)
 		return 0; /* The default */
@@ -68,7 +68,7 @@ gck_secret_compat_parse_item_type (const gchar *value)
 }
 
 const gchar*
-gck_secret_compat_format_item_type (guint value)
+gkm_secret_compat_format_item_type (guint value)
 {
 	/* Only GNOME_KEYRING_ITEM_TYPE_MASK */
 	switch (value & 0x0000ffff)
diff --git a/pkcs11/secret-store/gck-secret-compat.h b/pkcs11/secret-store/gkm-secret-compat.h
similarity index 58%
rename from pkcs11/secret-store/gck-secret-compat.h
rename to pkcs11/secret-store/gkm-secret-compat.h
index f5a287d..83f620c 100644
--- a/pkcs11/secret-store/gck-secret-compat.h
+++ b/pkcs11/secret-store/gkm-secret-compat.h
@@ -1,47 +1,47 @@
-/* 
+/*
  * gnome-keyring
- * 
+ *
  * Copyright (C) 2009 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.
  */
 
-#ifndef __GCK_SECRET_COMPAT_H__
-#define __GCK_SECRET_COMPAT_H__
+#ifndef __GKM_SECRET_COMPAT_H__
+#define __GKM_SECRET_COMPAT_H__
 
 #include <glib.h>
 
 typedef enum {
-	GCK_SECRET_ACCESS_READ = 1 << 0,
-	GCK_SECRET_ACCESS_WRITE = 1 << 1,
-	GCK_SECRET_ACCESS_REMOVE = 1 << 2
-} GckSecretAccessType;
+	GKM_SECRET_ACCESS_READ = 1 << 0,
+	GKM_SECRET_ACCESS_WRITE = 1 << 1,
+	GKM_SECRET_ACCESS_REMOVE = 1 << 2
+} GkmSecretAccessType;
 
-typedef struct _GckSecretAccess {
+typedef struct _GkmSecretAccess {
 	char *display_name;
 	char *pathname;
-	GckSecretAccessType types_allowed;
-} GckSecretAccess;
+	GkmSecretAccessType types_allowed;
+} GkmSecretAccess;
 
-void           gck_secret_compat_access_free         (gpointer ac);
+void           gkm_secret_compat_access_free         (gpointer ac);
 
-void           gck_secret_compat_acl_free            (gpointer acl);
+void           gkm_secret_compat_acl_free            (gpointer acl);
 
-guint          gck_secret_compat_parse_item_type     (const gchar *value);
+guint          gkm_secret_compat_parse_item_type     (const gchar *value);
 
-const gchar*   gck_secret_compat_format_item_type    (guint value);
+const gchar*   gkm_secret_compat_format_item_type    (guint value);
 
-#endif /* __GCK_SECRET_COMPAT_H__ */
+#endif /* __GKM_SECRET_COMPAT_H__ */
diff --git a/pkcs11/secret-store/gck-secret-data.c b/pkcs11/secret-store/gkm-secret-data.c
similarity index 60%
rename from pkcs11/secret-store/gck-secret-data.c
rename to pkcs11/secret-store/gkm-secret-data.c
index 9d677d1..96732c4 100644
--- a/pkcs11/secret-store/gck-secret-data.c
+++ b/pkcs11/secret-store/gkm-secret-data.c
@@ -1,43 +1,43 @@
-/* 
+/*
  * gnome-keyring
- * 
+ *
  * Copyright (C) 2009 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"
 
-#include "gck-secret-data.h"
+#include "gkm-secret-data.h"
 
-#include "gck/gck-secret.h"
-#include "gck/gck-transaction.h"
-#include "gck/gck-util.h"
+#include "gkm/gkm-secret.h"
+#include "gkm/gkm-transaction.h"
+#include "gkm/gkm-util.h"
 
 #include "egg/egg-secure-memory.h"
 
 #include <glib/gi18n.h>
 
-struct _GckSecretData {
+struct _GkmSecretData {
 	GObject parent;
 	GHashTable *secrets;
-	GckSecret *master;
+	GkmSecret *master;
 };
 
-G_DEFINE_TYPE (GckSecretData, gck_secret_data, G_TYPE_OBJECT);
+G_DEFINE_TYPE (GkmSecretData, gkm_secret_data, G_TYPE_OBJECT);
 
 /* -----------------------------------------------------------------------------
  * INTERNAL
@@ -45,17 +45,17 @@ G_DEFINE_TYPE (GckSecretData, gck_secret_data, G_TYPE_OBJECT);
 
 typedef struct _set_secret_args {
 	gchar *identifier;
-	GckSecret *old_secret;
+	GkmSecret *old_secret;
 } set_secret_args;
 
 static gboolean
-complete_set_secret (GckTransaction *transaction, GObject *obj, gpointer user_data)
+complete_set_secret (GkmTransaction *transaction, GObject *obj, gpointer user_data)
 {
-	GckSecretData *self = GCK_SECRET_DATA (obj);
+	GkmSecretData *self = GKM_SECRET_DATA (obj);
 	set_secret_args *args = user_data;
 
 	/* If the transaction failed, revert */
-	if (gck_transaction_get_failed (transaction)) {
+	if (gkm_transaction_get_failed (transaction)) {
 		if (!args->old_secret) {
 			g_hash_table_remove (self->secrets, args->identifier);
 		} else {
@@ -75,15 +75,15 @@ complete_set_secret (GckTransaction *transaction, GObject *obj, gpointer user_da
 }
 
 static void
-begin_set_secret (GckSecretData *self, GckTransaction *transaction,
-                  const gchar *identifier, GckSecret *secret)
+begin_set_secret (GkmSecretData *self, GkmTransaction *transaction,
+                  const gchar *identifier, GkmSecret *secret)
 {
 	set_secret_args *args;
 
-	g_assert (GCK_IS_SECRET_DATA (self));
-	g_assert (!gck_transaction_get_failed (transaction));
+	g_assert (GKM_IS_SECRET_DATA (self));
+	g_assert (!gkm_transaction_get_failed (transaction));
 	g_assert (identifier);
-	g_assert (GCK_IS_SECRET (secret));
+	g_assert (GKM_IS_SECRET (secret));
 
 	args = g_slice_new0 (set_secret_args);
 
@@ -102,7 +102,7 @@ begin_set_secret (GckSecretData *self, GckTransaction *transaction,
 	                      g_object_ref (secret));
 
 	/* Track in the transaction */
-	gck_transaction_add (transaction, self, complete_set_secret, args);
+	gkm_transaction_add (transaction, self, complete_set_secret, args);
 }
 
 /* -----------------------------------------------------------------------------
@@ -110,15 +110,15 @@ begin_set_secret (GckSecretData *self, GckTransaction *transaction,
  */
 
 static void
-gck_secret_data_init (GckSecretData *self)
+gkm_secret_data_init (GkmSecretData *self)
 {
 	self->secrets = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
 }
 
 static void
-gck_secret_data_finalize (GObject *obj)
+gkm_secret_data_finalize (GObject *obj)
 {
-	GckSecretData *self = GCK_SECRET_DATA (obj);
+	GkmSecretData *self = GKM_SECRET_DATA (obj);
 
 	if (self->secrets)
 		g_hash_table_destroy (self->secrets);
@@ -127,93 +127,93 @@ gck_secret_data_finalize (GObject *obj)
 	if (self->master)
 		g_object_unref (self->master);
 	self->master = NULL;
-	
-	G_OBJECT_CLASS (gck_secret_data_parent_class)->finalize (obj);
+
+	G_OBJECT_CLASS (gkm_secret_data_parent_class)->finalize (obj);
 }
 
 static void
-gck_secret_data_class_init (GckSecretDataClass *klass)
+gkm_secret_data_class_init (GkmSecretDataClass *klass)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	gck_secret_data_parent_class = g_type_class_peek_parent (klass);
-	gobject_class->finalize = gck_secret_data_finalize;
+	gkm_secret_data_parent_class = g_type_class_peek_parent (klass);
+	gobject_class->finalize = gkm_secret_data_finalize;
 }
 
 /* -----------------------------------------------------------------------------
  * PUBLIC
  */
 
-GckSecret*
-gck_secret_data_get_secret (GckSecretData *self, const gchar *identifier)
+GkmSecret*
+gkm_secret_data_get_secret (GkmSecretData *self, const gchar *identifier)
 {
-	g_return_val_if_fail (GCK_IS_SECRET_DATA (self), NULL);
+	g_return_val_if_fail (GKM_IS_SECRET_DATA (self), NULL);
 	g_return_val_if_fail (identifier, NULL);
 	return g_hash_table_lookup (self->secrets, identifier);
 }
 
 const guchar*
-gck_secret_data_get_raw (GckSecretData *self, const gchar *identifier,
+gkm_secret_data_get_raw (GkmSecretData *self, const gchar *identifier,
                          gsize *n_result)
 {
-	GckSecret *secret;
+	GkmSecret *secret;
 
-	g_return_val_if_fail (GCK_IS_SECRET_DATA (self), NULL);
+	g_return_val_if_fail (GKM_IS_SECRET_DATA (self), NULL);
 	g_return_val_if_fail (identifier, NULL);
 	g_return_val_if_fail (n_result, NULL);
 
-	secret = gck_secret_data_get_secret (self, identifier);
+	secret = gkm_secret_data_get_secret (self, identifier);
 	if (secret == NULL)
 		return NULL;
 
-	return gck_secret_get (secret, n_result);
+	return gkm_secret_get (secret, n_result);
 }
 
 
 void
-gck_secret_data_set_secret (GckSecretData *self, const gchar *identifier,
-                            GckSecret *secret)
+gkm_secret_data_set_secret (GkmSecretData *self, const gchar *identifier,
+                            GkmSecret *secret)
 {
-	g_return_if_fail (GCK_IS_SECRET_DATA (self));
+	g_return_if_fail (GKM_IS_SECRET_DATA (self));
 	g_return_if_fail (identifier);
-	g_return_if_fail (GCK_IS_SECRET (secret));
+	g_return_if_fail (GKM_IS_SECRET (secret));
 	g_hash_table_replace (self->secrets, g_strdup (identifier),
 	                      g_object_ref (secret));
 }
 
 void
-gck_secret_data_set_transacted  (GckSecretData *self, GckTransaction *transaction,
-                                 const gchar *identifier, GckSecret *secret)
+gkm_secret_data_set_transacted  (GkmSecretData *self, GkmTransaction *transaction,
+                                 const gchar *identifier, GkmSecret *secret)
 {
-	g_return_if_fail (GCK_IS_SECRET_DATA (self));
-	g_return_if_fail (GCK_IS_TRANSACTION (transaction));
-	g_return_if_fail (!gck_transaction_get_failed (transaction));
+	g_return_if_fail (GKM_IS_SECRET_DATA (self));
+	g_return_if_fail (GKM_IS_TRANSACTION (transaction));
+	g_return_if_fail (!gkm_transaction_get_failed (transaction));
 	g_return_if_fail (identifier);
-	g_return_if_fail (GCK_IS_SECRET (secret));
+	g_return_if_fail (GKM_IS_SECRET (secret));
 
 	begin_set_secret (self, transaction, identifier, secret);
 }
 
 void
-gck_secret_data_remove_secret (GckSecretData *self, const gchar *identifier)
+gkm_secret_data_remove_secret (GkmSecretData *self, const gchar *identifier)
 {
-	g_return_if_fail (GCK_IS_SECRET_DATA (self));
+	g_return_if_fail (GKM_IS_SECRET_DATA (self));
 	g_return_if_fail (identifier);
 	g_hash_table_remove (self->secrets, identifier);
 }
 
-GckSecret*
-gck_secret_data_get_master (GckSecretData *self)
+GkmSecret*
+gkm_secret_data_get_master (GkmSecretData *self)
 {
-	g_return_val_if_fail (GCK_IS_SECRET_DATA (self), NULL);
+	g_return_val_if_fail (GKM_IS_SECRET_DATA (self), NULL);
 	return self->master;
 }
 
 void
-gck_secret_data_set_master (GckSecretData *self, GckSecret *master)
+gkm_secret_data_set_master (GkmSecretData *self, GkmSecret *master)
 {
-	g_return_if_fail (GCK_IS_SECRET_DATA (self));
-	g_return_if_fail (!master || GCK_IS_SECRET (master));
-	
+	g_return_if_fail (GKM_IS_SECRET_DATA (self));
+	g_return_if_fail (!master || GKM_IS_SECRET (master));
+
 	if (master)
 		g_object_ref (master);
 	if (self->master)
diff --git a/pkcs11/secret-store/gkm-secret-data.h b/pkcs11/secret-store/gkm-secret-data.h
new file mode 100644
index 0000000..4d45a55
--- /dev/null
+++ b/pkcs11/secret-store/gkm-secret-data.h
@@ -0,0 +1,70 @@
+/*
+ * gnome-keyring
+ *
+ * Copyright (C) 2009 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 __GKM_SECRET_DATA_H__
+#define __GKM_SECRET_DATA_H__
+
+#include <glib-object.h>
+
+#include "gkm-secret-types.h"
+
+#include "gkm/gkm-types.h"
+
+#define GKM_TYPE_SECRET_DATA               (gkm_secret_data_get_type ())
+#define GKM_SECRET_DATA(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_SECRET_DATA, GkmSecretData))
+#define GKM_SECRET_DATA_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_SECRET_DATA, GkmSecretDataClass))
+#define GKM_IS_SECRET_DATA(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_SECRET_DATA))
+#define GKM_IS_SECRET_DATA_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_SECRET_DATA))
+#define GKM_SECRET_DATA_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_SECRET_DATA, GkmSecretDataClass))
+
+typedef struct _GkmSecretDataClass GkmSecretDataClass;
+
+struct _GkmSecretDataClass {
+	GObjectClass parent_class;
+};
+
+GType                gkm_secret_data_get_type        (void);
+
+GkmSecret*           gkm_secret_data_get_secret      (GkmSecretData *self,
+                                                      const gchar *identifier);
+
+const guchar*        gkm_secret_data_get_raw         (GkmSecretData *self,
+                                                      const gchar *identifier,
+                                                      gsize *n_result);
+
+void                 gkm_secret_data_set_secret      (GkmSecretData *self,
+                                                      const gchar *identifier,
+                                                      GkmSecret *secret);
+
+void                 gkm_secret_data_set_transacted  (GkmSecretData *self,
+                                                      GkmTransaction *transaction,
+                                                      const gchar *identifier,
+                                                      GkmSecret *secret);
+
+void                 gkm_secret_data_remove_secret   (GkmSecretData *self,
+                                                      const gchar *identifier);
+
+GkmSecret*           gkm_secret_data_get_master      (GkmSecretData *self);
+
+void                 gkm_secret_data_set_master      (GkmSecretData *self,
+                                                      GkmSecret *master);
+
+#endif /* __GKM_SECRET_DATA_H__ */
diff --git a/pkcs11/secret-store/gck-secret-fields.c b/pkcs11/secret-store/gkm-secret-fields.c
similarity index 88%
rename from pkcs11/secret-store/gck-secret-fields.c
rename to pkcs11/secret-store/gkm-secret-fields.c
index 87d3a69..279f216 100644
--- a/pkcs11/secret-store/gck-secret-fields.c
+++ b/pkcs11/secret-store/gkm-secret-fields.c
@@ -1,31 +1,31 @@
-/* 
+/*
  * gnome-keyring
- * 
+ *
  * Copyright (C) 2009 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"
 
-#include "gck-secret-fields.h"
+#include "gkm-secret-fields.h"
 
 #include "egg/egg-hex.h"
 
-#include "gck/gck-attributes.h"
+#include "gkm/gkm-attributes.h"
 
 #include <ctype.h>
 #include <string.h>
@@ -123,13 +123,13 @@ compat_hash_value_as_string (const gchar *value)
 }
 
 GType
-gck_secret_fields_boxed_type (void)
+gkm_secret_fields_boxed_type (void)
 {
 	static volatile gsize type_inited = 0;
 	static GType type = 0;
 
 	if (g_once_init_enter (&type_inited)) {
-		type = g_boxed_type_register_static ("GHashTable_Fields", 
+		type = g_boxed_type_register_static ("GHashTable_Fields",
 		                                     (GBoxedCopyFunc)g_hash_table_ref,
 		                                     (GBoxedFreeFunc)g_hash_table_unref);
 		g_once_init_leave (&type_inited, 1);
@@ -139,13 +139,13 @@ gck_secret_fields_boxed_type (void)
 }
 
 GHashTable*
-gck_secret_fields_new (void)
+gkm_secret_fields_new (void)
 {
 	return g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
 }
 
 CK_RV
-gck_secret_fields_parse (CK_ATTRIBUTE_PTR attr, GHashTable **fields)
+gkm_secret_fields_parse (CK_ATTRIBUTE_PTR attr, GHashTable **fields)
 {
 	GHashTable *result;
 	const gchar *name;
@@ -154,53 +154,53 @@ gck_secret_fields_parse (CK_ATTRIBUTE_PTR attr, GHashTable **fields)
 	gsize n_value;
 	const gchar *ptr;
 	const gchar *last;
-	
+
 	g_assert (attr);
 	g_assert (fields);
 
 	ptr = attr->pValue;
 	last = ptr + attr->ulValueLen;
-	
+
 	if (!ptr && last != ptr)
 		return CKR_ATTRIBUTE_VALUE_INVALID;
 
-	result = gck_secret_fields_new ();
+	result = gkm_secret_fields_new ();
 
 	while (ptr && ptr != last) {
 		g_assert (ptr < last);
-		
+
 		name = ptr;
 		ptr = memchr (ptr, 0, last - ptr);
-		
+
 		/* No value is present? */
 		if (!ptr) {
 			g_hash_table_unref (result);
 			return CKR_ATTRIBUTE_VALUE_INVALID;
 		}
-		
+
 		n_name = ptr - name;
 		value = ++ptr;
 		ptr = memchr (ptr, 0, last - ptr);
-		
+
 		/* Missing null terminator on value */
 		if (ptr == NULL) {
 			g_hash_table_unref (result);
 			return CKR_ATTRIBUTE_VALUE_INVALID;
 		}
-		
+
 		n_value = ptr - value;
 		++ptr;
 
 		/* Validate the name and value*/
-		if (!g_utf8_validate (name, n_name, NULL) || 
+		if (!g_utf8_validate (name, n_name, NULL) ||
 		    !g_utf8_validate (value, n_value, NULL)) {
 			g_hash_table_unref (result);
 			return CKR_ATTRIBUTE_VALUE_INVALID;
 		}
-		
+
 		g_hash_table_replace (result, g_strndup (name, n_name), g_strndup (value, n_value));
 	}
-	
+
 	*fields = result;
 	return CKR_OK;
 }
@@ -225,33 +225,33 @@ each_field_length (gpointer key, gpointer value, gpointer user_data)
 }
 
 CK_RV
-gck_secret_fields_serialize (CK_ATTRIBUTE_PTR attr, GHashTable *fields)
+gkm_secret_fields_serialize (CK_ATTRIBUTE_PTR attr, GHashTable *fields)
 {
 	GString *result;
 	gsize length;
 	CK_RV rv;
-	
+
 	g_assert (attr);
 	g_assert (fields);
-	
+
 	if (!attr->pValue) {
 		length = 0;
 		g_hash_table_foreach (fields, each_field_length, &length);
 		attr->ulValueLen = length;
 		return CKR_OK;
 	}
-	
+
 	result = g_string_sized_new (256);
 	g_hash_table_foreach (fields, each_field_append, result);
-	
-	rv = gck_attribute_set_data (attr, result->str, result->len);
+
+	rv = gkm_attribute_set_data (attr, result->str, result->len);
 	g_string_free (result, TRUE);
-	
+
 	return rv;
 }
 
 gboolean
-gck_secret_fields_match (GHashTable *haystack, GHashTable *needle)
+gkm_secret_fields_match (GHashTable *haystack, GHashTable *needle)
 {
 	GHashTableIter iter;
 	const gchar *key, *value, *hay;
@@ -265,7 +265,7 @@ gck_secret_fields_match (GHashTable *haystack, GHashTable *needle)
 	g_hash_table_iter_init (&iter, needle);
 	while (g_hash_table_iter_next (&iter, (gpointer*)&key, (gpointer*)&value)) {
 		g_assert (key && value);
-		
+
 		/* Compat attributes in the needle make no difference */
 		if (is_compat_name (key))
 			continue;
@@ -309,12 +309,12 @@ gck_secret_fields_match (GHashTable *haystack, GHashTable *needle)
 		if (!match)
 			return FALSE;
 	}
-	
+
 	return TRUE;
 }
 
 void
-gck_secret_fields_take (GHashTable *fields, gchar *name, gchar *value)
+gkm_secret_fields_take (GHashTable *fields, gchar *name, gchar *value)
 {
 	g_return_if_fail (fields);
 	g_return_if_fail (name);
@@ -324,16 +324,16 @@ gck_secret_fields_take (GHashTable *fields, gchar *name, gchar *value)
 }
 
 void
-gck_secret_fields_add (GHashTable *fields, const gchar *name,
+gkm_secret_fields_add (GHashTable *fields, const gchar *name,
                        const gchar *value)
 {
 	g_return_if_fail (fields);
 	g_return_if_fail (name);
-	gck_secret_fields_take (fields, g_strdup (name), g_strdup (value));
+	gkm_secret_fields_take (fields, g_strdup (name), g_strdup (value));
 }
 
 const gchar*
-gck_secret_fields_get (GHashTable *fields, const gchar *name)
+gkm_secret_fields_get (GHashTable *fields, const gchar *name)
 {
 	g_return_val_if_fail (fields, NULL);
 	g_return_val_if_fail (name, NULL);
@@ -342,7 +342,7 @@ gck_secret_fields_get (GHashTable *fields, const gchar *name)
 }
 
 GList*
-gck_secret_fields_get_names (GHashTable *fields)
+gkm_secret_fields_get_names (GHashTable *fields)
 {
 	const gchar *prefix = "gkr:compat:hashed:";
 	GList *keys, *l, *next;
@@ -375,7 +375,7 @@ gck_secret_fields_get_names (GHashTable *fields)
 }
 
 void
-gck_secret_fields_add_compat_uint32 (GHashTable *fields, const gchar *name,
+gkm_secret_fields_add_compat_uint32 (GHashTable *fields, const gchar *name,
                                      guint32 value)
 {
 	g_return_if_fail (fields);
@@ -386,7 +386,7 @@ gck_secret_fields_add_compat_uint32 (GHashTable *fields, const gchar *name,
 }
 
 gboolean
-gck_secret_fields_get_compat_uint32 (GHashTable *fields, const gchar *name,
+gkm_secret_fields_get_compat_uint32 (GHashTable *fields, const gchar *name,
                                      guint32 *value)
 {
 	gchar *other_key;
@@ -408,7 +408,7 @@ gck_secret_fields_get_compat_uint32 (GHashTable *fields, const gchar *name,
 }
 
 void
-gck_secret_fields_add_compat_hashed_string (GHashTable *fields, const gchar *name,
+gkm_secret_fields_add_compat_hashed_string (GHashTable *fields, const gchar *name,
                                             const gchar *value)
 {
 	g_return_if_fail (fields);
@@ -418,7 +418,7 @@ gck_secret_fields_add_compat_hashed_string (GHashTable *fields, const gchar *nam
 }
 
 gboolean
-gck_secret_fields_get_compat_hashed_string (GHashTable *fields, const gchar *name,
+gkm_secret_fields_get_compat_hashed_string (GHashTable *fields, const gchar *name,
                                             gchar **value)
 {
 	gchar *other_key;
@@ -447,7 +447,7 @@ gck_secret_fields_get_compat_hashed_string (GHashTable *fields, const gchar *nam
 }
 
 void
-gck_secret_fields_add_compat_hashed_uint32 (GHashTable *fields, const gchar *name, 
+gkm_secret_fields_add_compat_hashed_uint32 (GHashTable *fields, const gchar *name,
                                             guint32 value)
 {
 	g_return_if_fail (fields);
@@ -458,7 +458,7 @@ gck_secret_fields_add_compat_hashed_uint32 (GHashTable *fields, const gchar *nam
 }
 
 gboolean
-gck_secret_fields_get_compat_hashed_uint32 (GHashTable *fields, const gchar *name, 
+gkm_secret_fields_get_compat_hashed_uint32 (GHashTable *fields, const gchar *name,
                                             guint32 *value)
 {
 	const gchar *val;
diff --git a/pkcs11/secret-store/gck-secret-fields.h b/pkcs11/secret-store/gkm-secret-fields.h
similarity index 66%
rename from pkcs11/secret-store/gck-secret-fields.h
rename to pkcs11/secret-store/gkm-secret-fields.h
index 206976c..aef7945 100644
--- a/pkcs11/secret-store/gck-secret-fields.h
+++ b/pkcs11/secret-store/gkm-secret-fields.h
@@ -1,26 +1,26 @@
-/* 
+/*
  * gnome-keyring
- * 
+ *
  * Copyright (C) 2009 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.
  */
 
-#ifndef __GCK_SECRET_FIELDS_H__
-#define __GCK_SECRET_FIELDS_H__
+#ifndef __GKM_SECRET_FIELDS_H__
+#define __GKM_SECRET_FIELDS_H__
 
 #include "pkcs11.h"
 
@@ -28,79 +28,79 @@
 #include <glib-object.h>
 
 /*
- * This represents a set of attributes from the secrets API. We 
- * call them 'fields' here, so they don't get mixed up with the 
+ * This represents a set of attributes from the secrets API. We
+ * call them 'fields' here, so they don't get mixed up with the
  * PKCS#11 API's notion of attributes.
- * 
- * Each field has a name, and a string value. 
- * 
+ *
+ * Each field has a name, and a string value.
+ *
  * Previous versions of gnome-keyring had the notion of attributes
  * that were integers. In this version everything is a string.
- * 
+ *
  * Compatibility attributes start with gkr:compat:
- * 
+ *
  * gkr:compat:uint32:xxxx  The presence of this attribute means that
  * the xxxx attribute is a uint32 in older versions of gnome-keyring.
  * The value of this attribute is insignificant.
- * 
+ *
  * gkr:compat:hashed:xxxx  This attribute contains a hashed version
- * of xxxx. 
+ * of xxxx.
  */
 
-#define         GCK_BOXED_SECRET_FIELDS                       (gck_secret_fields_boxed_type ())
+#define         GKM_BOXED_SECRET_FIELDS                       (gkm_secret_fields_boxed_type ())
 
-GType           gck_secret_fields_boxed_type                  (void);
+GType           gkm_secret_fields_boxed_type                  (void);
 
-GHashTable*     gck_secret_fields_new                         (void);
+GHashTable*     gkm_secret_fields_new                         (void);
 
-void            gck_secret_fields_add                         (GHashTable *fields,
+void            gkm_secret_fields_add                         (GHashTable *fields,
                                                                const gchar *name,
                                                                const gchar *value);
 
-void            gck_secret_fields_take                        (GHashTable *fields,
+void            gkm_secret_fields_take                        (GHashTable *fields,
                                                                gchar *name,
                                                                gchar *value);
 
-const gchar*    gck_secret_fields_get                         (GHashTable *fields,
+const gchar*    gkm_secret_fields_get                         (GHashTable *fields,
                                                                const gchar *name);
 
-CK_RV           gck_secret_fields_parse                       (CK_ATTRIBUTE_PTR attr,
+CK_RV           gkm_secret_fields_parse                       (CK_ATTRIBUTE_PTR attr,
                                                                GHashTable **fields);
 
-CK_RV           gck_secret_fields_serialize                   (CK_ATTRIBUTE_PTR attr,
+CK_RV           gkm_secret_fields_serialize                   (CK_ATTRIBUTE_PTR attr,
                                                                GHashTable *fields);
 
-gboolean        gck_secret_fields_match                       (GHashTable *haystack,
+gboolean        gkm_secret_fields_match                       (GHashTable *haystack,
                                                                GHashTable *needle);
 
-GList*          gck_secret_fields_get_names                   (GHashTable *fields);
+GList*          gkm_secret_fields_get_names                   (GHashTable *fields);
 
 /* COMPAT ------------------------------------------------------------------------ */
 
-GList*          gck_secret_fields_get_compat_hashed_names     (GHashTable *fields);
+GList*          gkm_secret_fields_get_compat_hashed_names     (GHashTable *fields);
 
-void            gck_secret_fields_add_compat_uint32           (GHashTable *fields, 
+void            gkm_secret_fields_add_compat_uint32           (GHashTable *fields,
                                                                const gchar *name,
                                                                guint32 value);
 
-gboolean        gck_secret_fields_get_compat_uint32           (GHashTable *fields,
+gboolean        gkm_secret_fields_get_compat_uint32           (GHashTable *fields,
                                                                const gchar *name,
                                                                guint32 *value);
 
-void            gck_secret_fields_add_compat_hashed_string    (GHashTable *fields, 
+void            gkm_secret_fields_add_compat_hashed_string    (GHashTable *fields,
                                                                const gchar *name,
                                                                const gchar *value);
 
-gboolean        gck_secret_fields_get_compat_hashed_string    (GHashTable *fields, 
+gboolean        gkm_secret_fields_get_compat_hashed_string    (GHashTable *fields,
                                                                const gchar *name,
                                                                gchar **value);
 
-void            gck_secret_fields_add_compat_hashed_uint32    (GHashTable *fields, 
-                                                               const gchar *name, 
+void            gkm_secret_fields_add_compat_hashed_uint32    (GHashTable *fields,
+                                                               const gchar *name,
                                                                guint32 value);
 
-gboolean        gck_secret_fields_get_compat_hashed_uint32    (GHashTable *fields, 
+gboolean        gkm_secret_fields_get_compat_hashed_uint32    (GHashTable *fields,
                                                                const gchar *name,
                                                                guint32 *value);
 
-#endif /* __GCK_SECRET_FIELDS_H__ */
+#endif /* __GKM_SECRET_FIELDS_H__ */
diff --git a/pkcs11/secret-store/gkm-secret-item.c b/pkcs11/secret-store/gkm-secret-item.c
new file mode 100644
index 0000000..0311ade
--- /dev/null
+++ b/pkcs11/secret-store/gkm-secret-item.c
@@ -0,0 +1,499 @@
+/*
+ * gnome-keyring
+ *
+ * Copyright (C) 2009 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.
+ */
+
+#include "config.h"
+
+#include "gkm-secret-data.h"
+#include "gkm-secret-fields.h"
+#include "gkm-secret-item.h"
+
+#include "gkm/gkm-attributes.h"
+#include "gkm/gkm-module.h"
+#include "gkm/gkm-secret.h"
+#include "gkm/gkm-session.h"
+#include "gkm/gkm-transaction.h"
+
+#include "pkcs11/pkcs11i.h"
+
+#include <glib/gi18n.h>
+
+enum {
+	PROP_0,
+	PROP_COLLECTION,
+	PROP_FIELDS,
+	PROP_SCHEMA
+};
+
+struct _GkmSecretItem {
+	GkmSecretObject parent;
+	GHashTable *fields;
+	gchar *schema;
+	GkmSecretCollection *collection;
+};
+
+G_DEFINE_TYPE (GkmSecretItem, gkm_secret_item, GKM_TYPE_SECRET_OBJECT);
+
+/* -----------------------------------------------------------------------------
+ * INTERNAL
+ */
+
+static gboolean
+complete_set_schema (GkmTransaction *transaction, GObject *obj, gpointer user_data)
+{
+	GkmSecretItem *self = GKM_SECRET_ITEM (obj);
+	gchar *old_schema = user_data;
+
+	if (gkm_transaction_get_failed (transaction)) {
+		g_free (self->schema);
+		self->schema = old_schema;
+	} else {
+		gkm_object_notify_attribute (GKM_OBJECT (obj), CKA_G_SCHEMA);
+		g_object_notify (G_OBJECT (obj), "schema");
+		gkm_secret_object_was_modified (GKM_SECRET_OBJECT (self));
+		g_free (old_schema);
+	}
+
+	return TRUE;
+}
+
+static void
+begin_set_schema (GkmSecretItem *self, GkmTransaction *transaction, gchar *schema)
+{
+	g_assert (GKM_IS_SECRET_OBJECT (self));
+	g_assert (!gkm_transaction_get_failed (transaction));
+
+	if (self->schema != schema) {
+		gkm_transaction_add (transaction, self, complete_set_schema, self->schema);
+		self->schema = schema;
+	}
+}
+
+static gboolean
+complete_set_secret (GkmTransaction *transaction, GObject *obj, gpointer user_data)
+{
+	GkmSecretItem *self = GKM_SECRET_ITEM (obj);
+
+	if (!gkm_transaction_get_failed (transaction)) {
+		gkm_object_notify_attribute (GKM_OBJECT (obj), CKA_VALUE);
+		gkm_secret_object_was_modified (GKM_SECRET_OBJECT (self));
+	}
+
+	return TRUE;
+}
+
+static gboolean
+complete_set_fields (GkmTransaction *transaction, GObject *obj, gpointer user_data)
+{
+	GkmSecretItem *self = GKM_SECRET_ITEM (obj);
+	GHashTable *old_fields = user_data;
+
+	if (gkm_transaction_get_failed (transaction)) {
+		if (self->fields)
+			g_hash_table_unref (self->fields);
+		self->fields = old_fields;
+	} else {
+		gkm_object_notify_attribute (GKM_OBJECT (obj), CKA_G_FIELDS);
+		g_object_notify (G_OBJECT (obj), "fields");
+		gkm_secret_object_was_modified (GKM_SECRET_OBJECT (self));
+		if (old_fields)
+			g_hash_table_unref (old_fields);
+	}
+
+	return TRUE;
+}
+
+static void
+begin_set_fields (GkmSecretItem *self, GkmTransaction *transaction, GHashTable *fields)
+{
+	g_assert (GKM_IS_SECRET_OBJECT (self));
+	g_assert (!gkm_transaction_get_failed (transaction));
+
+	gkm_transaction_add (transaction, self, complete_set_fields, self->fields);
+	self->fields = fields;
+}
+
+static GkmObject*
+factory_create_item (GkmSession *session, GkmTransaction *transaction,
+                     CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
+{
+	GkmSecretCollection *collection = NULL;
+	GkmSecretItem *item;
+	GkmManager *m_manager;
+	GkmManager *s_manager;
+	CK_ATTRIBUTE *attr;
+	gboolean is_token;
+	gchar *identifier;
+
+	g_return_val_if_fail (GKM_IS_TRANSACTION (transaction), NULL);
+	g_return_val_if_fail (attrs || !n_attrs, NULL);
+
+	/* See if a collection attribute was specified */
+	attr = gkm_attributes_find (attrs, n_attrs, CKA_G_COLLECTION);
+	if (attr == NULL) {
+		gkm_transaction_fail (transaction, CKR_TEMPLATE_INCOMPLETE);
+		return NULL;
+	}
+
+	m_manager = gkm_module_get_manager (gkm_session_get_module (session));
+	s_manager = gkm_session_get_manager (session);
+
+	gkm_attribute_consume (attr);
+	if (!gkm_attributes_find_boolean (attrs, n_attrs, CKA_TOKEN, &is_token))
+		collection = gkm_secret_collection_find (attr, m_manager, s_manager, NULL);
+	else if (is_token)
+		collection = gkm_secret_collection_find (attr, m_manager, NULL);
+	else
+		collection = gkm_secret_collection_find (attr, s_manager, NULL);
+
+	if (!collection) {
+		gkm_transaction_fail (transaction, CKR_TEMPLATE_INCONSISTENT);
+		return NULL;
+	}
+
+	/* If an ID was specified, then try and see if that ID already exists */
+	if (gkm_attributes_find_string (attrs, n_attrs, CKA_ID, &identifier)) {
+		item = gkm_secret_collection_get_item (collection, identifier);
+		if (item == NULL) {
+			gkm_transaction_fail (transaction, CKR_TEMPLATE_INCONSISTENT);
+			return NULL;
+		} else {
+			gkm_session_complete_object_creation (session, transaction, GKM_OBJECT (item),
+			                                      FALSE, attrs, n_attrs);
+			return g_object_ref (item);
+		}
+	}
+
+	/* Create a new collection which will own the item */
+	item = gkm_secret_collection_create_item (collection, transaction);
+	gkm_session_complete_object_creation (session, transaction, GKM_OBJECT (item),
+	                                      TRUE, attrs, n_attrs);
+	return g_object_ref (item);
+}
+
+/* -----------------------------------------------------------------------------
+ * OBJECT
+ */
+
+static gboolean
+gkm_secret_item_real_is_locked (GkmSecretObject *obj, GkmSession *session)
+{
+	GkmSecretItem *self = GKM_SECRET_ITEM (obj);
+	if (!self->collection)
+		return TRUE;
+	return gkm_secret_object_is_locked (GKM_SECRET_OBJECT (self->collection), session);
+}
+
+static CK_RV
+gkm_secret_item_real_get_attribute (GkmObject *base, GkmSession *session, CK_ATTRIBUTE_PTR attr)
+{
+	GkmSecretItem *self = GKM_SECRET_ITEM (base);
+	GkmSecretData *sdata;
+	const gchar *identifier;
+	const guchar *secret;
+	gsize n_secret = 0;
+	CK_RV rv;
+
+	g_return_val_if_fail (self->collection, CKR_GENERAL_ERROR);
+
+	switch (attr->type) {
+	case CKA_CLASS:
+		return gkm_attribute_set_ulong (attr, CKO_SECRET_KEY);
+
+	case CKA_VALUE:
+		sdata = gkm_secret_collection_unlocked_use (self->collection, session);
+		if (sdata == NULL)
+			return CKR_USER_NOT_LOGGED_IN;
+		identifier = gkm_secret_object_get_identifier (GKM_SECRET_OBJECT (self));
+		secret = gkm_secret_data_get_raw (sdata, identifier, &n_secret);
+		rv = gkm_attribute_set_data (attr, secret, n_secret);
+		g_object_unref (sdata);
+		return rv;
+
+	case CKA_G_COLLECTION:
+		g_return_val_if_fail (self->collection, CKR_GENERAL_ERROR);
+		identifier = gkm_secret_object_get_identifier (GKM_SECRET_OBJECT (self->collection));
+		return gkm_attribute_set_string (attr, identifier);
+
+	case CKA_G_FIELDS:
+		if (!self->fields)
+			return gkm_attribute_set_data (attr, NULL, 0);
+		return gkm_secret_fields_serialize (attr, self->fields);
+
+	case CKA_G_SCHEMA:
+		return gkm_attribute_set_string (attr, self->schema);
+	}
+
+	return GKM_OBJECT_CLASS (gkm_secret_item_parent_class)->get_attribute (base, session, attr);
+}
+
+static void
+gkm_secret_item_real_set_attribute (GkmObject *base, GkmSession *session,
+                                    GkmTransaction *transaction, CK_ATTRIBUTE_PTR attr)
+{
+	GkmSecretItem *self = GKM_SECRET_ITEM (base);
+	const gchar *identifier;
+	GkmSecretData *sdata;
+	GHashTable *fields;
+	GkmSecret *secret;
+	gchar *schema;
+	CK_RV rv;
+
+	if (!self->collection) {
+		gkm_transaction_fail (transaction, CKR_GENERAL_ERROR);
+		g_return_if_reached ();
+	}
+
+	/* Check that the object is not locked */
+	if (!gkm_secret_collection_unlocked_have (self->collection, session)) {
+		gkm_transaction_fail (transaction, CKR_USER_NOT_LOGGED_IN);
+		return;
+	}
+
+	switch (attr->type) {
+	case CKA_VALUE:
+		sdata = gkm_secret_collection_unlocked_use (self->collection, session);
+		g_return_if_fail (sdata);
+		identifier = gkm_secret_object_get_identifier (GKM_SECRET_OBJECT (self));
+		secret = gkm_secret_new (attr->pValue, attr->ulValueLen);
+		gkm_secret_data_set_transacted (sdata, transaction, identifier, secret);
+		g_object_unref (secret);
+		g_object_unref (sdata);
+		if (!gkm_transaction_get_failed (transaction))
+			gkm_transaction_add (transaction, self, complete_set_secret, NULL);
+		return;
+
+	case CKA_G_FIELDS:
+		rv = gkm_secret_fields_parse (attr, &fields);
+		if (rv != CKR_OK)
+			gkm_transaction_fail (transaction, rv);
+		else
+			begin_set_fields (self, transaction, fields);
+		return;
+
+	case CKA_G_SCHEMA:
+		rv = gkm_attribute_get_string (attr, &schema);
+		if (rv != CKR_OK)
+			gkm_transaction_fail (transaction, rv);
+		else
+			begin_set_schema (self, transaction, schema);
+		return;
+	}
+
+	GKM_OBJECT_CLASS (gkm_secret_item_parent_class)->set_attribute (base, session, transaction, attr);
+}
+
+static void
+gkm_secret_item_init (GkmSecretItem *self)
+{
+
+}
+
+static GObject*
+gkm_secret_item_constructor (GType type, guint n_props, GObjectConstructParam *props)
+{
+	GkmSecretItem *self = GKM_SECRET_ITEM (G_OBJECT_CLASS (gkm_secret_item_parent_class)->constructor(type, n_props, props));
+	g_return_val_if_fail (self, NULL);
+
+	g_return_val_if_fail (self->collection, NULL);
+
+	return G_OBJECT (self);
+}
+
+static void
+gkm_secret_item_set_property (GObject *obj, guint prop_id, const GValue *value,
+                              GParamSpec *pspec)
+{
+	GkmSecretItem *self = GKM_SECRET_ITEM (obj);
+
+	switch (prop_id) {
+	case PROP_COLLECTION:
+		g_return_if_fail (!self->collection);
+		self->collection = g_value_get_object (value);
+		g_return_if_fail (self->collection);
+		g_object_add_weak_pointer (G_OBJECT (self->collection),
+		                           (gpointer*)&(self->collection));
+		break;
+	case PROP_FIELDS:
+		gkm_secret_item_set_fields (self, g_value_get_boxed (value));
+		break;
+	case PROP_SCHEMA:
+		gkm_secret_item_set_schema (self, g_value_get_string (value));
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+gkm_secret_item_get_property (GObject *obj, guint prop_id, GValue *value,
+                              GParamSpec *pspec)
+{
+	GkmSecretItem *self = GKM_SECRET_ITEM (obj);
+
+	switch (prop_id) {
+	case PROP_COLLECTION:
+		g_value_set_object (value, gkm_secret_item_get_collection (self));
+		break;
+	case PROP_FIELDS:
+		g_value_set_boxed (value, gkm_secret_item_get_fields (self));
+		break;
+	case PROP_SCHEMA:
+		g_value_set_string (value, gkm_secret_item_get_schema (self));
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+gkm_secret_item_dispose (GObject *obj)
+{
+	GkmSecretItem *self = GKM_SECRET_ITEM (obj);
+
+	if (self->collection)
+		g_object_remove_weak_pointer (G_OBJECT (self->collection),
+		                              (gpointer*)&(self->collection));
+	self->collection = NULL;
+
+	G_OBJECT_CLASS (gkm_secret_item_parent_class)->dispose (obj);
+}
+
+static void
+gkm_secret_item_finalize (GObject *obj)
+{
+	GkmSecretItem *self = GKM_SECRET_ITEM (obj);
+
+	g_assert (!self->collection);
+
+	if (self->fields)
+		g_hash_table_unref (self->fields);
+	self->fields = NULL;
+
+	G_OBJECT_CLASS (gkm_secret_item_parent_class)->finalize (obj);
+}
+
+static void
+gkm_secret_item_class_init (GkmSecretItemClass *klass)
+{
+	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+	GkmObjectClass *gkm_class = GKM_OBJECT_CLASS (klass);
+	GkmSecretObjectClass *secret_class = GKM_SECRET_OBJECT_CLASS (klass);
+
+	gkm_secret_item_parent_class = g_type_class_peek_parent (klass);
+
+	gobject_class->constructor = gkm_secret_item_constructor;
+	gobject_class->dispose = gkm_secret_item_dispose;
+	gobject_class->finalize = gkm_secret_item_finalize;
+	gobject_class->set_property = gkm_secret_item_set_property;
+	gobject_class->get_property = gkm_secret_item_get_property;
+
+	gkm_class->get_attribute = gkm_secret_item_real_get_attribute;
+	gkm_class->set_attribute = gkm_secret_item_real_set_attribute;
+
+	secret_class->is_locked = gkm_secret_item_real_is_locked;
+
+	g_object_class_install_property (gobject_class, PROP_COLLECTION,
+	           g_param_spec_object ("collection", "Collection", "Item's Collection",
+	                                GKM_TYPE_SECRET_COLLECTION, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+	g_object_class_install_property (gobject_class, PROP_FIELDS,
+	           g_param_spec_boxed ("fields", "Fields", "Item's fields",
+	                               GKM_BOXED_SECRET_FIELDS, G_PARAM_READWRITE));
+
+	g_object_class_install_property (gobject_class, PROP_SCHEMA,
+	           g_param_spec_string ("schema", "Schema", "Item's type or schema",
+	                                NULL, G_PARAM_READWRITE));
+}
+
+/* -----------------------------------------------------------------------------
+ * PUBLIC
+ */
+
+GkmFactory*
+gkm_secret_item_get_factory (void)
+{
+	static CK_OBJECT_CLASS klass = CKO_SECRET_KEY;
+
+	static CK_ATTRIBUTE attributes[] = {
+		{ CKA_CLASS, &klass, sizeof (klass) },
+	};
+
+	static GkmFactory factory = {
+		attributes,
+		G_N_ELEMENTS (attributes),
+		factory_create_item
+	};
+
+	return &factory;
+}
+
+GkmSecretCollection*
+gkm_secret_item_get_collection (GkmSecretItem *self)
+{
+	g_return_val_if_fail (GKM_IS_SECRET_ITEM (self), NULL);
+	return self->collection;
+}
+
+GHashTable*
+gkm_secret_item_get_fields (GkmSecretItem *self)
+{
+	g_return_val_if_fail (GKM_IS_SECRET_ITEM (self), NULL);
+	if (self->fields == NULL)
+		self->fields = gkm_secret_fields_new ();
+	return self->fields;
+}
+
+void
+gkm_secret_item_set_fields (GkmSecretItem *self, GHashTable *fields)
+{
+	g_return_if_fail (GKM_IS_SECRET_ITEM (self));
+
+	if (fields)
+		g_hash_table_ref (fields);
+	if (self->fields)
+		g_hash_table_unref (self->fields);
+	self->fields = fields;
+
+	g_object_notify (G_OBJECT (self), "fields");
+	gkm_object_notify_attribute (GKM_OBJECT (self), CKA_G_FIELDS);
+}
+
+const gchar*
+gkm_secret_item_get_schema (GkmSecretItem *self)
+{
+	g_return_val_if_fail (GKM_IS_SECRET_ITEM (self), NULL);
+	return self->schema;
+}
+
+void
+gkm_secret_item_set_schema (GkmSecretItem *self, const gchar *schema)
+{
+	g_return_if_fail (GKM_IS_SECRET_ITEM (self));
+
+	if (schema != self->schema) {
+		g_free (self->schema);
+		self->schema = g_strdup (schema);
+		g_object_notify (G_OBJECT (self), "schema");
+		gkm_object_notify_attribute (GKM_OBJECT (self), CKA_G_SCHEMA);
+	}
+}
diff --git a/pkcs11/secret-store/gkm-secret-item.h b/pkcs11/secret-store/gkm-secret-item.h
new file mode 100644
index 0000000..febb3e9
--- /dev/null
+++ b/pkcs11/secret-store/gkm-secret-item.h
@@ -0,0 +1,61 @@
+/*
+ * gnome-keyring
+ *
+ * Copyright (C) 2009 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 __GKM_SECRET_ITEM_H__
+#define __GKM_SECRET_ITEM_H__
+
+#include <glib-object.h>
+
+#include "gkm-secret-object.h"
+#include "gkm-secret-collection.h"
+
+#define GKM_FACTORY_SECRET_ITEM             (gkm_secret_item_get_factory ())
+
+#define GKM_TYPE_SECRET_ITEM               (gkm_secret_item_get_type ())
+#define GKM_SECRET_ITEM(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_SECRET_ITEM, GkmSecretItem))
+#define GKM_SECRET_ITEM_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_SECRET_ITEM, GkmSecretItemClass))
+#define GKM_IS_SECRET_ITEM(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_SECRET_ITEM))
+#define GKM_IS_SECRET_ITEM_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_SECRET_ITEM))
+#define GKM_SECRET_ITEM_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_SECRET_ITEM, GkmSecretItemClass))
+
+typedef struct _GkmSecretItemClass GkmSecretItemClass;
+
+struct _GkmSecretItemClass {
+	GkmSecretObjectClass parent_class;
+};
+
+GType                  gkm_secret_item_get_type               (void);
+
+GkmFactory*            gkm_secret_item_get_factory            (void) G_GNUC_CONST;
+
+GkmSecretCollection*   gkm_secret_item_get_collection         (GkmSecretItem *self);
+
+GHashTable*            gkm_secret_item_get_fields             (GkmSecretItem *self);
+
+void                   gkm_secret_item_set_fields             (GkmSecretItem *self,
+                                                               GHashTable *fields);
+
+const gchar*           gkm_secret_item_get_schema             (GkmSecretItem *self);
+
+void                   gkm_secret_item_set_schema             (GkmSecretItem *self,
+                                                               const gchar *type);
+
+#endif /* __GKM_SECRET_ITEM_H__ */
diff --git a/pkcs11/secret-store/gck-secret-module.c b/pkcs11/secret-store/gkm-secret-module.c
similarity index 50%
rename from pkcs11/secret-store/gck-secret-module.c
rename to pkcs11/secret-store/gkm-secret-module.c
index c3cba91..cb22b0a 100644
--- a/pkcs11/secret-store/gck-secret-module.c
+++ b/pkcs11/secret-store/gkm-secret-module.c
@@ -1,35 +1,35 @@
-/* 
+/*
  * gnome-keyring
- * 
+ *
  * Copyright (C) 2009 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"
 
-#include "gck-secret-collection.h"
-#include "gck-secret-item.h"
-#include "gck-secret-module.h"
-#include "gck-secret-search.h"
-#include "gck-secret-store.h"
+#include "gkm-secret-collection.h"
+#include "gkm-secret-item.h"
+#include "gkm-secret-module.h"
+#include "gkm-secret-search.h"
+#include "gkm-secret-store.h"
 
-#include "gck/gck-credential.h"
-#include "gck/gck-file-tracker.h"
-#include "gck/gck-transaction.h"
+#include "gkm/gkm-credential.h"
+#include "gkm/gkm-file-tracker.h"
+#include "gkm/gkm-transaction.h"
 
 #include <glib/gstdio.h>
 
@@ -37,15 +37,15 @@
 #include <fcntl.h>
 #include <string.h>
 
-struct _GckSecretModule {
-	GckModule parent;
-	GckFileTracker *tracker;
+struct _GkmSecretModule {
+	GkmModule parent;
+	GkmFileTracker *tracker;
 	GHashTable *collections;
 	gchar *directory;
-	GckCredential *session_credential;
+	GkmCredential *session_credential;
 };
 
-static const CK_SLOT_INFO gck_secret_module_slot_info = {
+static const CK_SLOT_INFO gkm_secret_module_slot_info = {
 	"Secret Store",
 	"Gnome Keyring",
 	CKF_TOKEN_PRESENT,
@@ -53,7 +53,7 @@ static const CK_SLOT_INFO gck_secret_module_slot_info = {
 	{ 0, 0 }
 };
 
-static const CK_TOKEN_INFO gck_secret_module_token_info = {
+static const CK_TOKEN_INFO gkm_secret_module_token_info = {
 	"Secret Store",
 	"Gnome Keyring",
 	"1.0",
@@ -74,84 +74,84 @@ static const CK_TOKEN_INFO gck_secret_module_token_info = {
 	""
 };
 
-G_DEFINE_TYPE (GckSecretModule, gck_secret_module, GCK_TYPE_MODULE);
+G_DEFINE_TYPE (GkmSecretModule, gkm_secret_module, GKM_TYPE_MODULE);
 
-GckModule*  _gck_secret_store_get_module_for_testing (void);
+GkmModule*  _gkm_secret_store_get_module_for_testing (void);
 
 /* Forward declarations */
-static void add_collection (GckSecretModule *, GckTransaction *, GckSecretCollection *);
-static void remove_collection (GckSecretModule *, GckTransaction *, GckSecretCollection *);
+static void add_collection (GkmSecretModule *, GkmTransaction *, GkmSecretCollection *);
+static void remove_collection (GkmSecretModule *, GkmTransaction *, GkmSecretCollection *);
 
 /* -----------------------------------------------------------------------------
- * ACTUAL PKCS#11 Module Implementation 
+ * ACTUAL PKCS#11 Module Implementation
  */
 
 /* Include all the module entry points */
-#include "gck/gck-module-ep.h"
-GCK_DEFINE_MODULE (gck_secret_module, GCK_TYPE_SECRET_MODULE);
+#include "gkm/gkm-module-ep.h"
+GKM_DEFINE_MODULE (gkm_secret_module, GKM_TYPE_SECRET_MODULE);
 
 /* -----------------------------------------------------------------------------
- * INTERNAL 
+ * INTERNAL
  */
 
 static gboolean
-complete_add (GckTransaction *transaction, GObject *obj, gpointer user_data)
+complete_add (GkmTransaction *transaction, GObject *obj, gpointer user_data)
 {
-	GckSecretCollection *collection = GCK_SECRET_COLLECTION (user_data);
-	if (gck_transaction_get_failed (transaction))
-		remove_collection (GCK_SECRET_MODULE (obj), NULL, collection);
+	GkmSecretCollection *collection = GKM_SECRET_COLLECTION (user_data);
+	if (gkm_transaction_get_failed (transaction))
+		remove_collection (GKM_SECRET_MODULE (obj), NULL, collection);
 	g_object_unref (collection);
 	return TRUE;
 }
 
 static void
-add_collection (GckSecretModule *self, GckTransaction *transaction, GckSecretCollection  *collection)
+add_collection (GkmSecretModule *self, GkmTransaction *transaction, GkmSecretCollection  *collection)
 {
 	const gchar *filename;
 
-	g_assert (GCK_IS_SECRET_MODULE(self));
-	g_assert (GCK_IS_SECRET_COLLECTION (collection));
+	g_assert (GKM_IS_SECRET_MODULE(self));
+	g_assert (GKM_IS_SECRET_COLLECTION (collection));
 
-	filename = gck_secret_collection_get_filename (collection);
+	filename = gkm_secret_collection_get_filename (collection);
 	g_return_if_fail (filename);
 
 	g_hash_table_replace (self->collections, g_strdup (filename), g_object_ref (collection));
 
-	gck_object_expose_full (GCK_OBJECT (collection), transaction, TRUE);
+	gkm_object_expose_full (GKM_OBJECT (collection), transaction, TRUE);
 	if (transaction)
-		gck_transaction_add (transaction, self, complete_add, g_object_ref (collection));
+		gkm_transaction_add (transaction, self, complete_add, g_object_ref (collection));
 }
 
 static gboolean
-complete_remove (GckTransaction *transaction, GObject *obj, gpointer user_data)
+complete_remove (GkmTransaction *transaction, GObject *obj, gpointer user_data)
 {
-	GckSecretCollection *collection = GCK_SECRET_COLLECTION (user_data);
-	if (gck_transaction_get_failed (transaction))
-		add_collection (GCK_SECRET_MODULE (obj), NULL, collection);
+	GkmSecretCollection *collection = GKM_SECRET_COLLECTION (user_data);
+	if (gkm_transaction_get_failed (transaction))
+		add_collection (GKM_SECRET_MODULE (obj), NULL, collection);
 	g_object_unref (collection);
 	return TRUE;
 }
 
 static void
-remove_collection (GckSecretModule *self, GckTransaction *transaction, GckSecretCollection *collection)
+remove_collection (GkmSecretModule *self, GkmTransaction *transaction, GkmSecretCollection *collection)
 {
 	const gchar *filename;
 
-	g_assert (GCK_IS_SECRET_MODULE (self));
-	g_assert (GCK_IS_SECRET_COLLECTION (collection));
+	g_assert (GKM_IS_SECRET_MODULE (self));
+	g_assert (GKM_IS_SECRET_COLLECTION (collection));
 
-	filename = gck_secret_collection_get_filename (collection);
+	filename = gkm_secret_collection_get_filename (collection);
 	g_return_if_fail (filename);
 
 	g_hash_table_remove (self->collections, filename);
 
-	gck_object_expose_full (GCK_OBJECT (collection), transaction, FALSE);
+	gkm_object_expose_full (GKM_OBJECT (collection), transaction, FALSE);
 	if (transaction)
-		gck_transaction_add (transaction, self, complete_remove, g_object_ref (collection));
+		gkm_transaction_add (transaction, self, complete_remove, g_object_ref (collection));
 }
 
 static gchar*
-identifier_from_filename (GckSecretModule *self, const gchar *filename)
+identifier_from_filename (GkmSecretModule *self, const gchar *filename)
 {
 	gchar *identifier;
 
@@ -166,7 +166,7 @@ identifier_from_filename (GckSecretModule *self, const gchar *filename)
 }
 
 static gchar*
-identifier_to_new_filename (GckSecretModule *self, const gchar *identifier)
+identifier_to_new_filename (GkmSecretModule *self, const gchar *identifier)
 {
 	gchar *filename;
 	gint i;
@@ -196,15 +196,15 @@ identifier_to_new_filename (GckSecretModule *self, const gchar *identifier)
 
 
 static void
-on_file_load (GckFileTracker *tracker, const gchar *path, GckSecretModule *self)
+on_file_load (GkmFileTracker *tracker, const gchar *path, GkmSecretModule *self)
 {
-	GckSecretCollection *collection;
-	GckManager *manager;
-	GckDataResult res;
+	GkmSecretCollection *collection;
+	GkmManager *manager;
+	GkmDataResult res;
 	gboolean created;
 	gchar *identifier;
 
-	manager = gck_module_get_manager (GCK_MODULE (self));
+	manager = gkm_module_get_manager (GKM_MODULE (self));
 	g_return_if_fail (manager);
 
 	/* Do we have one for this path yet? */
@@ -213,7 +213,7 @@ on_file_load (GckFileTracker *tracker, const gchar *path, GckSecretModule *self)
 
 	if (collection == NULL) {
 		created = TRUE;
-		collection = g_object_new (GCK_TYPE_SECRET_COLLECTION,
+		collection = g_object_new (GKM_TYPE_SECRET_COLLECTION,
 		                           "module", self,
 		                           "identifier", identifier,
 		                           "filename", path,
@@ -224,21 +224,21 @@ on_file_load (GckFileTracker *tracker, const gchar *path, GckSecretModule *self)
 		g_object_ref (collection);
 	}
 
-	res = gck_secret_collection_load (collection);
+	res = gkm_secret_collection_load (collection);
 
 	switch (res) {
-	case GCK_DATA_SUCCESS:
+	case GKM_DATA_SUCCESS:
 		if (created)
 			add_collection (self, NULL, collection);
 		break;
-	case GCK_DATA_LOCKED:
+	case GKM_DATA_LOCKED:
 		g_message ("master password for keyring changed without our knowledge: %s", path);
-		gck_secret_collection_unlocked_clear (collection);
+		gkm_secret_collection_unlocked_clear (collection);
 		break;
-	case GCK_DATA_UNRECOGNIZED:
+	case GKM_DATA_UNRECOGNIZED:
 		g_message ("keyring was in an invalid or unrecognized format: %s", path);
 		break;
-	case GCK_DATA_FAILURE:
+	case GKM_DATA_FAILURE:
 		g_message ("failed to parse keyring: %s", path);
 		break;
 	default:
@@ -250,12 +250,12 @@ on_file_load (GckFileTracker *tracker, const gchar *path, GckSecretModule *self)
 }
 
 static void
-on_file_remove (GckFileTracker *tracker, const gchar *path, GckSecretModule *self)
+on_file_remove (GkmFileTracker *tracker, const gchar *path, GkmSecretModule *self)
 {
-	GckSecretCollection *collection;
+	GkmSecretCollection *collection;
 
 	g_return_if_fail (path);
-	g_return_if_fail (GCK_IS_SECRET_MODULE (self));
+	g_return_if_fail (GKM_IS_SECRET_MODULE (self));
 
 	collection = g_hash_table_lookup (self->collections, path);
 	if (collection)
@@ -266,22 +266,22 @@ on_file_remove (GckFileTracker *tracker, const gchar *path, GckSecretModule *sel
  * OBJECT
  */
 
-static const CK_SLOT_INFO* 
-gck_secret_module_real_get_slot_info (GckModule *self)
+static const CK_SLOT_INFO*
+gkm_secret_module_real_get_slot_info (GkmModule *self)
 {
-	return &gck_secret_module_slot_info;
+	return &gkm_secret_module_slot_info;
 }
 
 static const CK_TOKEN_INFO*
-gck_secret_module_real_get_token_info (GckModule *self)
+gkm_secret_module_real_get_token_info (GkmModule *self)
 {
-	return &gck_secret_module_token_info;
+	return &gkm_secret_module_token_info;
 }
 
-static void 
-gck_secret_module_real_parse_argument (GckModule *base, const gchar *name, const gchar *value)
+static void
+gkm_secret_module_real_parse_argument (GkmModule *base, const gchar *name, const gchar *value)
 {
-	GckSecretModule *self = GCK_SECRET_MODULE (base);
+	GkmSecretModule *self = GKM_SECRET_MODULE (base);
 	if (g_str_equal (name, "directory")) {
 		g_free (self->directory);
 		self->directory = g_strdup (value);
@@ -289,32 +289,32 @@ gck_secret_module_real_parse_argument (GckModule *base, const gchar *name, const
 }
 
 static CK_RV
-gck_secret_module_real_refresh_token (GckModule *base)
+gkm_secret_module_real_refresh_token (GkmModule *base)
 {
-	GckSecretModule *self = GCK_SECRET_MODULE (base);
+	GkmSecretModule *self = GKM_SECRET_MODULE (base);
 	if (self->tracker)
-		gck_file_tracker_refresh (self->tracker, FALSE);
+		gkm_file_tracker_refresh (self->tracker, FALSE);
 	return CKR_OK;
 }
 
 static void
-gck_secret_module_real_add_object (GckModule *module, GckTransaction *transaction,
-                                   GckObject *object)
+gkm_secret_module_real_add_object (GkmModule *module, GkmTransaction *transaction,
+                                   GkmObject *object)
 {
-	GckSecretModule *self = GCK_SECRET_MODULE (module);
-	GckSecretCollection *collection;
+	GkmSecretModule *self = GKM_SECRET_MODULE (module);
+	GkmSecretCollection *collection;
 	const gchar *identifier;
 	gchar *filename;
 
-	g_return_if_fail (!gck_transaction_get_failed (transaction));
+	g_return_if_fail (!gkm_transaction_get_failed (transaction));
 
-	if (GCK_IS_SECRET_COLLECTION (object)) {
-		collection = GCK_SECRET_COLLECTION (object);
+	if (GKM_IS_SECRET_COLLECTION (object)) {
+		collection = GKM_SECRET_COLLECTION (object);
 
 		/* Setup a filename for this collection */
-		identifier = gck_secret_object_get_identifier (GCK_SECRET_OBJECT (collection));
+		identifier = gkm_secret_object_get_identifier (GKM_SECRET_OBJECT (collection));
 		filename = identifier_to_new_filename (self, identifier);
-		gck_secret_collection_set_filename (collection, filename);
+		gkm_secret_collection_set_filename (collection, filename);
 		g_free (filename);
 
 		add_collection (self, transaction, collection);
@@ -322,71 +322,71 @@ gck_secret_module_real_add_object (GckModule *module, GckTransaction *transactio
 }
 
 static void
-gck_secret_module_real_store_object (GckModule *module, GckTransaction *transaction,
-                                     GckObject *object)
+gkm_secret_module_real_store_object (GkmModule *module, GkmTransaction *transaction,
+                                     GkmObject *object)
 {
-	GckSecretModule *self = GCK_SECRET_MODULE (module);
-	GckSecretCollection *collection = NULL;
+	GkmSecretModule *self = GKM_SECRET_MODULE (module);
+	GkmSecretCollection *collection = NULL;
 
 	/* Store the item's collection */
-	if (GCK_IS_SECRET_ITEM (object)) {
-		collection = gck_secret_item_get_collection (GCK_SECRET_ITEM (object));
-		g_return_if_fail (GCK_IS_SECRET_COLLECTION (collection));
-		gck_module_store_token_object (GCK_MODULE (self), transaction, GCK_OBJECT (collection));
+	if (GKM_IS_SECRET_ITEM (object)) {
+		collection = gkm_secret_item_get_collection (GKM_SECRET_ITEM (object));
+		g_return_if_fail (GKM_IS_SECRET_COLLECTION (collection));
+		gkm_module_store_token_object (GKM_MODULE (self), transaction, GKM_OBJECT (collection));
 
 	/* Storing a collection */
-	} else if (GCK_IS_SECRET_COLLECTION (object)) {
-		collection = GCK_SECRET_COLLECTION (object);
-		gck_secret_collection_save (collection, transaction);
+	} else if (GKM_IS_SECRET_COLLECTION (object)) {
+		collection = GKM_SECRET_COLLECTION (object);
+		gkm_secret_collection_save (collection, transaction);
 
 	/* No other kind of token object */
 	} else {
 		g_warning ("can't store object of type '%s' on secret token", G_OBJECT_TYPE_NAME (object));
-		gck_transaction_fail (transaction, CKR_GENERAL_ERROR);
+		gkm_transaction_fail (transaction, CKR_GENERAL_ERROR);
 	}
 }
 
 static void
-gck_secret_module_real_remove_object (GckModule *module, GckTransaction *transaction,
-                                      GckObject *object)
+gkm_secret_module_real_remove_object (GkmModule *module, GkmTransaction *transaction,
+                                      GkmObject *object)
 {
-	GckSecretModule *self = GCK_SECRET_MODULE (module);
-	GckSecretCollection *collection;
+	GkmSecretModule *self = GKM_SECRET_MODULE (module);
+	GkmSecretCollection *collection;
 
 	/* Ignore the session keyring credentials */
 	if (self->session_credential != NULL &&
-	    GCK_OBJECT (self->session_credential) == object)
+	    GKM_OBJECT (self->session_credential) == object)
 		return;
 
 	/* Removing an item */
-	if (GCK_IS_SECRET_ITEM (object)) {
-		collection = gck_secret_item_get_collection (GCK_SECRET_ITEM (object));
-		g_return_if_fail (GCK_IS_SECRET_COLLECTION (collection));
-		gck_secret_collection_destroy_item (collection, transaction, GCK_SECRET_ITEM (object));
-		if (!gck_transaction_get_failed (transaction))
-			gck_secret_collection_save (collection, transaction);
+	if (GKM_IS_SECRET_ITEM (object)) {
+		collection = gkm_secret_item_get_collection (GKM_SECRET_ITEM (object));
+		g_return_if_fail (GKM_IS_SECRET_COLLECTION (collection));
+		gkm_secret_collection_destroy_item (collection, transaction, GKM_SECRET_ITEM (object));
+		if (!gkm_transaction_get_failed (transaction))
+			gkm_secret_collection_save (collection, transaction);
 
 	/* Removing a collection */
-	} else if (GCK_IS_SECRET_COLLECTION (object)) {
-		collection = GCK_SECRET_COLLECTION (object);
-		gck_secret_collection_destroy (collection, transaction);
-		if (!gck_transaction_get_failed (transaction))
+	} else if (GKM_IS_SECRET_COLLECTION (object)) {
+		collection = GKM_SECRET_COLLECTION (object);
+		gkm_secret_collection_destroy (collection, transaction);
+		if (!gkm_transaction_get_failed (transaction))
 			remove_collection (self, transaction, collection);
 
 	/* No other token objects */
 	} else {
 		g_warning ("Trying to remove token object of type '%s' from secret "
 		           "module, but that type is not supported.", G_OBJECT_TYPE_NAME (object));
-		gck_transaction_fail (transaction, CKR_FUNCTION_NOT_SUPPORTED);
+		gkm_transaction_fail (transaction, CKR_FUNCTION_NOT_SUPPORTED);
 	}
 }
 
-static GObject* 
-gck_secret_module_constructor (GType type, guint n_props, GObjectConstructParam *props) 
+static GObject*
+gkm_secret_module_constructor (GType type, guint n_props, GObjectConstructParam *props)
 {
-	GckSecretModule *self = GCK_SECRET_MODULE (G_OBJECT_CLASS (gck_secret_module_parent_class)->constructor(type, n_props, props));
-	GckManager *manager;
-	GckObject *collection;
+	GkmSecretModule *self = GKM_SECRET_MODULE (G_OBJECT_CLASS (gkm_secret_module_parent_class)->constructor(type, n_props, props));
+	GkmManager *manager;
+	GkmObject *collection;
 	CK_RV rv;
 
 	g_return_val_if_fail (self, NULL);
@@ -397,14 +397,14 @@ gck_secret_module_constructor (GType type, guint n_props, GObjectConstructParam
 			g_warning ("unable to create keyring dir: %s", self->directory);
 	}
 
-	self->tracker = gck_file_tracker_new (self->directory, "*.keyring", NULL);
+	self->tracker = gkm_file_tracker_new (self->directory, "*.keyring", NULL);
 	g_signal_connect (self->tracker, "file-added", G_CALLBACK (on_file_load), self);
 	g_signal_connect (self->tracker, "file-changed", G_CALLBACK (on_file_load), self);
 	g_signal_connect (self->tracker, "file-removed", G_CALLBACK (on_file_remove), self);
 
-	manager = gck_module_get_manager (GCK_MODULE (self));
+	manager = gkm_module_get_manager (GKM_MODULE (self));
 
-	collection = g_object_new (GCK_TYPE_SECRET_COLLECTION,
+	collection = g_object_new (GKM_TYPE_SECRET_COLLECTION,
 	                           "module", self,
 	                           "identifier", "session",
 	                           "manager", manager,
@@ -412,15 +412,15 @@ gck_secret_module_constructor (GType type, guint n_props, GObjectConstructParam
 	                           NULL);
 
 	/* Create the 'session' keyring, which is not stored to disk */
-	g_return_val_if_fail (gck_object_is_transient (collection), NULL);
-	gck_module_add_token_object (GCK_MODULE (self), NULL, collection);
-	gck_object_expose (collection, TRUE);
+	g_return_val_if_fail (gkm_object_is_transient (collection), NULL);
+	gkm_module_add_token_object (GKM_MODULE (self), NULL, collection);
+	gkm_object_expose (collection, TRUE);
 
 	/* Unlock the 'session' keyring */
-	rv = gck_credential_create (GCK_MODULE (self), manager, GCK_OBJECT (collection),
+	rv = gkm_credential_create (GKM_MODULE (self), manager, GKM_OBJECT (collection),
 	                            NULL, 0, &self->session_credential);
 	if (rv == CKR_OK)
-		gck_object_expose (GCK_OBJECT (self->session_credential), TRUE);
+		gkm_object_expose (GKM_OBJECT (self->session_credential), TRUE);
 	else
 		g_warning ("couldn't unlock the 'session' keyring");
 
@@ -429,18 +429,18 @@ gck_secret_module_constructor (GType type, guint n_props, GObjectConstructParam
 }
 
 static void
-gck_secret_module_init (GckSecretModule *self)
+gkm_secret_module_init (GkmSecretModule *self)
 {
 	self->collections = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
-	gck_module_register_factory (GCK_MODULE (self), GCK_FACTORY_SECRET_SEARCH);
-	gck_module_register_factory (GCK_MODULE (self), GCK_FACTORY_SECRET_ITEM);
-	gck_module_register_factory (GCK_MODULE (self), GCK_FACTORY_SECRET_COLLECTION);
+	gkm_module_register_factory (GKM_MODULE (self), GKM_FACTORY_SECRET_SEARCH);
+	gkm_module_register_factory (GKM_MODULE (self), GKM_FACTORY_SECRET_ITEM);
+	gkm_module_register_factory (GKM_MODULE (self), GKM_FACTORY_SECRET_COLLECTION);
 }
 
 static void
-gck_secret_module_dispose (GObject *obj)
+gkm_secret_module_dispose (GObject *obj)
 {
-	GckSecretModule *self = GCK_SECRET_MODULE (obj);
+	GkmSecretModule *self = GKM_SECRET_MODULE (obj);
 
 	if (self->tracker)
 		g_object_unref (self->tracker);
@@ -452,14 +452,14 @@ gck_secret_module_dispose (GObject *obj)
 
 	g_hash_table_remove_all (self->collections);
 
-	G_OBJECT_CLASS (gck_secret_module_parent_class)->dispose (obj);
+	G_OBJECT_CLASS (gkm_secret_module_parent_class)->dispose (obj);
 }
 
 static void
-gck_secret_module_finalize (GObject *obj)
+gkm_secret_module_finalize (GObject *obj)
 {
-	GckSecretModule *self = GCK_SECRET_MODULE (obj);
-	
+	GkmSecretModule *self = GKM_SECRET_MODULE (obj);
+
 	g_assert (self->tracker == NULL);
 
 	g_hash_table_destroy (self->collections);
@@ -470,41 +470,41 @@ gck_secret_module_finalize (GObject *obj)
 
 	g_assert (!self->session_credential);
 
-	G_OBJECT_CLASS (gck_secret_module_parent_class)->finalize (obj);
+	G_OBJECT_CLASS (gkm_secret_module_parent_class)->finalize (obj);
 }
 
 static void
-gck_secret_module_class_init (GckSecretModuleClass *klass)
+gkm_secret_module_class_init (GkmSecretModuleClass *klass)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	GckModuleClass *module_class = GCK_MODULE_CLASS (klass);
-	
-	gobject_class->constructor = gck_secret_module_constructor;
-	gobject_class->dispose = gck_secret_module_dispose;
-	gobject_class->finalize = gck_secret_module_finalize;
-
-	module_class->get_slot_info = gck_secret_module_real_get_slot_info;
-	module_class->get_token_info = gck_secret_module_real_get_token_info;
-	module_class->parse_argument = gck_secret_module_real_parse_argument;
-	module_class->refresh_token = gck_secret_module_real_refresh_token;
-	module_class->add_token_object = gck_secret_module_real_add_object;
-	module_class->store_token_object = gck_secret_module_real_store_object;
-	module_class->remove_token_object = gck_secret_module_real_remove_object;
+	GkmModuleClass *module_class = GKM_MODULE_CLASS (klass);
+
+	gobject_class->constructor = gkm_secret_module_constructor;
+	gobject_class->dispose = gkm_secret_module_dispose;
+	gobject_class->finalize = gkm_secret_module_finalize;
+
+	module_class->get_slot_info = gkm_secret_module_real_get_slot_info;
+	module_class->get_token_info = gkm_secret_module_real_get_token_info;
+	module_class->parse_argument = gkm_secret_module_real_parse_argument;
+	module_class->refresh_token = gkm_secret_module_real_refresh_token;
+	module_class->add_token_object = gkm_secret_module_real_add_object;
+	module_class->store_token_object = gkm_secret_module_real_store_object;
+	module_class->remove_token_object = gkm_secret_module_real_remove_object;
 }
 
 /* ---------------------------------------------------------------------------------------
- * PUBLIC 
+ * PUBLIC
  */
 
 CK_FUNCTION_LIST_PTR
-gck_secret_store_get_functions (void)
+gkm_secret_store_get_functions (void)
 {
-	gck_crypto_initialize ();
-	return gck_secret_module_function_list;
+	gkm_crypto_initialize ();
+	return gkm_secret_module_function_list;
 }
 
-GckModule*
-_gck_secret_store_get_module_for_testing (void)
+GkmModule*
+_gkm_secret_store_get_module_for_testing (void)
 {
 	return pkcs11_module;
 }
diff --git a/pkcs11/secret-store/gkm-secret-module.h b/pkcs11/secret-store/gkm-secret-module.h
new file mode 100644
index 0000000..dffbbac
--- /dev/null
+++ b/pkcs11/secret-store/gkm-secret-module.h
@@ -0,0 +1,44 @@
+/*
+ * gnome-keyring
+ *
+ * Copyright (C) 2009 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 __GKM_SECRET_MODULE_H__
+#define __GKM_SECRET_MODULE_H__
+
+#include <glib-object.h>
+
+#include "gkm/gkm-module.h"
+
+#define GKM_TYPE_SECRET_MODULE               (gkm_secret_module_get_type ())
+#define GKM_SECRET_MODULE(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_SECRET_MODULE, GkmSecretModule))
+#define GKM_SECRET_MODULE_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_SECRET_MODULE, GkmSecretModuleClass))
+#define GKM_IS_SECRET_MODULE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_SECRET_MODULE))
+#define GKM_IS_SECRET_MODULE_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_SECRET_MODULE))
+#define GKM_SECRET_MODULE_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_SECRET_MODULE, GkmSecretModuleClass))
+
+typedef struct _GkmSecretModuleClass GkmSecretModuleClass;
+
+struct _GkmSecretModuleClass {
+	GkmModuleClass parent_class;
+};
+
+GType               gkm_secret_module_get_type               (void);
+
+#endif /* __GKM_SECRET_MODULE_H__ */
diff --git a/pkcs11/secret-store/gck-secret-object.c b/pkcs11/secret-store/gkm-secret-object.c
similarity index 52%
rename from pkcs11/secret-store/gck-secret-object.c
rename to pkcs11/secret-store/gkm-secret-object.c
index 39783e9..2c71719 100644
--- a/pkcs11/secret-store/gck-secret-object.c
+++ b/pkcs11/secret-store/gkm-secret-object.c
@@ -1,31 +1,31 @@
-/* 
+/*
  * gnome-keyring
- * 
+ *
  * Copyright (C) 2009 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"
 
-#include "gck-secret-object.h"
+#include "gkm-secret-object.h"
 
-#include "gck/gck-attributes.h"
-#include "gck/gck-session.h"
-#include "gck/gck-transaction.h"
+#include "gkm/gkm-attributes.h"
+#include "gkm/gkm-session.h"
+#include "gkm/gkm-transaction.h"
 
 #include "pkcs11/pkcs11i.h"
 
@@ -39,50 +39,50 @@ enum {
 	PROP_MODIFIED
 };
 
-struct _GckSecretObjectPrivate {
+struct _GkmSecretObjectPrivate {
 	gchar *identifier;
 	gchar *label;
 	glong created;
 	glong modified;
 };
 
-G_DEFINE_TYPE (GckSecretObject, gck_secret_object, GCK_TYPE_OBJECT);
+G_DEFINE_TYPE (GkmSecretObject, gkm_secret_object, GKM_TYPE_OBJECT);
 
 /* -----------------------------------------------------------------------------
- * INTERNAL 
+ * INTERNAL
  */
 
 static gboolean
-complete_set_label (GckTransaction *transaction, GObject *obj, gpointer user_data)
+complete_set_label (GkmTransaction *transaction, GObject *obj, gpointer user_data)
 {
-	GckSecretObject *self = GCK_SECRET_OBJECT (obj);
+	GkmSecretObject *self = GKM_SECRET_OBJECT (obj);
 	gchar *old_label = user_data;
-	
-	if (gck_transaction_get_failed (transaction)) {
+
+	if (gkm_transaction_get_failed (transaction)) {
 		g_free (self->pv->label);
 		self->pv->label = old_label;
 	} else {
-		gck_object_notify_attribute (GCK_OBJECT (obj), CKA_LABEL);
+		gkm_object_notify_attribute (GKM_OBJECT (obj), CKA_LABEL);
 		g_object_notify (G_OBJECT (obj), "label");
-		gck_secret_object_was_modified (self);
+		gkm_secret_object_was_modified (self);
 		g_free (old_label);
 	}
-	
+
 	return TRUE;
 }
 
 static void
-begin_set_label (GckSecretObject *self, GckTransaction *transaction, gchar *label)
+begin_set_label (GkmSecretObject *self, GkmTransaction *transaction, gchar *label)
 {
-	g_assert (GCK_IS_SECRET_OBJECT (self));
-	g_assert (!gck_transaction_get_failed (transaction));
-	
-	gck_transaction_add (transaction, self, complete_set_label, self->pv->label);
+	g_assert (GKM_IS_SECRET_OBJECT (self));
+	g_assert (!gkm_transaction_get_failed (transaction));
+
+	gkm_transaction_add (transaction, self, complete_set_label, self->pv->label);
 	self->pv->label = label;
 }
 
 static gchar*
-register_identifier (GckSecretObjectClass *klass, const gchar *identifier)
+register_identifier (GkmSecretObjectClass *klass, const gchar *identifier)
 {
 	gchar *result;
 	gint i;
@@ -110,7 +110,7 @@ register_identifier (GckSecretObjectClass *klass, const gchar *identifier)
 }
 
 static void
-unregister_identifier (GckSecretObjectClass *klass, gchar *identifier)
+unregister_identifier (GkmSecretObjectClass *klass, gchar *identifier)
 {
 	g_assert (klass);
 	g_assert (identifier);
@@ -121,80 +121,80 @@ unregister_identifier (GckSecretObjectClass *klass, gchar *identifier)
 }
 
 /* -----------------------------------------------------------------------------
- * OBJECT 
+ * OBJECT
  */
 
 static CK_RV
-gck_secret_object_get_attribute (GckObject *base, GckSession *session, CK_ATTRIBUTE_PTR attr)
+gkm_secret_object_get_attribute (GkmObject *base, GkmSession *session, CK_ATTRIBUTE_PTR attr)
 {
-	GckSecretObject *self = GCK_SECRET_OBJECT (base);
-	
+	GkmSecretObject *self = GKM_SECRET_OBJECT (base);
+
 	switch (attr->type) {
 	case CKA_MODIFIABLE:
-		return gck_attribute_set_bool (attr, TRUE);
+		return gkm_attribute_set_bool (attr, TRUE);
 
 	case CKA_ID:
-		return gck_attribute_set_string (attr, gck_secret_object_get_identifier (self));
-		
+		return gkm_attribute_set_string (attr, gkm_secret_object_get_identifier (self));
+
 	case CKA_LABEL:
-		return gck_attribute_set_string (attr, gck_secret_object_get_label (self));
-		
+		return gkm_attribute_set_string (attr, gkm_secret_object_get_label (self));
+
 	case CKA_G_LOCKED:
-		return gck_attribute_set_bool (attr, gck_secret_object_is_locked (self, session));
-		
+		return gkm_attribute_set_bool (attr, gkm_secret_object_is_locked (self, session));
+
 	case CKA_G_CREATED:
-		return gck_attribute_set_time (attr, gck_secret_object_get_created (self));
-		
+		return gkm_attribute_set_time (attr, gkm_secret_object_get_created (self));
+
 	case CKA_G_MODIFIED:
-		return gck_attribute_set_time (attr, gck_secret_object_get_modified (self));
+		return gkm_attribute_set_time (attr, gkm_secret_object_get_modified (self));
 	}
-	
-	return GCK_OBJECT_CLASS (gck_secret_object_parent_class)->get_attribute (base, session, attr);
+
+	return GKM_OBJECT_CLASS (gkm_secret_object_parent_class)->get_attribute (base, session, attr);
 }
 
 static void
-gck_secret_object_set_attribute (GckObject *base, GckSession *session, 
-                                 GckTransaction *transaction, CK_ATTRIBUTE_PTR attr)
+gkm_secret_object_set_attribute (GkmObject *base, GkmSession *session,
+                                 GkmTransaction *transaction, CK_ATTRIBUTE_PTR attr)
 {
-	GckSecretObject *self = GCK_SECRET_OBJECT (base);
+	GkmSecretObject *self = GKM_SECRET_OBJECT (base);
 	gchar *label;
 	CK_RV rv;
 
 	switch (attr->type) {
-	
+
 	case CKA_LABEL:
 		/* Check that the object is not locked */
-		if (gck_secret_object_is_locked (self, session))
+		if (gkm_secret_object_is_locked (self, session))
 			rv = CKR_USER_NOT_LOGGED_IN;
 		else
-			rv = gck_attribute_get_string (attr, &label);
+			rv = gkm_attribute_get_string (attr, &label);
 		if (rv != CKR_OK)
-			gck_transaction_fail (transaction, rv);
+			gkm_transaction_fail (transaction, rv);
 		else
 			begin_set_label (self, transaction, label);
 		return;
 	}
-	
-	GCK_OBJECT_CLASS (gck_secret_object_parent_class)->set_attribute (base, session, transaction, attr);
+
+	GKM_OBJECT_CLASS (gkm_secret_object_parent_class)->set_attribute (base, session, transaction, attr);
 }
 
 static gboolean
-gck_secret_object_real_is_locked (GckSecretObject *self, GckSession *session)
+gkm_secret_object_real_is_locked (GkmSecretObject *self, GkmSession *session)
 {
 	/* Derived classes override us */
 	return FALSE;
 }
 
 static void
-gck_secret_object_init (GckSecretObject *self)
+gkm_secret_object_init (GkmSecretObject *self)
 {
-	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GCK_TYPE_SECRET_OBJECT, GckSecretObjectPrivate);
+	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GKM_TYPE_SECRET_OBJECT, GkmSecretObjectPrivate);
 }
 
-static GObject* 
-gck_secret_object_constructor (GType type, guint n_props, GObjectConstructParam *props) 
+static GObject*
+gkm_secret_object_constructor (GType type, guint n_props, GObjectConstructParam *props)
 {
-	GckSecretObject *self = GCK_SECRET_OBJECT (G_OBJECT_CLASS (gck_secret_object_parent_class)->constructor(type, n_props, props));
+	GkmSecretObject *self = GKM_SECRET_OBJECT (G_OBJECT_CLASS (gkm_secret_object_parent_class)->constructor(type, n_props, props));
 	g_return_val_if_fail (self, NULL);
 
 	/* Must be created with an identifier */
@@ -204,16 +204,16 @@ gck_secret_object_constructor (GType type, guint n_props, GObjectConstructParam
 }
 
 static void
-gck_secret_object_set_property (GObject *obj, guint prop_id, const GValue *value, 
+gkm_secret_object_set_property (GObject *obj, guint prop_id, const GValue *value,
                                 GParamSpec *pspec)
 {
-	GckSecretObjectClass *klass = GCK_SECRET_OBJECT_GET_CLASS (obj);
-	GckSecretObject *self = GCK_SECRET_OBJECT (obj);
+	GkmSecretObjectClass *klass = GKM_SECRET_OBJECT_GET_CLASS (obj);
+	GkmSecretObject *self = GKM_SECRET_OBJECT (obj);
 	const gchar *identifier;
 
 	switch (prop_id) {
 	case PROP_LABEL:
-		gck_secret_object_set_label (self, g_value_get_string (value));
+		gkm_secret_object_set_label (self, g_value_get_string (value));
 		break;
 	case PROP_IDENTIFIER:
 		g_return_if_fail (!self->pv->identifier);
@@ -222,10 +222,10 @@ gck_secret_object_set_property (GObject *obj, guint prop_id, const GValue *value
 		self->pv->identifier = register_identifier (klass, identifier);
 		break;
 	case PROP_CREATED:
-		gck_secret_object_set_created (self, g_value_get_long (value));
+		gkm_secret_object_set_created (self, g_value_get_long (value));
 		break;
 	case PROP_MODIFIED:
-		gck_secret_object_set_modified (self, g_value_get_long (value));
+		gkm_secret_object_set_modified (self, g_value_get_long (value));
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -234,23 +234,23 @@ gck_secret_object_set_property (GObject *obj, guint prop_id, const GValue *value
 }
 
 static void
-gck_secret_object_get_property (GObject *obj, guint prop_id, GValue *value, 
+gkm_secret_object_get_property (GObject *obj, guint prop_id, GValue *value,
                                     GParamSpec *pspec)
 {
-	GckSecretObject *self = GCK_SECRET_OBJECT (obj);
-	
+	GkmSecretObject *self = GKM_SECRET_OBJECT (obj);
+
 	switch (prop_id) {
 	case PROP_LABEL:
-		g_value_set_string (value, gck_secret_object_get_label (self));
+		g_value_set_string (value, gkm_secret_object_get_label (self));
 		break;
 	case PROP_IDENTIFIER:
-		g_value_set_string (value, gck_secret_object_get_identifier (self));
+		g_value_set_string (value, gkm_secret_object_get_identifier (self));
 		break;
 	case PROP_CREATED:
-		g_value_set_long (value, gck_secret_object_get_created (self));
+		g_value_set_long (value, gkm_secret_object_get_created (self));
 		break;
 	case PROP_MODIFIED:
-		g_value_set_long (value, gck_secret_object_get_modified (self));
+		g_value_set_long (value, gkm_secret_object_get_modified (self));
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -259,89 +259,89 @@ gck_secret_object_get_property (GObject *obj, guint prop_id, GValue *value,
 }
 
 static void
-gck_secret_object_finalize (GObject *obj)
+gkm_secret_object_finalize (GObject *obj)
 {
-	GckSecretObjectClass *klass = GCK_SECRET_OBJECT_GET_CLASS (obj);
-	GckSecretObject *self = GCK_SECRET_OBJECT (obj);
+	GkmSecretObjectClass *klass = GKM_SECRET_OBJECT_GET_CLASS (obj);
+	GkmSecretObject *self = GKM_SECRET_OBJECT (obj);
 
 	if (self->pv->identifier)
 		unregister_identifier (klass, self->pv->identifier);
 	self->pv->identifier = NULL;
-	
+
 	g_free (self->pv->label);
 	self->pv->label = NULL;
-	
+
 	self->pv->created = 0;
 	self->pv->modified = 0;
 
-	G_OBJECT_CLASS (gck_secret_object_parent_class)->finalize (obj);
+	G_OBJECT_CLASS (gkm_secret_object_parent_class)->finalize (obj);
 }
 
 static void
-gck_secret_object_class_init (GckSecretObjectClass *klass)
+gkm_secret_object_class_init (GkmSecretObjectClass *klass)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	GckObjectClass *gck_class = GCK_OBJECT_CLASS (klass);
+	GkmObjectClass *gkm_class = GKM_OBJECT_CLASS (klass);
 
-	gck_secret_object_parent_class = g_type_class_peek_parent (klass);
-	g_type_class_add_private (klass, sizeof (GckSecretObjectPrivate));
+	gkm_secret_object_parent_class = g_type_class_peek_parent (klass);
+	g_type_class_add_private (klass, sizeof (GkmSecretObjectPrivate));
 
-	gobject_class->constructor = gck_secret_object_constructor;
-	gobject_class->finalize = gck_secret_object_finalize;
-	gobject_class->set_property = gck_secret_object_set_property;
-	gobject_class->get_property = gck_secret_object_get_property;
+	gobject_class->constructor = gkm_secret_object_constructor;
+	gobject_class->finalize = gkm_secret_object_finalize;
+	gobject_class->set_property = gkm_secret_object_set_property;
+	gobject_class->get_property = gkm_secret_object_get_property;
 
-	gck_class->get_attribute = gck_secret_object_get_attribute;
-	gck_class->set_attribute = gck_secret_object_set_attribute;
+	gkm_class->get_attribute = gkm_secret_object_get_attribute;
+	gkm_class->set_attribute = gkm_secret_object_set_attribute;
 
-	klass->is_locked = gck_secret_object_real_is_locked;
+	klass->is_locked = gkm_secret_object_real_is_locked;
 
 	g_object_class_install_property (gobject_class, PROP_IDENTIFIER,
-	           g_param_spec_string ("identifier", "Identifier", "Object Identifier", 
+	           g_param_spec_string ("identifier", "Identifier", "Object Identifier",
 	                                NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-	
+
 	g_object_class_install_property (gobject_class, PROP_LABEL,
-	           g_param_spec_string ("label", "Label", "Object Label", 
+	           g_param_spec_string ("label", "Label", "Object Label",
 	                                "", G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
-	
+
 	g_object_class_install_property (gobject_class, PROP_CREATED,
 	           g_param_spec_long ("created", "Created", "Object Create Time",
 	                              0, G_MAXLONG, 0, G_PARAM_READABLE));
-	
+
 	g_object_class_install_property (gobject_class, PROP_MODIFIED,
 	           g_param_spec_long ("modified", "Modified", "Object Modify Time",
 	                              0, G_MAXLONG, 0, G_PARAM_READABLE));
 }
 
 /* -----------------------------------------------------------------------------
- * PUBLIC 
+ * PUBLIC
  */
 
 void
-gck_secret_object_class_unique_identifiers (GckSecretObjectClass *klass)
+gkm_secret_object_class_unique_identifiers (GkmSecretObjectClass *klass)
 {
 	if (!klass->identifiers)
 		klass->identifiers = g_hash_table_new (g_str_hash, g_str_equal);
 }
 
 const gchar*
-gck_secret_object_get_identifier (GckSecretObject *self)
+gkm_secret_object_get_identifier (GkmSecretObject *self)
 {
-	g_return_val_if_fail (GCK_IS_SECRET_OBJECT (self), NULL);
+	g_return_val_if_fail (GKM_IS_SECRET_OBJECT (self), NULL);
 	return self->pv->identifier;
 }
 
 const gchar*
-gck_secret_object_get_label (GckSecretObject *self)
+gkm_secret_object_get_label (GkmSecretObject *self)
 {
-	g_return_val_if_fail (GCK_IS_SECRET_OBJECT (self), NULL);
-	return self->pv->label;	
+	g_return_val_if_fail (GKM_IS_SECRET_OBJECT (self), NULL);
+	return self->pv->label;
 }
 
 void
-gck_secret_object_set_label (GckSecretObject *self, const gchar *label)
+gkm_secret_object_set_label (GkmSecretObject *self, const gchar *label)
 {
-	g_return_if_fail (GCK_IS_SECRET_OBJECT (self));
+	g_return_if_fail (GKM_IS_SECRET_OBJECT (self));
 
 	if (self->pv->label == label)
 		return;
@@ -352,48 +352,48 @@ gck_secret_object_set_label (GckSecretObject *self, const gchar *label)
 }
 
 glong
-gck_secret_object_get_created (GckSecretObject *self)
+gkm_secret_object_get_created (GkmSecretObject *self)
 {
-	g_return_val_if_fail (GCK_IS_SECRET_OBJECT (self), 0);
+	g_return_val_if_fail (GKM_IS_SECRET_OBJECT (self), 0);
 	return self->pv->created;
 }
 
 void
-gck_secret_object_set_created (GckSecretObject *self, glong when)
+gkm_secret_object_set_created (GkmSecretObject *self, glong when)
 {
-	g_return_if_fail (GCK_IS_SECRET_OBJECT (self));
+	g_return_if_fail (GKM_IS_SECRET_OBJECT (self));
 	self->pv->created = when;
 	g_object_notify (G_OBJECT (self), "created");
 }
 
 glong
-gck_secret_object_get_modified (GckSecretObject *self)
+gkm_secret_object_get_modified (GkmSecretObject *self)
 {
-	g_return_val_if_fail (GCK_IS_SECRET_OBJECT (self), 0);
+	g_return_val_if_fail (GKM_IS_SECRET_OBJECT (self), 0);
 	return self->pv->modified;
 }
 
 void
-gck_secret_object_set_modified (GckSecretObject *self, glong when)
+gkm_secret_object_set_modified (GkmSecretObject *self, glong when)
 {
-	g_return_if_fail (GCK_IS_SECRET_OBJECT (self));
+	g_return_if_fail (GKM_IS_SECRET_OBJECT (self));
 	self->pv->modified = when;
 	g_object_notify (G_OBJECT (self), "modified");
 }
 
 void
-gck_secret_object_was_modified (GckSecretObject *self)
+gkm_secret_object_was_modified (GkmSecretObject *self)
 {
 	GTimeVal tv;
-	g_return_if_fail (GCK_IS_SECRET_OBJECT (self));
+	g_return_if_fail (GKM_IS_SECRET_OBJECT (self));
 	g_get_current_time (&tv);
-	gck_secret_object_set_modified (self, tv.tv_sec);
+	gkm_secret_object_set_modified (self, tv.tv_sec);
 }
 
 gboolean
-gck_secret_object_is_locked (GckSecretObject *self, GckSession *session)
+gkm_secret_object_is_locked (GkmSecretObject *self, GkmSession *session)
 {
-	g_return_val_if_fail (GCK_IS_SECRET_OBJECT (self), TRUE);
-	g_return_val_if_fail (GCK_SECRET_OBJECT_GET_CLASS (self)->is_locked, TRUE);
-	return GCK_SECRET_OBJECT_GET_CLASS (self)->is_locked (self, session);
+	g_return_val_if_fail (GKM_IS_SECRET_OBJECT (self), TRUE);
+	g_return_val_if_fail (GKM_SECRET_OBJECT_GET_CLASS (self)->is_locked, TRUE);
+	return GKM_SECRET_OBJECT_GET_CLASS (self)->is_locked (self, session);
 }
diff --git a/pkcs11/secret-store/gkm-secret-object.h b/pkcs11/secret-store/gkm-secret-object.h
new file mode 100644
index 0000000..9cd458a
--- /dev/null
+++ b/pkcs11/secret-store/gkm-secret-object.h
@@ -0,0 +1,81 @@
+/*
+ * gnome-keyring
+ *
+ * Copyright (C) 2009 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 __GKM_SECRET_OBJECT_H__
+#define __GKM_SECRET_OBJECT_H__
+
+#include "gkm-secret-types.h"
+
+#include "gkm/gkm-object.h"
+
+#include <glib-object.h>
+
+#define GKM_TYPE_SECRET_OBJECT               (gkm_secret_object_get_type ())
+#define GKM_SECRET_OBJECT(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_SECRET_OBJECT, GkmSecretObject))
+#define GKM_SECRET_OBJECT_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_SECRET_OBJECT, GkmSecretObjectClass))
+#define GKM_IS_SECRET_OBJECT(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_SECRET_OBJECT))
+#define GKM_IS_SECRET_OBJECT_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_SECRET_OBJECT))
+#define GKM_SECRET_OBJECT_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_SECRET_OBJECT, GkmSecretObjectClass))
+
+typedef struct _GkmSecretObjectClass GkmSecretObjectClass;
+typedef struct _GkmSecretObjectPrivate GkmSecretObjectPrivate;
+
+struct _GkmSecretObject {
+	GkmObject parent;
+	GkmSecretObjectPrivate *pv;
+};
+struct _GkmSecretObjectClass {
+	GkmObjectClass parent_class;
+	GHashTable *identifiers;
+
+	gboolean (*is_locked) (GkmSecretObject *self, GkmSession *session);
+
+};
+
+GType                gkm_secret_object_get_type        (void);
+
+const gchar*         gkm_secret_object_get_identifier  (GkmSecretObject *self);
+
+const gchar*         gkm_secret_object_get_label       (GkmSecretObject *self);
+
+void                 gkm_secret_object_set_label       (GkmSecretObject *self,
+                                                        const gchar *label);
+
+glong                gkm_secret_object_get_created     (GkmSecretObject *self);
+
+void                 gkm_secret_object_set_created     (GkmSecretObject *self,
+                                                        glong value);
+
+glong                gkm_secret_object_get_modified    (GkmSecretObject *self);
+
+void                 gkm_secret_object_set_modified    (GkmSecretObject *self,
+                                                        glong value);
+
+void                 gkm_secret_object_was_modified    (GkmSecretObject *self);
+
+gboolean             gkm_secret_object_is_locked       (GkmSecretObject *self,
+                                                        GkmSession *session);
+
+void       gkm_secret_object_class_unique_identifiers  (GkmSecretObjectClass *klass);
+
+gchar*     gkm_secret_object_anonymous_identifier      (void);
+
+#endif /* __GKM_SECRET_OBJECT_H__ */
diff --git a/pkcs11/secret-store/gck-secret-search.c b/pkcs11/secret-store/gkm-secret-search.c
similarity index 61%
rename from pkcs11/secret-store/gck-secret-search.c
rename to pkcs11/secret-store/gkm-secret-search.c
index 707366d..00754cb 100644
--- a/pkcs11/secret-store/gck-secret-search.c
+++ b/pkcs11/secret-store/gkm-secret-search.c
@@ -21,17 +21,17 @@
 
 #include "config.h"
 
-#include "gck-secret-collection.h"
-#include "gck-secret-fields.h"
-#include "gck-secret-item.h"
-#include "gck-secret-search.h"
-
-#include "gck/gck-attributes.h"
-#include "gck/gck-manager.h"
-#include "gck/gck-module.h"
-#include "gck/gck-session.h"
-#include "gck/gck-transaction.h"
-#include "gck/gck-util.h"
+#include "gkm-secret-collection.h"
+#include "gkm-secret-fields.h"
+#include "gkm-secret-item.h"
+#include "gkm-secret-search.h"
+
+#include "gkm/gkm-attributes.h"
+#include "gkm/gkm-manager.h"
+#include "gkm/gkm-module.h"
+#include "gkm/gkm-session.h"
+#include "gkm/gkm-transaction.h"
+#include "gkm/gkm-util.h"
 
 #include "pkcs11i.h"
 
@@ -43,111 +43,111 @@ enum {
 	PROP_FIELDS
 };
 
-struct _GckSecretSearch {
-	GckObject parent;
+struct _GkmSecretSearch {
+	GkmObject parent;
 	gchar *collection_id;
 	GHashTable *fields;
 	GList *managers;
 	GHashTable *handles;
 };
 
-G_DEFINE_TYPE (GckSecretSearch, gck_secret_search, GCK_TYPE_OBJECT);
+G_DEFINE_TYPE (GkmSecretSearch, gkm_secret_search, GKM_TYPE_OBJECT);
 
 /* -----------------------------------------------------------------------------
  * INTERNAL
  */
 
 static gboolean
-match_object_against_criteria (GckSecretSearch *self, GckObject *object)
+match_object_against_criteria (GkmSecretSearch *self, GkmObject *object)
 {
-	GckSecretCollection *collection;
-	GckSecretItem *item;
+	GkmSecretCollection *collection;
+	GkmSecretItem *item;
 	GHashTable *fields;
 	const gchar *identifier;
 
-	if (!GCK_IS_SECRET_ITEM (object))
+	if (!GKM_IS_SECRET_ITEM (object))
 		return FALSE;
 
-	item = GCK_SECRET_ITEM (object);
+	item = GKM_SECRET_ITEM (object);
 
 	/* Collection should match unless any collection allowed */
 	if (self->collection_id) {
-		collection = gck_secret_item_get_collection (item);
+		collection = gkm_secret_item_get_collection (item);
 		g_return_val_if_fail (collection, FALSE);
-		identifier = gck_secret_object_get_identifier (GCK_SECRET_OBJECT (collection));
+		identifier = gkm_secret_object_get_identifier (GKM_SECRET_OBJECT (collection));
 		g_return_val_if_fail (identifier, FALSE);
 		if (!g_str_equal (identifier, self->collection_id))
 			return FALSE;
 	}
 
 	/* Fields should match using our special algorithm */
-	fields = gck_secret_item_get_fields (item);
-	return gck_secret_fields_match (fields, self->fields);
+	fields = gkm_secret_item_get_fields (item);
+	return gkm_secret_fields_match (fields, self->fields);
 }
 
 static void
-on_manager_added_object (GckManager *manager, GckObject *object, gpointer user_data)
+on_manager_added_object (GkmManager *manager, GkmObject *object, gpointer user_data)
 {
-	GckSecretSearch *self = user_data;
+	GkmSecretSearch *self = user_data;
 	CK_OBJECT_HANDLE handle;
 
-	g_return_if_fail (GCK_IS_SECRET_SEARCH (self));
+	g_return_if_fail (GKM_IS_SECRET_SEARCH (self));
 
-	handle = gck_object_get_handle (object);
+	handle = gkm_object_get_handle (object);
 	g_return_if_fail (handle);
 
 	g_return_if_fail (g_hash_table_lookup (self->handles, &handle) == NULL);
 
 	if (match_object_against_criteria (self, object)) {
-		g_hash_table_replace (self->handles, gck_util_ulong_alloc (handle), "unused");
-		gck_object_notify_attribute (GCK_OBJECT (self), CKA_G_MATCHED);
+		g_hash_table_replace (self->handles, gkm_util_ulong_alloc (handle), "unused");
+		gkm_object_notify_attribute (GKM_OBJECT (self), CKA_G_MATCHED);
 	}
 }
 
 static void
-on_manager_removed_object (GckManager *manager, GckObject *object, gpointer user_data)
+on_manager_removed_object (GkmManager *manager, GkmObject *object, gpointer user_data)
 {
-	GckSecretSearch *self = user_data;
+	GkmSecretSearch *self = user_data;
 	CK_OBJECT_HANDLE handle;
 
-	g_return_if_fail (GCK_IS_SECRET_SEARCH (self));
+	g_return_if_fail (GKM_IS_SECRET_SEARCH (self));
 
-	handle = gck_object_get_handle (object);
+	handle = gkm_object_get_handle (object);
 	g_return_if_fail (handle);
 
 	if (g_hash_table_lookup (self->handles, &handle) != NULL) {
 		g_hash_table_remove (self->handles, &handle);
-		gck_object_notify_attribute (GCK_OBJECT (self), CKA_G_MATCHED);
+		gkm_object_notify_attribute (GKM_OBJECT (self), CKA_G_MATCHED);
 	}
 }
 
 static void
-on_manager_changed_object (GckManager *manager, GckObject *object,
+on_manager_changed_object (GkmManager *manager, GkmObject *object,
                            CK_ATTRIBUTE_TYPE type, gpointer user_data)
 {
-	GckSecretSearch *self = user_data;
+	GkmSecretSearch *self = user_data;
 	CK_OBJECT_HANDLE handle;
 
 	if (type != CKA_G_FIELDS)
 		return;
 
-	g_return_if_fail (GCK_IS_SECRET_SEARCH (self));
+	g_return_if_fail (GKM_IS_SECRET_SEARCH (self));
 
-	handle = gck_object_get_handle (object);
+	handle = gkm_object_get_handle (object);
 	g_return_if_fail (handle);
 
 	/* Should we have this object? */
 	if (match_object_against_criteria (self, object)) {
 		if (g_hash_table_lookup (self->handles, &handle) == NULL) {
-			g_hash_table_replace (self->handles, gck_util_ulong_alloc (handle), "unused");
-			gck_object_notify_attribute (GCK_OBJECT (self), CKA_G_MATCHED);
+			g_hash_table_replace (self->handles, gkm_util_ulong_alloc (handle), "unused");
+			gkm_object_notify_attribute (GKM_OBJECT (self), CKA_G_MATCHED);
 		}
 
 	/* Should we not have this object? */
 	} else {
 		if (g_hash_table_lookup (self->handles, &handle) != NULL) {
 			g_hash_table_remove (self->handles, &handle);
-			gck_object_notify_attribute (GCK_OBJECT (self), CKA_G_MATCHED);
+			gkm_object_notify_attribute (GKM_OBJECT (self), CKA_G_MATCHED);
 		}
 	}
 }
@@ -155,7 +155,7 @@ on_manager_changed_object (GckManager *manager, GckObject *object,
 static void
 on_manager_gone_away (gpointer user_data, GObject *where_the_object_was)
 {
-	GckSecretSearch *self = GCK_SECRET_SEARCH (user_data);
+	GkmSecretSearch *self = GKM_SECRET_SEARCH (user_data);
 	GList *l;
 
 	g_return_if_fail (self);
@@ -166,14 +166,14 @@ on_manager_gone_away (gpointer user_data, GObject *where_the_object_was)
 }
 
 static void
-populate_search_from_manager (GckSecretSearch *self, GckManager *manager)
+populate_search_from_manager (GkmSecretSearch *self, GkmManager *manager)
 {
 	GList *objects, *o;
 
 	self->managers = g_list_append (self->managers, manager);
 
 	/* Add in all the objects */
-	objects = gck_manager_find_by_class (manager, CKO_SECRET_KEY);
+	objects = gkm_manager_find_by_class (manager, CKO_SECRET_KEY);
 	for (o = objects; o; o = g_list_next (o))
 		on_manager_added_object (manager, o->data, self);
 	g_list_free (objects);
@@ -187,52 +187,52 @@ populate_search_from_manager (GckSecretSearch *self, GckManager *manager)
 	g_signal_connect (manager, "attribute-changed", G_CALLBACK (on_manager_changed_object), self);
 }
 
-static GckObject*
-factory_create_search (GckSession *session, GckTransaction *transaction,
+static GkmObject*
+factory_create_search (GkmSession *session, GkmTransaction *transaction,
                        CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
 {
-	GckManager *s_manager, *m_manager;
-	GckSecretSearch *search;
+	GkmManager *s_manager, *m_manager;
+	GkmSecretSearch *search;
 	gchar *identifier = NULL;
 	CK_ATTRIBUTE *attr;
 	GHashTable *fields;
-	GckModule *module;
+	GkmModule *module;
 	CK_RV rv;
 
-	g_return_val_if_fail (GCK_IS_TRANSACTION (transaction), NULL);
+	g_return_val_if_fail (GKM_IS_TRANSACTION (transaction), NULL);
 	g_return_val_if_fail (attrs || !n_attrs, NULL);
 
 	/* Find the fields being requested */
-	attr = gck_attributes_find (attrs, n_attrs, CKA_G_FIELDS);
+	attr = gkm_attributes_find (attrs, n_attrs, CKA_G_FIELDS);
 	if (attr == NULL) {
-		gck_transaction_fail (transaction, CKR_TEMPLATE_INCOMPLETE);
+		gkm_transaction_fail (transaction, CKR_TEMPLATE_INCOMPLETE);
 		return NULL;
 	}
 
 	/* Parse the fields, into our internal representation */
-	rv = gck_secret_fields_parse (attr, &fields);
-	gck_attribute_consume (attr);
+	rv = gkm_secret_fields_parse (attr, &fields);
+	gkm_attribute_consume (attr);
 	if (rv != CKR_OK) {
-		gck_transaction_fail (transaction, rv);
+		gkm_transaction_fail (transaction, rv);
 		return NULL;
 	}
 
-	s_manager = gck_session_get_manager (session);
-	module = gck_session_get_module (session);
-	m_manager = gck_module_get_manager (module);
+	s_manager = gkm_session_get_manager (session);
+	module = gkm_session_get_module (session);
+	m_manager = gkm_module_get_manager (module);
 
 	/* See if a collection attribute was specified, not present means all collections */
-	attr = gck_attributes_find (attrs, n_attrs, CKA_G_COLLECTION);
+	attr = gkm_attributes_find (attrs, n_attrs, CKA_G_COLLECTION);
 	if (attr) {
-		rv = gck_attribute_get_string (attr, &identifier);
+		rv = gkm_attribute_get_string (attr, &identifier);
 		if (rv != CKR_OK) {
 			g_hash_table_unref (fields);
-			gck_transaction_fail (transaction, rv);
+			gkm_transaction_fail (transaction, rv);
 			return NULL;
 		}
 	}
 
-	search = g_object_new (GCK_TYPE_SECRET_SEARCH,
+	search = g_object_new (GKM_TYPE_SECRET_SEARCH,
 	                       "module", module,
 	                       "manager", s_manager,
 	                       "fields", fields,
@@ -240,14 +240,14 @@ factory_create_search (GckSession *session, GckTransaction *transaction,
 	                       NULL);
 
 	/* Load any new items or collections */
-	gck_module_refresh_token (module);
+	gkm_module_refresh_token (module);
 
 	populate_search_from_manager (search, s_manager);
 	populate_search_from_manager (search, m_manager);
 
-	gck_session_complete_object_creation (session, transaction, GCK_OBJECT (search),
+	gkm_session_complete_object_creation (session, transaction, GKM_OBJECT (search),
 	                                      TRUE, attrs, n_attrs);
-	return GCK_OBJECT (search);
+	return GKM_OBJECT (search);
 }
 
 static void
@@ -276,7 +276,7 @@ attribute_set_handles (GHashTable *handles, CK_ATTRIBUTE_PTR attr)
 	/* Get the actual values */
 	array = g_array_new (FALSE, TRUE, sizeof (CK_OBJECT_HANDLE));
 	g_hash_table_foreach (handles, add_each_handle_to_array, array);
-	rv = gck_attribute_set_data (attr, array->data, array->len * sizeof (CK_OBJECT_HANDLE));
+	rv = gkm_attribute_set_data (attr, array->data, array->len * sizeof (CK_OBJECT_HANDLE));
 	g_array_free (array, TRUE);
 	return rv;
 }
@@ -286,39 +286,39 @@ attribute_set_handles (GHashTable *handles, CK_ATTRIBUTE_PTR attr)
  */
 
 static CK_RV
-gck_secret_search_get_attribute (GckObject *base, GckSession *session, CK_ATTRIBUTE_PTR attr)
+gkm_secret_search_get_attribute (GkmObject *base, GkmSession *session, CK_ATTRIBUTE_PTR attr)
 {
-	GckSecretSearch *self = GCK_SECRET_SEARCH (base);
+	GkmSecretSearch *self = GKM_SECRET_SEARCH (base);
 
 	switch (attr->type) {
 	case CKA_CLASS:
-		return gck_attribute_set_ulong (attr, CKO_G_SEARCH);
+		return gkm_attribute_set_ulong (attr, CKO_G_SEARCH);
 	case CKA_MODIFIABLE:
-		return gck_attribute_set_bool (attr, CK_TRUE); /* TODO: This is needed for deleting? */
+		return gkm_attribute_set_bool (attr, CK_TRUE); /* TODO: This is needed for deleting? */
 	case CKA_G_COLLECTION:
 		if (!self->collection_id)
-			return gck_attribute_set_empty (attr);
-		return gck_attribute_set_string (attr, self->collection_id);
+			return gkm_attribute_set_empty (attr);
+		return gkm_attribute_set_string (attr, self->collection_id);
 	case CKA_G_FIELDS:
-		return gck_secret_fields_serialize (attr, self->fields);
+		return gkm_secret_fields_serialize (attr, self->fields);
 	case CKA_G_MATCHED:
 		return attribute_set_handles (self->handles, attr);
 	}
 
-	return GCK_OBJECT_CLASS (gck_secret_search_parent_class)->get_attribute (base, session, attr);
+	return GKM_OBJECT_CLASS (gkm_secret_search_parent_class)->get_attribute (base, session, attr);
 }
 
 
 static void
-gck_secret_search_init (GckSecretSearch *self)
+gkm_secret_search_init (GkmSecretSearch *self)
 {
-	self->handles = g_hash_table_new_full (gck_util_ulong_hash, gck_util_ulong_equal, gck_util_ulong_free, NULL);
+	self->handles = g_hash_table_new_full (gkm_util_ulong_hash, gkm_util_ulong_equal, gkm_util_ulong_free, NULL);
 }
 
 static GObject*
-gck_secret_search_constructor (GType type, guint n_props, GObjectConstructParam *props)
+gkm_secret_search_constructor (GType type, guint n_props, GObjectConstructParam *props)
 {
-	GckSecretSearch *self = GCK_SECRET_SEARCH (G_OBJECT_CLASS (gck_secret_search_parent_class)->constructor(type, n_props, props));
+	GkmSecretSearch *self = GKM_SECRET_SEARCH (G_OBJECT_CLASS (gkm_secret_search_parent_class)->constructor(type, n_props, props));
 	g_return_val_if_fail (self, NULL);
 
 	g_return_val_if_fail (self->fields, NULL);
@@ -327,10 +327,10 @@ gck_secret_search_constructor (GType type, guint n_props, GObjectConstructParam
 }
 
 static void
-gck_secret_search_set_property (GObject *obj, guint prop_id, const GValue *value,
+gkm_secret_search_set_property (GObject *obj, guint prop_id, const GValue *value,
                                     GParamSpec *pspec)
 {
-	GckSecretSearch *self = GCK_SECRET_SEARCH (obj);
+	GkmSecretSearch *self = GKM_SECRET_SEARCH (obj);
 	switch (prop_id) {
 	case PROP_COLLECTION_ID:
 		g_return_if_fail (!self->collection_id);
@@ -348,17 +348,17 @@ gck_secret_search_set_property (GObject *obj, guint prop_id, const GValue *value
 }
 
 static void
-gck_secret_search_get_property (GObject *obj, guint prop_id, GValue *value,
+gkm_secret_search_get_property (GObject *obj, guint prop_id, GValue *value,
                                     GParamSpec *pspec)
 {
-	GckSecretSearch *self = GCK_SECRET_SEARCH (obj);
+	GkmSecretSearch *self = GKM_SECRET_SEARCH (obj);
 	switch (prop_id) {
 	case PROP_COLLECTION_ID:
 		g_value_set_string (value, self->collection_id);
 		break;
 	case PROP_FIELDS:
 		g_return_if_fail (self->fields);
-		g_value_set_boxed (value, gck_secret_search_get_fields (self));
+		g_value_set_boxed (value, gkm_secret_search_get_fields (self));
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -367,9 +367,9 @@ gck_secret_search_get_property (GObject *obj, guint prop_id, GValue *value,
 }
 
 static void
-gck_secret_search_dispose (GObject *obj)
+gkm_secret_search_dispose (GObject *obj)
 {
-	GckSecretSearch *self = GCK_SECRET_SEARCH (obj);
+	GkmSecretSearch *self = GKM_SECRET_SEARCH (obj);
 	GList *l;
 
 	for (l = self->managers; l; l = g_list_next (l)) {
@@ -384,13 +384,13 @@ gck_secret_search_dispose (GObject *obj)
 	g_free (self->collection_id);
 	self->collection_id = NULL;
 
-	G_OBJECT_CLASS (gck_secret_search_parent_class)->dispose (obj);
+	G_OBJECT_CLASS (gkm_secret_search_parent_class)->dispose (obj);
 }
 
 static void
-gck_secret_search_finalize (GObject *obj)
+gkm_secret_search_finalize (GObject *obj)
 {
-	GckSecretSearch *self = GCK_SECRET_SEARCH (obj);
+	GkmSecretSearch *self = GKM_SECRET_SEARCH (obj);
 
 	g_assert (!self->managers);
 
@@ -398,24 +398,24 @@ gck_secret_search_finalize (GObject *obj)
 		g_hash_table_destroy (self->fields);
 	self->fields = NULL;
 
-	G_OBJECT_CLASS (gck_secret_search_parent_class)->finalize (obj);
+	G_OBJECT_CLASS (gkm_secret_search_parent_class)->finalize (obj);
 }
 
 static void
-gck_secret_search_class_init (GckSecretSearchClass *klass)
+gkm_secret_search_class_init (GkmSecretSearchClass *klass)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	GckObjectClass *gck_class = GCK_OBJECT_CLASS (klass);
+	GkmObjectClass *gkm_class = GKM_OBJECT_CLASS (klass);
 
-	gck_secret_search_parent_class = g_type_class_peek_parent (klass);
+	gkm_secret_search_parent_class = g_type_class_peek_parent (klass);
 
-	gobject_class->constructor = gck_secret_search_constructor;
-	gobject_class->dispose = gck_secret_search_dispose;
-	gobject_class->finalize = gck_secret_search_finalize;
-	gobject_class->set_property = gck_secret_search_set_property;
-	gobject_class->get_property = gck_secret_search_get_property;
+	gobject_class->constructor = gkm_secret_search_constructor;
+	gobject_class->dispose = gkm_secret_search_dispose;
+	gobject_class->finalize = gkm_secret_search_finalize;
+	gobject_class->set_property = gkm_secret_search_set_property;
+	gobject_class->get_property = gkm_secret_search_get_property;
 
-	gck_class->get_attribute = gck_secret_search_get_attribute;
+	gkm_class->get_attribute = gkm_secret_search_get_attribute;
 
 	g_object_class_install_property (gobject_class, PROP_COLLECTION_ID,
 	           g_param_spec_string ("collection-id", "Collection ID", "Item's Collection's Identifier",
@@ -423,15 +423,15 @@ gck_secret_search_class_init (GckSecretSearchClass *klass)
 
 	g_object_class_install_property (gobject_class, PROP_FIELDS,
 	           g_param_spec_boxed ("fields", "Fields", "Item's fields",
-	                               GCK_BOXED_SECRET_FIELDS, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+	                               GKM_BOXED_SECRET_FIELDS, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
 }
 
 /* -----------------------------------------------------------------------------
  * PUBLIC
  */
 
-GckFactory*
-gck_secret_search_get_factory (void)
+GkmFactory*
+gkm_secret_search_get_factory (void)
 {
 	static CK_OBJECT_CLASS klass = CKO_G_SEARCH;
 	static CK_BBOOL token = CK_FALSE;
@@ -441,7 +441,7 @@ gck_secret_search_get_factory (void)
 		{ CKA_TOKEN, &token, sizeof (token) },
 	};
 
-	static GckFactory factory = {
+	static GkmFactory factory = {
 		attributes,
 		G_N_ELEMENTS (attributes),
 		factory_create_search
@@ -451,15 +451,15 @@ gck_secret_search_get_factory (void)
 }
 
 GHashTable*
-gck_secret_search_get_fields (GckSecretSearch *self)
+gkm_secret_search_get_fields (GkmSecretSearch *self)
 {
-	g_return_val_if_fail (GCK_IS_SECRET_SEARCH (self), NULL);
+	g_return_val_if_fail (GKM_IS_SECRET_SEARCH (self), NULL);
 	return self->fields;
 }
 
 const gchar*
-gck_secret_search_get_collection_id (GckSecretSearch *self)
+gkm_secret_search_get_collection_id (GkmSecretSearch *self)
 {
-	g_return_val_if_fail (GCK_IS_SECRET_SEARCH (self), NULL);
+	g_return_val_if_fail (GKM_IS_SECRET_SEARCH (self), NULL);
 	return self->collection_id;
 }
diff --git a/pkcs11/secret-store/gkm-secret-search.h b/pkcs11/secret-store/gkm-secret-search.h
new file mode 100644
index 0000000..b82c969
--- /dev/null
+++ b/pkcs11/secret-store/gkm-secret-search.h
@@ -0,0 +1,54 @@
+/*
+ * gnome-keyring
+ *
+ * Copyright (C) 2009 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 __GKM_SECRET_SEARCH_H__
+#define __GKM_SECRET_SEARCH_H__
+
+#include "gkm-secret-types.h"
+
+#include "gkm/gkm-object.h"
+
+#include <glib-object.h>
+
+#define GKM_FACTORY_SECRET_SEARCH            (gkm_secret_search_get_factory ())
+
+#define GKM_TYPE_SECRET_SEARCH               (gkm_secret_search_get_type ())
+#define GKM_SECRET_SEARCH(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_SECRET_SEARCH, GkmSecretSearch))
+#define GKM_SECRET_SEARCH_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_SECRET_SEARCH, GkmSecretSearchClass))
+#define GKM_IS_SECRET_SEARCH(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_SECRET_SEARCH))
+#define GKM_IS_SECRET_SEARCH_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_SECRET_SEARCH))
+#define GKM_SECRET_SEARCH_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_SECRET_SEARCH, GkmSecretSearchClass))
+
+typedef struct _GkmSecretSearchClass GkmSecretSearchClass;
+
+struct _GkmSecretSearchClass {
+	GkmObjectClass parent_class;
+};
+
+GType                gkm_secret_search_get_type        (void) G_GNUC_CONST;
+
+GkmFactory*          gkm_secret_search_get_factory     (void) G_GNUC_CONST;
+
+GHashTable*          gkm_secret_search_get_fields      (GkmSecretSearch *self);
+
+const gchar*      gkm_secret_search_get_collection_id  (GkmSecretSearch *self);
+
+#endif /* __GKM_SECRET_SEARCH_H__ */
diff --git a/pkcs11/secret-store/gck-secret-standalone.c b/pkcs11/secret-store/gkm-secret-standalone.c
similarity index 82%
rename from pkcs11/secret-store/gck-secret-standalone.c
rename to pkcs11/secret-store/gkm-secret-standalone.c
index 3e7ee2e..0baacbd 100644
--- a/pkcs11/secret-store/gck-secret-standalone.c
+++ b/pkcs11/secret-store/gkm-secret-standalone.c
@@ -1,5 +1,5 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* gck-secret-standalone.h - The Secret PKCS#11 code as a standalone module
+/* gkm-secret-standalone.h - The Secret PKCS#11 code as a standalone module
 
    Copyright (C) 2009, Stef Walter
 
@@ -23,9 +23,9 @@
 
 #include "config.h"
 
-#include "gck-secret-store.h"
+#include "gkm-secret-store.h"
 
-#include "gck/gck-crypto.h"
+#include "gkm/gkm-crypto.h"
 
 #include "egg/egg-secure-memory.h"
 
@@ -35,11 +35,11 @@
 
 /* Module callbacks for secure memory */
 static GStaticMutex memory_mutex = G_STATIC_MUTEX_INIT;
-void egg_memory_lock (void) 
+void egg_memory_lock (void)
 	{ g_static_mutex_lock (&memory_mutex); }
-void egg_memory_unlock (void) 
+void egg_memory_unlock (void)
 	{ g_static_mutex_unlock (&memory_mutex); }
-void* egg_memory_fallback (void *p, size_t sz) 
+void* egg_memory_fallback (void *p, size_t sz)
 	{ return g_realloc (p, sz); }
 
 CK_RV
@@ -47,14 +47,14 @@ C_GetFunctionList (CK_FUNCTION_LIST_PTR_PTR list)
 {
 	if (!list)
 		return CKR_ARGUMENTS_BAD;
-	
+
 	g_type_init ();
-	
+
 	if (!g_thread_supported ())
 		g_thread_init (NULL);
-	
-	gck_crypto_initialize ();
-	
-	*list = gck_secret_store_get_functions ();
+
+	gkm_crypto_initialize ();
+
+	*list = gkm_secret_store_get_functions ();
 	return CKR_OK;
 }
diff --git a/pkcs11/secret-store/gck-secret-store.h b/pkcs11/secret-store/gkm-secret-store.h
similarity index 78%
rename from pkcs11/secret-store/gck-secret-store.h
rename to pkcs11/secret-store/gkm-secret-store.h
index 461528c..0bfdb64 100644
--- a/pkcs11/secret-store/gck-secret-store.h
+++ b/pkcs11/secret-store/gkm-secret-store.h
@@ -1,29 +1,29 @@
-/* 
+/*
  * gnome-keyring
- * 
+ *
  * Copyright (C) 2009 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.
  */
 
-#ifndef __GCK_SECRET_STORE_H__
-#define __GCK_SECRET_STORE_H__
+#ifndef __GKM_SECRET_STORE_H__
+#define __GKM_SECRET_STORE_H__
 
 #include "pkcs11/pkcs11.h"
 
-CK_FUNCTION_LIST_PTR  gck_secret_store_get_functions  (void);
+CK_FUNCTION_LIST_PTR  gkm_secret_store_get_functions  (void);
 
-#endif /* __GCK_SECRET_STORE_H__ */
+#endif /* __GKM_SECRET_STORE_H__ */
diff --git a/pkcs11/secret-store/gck-secret-textual.c b/pkcs11/secret-store/gkm-secret-textual.c
similarity index 65%
rename from pkcs11/secret-store/gck-secret-textual.c
rename to pkcs11/secret-store/gkm-secret-textual.c
index 1627ac9..c0168f4 100644
--- a/pkcs11/secret-store/gck-secret-textual.c
+++ b/pkcs11/secret-store/gkm-secret-textual.c
@@ -1,5 +1,5 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* gck-secret-textual.c - Textual non-encrypted format for the keyring
+/* gkm-secret-textual.c - Textual non-encrypted format for the keyring
 
    Copyright (C) 2007, 2009 Stefan Walter
 
@@ -23,18 +23,18 @@
 
 #include "config.h"
 
-#include "gck-secret-collection.h"
-#include "gck-secret-compat.h"
-#include "gck-secret-data.h"
-#include "gck-secret-fields.h"
-#include "gck-secret-item.h"
-#include "gck-secret-textual.h"
+#include "gkm-secret-collection.h"
+#include "gkm-secret-compat.h"
+#include "gkm-secret-data.h"
+#include "gkm-secret-fields.h"
+#include "gkm-secret-item.h"
+#include "gkm-secret-textual.h"
 
 #include "egg/egg-error.h"
 #include "egg/egg-hex.h"
 #include "egg/egg-secure-memory.h"
 
-#include "gck/gck-secret.h"
+#include "gkm/gkm-secret.h"
 
 #include <glib.h>
 
@@ -45,11 +45,11 @@
 #include <string.h>
 
 static void
-key_file_set_uint64 (GKeyFile *file, const gchar *group, 
+key_file_set_uint64 (GKeyFile *file, const gchar *group,
                      const gchar *key, guint64 value)
 {
 	gchar buffer[64];
-	g_snprintf (buffer, sizeof (buffer), "%llu", 
+	g_snprintf (buffer, sizeof (buffer), "%llu",
 	            (long long unsigned int)value);
 	g_key_file_set_value (file, group, key, buffer);
 }
@@ -59,23 +59,23 @@ key_file_get_uint64 (GKeyFile *file, const gchar *group,
                      const gchar *key, guint64 *value)
 {
 	gchar *str, *end;
-	
+
 	str = g_key_file_get_value (file, group, key, NULL);
 	if (!str)
 		return FALSE;
-		
+
 	*value = g_ascii_strtoull (str, &end, 10);
 	if (end[0]) {
 		g_free (str);
 		return FALSE;
 	}
-	
+
 	g_free (str);
 	return TRUE;
 }
 
 static void
-generate_attributes (GKeyFile *file, GckSecretItem *item)
+generate_attributes (GKeyFile *file, GkmSecretItem *item)
 {
 	GHashTable *attributes;
 	gchar *groupname;
@@ -83,13 +83,13 @@ generate_attributes (GKeyFile *file, GckSecretItem *item)
 	guint32 number;
 	gint index = 0;
 
-	attributes = gck_secret_item_get_fields (item);
+	attributes = gkm_secret_item_get_fields (item);
 	g_return_if_fail (attributes);
 
-	names = gck_secret_fields_get_names (attributes);
+	names = gkm_secret_fields_get_names (attributes);
 	for (l = names; l; l = g_list_next (l)) {
 		groupname = g_strdup_printf ("%s:attribute%d",
-		                             gck_secret_object_get_identifier (GCK_SECRET_OBJECT (item)),
+		                             gkm_secret_object_get_identifier (GKM_SECRET_OBJECT (item)),
 		                             index);
 
 		g_key_file_set_string (file, groupname, "name", l->data);
@@ -106,14 +106,14 @@ generate_attributes (GKeyFile *file, GckSecretItem *item)
 		 */
 
 		/* Determine if it's a uint32 compatible value, and store as such if it is */
-		if (gck_secret_fields_get_compat_uint32 (attributes, l->data, &number)) {
+		if (gkm_secret_fields_get_compat_uint32 (attributes, l->data, &number)) {
 			g_key_file_set_string (file, groupname, "type", "uint32");
 			key_file_set_uint64 (file, groupname, "value", number);
 
 		/* A normal string attribute */
 		} else {
 			g_key_file_set_string (file, groupname, "type", "string");
-			g_key_file_set_string (file, groupname, "value", gck_secret_fields_get (attributes, l->data));
+			g_key_file_set_string (file, groupname, "value", gkm_secret_fields_get (attributes, l->data));
 		}
 
 		g_free (groupname);
@@ -122,7 +122,7 @@ generate_attributes (GKeyFile *file, GckSecretItem *item)
 }
 
 static void
-parse_attributes (GKeyFile *file, GckSecretItem *item, const gchar **groups)
+parse_attributes (GKeyFile *file, GkmSecretItem *item, const gchar **groups)
 {
 	GHashTable *attributes;
 	const gchar *identifier;
@@ -130,17 +130,17 @@ parse_attributes (GKeyFile *file, GckSecretItem *item, const gchar **groups)
 	gchar *prefix;
 	gchar *name, *type;
 	guint64 number;
-	
+
 	/* Now do the attributes */
-	
-	identifier = gck_secret_object_get_identifier (GCK_SECRET_OBJECT (item));
+
+	identifier = gkm_secret_object_get_identifier (GKM_SECRET_OBJECT (item));
 	prefix = g_strdup_printf ("%s:attribute", identifier);
-	attributes = gck_secret_fields_new ();
-	
+	attributes = gkm_secret_fields_new ();
+
 	for (g = groups; *g; ++g) {
-		if (!g_str_has_prefix (*g, prefix)) 
+		if (!g_str_has_prefix (*g, prefix))
 			continue;
-			
+
 		name = g_key_file_get_string (file, *g, "name", NULL);
 		if (!name)
 			continue;
@@ -150,38 +150,38 @@ parse_attributes (GKeyFile *file, GckSecretItem *item, const gchar **groups)
 		/* A uint32 type value */
 		if (type && g_str_equal (type, "uint32")) {
 			if (key_file_get_uint64 (file, *g, "value", &number))
-				gck_secret_fields_add_compat_uint32 (attributes, name, number);
+				gkm_secret_fields_add_compat_uint32 (attributes, name, number);
 			g_free (name);
 
 		/* A string type value */
 		} else {
-			gck_secret_fields_take (attributes, name,
+			gkm_secret_fields_take (attributes, name,
 			                        g_key_file_get_string (file, *g, "value", NULL));
 		}
-		
+
 		g_free (type);
 	}
-	
-	gck_secret_item_set_fields (item, attributes);
+
+	gkm_secret_item_set_fields (item, attributes);
 	g_hash_table_unref (attributes);
 	g_free (prefix);
-} 
+}
 
-static void 
-generate_acl (GKeyFile *file, GckSecretItem *item)
+static void
+generate_acl (GKeyFile *file, GkmSecretItem *item)
 {
 	const gchar *identifier;
-	GckSecretAccess *ac;
+	GkmSecretAccess *ac;
 	gchar *groupname;
 	GList *acl;
 	gint i;
-	
-	/* 
+
+	/*
 	 * COMPATIBILITY: If we loaded ACLs and they're set on the item,
 	 * then store them back in.
 	 */
-	
-	identifier = gck_secret_object_get_identifier (GCK_SECRET_OBJECT (item));
+
+	identifier = gkm_secret_object_get_identifier (GKM_SECRET_OBJECT (item));
 	acl = g_object_get_data (G_OBJECT (item), "compat-acl");
 	for (i = 0; acl != NULL; acl = g_list_next (acl), ++i) {
 		ac = acl->data;
@@ -194,77 +194,77 @@ generate_acl (GKeyFile *file, GckSecretItem *item)
 		if (ac->pathname)
 			g_key_file_set_string (file, groupname, "path", ac->pathname);
 
-		g_key_file_set_boolean (file, groupname, "read-access", 
-		                        ac->types_allowed & GCK_SECRET_ACCESS_READ); 
-		g_key_file_set_boolean (file, groupname, "write-access", 
-		                        ac->types_allowed & GCK_SECRET_ACCESS_WRITE); 
-		g_key_file_set_boolean (file, groupname, "remove-access", 
-		                        ac->types_allowed & GCK_SECRET_ACCESS_REMOVE);
-		                        
+		g_key_file_set_boolean (file, groupname, "read-access",
+		                        ac->types_allowed & GKM_SECRET_ACCESS_READ);
+		g_key_file_set_boolean (file, groupname, "write-access",
+		                        ac->types_allowed & GKM_SECRET_ACCESS_WRITE);
+		g_key_file_set_boolean (file, groupname, "remove-access",
+		                        ac->types_allowed & GKM_SECRET_ACCESS_REMOVE);
+
 		g_free (groupname);
 	}
 }
 
-static void 
-parse_acl (GKeyFile *file, GckSecretItem *item, const gchar **groups)
+static void
+parse_acl (GKeyFile *file, GkmSecretItem *item, const gchar **groups)
 {
-	GckSecretAccessType access_type;
-	GckSecretAccess *ac;
+	GkmSecretAccessType access_type;
+	GkmSecretAccess *ac;
 	const gchar *identifier;
 	const gchar **g;
 	gchar *prefix;
 	gchar *path, *display;
 	GError *err = NULL;
 	GList *acl;
-	
-	/* 
-	 * COMPATIBILITY: We don't actually use ACLs, but if we find them in the 
+
+	/*
+	 * COMPATIBILITY: We don't actually use ACLs, but if we find them in the
 	 * file, then load them and save back later.
 	 */
-	
-	identifier = gck_secret_object_get_identifier (GCK_SECRET_OBJECT (item));
+
+	identifier = gkm_secret_object_get_identifier (GKM_SECRET_OBJECT (item));
 	prefix = g_strdup_printf ("%s:acl", identifier);
 	acl = NULL;
-	
+
 	for (g = groups; *g; ++g) {
-		if (!g_str_has_prefix (*g, prefix)) 
+		if (!g_str_has_prefix (*g, prefix))
 			continue;
 		path = g_key_file_get_string (file, *g, "path", NULL);
 		if (!path)
 			continue;
-			
+
 		display = g_key_file_get_string (file, *g, "display-name", NULL);
 
 		access_type = 0;
 
 		if (g_key_file_get_boolean (file, *g, "read-access", &err) && !err)
-			access_type |= GCK_SECRET_ACCESS_READ;
+			access_type |= GKM_SECRET_ACCESS_READ;
 		g_clear_error (&err);
 
 		if (g_key_file_get_boolean (file, *g, "write-access", &err) && !err)
-			access_type |= GCK_SECRET_ACCESS_WRITE;
+			access_type |= GKM_SECRET_ACCESS_WRITE;
 		g_clear_error (&err);
 
 		if (g_key_file_get_boolean (file, *g, "remove-access", &err) && !err)
-			access_type |= GCK_SECRET_ACCESS_REMOVE;
+			access_type |= GKM_SECRET_ACCESS_REMOVE;
 		g_clear_error (&err);
-		
-		ac = g_new0 (GckSecretAccess, 1);
+
+		ac = g_new0 (GkmSecretAccess, 1);
 		ac->display_name = display;
 		ac->pathname = path;
 		ac->types_allowed = access_type;
-		
+
 		acl = g_list_prepend (acl, ac);
 	}
-	
-	g_object_set_data_full (G_OBJECT (item), "compat-acl", acl, gck_secret_compat_acl_free);
+
+	g_object_set_data_full (G_OBJECT (item), "compat-acl", acl, gkm_secret_compat_acl_free);
 	g_free (prefix);
 }
 
 static void
-generate_item (GKeyFile *file, GckSecretItem *item, GckSecretData *sdata)
+generate_item (GKeyFile *file, GkmSecretItem *item, GkmSecretData *sdata)
 {
-	GckSecretObject *obj;
+	GkmSecretObject *obj;
 	GHashTable *attributes;
 	const gchar *value;
 	const gchar *identifier;
@@ -273,22 +273,22 @@ generate_item (GKeyFile *file, GckSecretItem *item, GckSecretData *sdata)
 	gchar *hex;
 
 	g_assert (file);
-	g_assert (GCK_IS_SECRET_ITEM (item));
-	g_assert (GCK_IS_SECRET_DATA (sdata));
+	g_assert (GKM_IS_SECRET_ITEM (item));
+	g_assert (GKM_IS_SECRET_DATA (sdata));
 
-	obj = GCK_SECRET_OBJECT (item);
-	identifier = gck_secret_object_get_identifier (obj);
-	attributes = gck_secret_item_get_fields (item);
+	obj = GKM_SECRET_OBJECT (item);
+	identifier = gkm_secret_object_get_identifier (obj);
+	attributes = gkm_secret_item_get_fields (item);
 
-	value = gck_secret_item_get_schema (item);
+	value = gkm_secret_item_get_schema (item);
 	g_key_file_set_integer (file, identifier, "item-type",
-	                        gck_secret_compat_parse_item_type (value));
+	                        gkm_secret_compat_parse_item_type (value));
 
-	value = gck_secret_object_get_label (obj);
+	value = gkm_secret_object_get_label (obj);
 	if (value != NULL)
 		g_key_file_set_string (file, identifier, "display-name", value);
 
-	secret = gck_secret_data_get_raw (sdata, identifier, &n_secret);
+	secret = gkm_secret_data_get_raw (sdata, identifier, &n_secret);
 	if (secret != NULL) {
 		/* A textual secret. Note that secrets are always null-terminated. */
 		if (g_utf8_validate ((gchar*)secret, n_secret, NULL)) {
@@ -302,22 +302,22 @@ generate_item (GKeyFile *file, GckSecretItem *item, GckSecretData *sdata)
 		}
 	}
 
-	key_file_set_uint64 (file, identifier, "mtime", gck_secret_object_get_modified (obj));
-	key_file_set_uint64 (file, identifier, "ctime", gck_secret_object_get_created (obj));
+	key_file_set_uint64 (file, identifier, "mtime", gkm_secret_object_get_modified (obj));
+	key_file_set_uint64 (file, identifier, "ctime", gkm_secret_object_get_created (obj));
 
 	generate_attributes (file, item);
 	generate_acl (file, item);
 }
 
-static void 
-parse_item (GKeyFile *file, GckSecretItem *item, GckSecretData *sdata,
+static void
+parse_item (GKeyFile *file, GkmSecretItem *item, GkmSecretData *sdata,
             const gchar **groups)
 {
-	GckSecretObject *obj;
+	GkmSecretObject *obj;
 	GHashTable *attributes;
 	const gchar *identifier;
 	GError *err = NULL;
-	GckSecret *secret;
+	GkmSecret *secret;
 	guchar *binary;
 	gsize n_binary;
 	gchar *val;
@@ -326,19 +326,19 @@ parse_item (GKeyFile *file, GckSecretItem *item, GckSecretData *sdata,
 
 	/* First the main item data */
 
-	obj = GCK_SECRET_OBJECT (item);
-	identifier = gck_secret_object_get_identifier (obj);
-	attributes = gck_secret_item_get_fields (item);
+	obj = GKM_SECRET_OBJECT (item);
+	identifier = gkm_secret_object_get_identifier (obj);
+	attributes = gkm_secret_item_get_fields (item);
 
 	type = g_key_file_get_integer (file, identifier, "item-type", &err);
 	if (err) {
 		g_clear_error (&err);
 		type = 0;
 	}
-	gck_secret_item_set_schema (item, gck_secret_compat_format_item_type (type));
+	gkm_secret_item_set_schema (item, gkm_secret_compat_format_item_type (type));
 
 	val = g_key_file_get_string (file, identifier, "display-name", NULL);
-	gck_secret_object_set_label (obj, val);
+	gkm_secret_object_set_label (obj, val);
 	g_free (val);
 
 	if (sdata) {
@@ -347,7 +347,7 @@ parse_item (GKeyFile *file, GckSecretItem *item, GckSecretData *sdata,
 		/* A textual secret */
 		val = g_key_file_get_string (file, identifier, "secret", NULL);
 		if (val != NULL) {
-			secret = gck_secret_new_from_password (val);
+			secret = gkm_secret_new_from_password (val);
 			g_free (val);
 
 		/* A binary secret */
@@ -355,7 +355,7 @@ parse_item (GKeyFile *file, GckSecretItem *item, GckSecretData *sdata,
 			val = g_key_file_get_string (file, identifier, "binary-secret", NULL);
 			if (val != NULL) {
 				binary = egg_hex_decode (val, -1, &n_binary);
-				secret = gck_secret_new (binary, n_binary);
+				secret = gkm_secret_new (binary, n_binary);
 				g_free (binary);
 				g_free (val);
 			}
@@ -363,61 +363,61 @@ parse_item (GKeyFile *file, GckSecretItem *item, GckSecretData *sdata,
 
 		/* Put the secret in the right place */
 		if (secret == NULL) {
-			gck_secret_data_remove_secret (sdata, identifier);
+			gkm_secret_data_remove_secret (sdata, identifier);
 		} else {
-			gck_secret_data_set_secret (sdata, identifier, secret);
+			gkm_secret_data_set_secret (sdata, identifier, secret);
 			g_object_unref (secret);
 		}
 	}
 
 	num = 0;
 	if (key_file_get_uint64 (file, identifier, "mtime", &num))
-		gck_secret_object_set_modified (obj, num);
+		gkm_secret_object_set_modified (obj, num);
 	num = 0;
 	if (key_file_get_uint64 (file, identifier, "ctime", &num))
-		gck_secret_object_set_created (obj, num);
+		gkm_secret_object_set_created (obj, num);
 
-	/* Now the other stuff */	
+	/* Now the other stuff */
 	parse_attributes (file, item, groups);
-	parse_acl (file, item, groups);	
+	parse_acl (file, item, groups);
 }
 
-GckDataResult
-gck_secret_textual_write (GckSecretCollection *collection, GckSecretData *sdata,
+GkmDataResult
+gkm_secret_textual_write (GkmSecretCollection *collection, GkmSecretData *sdata,
                           guchar **data, gsize *n_data)
 {
-	GckSecretObject *obj;
+	GkmSecretObject *obj;
 	GList *items, *l;
 	const gchar *value;
 	GKeyFile *file;
 	GError *err = NULL;
 	gint idle_timeout;
 
-	g_return_val_if_fail (GCK_IS_SECRET_COLLECTION (collection), GCK_DATA_FAILURE);
-	g_return_val_if_fail (GCK_IS_SECRET_DATA (sdata), GCK_DATA_LOCKED);
-	g_return_val_if_fail (data && n_data, GCK_DATA_FAILURE);
+	g_return_val_if_fail (GKM_IS_SECRET_COLLECTION (collection), GKM_DATA_FAILURE);
+	g_return_val_if_fail (GKM_IS_SECRET_DATA (sdata), GKM_DATA_LOCKED);
+	g_return_val_if_fail (data && n_data, GKM_DATA_FAILURE);
 
-	obj = GCK_SECRET_OBJECT (collection);
+	obj = GKM_SECRET_OBJECT (collection);
 	file = g_key_file_new ();
 
-	value = gck_secret_object_get_label (obj);
+	value = gkm_secret_object_get_label (obj);
 	if (value != NULL)
 		g_key_file_set_string (file, "keyring", "display-name", value);
 
-	key_file_set_uint64 (file, "keyring", "ctime", gck_secret_object_get_created (obj));
-	key_file_set_uint64 (file, "keyring", "mtime", gck_secret_object_get_modified (obj));
+	key_file_set_uint64 (file, "keyring", "ctime", gkm_secret_object_get_created (obj));
+	key_file_set_uint64 (file, "keyring", "mtime", gkm_secret_object_get_modified (obj));
 
-	idle_timeout = gck_secret_collection_get_lock_idle (collection);
+	idle_timeout = gkm_secret_collection_get_lock_idle (collection);
 	g_key_file_set_boolean (file, "keyring", "lock-on-idle", idle_timeout > 0);
 	if (idle_timeout)
 		g_key_file_set_integer (file, "keyring", "lock-timeout", idle_timeout);
-	idle_timeout = gck_secret_collection_get_lock_after (collection);
+	idle_timeout = gkm_secret_collection_get_lock_after (collection);
 	g_key_file_set_boolean (file, "keyring", "lock-after", idle_timeout > 0);
 	if (idle_timeout)
 		g_key_file_set_integer (file, "keyring", "lock-timeout", idle_timeout);
 
-	items = gck_secret_collection_get_items (collection);
-	for (l = items; l; l = g_list_next (l)) 
+	items = gkm_secret_collection_get_items (collection);
+	for (l = items; l; l = g_list_next (l))
 		generate_item (file, l->data, sdata);
 	g_list_free (items);
 
@@ -426,38 +426,38 @@ gck_secret_textual_write (GckSecretCollection *collection, GckSecretData *sdata,
 
 	if (!*data) {
 		g_warning ("couldn't generate textual keyring file: %s", egg_error_message (err));
-		return GCK_DATA_FAILURE;
+		return GKM_DATA_FAILURE;
 	}
 
-	return GCK_DATA_SUCCESS;
+	return GKM_DATA_SUCCESS;
 }
 
-static void 
+static void
 remove_unavailable_item (gpointer key, gpointer dummy, gpointer user_data)
 {
 	/* Called to remove items from a keyring that no longer exist */
 
-	GckSecretCollection *collection = GCK_SECRET_COLLECTION (user_data);
-	GckSecretItem *item;
-	
-	g_assert (GCK_IS_SECRET_COLLECTION (collection));
-	
-	item = gck_secret_collection_get_item (collection, key);
+	GkmSecretCollection *collection = GKM_SECRET_COLLECTION (user_data);
+	GkmSecretItem *item;
+
+	g_assert (GKM_IS_SECRET_COLLECTION (collection));
+
+	item = gkm_secret_collection_get_item (collection, key);
 	if (item != NULL)
-		gck_secret_collection_remove_item (collection, item);
+		gkm_secret_collection_remove_item (collection, item);
 }
 
-GckDataResult
-gck_secret_textual_read (GckSecretCollection *collection, GckSecretData *sdata,
+GkmDataResult
+gkm_secret_textual_read (GkmSecretCollection *collection, GkmSecretData *sdata,
                          const guchar *data, gsize n_data)
 {
-	GckSecretObject *obj;
-	GckSecretItem *item;
+	GkmSecretObject *obj;
+	GkmSecretItem *item;
 	GList *items, *l;
 	GError *err = NULL;
 	GKeyFile *file = NULL;
 	gchar **groups = NULL;
-	GckDataResult res = GCK_DATA_FAILURE;
+	GkmDataResult res = GKM_DATA_FAILURE;
 	gchar *start = NULL;
 	const gchar *identifier;
 	GHashTable *checks = NULL;
@@ -466,55 +466,55 @@ gck_secret_textual_read (GckSecretCollection *collection, GckSecretData *sdata,
 	guint64 num;
 	gchar **g;
 
-	g_return_val_if_fail (GCK_IS_SECRET_COLLECTION (collection), GCK_DATA_FAILURE);
-	g_return_val_if_fail (!sdata || GCK_IS_SECRET_DATA (sdata), GCK_DATA_FAILURE);
+	g_return_val_if_fail (GKM_IS_SECRET_COLLECTION (collection), GKM_DATA_FAILURE);
+	g_return_val_if_fail (!sdata || GKM_IS_SECRET_DATA (sdata), GKM_DATA_FAILURE);
 
 	file = g_key_file_new ();
-	obj = GCK_SECRET_OBJECT (collection);
+	obj = GKM_SECRET_OBJECT (collection);
 
 	if (!n_data) {
-		res = GCK_DATA_UNRECOGNIZED;
+		res = GKM_DATA_UNRECOGNIZED;
 		goto done;
 	}
 
 	if (!g_key_file_load_from_data (file, (const gchar*)data, n_data, G_KEY_FILE_NONE, &err)) {
 		if (g_error_matches (err, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_PARSE))
-			res = GCK_DATA_UNRECOGNIZED;
+			res = GKM_DATA_UNRECOGNIZED;
 		goto done;
 	}
-	
+
 	start = g_key_file_get_start_group (file);
 	if (!start || !g_str_equal (start, "keyring")) {
 		g_message ("invalid keyring file: wrong header group");
 		goto done;
 	}
-	
+
 	value = g_key_file_get_string (file, "keyring", "display-name", NULL);
-	gck_secret_object_set_label (obj, value);
+	gkm_secret_object_set_label (obj, value);
 	g_free (value);
 
 	num = 0;
 	key_file_get_uint64 (file, "keyring", "ctime", &num);
-	gck_secret_object_set_created (obj, num);
+	gkm_secret_object_set_created (obj, num);
 
 	num = 0;
 	key_file_get_uint64 (file, "keyring", "mtime", &num);
-	gck_secret_object_set_modified (obj, num);
-	
+	gkm_secret_object_set_modified (obj, num);
+
 	/* Not currently used :( */
 	lock_timeout = g_key_file_get_integer (file, "keyring", "lock-timeout", NULL);
 	if (g_key_file_get_boolean (file, "keyring", "lock-after", NULL))
-		gck_secret_collection_set_lock_idle (collection, lock_timeout);
+		gkm_secret_collection_set_lock_idle (collection, lock_timeout);
 	else if (g_key_file_get_boolean (file, "keyring", "lock-on-idle", NULL))
-		gck_secret_collection_set_lock_idle (collection, lock_timeout);
+		gkm_secret_collection_set_lock_idle (collection, lock_timeout);
 
 	g_object_set_data (G_OBJECT (collection), "lock-timeout", GINT_TO_POINTER (lock_timeout));
-	
+
 	/* Build a Hash table where we can track ids we haven't yet seen */
 	checks = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
-	items = gck_secret_collection_get_items (collection);
+	items = gkm_secret_collection_get_items (collection);
 	for (l = items; l; l = g_list_next (l)) {
-		identifier = gck_secret_object_get_identifier (l->data);
+		identifier = gkm_secret_object_get_identifier (l->data);
 		g_hash_table_replace (checks, g_strdup (identifier), "unused");
 	}
 	g_list_free (items);
@@ -527,15 +527,15 @@ gck_secret_textual_read (GckSecretCollection *collection, GckSecretData *sdata,
 
 		/* We've seen this id */
 		g_hash_table_remove (checks, identifier);
-		
-		item = gck_secret_collection_get_item (collection, identifier);
+
+		item = gkm_secret_collection_get_item (collection, identifier);
 		if (item == NULL)
-			item = gck_secret_collection_new_item (collection, identifier);
+			item = gkm_secret_collection_new_item (collection, identifier);
 		parse_item (file, item, sdata, (const gchar**)groups);
 	}
 
 	g_hash_table_foreach (checks, (GHFunc)remove_unavailable_item, collection);
-	res = GCK_DATA_SUCCESS;
+	res = GKM_DATA_SUCCESS;
 
 done:
 	if (checks)
diff --git a/pkcs11/secret-store/gck-secret-textual.h b/pkcs11/secret-store/gkm-secret-textual.h
similarity index 68%
rename from pkcs11/secret-store/gck-secret-textual.h
rename to pkcs11/secret-store/gkm-secret-textual.h
index 0a59f4a..bb96e8c 100644
--- a/pkcs11/secret-store/gck-secret-textual.h
+++ b/pkcs11/secret-store/gkm-secret-textual.h
@@ -1,39 +1,39 @@
-/* 
+/*
  * gnome-keyring
- * 
+ *
  * Copyright (C) 2009 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.
  */
 
-#ifndef __GCK_SECRET_TEXTUAL_H__
-#define __GCK_SECRET_TEXTUAL_H__
+#ifndef __GKM_SECRET_TEXTUAL_H__
+#define __GKM_SECRET_TEXTUAL_H__
 
-#include "gck-secret-collection.h"
+#include "gkm-secret-collection.h"
 
-#include "gck/gck-data-types.h"
+#include "gkm/gkm-data-types.h"
 
-GckDataResult          gck_secret_textual_read       (GckSecretCollection *collection, 
-                                                      GckSecretData *sdata,
+GkmDataResult          gkm_secret_textual_read       (GkmSecretCollection *collection,
+                                                      GkmSecretData *sdata,
                                                       const guchar *data,
                                                       gsize n_data);
 
-GckDataResult          gck_secret_textual_write      (GckSecretCollection *collection,
-                                                      GckSecretData *sdata,
+GkmDataResult          gkm_secret_textual_write      (GkmSecretCollection *collection,
+                                                      GkmSecretData *sdata,
                                                       guchar **data,
                                                       gsize *n_data);
 
-#endif /* __GCK_SECRET_TEXTUAL_H__ */
+#endif /* __GKM_SECRET_TEXTUAL_H__ */
diff --git a/pkcs11/secret-store/gck-secret-types.h b/pkcs11/secret-store/gkm-secret-types.h
similarity index 60%
rename from pkcs11/secret-store/gck-secret-types.h
rename to pkcs11/secret-store/gkm-secret-types.h
index af64578..c2eebcf 100644
--- a/pkcs11/secret-store/gck-secret-types.h
+++ b/pkcs11/secret-store/gkm-secret-types.h
@@ -1,35 +1,35 @@
-/* 
+/*
  * gnome-keyring
- * 
+ *
  * Copyright (C) 2009 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.
  */
 
-#ifndef __GCK_SECRET_TYPES_H__
-#define __GCK_SECRET_TYPES_H__
+#ifndef __GKM_SECRET_TYPES_H__
+#define __GKM_SECRET_TYPES_H__
 
-#include "gck/gck-types.h"
-#include "gck/gck-data-types.h"
+#include "gkm/gkm-types.h"
+#include "gkm/gkm-data-types.h"
 
-typedef struct _GckSecretCollection GckSecretCollection;
-typedef struct _GckSecretData GckSecretData;
-typedef struct _GckSecretItem GckSecretItem;
-typedef struct _GckSecretObject GckSecretObject;
-typedef struct _GckSecretModule GckSecretModule;
-typedef struct _GckSecretSearch GckSecretSearch;
+typedef struct _GkmSecretCollection GkmSecretCollection;
+typedef struct _GkmSecretData GkmSecretData;
+typedef struct _GkmSecretItem GkmSecretItem;
+typedef struct _GkmSecretObject GkmSecretObject;
+typedef struct _GkmSecretModule GkmSecretModule;
+typedef struct _GkmSecretSearch GkmSecretSearch;
 
-#endif /* __GCK_SECRET_TYPES_H__ */
+#endif /* __GKM_SECRET_TYPES_H__ */
diff --git a/pkcs11/secret-store/tests/Makefile.am b/pkcs11/secret-store/tests/Makefile.am
index c5d47d8..144808b 100644
--- a/pkcs11/secret-store/tests/Makefile.am
+++ b/pkcs11/secret-store/tests/Makefile.am
@@ -10,11 +10,11 @@ UNIT_AUTO = \
 	unit-test-secret-binary.c \
 	test-secret-module.c test-secret-module.h
 
-UNIT_PROMPT = 
+UNIT_PROMPT =
 
 UNIT_LIBS =  \
-	$(top_builddir)/pkcs11/secret-store/libgck-secret-store.la \
-	$(top_builddir)/pkcs11/gck/libgck.la \
+	$(top_builddir)/pkcs11/secret-store/libgkm-secret-store.la \
+	$(top_builddir)/pkcs11/gkm/libgkm.la \
 	$(top_builddir)/egg/libegg.la
 
 EXTRA_DIST = \
diff --git a/pkcs11/secret-store/tests/test-secret-module.c b/pkcs11/secret-store/tests/test-secret-module.c
index 7562aab..7eb7141 100644
--- a/pkcs11/secret-store/tests/test-secret-module.c
+++ b/pkcs11/secret-store/tests/test-secret-module.c
@@ -25,22 +25,22 @@
 #include "test-secret-module.h"
 #include "run-auto-test.h"
 
-#include "gck/gck-secret.h"
-#include "gck/gck-module.h"
+#include "gkm/gkm-secret.h"
+#include "gkm/gkm-module.h"
 
-#include "gck-secret-collection.h"
-#include "gck-secret-data.h"
-#include "gck-secret-fields.h"
-#include "gck-secret-item.h"
-#include "gck-secret-object.h"
-#include "gck-secret-store.h"
+#include "gkm-secret-collection.h"
+#include "gkm-secret-data.h"
+#include "gkm-secret-fields.h"
+#include "gkm-secret-item.h"
+#include "gkm-secret-object.h"
+#include "gkm-secret-store.h"
 
 #include <string.h>
 
 static GMutex *mutex = NULL;
 
-GckModule*  _gck_secret_store_get_module_for_testing (void);
-GMutex* _gck_module_get_scary_mutex_that_you_should_not_touch (GckModule *module);
+GkmModule*  _gkm_secret_store_get_module_for_testing (void);
+GMutex* _gkm_module_get_scary_mutex_that_you_should_not_touch (GkmModule *module);
 
 static void
 copy_scratch_file (const gchar *basename)
@@ -63,12 +63,12 @@ copy_scratch_file (const gchar *basename)
 	g_free (data);
 }
 
-GckModule*
+GkmModule*
 test_secret_module_initialize_and_enter (void)
 {
 	CK_FUNCTION_LIST_PTR funcs;
 	CK_C_INITIALIZE_ARGS args;
-	GckModule *module;
+	GkmModule *module;
 	gchar *string;
 	CK_RV rv;
 
@@ -82,14 +82,14 @@ test_secret_module_initialize_and_enter (void)
 	copy_scratch_file ("encrypted.keyring");
 	copy_scratch_file ("plain.keyring");
 
-	funcs = gck_secret_store_get_functions ();
+	funcs = gkm_secret_store_get_functions ();
 	rv = (funcs->C_Initialize) (&args);
 	g_return_val_if_fail (rv == CKR_OK, NULL);
 
-	module = _gck_secret_store_get_module_for_testing ();
+	module = _gkm_secret_store_get_module_for_testing ();
 	g_return_val_if_fail (module, NULL);
 
-	mutex = _gck_module_get_scary_mutex_that_you_should_not_touch (module);
+	mutex = _gkm_module_get_scary_mutex_that_you_should_not_touch (module);
 	test_secret_module_enter ();
 
 	g_free (string);
@@ -105,7 +105,7 @@ test_secret_module_leave_and_finalize (void)
 
 	test_secret_module_leave ();
 
-	funcs = gck_secret_store_get_functions ();
+	funcs = gkm_secret_store_get_functions ();
 	rv = (funcs->C_Finalize) (NULL);
 	g_return_if_fail (rv == CKR_OK);
 }
@@ -124,28 +124,28 @@ test_secret_module_enter (void)
 	g_mutex_lock (mutex);
 }
 
-GckSession*
+GkmSession*
 test_secret_module_open_session (gboolean writable)
 {
 	CK_ULONG flags = CKF_SERIAL_SESSION;
 	CK_SESSION_HANDLE handle;
-	GckModule *module;
-	GckSession *session;
+	GkmModule *module;
+	GkmSession *session;
 	CK_RV rv;
 
-	module = _gck_secret_store_get_module_for_testing ();
+	module = _gkm_secret_store_get_module_for_testing ();
 	g_return_val_if_fail (module, NULL);
 
 	if (writable)
 		flags |= CKF_RW_SESSION;
 
-	rv = gck_module_C_OpenSession (module, 1, flags, NULL, NULL, &handle);
+	rv = gkm_module_C_OpenSession (module, 1, flags, NULL, NULL, &handle);
 	g_assert (rv == CKR_OK);
 
-	rv = gck_module_C_Login (module, handle, CKU_USER, NULL, 0);
+	rv = gkm_module_C_Login (module, handle, CKU_USER, NULL, 0);
 	g_assert (rv == CKR_OK);
 
-	session = gck_module_lookup_session (module, handle);
+	session = gkm_module_lookup_session (module, handle);
 	g_assert (session);
 
 	return session;
@@ -153,22 +153,22 @@ test_secret_module_open_session (gboolean writable)
 
 /* Validates plain.keyring and encrypted.keyring in test-data */
 void
-test_secret_collection_validate (GckSecretCollection *collection, GckSecretData *sdata)
+test_secret_collection_validate (GkmSecretCollection *collection, GkmSecretData *sdata)
 {
-	GckSecretItem* item;
-	GckSecretObject *obj;
+	GkmSecretItem* item;
+	GkmSecretObject *obj;
 	GHashTable *fields;
 	const gchar *value;
-	GckSecret *secret;
+	GkmSecret *secret;
 	GList *items;
 	glong when;
 	guint32 num;
 
-	obj = GCK_SECRET_OBJECT (collection);
+	obj = GKM_SECRET_OBJECT (collection);
 
 	/* The keyring itself */
 	/* "Missing keyring name" */
-	value = gck_secret_object_get_label (obj);
+	value = gkm_secret_object_get_label (obj);
 	g_assert (value != NULL);
 	/* "Invalid keyring name" */
 	g_assert_cmpstr (value, ==, "unit-test-keyring");
@@ -177,19 +177,19 @@ test_secret_collection_validate (GckSecretCollection *collection, GckSecretData
 	g_assert (!keyring->lock_on_idle && keyring->lock_timeout == 0);
 #endif
 	/* "Bad Creation Time" */
-	when = gck_secret_object_get_created (obj);
+	when = gkm_secret_object_get_created (obj);
 	g_assert (when == 1198027852);
 	/* "Bad Modification Time" */
-	when = gck_secret_object_get_modified (obj);
+	when = gkm_secret_object_get_modified (obj);
 	g_assert (when == 1198027852);
 	/* "Wrong number of items" */
-	items = gck_secret_collection_get_items (collection);
+	items = gkm_secret_collection_get_items (collection);
 	g_assert_cmpint (g_list_length (items), ==, 2);
 	g_list_free (items);
 
 	/* Item #2 */
-	item = gck_secret_collection_get_item (collection, "2");
-	obj = GCK_SECRET_OBJECT (item);
+	item = gkm_secret_collection_get_item (collection, "2");
+	obj = GKM_SECRET_OBJECT (item);
 	/* "Couldn't find item" */
 	g_assert (item != NULL);
 #if 0
@@ -197,12 +197,12 @@ test_secret_collection_validate (GckSecretCollection *collection, GckSecretData
 	g_assert_cmpint (item->type, ==, GNOME_KEYRING_ITEM_GENERIC_SECRET);
 #endif
 	/* "Missing secret" */
-	secret = gck_secret_data_get_secret (sdata, "2");
+	secret = gkm_secret_data_get_secret (sdata, "2");
 	g_assert (secret != NULL);
 	/* "Wrong secret" */
-	g_assert (gck_secret_equals (secret, (guchar*)"item-secret", -1));
+	g_assert (gkm_secret_equals (secret, (guchar*)"item-secret", -1));
 	/* "Bad Creation Time" */
-	when = gck_secret_object_get_created (obj);
+	when = gkm_secret_object_get_created (obj);
 	g_assert_cmpint (when, ==, 1198027852);
 
 #if 0
@@ -222,67 +222,67 @@ test_secret_collection_validate (GckSecretCollection *collection, GckSecretData
 #endif
 
 	/* Item #3 */
-	item = gck_secret_collection_get_item (collection, "3");
-	obj = GCK_SECRET_OBJECT (item);
+	item = gkm_secret_collection_get_item (collection, "3");
+	obj = GKM_SECRET_OBJECT (item);
 	/* "Couldn't find item #3" */
 	g_assert (item != NULL);
-	fields = gck_secret_item_get_fields (item);
+	fields = gkm_secret_item_get_fields (item);
 	g_assert (fields != NULL);
 	/* Make fields are the same */
-	value = gck_secret_fields_get (fields, "dog");
+	value = gkm_secret_fields_get (fields, "dog");
 	g_assert_cmpstr (value, ==, "woof");
-	value = gck_secret_fields_get (fields, "bird");
+	value = gkm_secret_fields_get (fields, "bird");
 	g_assert_cmpstr (value, ==, "cheep");
-	value = gck_secret_fields_get (fields, "iguana");
+	value = gkm_secret_fields_get (fields, "iguana");
 	g_assert_cmpstr (value, ==, "");
-	g_assert (gck_secret_fields_get_compat_uint32 (fields, "num", &num));
+	g_assert (gkm_secret_fields_get_compat_uint32 (fields, "num", &num));
 	g_assert_cmpuint (num, ==, 3);
 #if 0
 	/* "Invalid item type" */
 	g_assert_cmpint (item->type, ==, GNOME_KEYRING_ITEM_GENERIC_SECRET);
 #endif
 	/* "Missing secret" */
-	secret = gck_secret_data_get_secret (sdata, "3");
+	secret = gkm_secret_data_get_secret (sdata, "3");
 	g_assert (secret != NULL);
 	/* "Wrong secret" */
-	g_assert (gck_secret_equals (secret, (guchar*)"item-secret", -1));
+	g_assert (gkm_secret_equals (secret, (guchar*)"item-secret", -1));
 }
 
 /* Fills a collection with some junk data */
 void
-test_secret_collection_populate (GckSecretCollection *collection, GckSecretData *sdata)
+test_secret_collection_populate (GkmSecretCollection *collection, GkmSecretData *sdata)
 {
-	GckSecretItem *item;
+	GkmSecretItem *item;
 	GHashTable *fields;
-	GckSecret *secret;
+	GkmSecret *secret;
 
-	item = gck_secret_collection_new_item (collection, "4");
-	gck_secret_object_set_label (GCK_SECRET_OBJECT (item), "Noises");
-	secret = gck_secret_new_from_password ("4's secret");
-	gck_secret_data_set_secret (sdata, "4", secret);
+	item = gkm_secret_collection_new_item (collection, "4");
+	gkm_secret_object_set_label (GKM_SECRET_OBJECT (item), "Noises");
+	secret = gkm_secret_new_from_password ("4's secret");
+	gkm_secret_data_set_secret (sdata, "4", secret);
 	g_object_unref (secret);
-	fields = gck_secret_item_get_fields (item);
-	gck_secret_fields_add (fields, "doggy", "fart");
-	gck_secret_fields_add (fields, "pig", "grunt");
-	gck_secret_fields_add_compat_uint32 (fields, "how-many", 292929);
-
-	item = gck_secret_collection_new_item (collection, "5");
-	gck_secret_object_set_label (GCK_SECRET_OBJECT (item), "Colors");
-	secret = gck_secret_new_from_password ("5's secret");
-	gck_secret_data_set_secret (sdata, "5", secret);
+	fields = gkm_secret_item_get_fields (item);
+	gkm_secret_fields_add (fields, "doggy", "fart");
+	gkm_secret_fields_add (fields, "pig", "grunt");
+	gkm_secret_fields_add_compat_uint32 (fields, "how-many", 292929);
+
+	item = gkm_secret_collection_new_item (collection, "5");
+	gkm_secret_object_set_label (GKM_SECRET_OBJECT (item), "Colors");
+	secret = gkm_secret_new_from_password ("5's secret");
+	gkm_secret_data_set_secret (sdata, "5", secret);
 	g_object_unref (secret);
-	fields = gck_secret_item_get_fields (item);
-	gck_secret_fields_add (fields, "barney", "purple");
-	gck_secret_fields_add (fields, "piglet", "pink");
-	gck_secret_fields_add_compat_uint32 (fields, "number", 8);
-
-	item = gck_secret_collection_new_item (collection, "6");
-	gck_secret_object_set_label (GCK_SECRET_OBJECT (item), "Binary Secret");
-	secret = gck_secret_new ((guchar*)"binary\0secret", 13);
-	gck_secret_data_set_secret (sdata, "6", secret);
+	fields = gkm_secret_item_get_fields (item);
+	gkm_secret_fields_add (fields, "barney", "purple");
+	gkm_secret_fields_add (fields, "piglet", "pink");
+	gkm_secret_fields_add_compat_uint32 (fields, "number", 8);
+
+	item = gkm_secret_collection_new_item (collection, "6");
+	gkm_secret_object_set_label (GKM_SECRET_OBJECT (item), "Binary Secret");
+	secret = gkm_secret_new ((guchar*)"binary\0secret", 13);
+	gkm_secret_data_set_secret (sdata, "6", secret);
 	g_object_unref (secret);
-	fields = gck_secret_item_get_fields (item);
-	gck_secret_fields_add (fields, "train", "zoom");
-	gck_secret_fields_add (fields, "hummer", NULL);
-	gck_secret_fields_add_compat_uint32 (fields, "number", 2);
+	fields = gkm_secret_item_get_fields (item);
+	gkm_secret_fields_add (fields, "train", "zoom");
+	gkm_secret_fields_add (fields, "hummer", NULL);
+	gkm_secret_fields_add_compat_uint32 (fields, "number", 2);
 }
diff --git a/pkcs11/secret-store/tests/test-secret-module.h b/pkcs11/secret-store/tests/test-secret-module.h
index 2c31e4e..46413e3 100644
--- a/pkcs11/secret-store/tests/test-secret-module.h
+++ b/pkcs11/secret-store/tests/test-secret-module.h
@@ -26,8 +26,8 @@
 
 #include <glib.h>
 
-#include "gck/gck-types.h"
-#include "gck-secret-types.h"
+#include "gkm/gkm-types.h"
+#include "gkm-secret-types.h"
 
 #include "pkcs11.h"
 
@@ -35,16 +35,16 @@ void                   test_secret_module_leave                    (void);
 
 void                   test_secret_module_enter                    (void);
 
-GckModule*             test_secret_module_initialize_and_enter     (void);
+GkmModule*             test_secret_module_initialize_and_enter     (void);
 
 void                   test_secret_module_leave_and_finalize       (void);
 
-GckSession*            test_secret_module_open_session             (gboolean writable);
+GkmSession*            test_secret_module_open_session             (gboolean writable);
 
-void                   test_secret_collection_validate             (GckSecretCollection *collection,
-                                                                    GckSecretData *sdata);
+void                   test_secret_collection_validate             (GkmSecretCollection *collection,
+                                                                    GkmSecretData *sdata);
 
-void                   test_secret_collection_populate             (GckSecretCollection *collection,
-                                                                    GckSecretData *sdata);
+void                   test_secret_collection_populate             (GkmSecretCollection *collection,
+                                                                    GkmSecretData *sdata);
 
 #endif /* TEST_SECRET_MODULE_H_ */
diff --git a/pkcs11/secret-store/tests/unit-test-secret-binary.c b/pkcs11/secret-store/tests/unit-test-secret-binary.c
index ceafb02..dca0347 100644
--- a/pkcs11/secret-store/tests/unit-test-secret-binary.c
+++ b/pkcs11/secret-store/tests/unit-test-secret-binary.c
@@ -26,13 +26,13 @@
 #include "run-auto-test.h"
 #include "test-secret-module.h"
 
-#include "gck-secret-binary.h"
-#include "gck-secret-collection.h"
-#include "gck-secret-data.h"
-#include "gck-secret-fields.h"
-#include "gck-secret-item.h"
+#include "gkm-secret-binary.h"
+#include "gkm-secret-collection.h"
+#include "gkm-secret-data.h"
+#include "gkm-secret-fields.h"
+#include "gkm-secret-item.h"
 
-#include "gck/gck-secret.h"
+#include "gkm/gkm-secret.h"
 
 #include "pkcs11/pkcs11i.h"
 
@@ -42,31 +42,31 @@
 #include <stdio.h>
 #include <string.h>
 
-static GckModule *module = NULL;
-static GckSession *session = NULL;
-static GckSecretCollection *collection = NULL;
-static GckSecretData *sdata = NULL;
+static GkmModule *module = NULL;
+static GkmSession *session = NULL;
+static GkmSecretCollection *collection = NULL;
+static GkmSecretData *sdata = NULL;
 
 DEFINE_SETUP(binary)
 {
-	GckSecret *master;
+	GkmSecret *master;
 
 	module = test_secret_module_initialize_and_enter ();
 	session = test_secret_module_open_session (TRUE);
 
-	collection = g_object_new (GCK_TYPE_SECRET_COLLECTION,
+	collection = g_object_new (GKM_TYPE_SECRET_COLLECTION,
 	                           "module", module,
 	                           "identifier", "test",
 	                           "label", "brigadooooooooooooon",
 	                           NULL);
-	
-	sdata = g_object_new (GCK_TYPE_SECRET_DATA, NULL);
-	master = gck_secret_new_from_password ("my-keyring-password");
-	gck_secret_data_set_master (sdata, master);
+
+	sdata = g_object_new (GKM_TYPE_SECRET_DATA, NULL);
+	master = gkm_secret_new_from_password ("my-keyring-password");
+	gkm_secret_data_set_master (sdata, master);
 	g_object_unref (master);
 
-	g_assert (GCK_IS_SECRET_COLLECTION (collection));
-	
+	g_assert (GKM_IS_SECRET_COLLECTION (collection));
+
 }
 
 DEFINE_TEARDOWN(binary)
@@ -86,96 +86,96 @@ DEFINE_TEARDOWN(binary)
 
 DEFINE_TEST(binary_read)
 {
-	GckDataResult res;
+	GkmDataResult res;
 	guchar *data;
 	gsize n_data;
 
 	data = test_data_read ("encrypted.keyring", &n_data);
-	res = gck_secret_binary_read (collection, sdata, data, n_data);
+	res = gkm_secret_binary_read (collection, sdata, data, n_data);
 	g_free (data);
 
 	test_secret_collection_validate (collection, sdata);
 
-	g_assert (res == GCK_DATA_SUCCESS);
+	g_assert (res == GKM_DATA_SUCCESS);
 }
 
 DEFINE_TEST(binary_read_wrong_format)
 {
-	GckDataResult res;
+	GkmDataResult res;
 	guchar *data;
 	gsize n_data;
 
 	data = test_data_read ("plain.keyring", &n_data);
-	res = gck_secret_binary_read (collection, sdata, data, n_data);
+	res = gkm_secret_binary_read (collection, sdata, data, n_data);
 	g_free (data);
 
-	g_assert (res == GCK_DATA_UNRECOGNIZED);
+	g_assert (res == GKM_DATA_UNRECOGNIZED);
 }
 
 DEFINE_TEST(binary_read_wrong_master)
 {
-	GckDataResult res;
-	GckSecret *master;
+	GkmDataResult res;
+	GkmSecret *master;
 	guchar *data;
 	gsize n_data;
 
-	master = gck_secret_new_from_password ("wrong");
-	gck_secret_data_set_master (sdata, master);
+	master = gkm_secret_new_from_password ("wrong");
+	gkm_secret_data_set_master (sdata, master);
 	g_object_unref (master);
 
 	data = test_data_read ("encrypted.keyring", &n_data);
-	res = gck_secret_binary_read (collection, sdata, data, n_data);
+	res = gkm_secret_binary_read (collection, sdata, data, n_data);
 	g_free (data);
 
-	g_assert (res == GCK_DATA_LOCKED);
+	g_assert (res == GKM_DATA_LOCKED);
 }
 
 DEFINE_TEST(binary_read_sdata_but_no_master)
 {
-	GckDataResult res;
+	GkmDataResult res;
 	guchar *data;
 	gsize n_data;
 
-	gck_secret_data_set_master (sdata, NULL);
+	gkm_secret_data_set_master (sdata, NULL);
 
 	data = test_data_read ("encrypted.keyring", &n_data);
-	res = gck_secret_binary_read (collection, sdata, data, n_data);
+	res = gkm_secret_binary_read (collection, sdata, data, n_data);
 	g_free (data);
 
-	g_assert (res == GCK_DATA_LOCKED);
+	g_assert (res == GKM_DATA_LOCKED);
 }
 
 DEFINE_TEST(binary_write)
 {
-	GckDataResult res;
+	GkmDataResult res;
 	guchar *data;
 	gsize n_data;
 
 	test_secret_collection_populate (collection, sdata);
 
-	res = gck_secret_binary_write (collection, sdata, &data, &n_data);
-	g_assert (res == GCK_DATA_SUCCESS);
+	res = gkm_secret_binary_write (collection, sdata, &data, &n_data);
+	g_assert (res == GKM_DATA_SUCCESS);
 	g_assert (data);
 	g_assert (n_data);
 
 	/* Try parsing it again */
-	res = gck_secret_binary_read (collection, sdata, data, n_data);
-	g_assert (res == GCK_DATA_SUCCESS);
+	res = gkm_secret_binary_read (collection, sdata, data, n_data);
+	g_assert (res == GKM_DATA_SUCCESS);
 }
 
 DEFINE_TEST(binary_remove_unavailable)
 {
-	GckDataResult res;
+	GkmDataResult res;
 	GList *items;
 	guchar *data;
 	gsize n_data;
 
 	data = test_data_read ("encrypted.keyring", &n_data);
-	res = gck_secret_binary_read (collection, sdata, data, n_data);
-	g_assert (res == GCK_DATA_SUCCESS);
+	res = gkm_secret_binary_read (collection, sdata, data, n_data);
+	g_assert (res == GKM_DATA_SUCCESS);
 
 	/* Two items from the file */
-	items = gck_secret_collection_get_items (collection);
+	items = gkm_secret_collection_get_items (collection);
 	g_assert_cmpint (g_list_length (items), ==, 2);
 	g_list_free (items);
 
@@ -183,16 +183,16 @@ DEFINE_TEST(binary_remove_unavailable)
 	test_secret_collection_populate (collection, sdata);
 
 	/* Should have added three more */
-	items = gck_secret_collection_get_items (collection);
+	items = gkm_secret_collection_get_items (collection);
 	g_assert_cmpint (g_list_length (items), ==, 5);
 	g_list_free (items);
 
 	/* Re-read the keyring */
-	res = gck_secret_binary_read (collection, sdata, data, n_data);
-	g_assert (res == GCK_DATA_SUCCESS);
+	res = gkm_secret_binary_read (collection, sdata, data, n_data);
+	g_assert (res == GKM_DATA_SUCCESS);
 
 	/* And we're back to two */
-	items = gck_secret_collection_get_items (collection);
+	items = gkm_secret_collection_get_items (collection);
 	g_assert_cmpint (g_list_length (items), ==, 2);
 	g_list_free (items);
 
diff --git a/pkcs11/secret-store/tests/unit-test-secret-collection.c b/pkcs11/secret-store/tests/unit-test-secret-collection.c
index 0a77d28..39a8285 100644
--- a/pkcs11/secret-store/tests/unit-test-secret-collection.c
+++ b/pkcs11/secret-store/tests/unit-test-secret-collection.c
@@ -26,13 +26,13 @@
 #include "run-auto-test.h"
 #include "test-secret-module.h"
 
-#include "gck-secret-data.h"
-#include "gck-secret-collection.h"
-#include "gck-secret-item.h"
+#include "gkm-secret-data.h"
+#include "gkm-secret-collection.h"
+#include "gkm-secret-item.h"
 
-#include "gck/gck-credential.h"
-#include "gck/gck-session.h"
-#include "gck/gck-transaction.h"
+#include "gkm/gkm-credential.h"
+#include "gkm/gkm-session.h"
+#include "gkm/gkm-transaction.h"
 
 #include "pkcs11/pkcs11i.h"
 
@@ -42,16 +42,16 @@
 #include <stdio.h>
 #include <string.h>
 
-static GckModule *module = NULL;
-static GckSession *session = NULL;
+static GkmModule *module = NULL;
+static GkmSession *session = NULL;
 static CK_OBJECT_HANDLE credential = 0;
 static CK_OBJECT_HANDLE credential2 = 0;
-static GckSecretCollection *collection = NULL;
+static GkmSecretCollection *collection = NULL;
 
 DEFINE_SETUP(secret_collection)
 {
 	CK_OBJECT_CLASS klass = CKO_G_CREDENTIAL;
-	GckObject *cred;
+	GkmObject *cred;
 
 	CK_ATTRIBUTE attrs[] = {
 		{ CKA_CLASS, &klass, sizeof (klass) },
@@ -61,23 +61,23 @@ DEFINE_SETUP(secret_collection)
 	module = test_secret_module_initialize_and_enter ();
 	session = test_secret_module_open_session (TRUE);
 
-	collection = g_object_new (GCK_TYPE_SECRET_COLLECTION,
+	collection = g_object_new (GKM_TYPE_SECRET_COLLECTION,
 	                           "module", module,
 	                           "identifier", "test",
 	                           NULL);
-	g_assert (GCK_IS_SECRET_COLLECTION (collection));
+	g_assert (GKM_IS_SECRET_COLLECTION (collection));
 
 	/* Make two credentials */
-	cred = gck_session_create_object_for_factory (session, GCK_FACTORY_CREDENTIAL, NULL,
+	cred = gkm_session_create_object_for_factory (session, GKM_FACTORY_CREDENTIAL, NULL,
 	                                            attrs, G_N_ELEMENTS (attrs));
 	g_assert (cred != NULL);
-	credential = gck_object_get_handle (GCK_OBJECT (cred));
+	credential = gkm_object_get_handle (GKM_OBJECT (cred));
 	g_object_unref (cred);
 
-	cred = gck_session_create_object_for_factory (session, GCK_FACTORY_CREDENTIAL, NULL,
+	cred = gkm_session_create_object_for_factory (session, GKM_FACTORY_CREDENTIAL, NULL,
 	                                            attrs, G_N_ELEMENTS (attrs));
 	g_assert (cred != NULL);
-	credential2 = gck_object_get_handle (GCK_OBJECT (cred));
+	credential2 = gkm_object_get_handle (GKM_OBJECT (cred));
 	g_object_unref (cred);
 }
 
@@ -98,41 +98,41 @@ DEFINE_TEST(secret_collection_is_locked)
 	gboolean locked;
 
 	/* By default is locked */
-	locked = gck_secret_object_is_locked (GCK_SECRET_OBJECT (collection), session);
+	locked = gkm_secret_object_is_locked (GKM_SECRET_OBJECT (collection), session);
 	g_assert (locked == TRUE);
 }
 
 DEFINE_TEST(secret_collection_unlocked_data)
 {
-	GckCredential *cred;
-	GckSecretData *sdata;
+	GkmCredential *cred;
+	GkmSecretData *sdata;
 	CK_RV rv;
 
 	/* Create credential, which unlocks collection */
-	rv = gck_credential_create (module, gck_session_get_manager (session), GCK_OBJECT (collection), NULL, 0, &cred);
+	rv = gkm_credential_create (module, gkm_session_get_manager (session), GKM_OBJECT (collection), NULL, 0, &cred);
 	g_assert (rv == CKR_OK);
-	gck_session_add_session_object (session, NULL, GCK_OBJECT (cred));
+	gkm_session_add_session_object (session, NULL, GKM_OBJECT (cred));
 	g_object_unref (cred);
 
 	/* Collection should now be unlocked */
-	sdata = gck_secret_collection_unlocked_use (collection, session);
-	g_assert (GCK_IS_SECRET_DATA (sdata));
-	g_assert (!gck_secret_object_is_locked (GCK_SECRET_OBJECT (collection), session));
+	sdata = gkm_secret_collection_unlocked_use (collection, session);
+	g_assert (GKM_IS_SECRET_DATA (sdata));
+	g_assert (!gkm_secret_object_is_locked (GKM_SECRET_OBJECT (collection), session));
 	g_object_unref (sdata);
 }
 
 DEFINE_TEST(secret_collection_get_filename)
 {
-	GckSecretCollection *other;
+	GkmSecretCollection *other;
 	const gchar *filename;
 
-	other = g_object_new (GCK_TYPE_SECRET_COLLECTION,
+	other = g_object_new (GKM_TYPE_SECRET_COLLECTION,
 	                      "module", module,
 	                      "identifier", "test",
 	                      "filename", "/tmp/filename.keyring",
 	                      NULL);
 
-	filename = gck_secret_collection_get_filename (other);
+	filename = gkm_secret_collection_get_filename (other);
 	g_assert_cmpstr (filename, ==, "/tmp/filename.keyring");
 
 	g_object_unref (other);
@@ -142,212 +142,212 @@ DEFINE_TEST(secret_collection_set_filename)
 {
 	const gchar *filename;
 
-	gck_secret_collection_set_filename (collection, "/tmp/filename.keyring");
+	gkm_secret_collection_set_filename (collection, "/tmp/filename.keyring");
 
-	filename = gck_secret_collection_get_filename (collection);
+	filename = gkm_secret_collection_get_filename (collection);
 	g_assert_cmpstr (filename, ==, "/tmp/filename.keyring");
 }
 
 DEFINE_TEST(secret_collection_has_item)
 {
-	GckSecretItem *item;
+	GkmSecretItem *item;
 
-	item = gck_secret_collection_new_item (collection, "testo");
-	g_assert (gck_secret_collection_has_item (collection, item));
+	item = gkm_secret_collection_new_item (collection, "testo");
+	g_assert (gkm_secret_collection_has_item (collection, item));
 }
 
 DEFINE_TEST(secret_collection_load_unlock_plain)
 {
-	GckCredential *cred;
-	GckSecretData *sdata;
-	GckDataResult res;
+	GkmCredential *cred;
+	GkmSecretData *sdata;
+	GkmDataResult res;
 	gchar *filename;
 	CK_RV rv;
 
 	filename = test_data_filename ("plain.keyring");
-	gck_secret_collection_set_filename (collection, filename);
+	gkm_secret_collection_set_filename (collection, filename);
 	g_free (filename);
 
 	/* Load the data in the file */
-	res = gck_secret_collection_load (collection);
-	g_assert (res == GCK_DATA_SUCCESS);
+	res = gkm_secret_collection_load (collection);
+	g_assert (res == GKM_DATA_SUCCESS);
 
 	/* Unlock the keyring, which should load again */
-	rv = gck_credential_create (module, gck_session_get_manager (session), GCK_OBJECT (collection), NULL, 0, &cred);
+	rv = gkm_credential_create (module, gkm_session_get_manager (session), GKM_OBJECT (collection), NULL, 0, &cred);
 	g_assert (rv == CKR_OK);
-	gck_session_add_session_object (session, NULL, GCK_OBJECT (cred));
+	gkm_session_add_session_object (session, NULL, GKM_OBJECT (cred));
 	g_object_unref (cred);
 
-	sdata = gck_secret_collection_unlocked_use (collection, session);
-	g_assert (sdata != NULL && GCK_IS_SECRET_DATA (sdata));
+	sdata = gkm_secret_collection_unlocked_use (collection, session);
+	g_assert (sdata != NULL && GKM_IS_SECRET_DATA (sdata));
 	test_secret_collection_validate (collection, sdata);
 	g_object_unref (sdata);
 }
 
 DEFINE_TEST(secret_collection_load_unlock_encrypted)
 {
-	GckCredential *cred;
-	GckSecretData *sdata;
-	GckDataResult res;
+	GkmCredential *cred;
+	GkmSecretData *sdata;
+	GkmDataResult res;
 	gchar *filename;
 	CK_RV rv;
 
 	filename = test_data_filename ("encrypted.keyring");
-	gck_secret_collection_set_filename (collection, filename);
+	gkm_secret_collection_set_filename (collection, filename);
 	g_free (filename);
 
 	/* Load the data in the file */
-	res = gck_secret_collection_load (collection);
-	g_assert (res == GCK_DATA_SUCCESS);
+	res = gkm_secret_collection_load (collection);
+	g_assert (res == GKM_DATA_SUCCESS);
 
 	/* Unlock the keyring, which should load again */
-	rv = gck_credential_create (module, gck_session_get_manager (session), GCK_OBJECT (collection),
+	rv = gkm_credential_create (module, gkm_session_get_manager (session), GKM_OBJECT (collection),
 	                            (guchar*)"my-keyring-password", 19, &cred);
 	g_assert (rv == CKR_OK);
-	gck_session_add_session_object (session, NULL, GCK_OBJECT (cred));
+	gkm_session_add_session_object (session, NULL, GKM_OBJECT (cred));
 	g_object_unref (cred);
 
-	sdata = gck_secret_collection_unlocked_use (collection, session);
-	g_assert (sdata != NULL && GCK_IS_SECRET_DATA (sdata));
+	sdata = gkm_secret_collection_unlocked_use (collection, session);
+	g_assert (sdata != NULL && GKM_IS_SECRET_DATA (sdata));
 	test_secret_collection_validate (collection, sdata);
 	g_object_unref (sdata);
 }
 
 DEFINE_TEST(secret_collection_load_unlock_bad_password)
 {
-	GckCredential *cred;
-	GckDataResult res;
+	GkmCredential *cred;
+	GkmDataResult res;
 	gchar *filename;
 	CK_RV rv;
 
 	filename = test_data_filename ("encrypted.keyring");
-	gck_secret_collection_set_filename (collection, filename);
+	gkm_secret_collection_set_filename (collection, filename);
 	g_free (filename);
 
 	/* Load the data in the file */
-	res = gck_secret_collection_load (collection);
-	g_assert (res == GCK_DATA_SUCCESS);
+	res = gkm_secret_collection_load (collection);
+	g_assert (res == GKM_DATA_SUCCESS);
 
 	/* Unlock the keyring, which should load again */
-	rv = gck_credential_create (module, gck_session_get_manager (session), GCK_OBJECT (collection),
+	rv = gkm_credential_create (module, gkm_session_get_manager (session), GKM_OBJECT (collection),
 	                            (guchar*)"wrong", 5, &cred);
 	g_assert (rv == CKR_PIN_INCORRECT);
 }
 
 DEFINE_TEST(secret_collection_unlock_without_load)
 {
-	GckCredential *cred;
-	GckSecretData *sdata;
+	GkmCredential *cred;
+	GkmSecretData *sdata;
 	gchar *filename;
 	CK_RV rv;
 
 	filename = test_data_filename ("encrypted.keyring");
-	gck_secret_collection_set_filename (collection, filename);
+	gkm_secret_collection_set_filename (collection, filename);
 	g_free (filename);
 
 	/* Unlock the keyring, which should load it */
-	rv = gck_credential_create (module, gck_session_get_manager (session), GCK_OBJECT (collection),
+	rv = gkm_credential_create (module, gkm_session_get_manager (session), GKM_OBJECT (collection),
 	                            (guchar*)"my-keyring-password", 19, &cred);
 	g_assert (rv == CKR_OK);
-	gck_session_add_session_object (session, NULL, GCK_OBJECT (cred));
+	gkm_session_add_session_object (session, NULL, GKM_OBJECT (cred));
 	g_object_unref (cred);
 
-	sdata = gck_secret_collection_unlocked_use (collection, session);
-	g_assert (sdata != NULL && GCK_IS_SECRET_DATA (sdata));
+	sdata = gkm_secret_collection_unlocked_use (collection, session);
+	g_assert (sdata != NULL && GKM_IS_SECRET_DATA (sdata));
 	test_secret_collection_validate (collection, sdata);
 	g_object_unref (sdata);
 }
 
 DEFINE_TEST(secret_collection_twice_unlock)
 {
-	GckCredential *cred;
-	GckSecretData *sdata;
+	GkmCredential *cred;
+	GkmSecretData *sdata;
 	gchar *filename;
 	CK_RV rv;
 
 	filename = test_data_filename ("encrypted.keyring");
-	gck_secret_collection_set_filename (collection, filename);
+	gkm_secret_collection_set_filename (collection, filename);
 	g_free (filename);
 
 	/* Unlock the keyring, which should load */
-	rv = gck_credential_create (module, gck_session_get_manager (session), GCK_OBJECT (collection),
+	rv = gkm_credential_create (module, gkm_session_get_manager (session), GKM_OBJECT (collection),
 	                            (guchar*)"my-keyring-password", 19, &cred);
 	g_assert (rv == CKR_OK);
-	gck_session_add_session_object (session, NULL, GCK_OBJECT (cred));
+	gkm_session_add_session_object (session, NULL, GKM_OBJECT (cred));
 	g_object_unref (cred);
 
 	/* Unlock the keyring again, which should not reload */
-	rv = gck_credential_create (module, gck_session_get_manager (session), GCK_OBJECT (collection),
+	rv = gkm_credential_create (module, gkm_session_get_manager (session), GKM_OBJECT (collection),
 	                            (guchar*)"my-keyring-password", 19, &cred);
 	g_assert (rv == CKR_OK);
-	gck_session_add_session_object (session, NULL, GCK_OBJECT (cred));
+	gkm_session_add_session_object (session, NULL, GKM_OBJECT (cred));
 	g_object_unref (cred);
 
-	sdata = gck_secret_collection_unlocked_use (collection, session);
-	g_assert (sdata != NULL && GCK_IS_SECRET_DATA (sdata));
+	sdata = gkm_secret_collection_unlocked_use (collection, session);
+	g_assert (sdata != NULL && GKM_IS_SECRET_DATA (sdata));
 	test_secret_collection_validate (collection, sdata);
 	g_object_unref (sdata);
 }
 
 DEFINE_TEST(secret_collection_twice_unlock_bad_password)
 {
-	GckCredential *cred;
-	GckSecretData *sdata;
+	GkmCredential *cred;
+	GkmSecretData *sdata;
 	gchar *filename;
 	CK_RV rv;
 
 	filename = test_data_filename ("encrypted.keyring");
-	gck_secret_collection_set_filename (collection, filename);
+	gkm_secret_collection_set_filename (collection, filename);
 	g_free (filename);
 
 	/* Unlock the keyring, which should load */
-	rv = gck_credential_create (module, gck_session_get_manager (session), GCK_OBJECT (collection),
+	rv = gkm_credential_create (module, gkm_session_get_manager (session), GKM_OBJECT (collection),
 	                               (guchar*)"my-keyring-password", 19, &cred);
 	g_assert (rv == CKR_OK);
-	gck_session_add_session_object (session, NULL, GCK_OBJECT (cred));
+	gkm_session_add_session_object (session, NULL, GKM_OBJECT (cred));
 	g_object_unref (cred);
 
 	/* Unlock the keyring again, wrong password */
-	rv = gck_credential_create (module, gck_session_get_manager (session), GCK_OBJECT (collection),
+	rv = gkm_credential_create (module, gkm_session_get_manager (session), GKM_OBJECT (collection),
 	                            (guchar*)"wrong", 5, &cred);
 	g_assert (rv == CKR_PIN_INCORRECT);
 
-	sdata = gck_secret_collection_unlocked_use (collection, session);
-	g_assert (sdata != NULL && GCK_IS_SECRET_DATA (sdata));
+	sdata = gkm_secret_collection_unlocked_use (collection, session);
+	g_assert (sdata != NULL && GKM_IS_SECRET_DATA (sdata));
 	test_secret_collection_validate (collection, sdata);
 	g_object_unref (sdata);
 }
 
 DEFINE_TEST(secret_collection_memory_unlock)
 {
-	GckCredential *cred;
-	GckDataResult res;
+	GkmCredential *cred;
+	GkmDataResult res;
 	CK_RV rv;
 
 	/* Load the data in the file */
-	res = gck_secret_collection_load (collection);
-	g_assert (res == GCK_DATA_SUCCESS);
+	res = gkm_secret_collection_load (collection);
+	g_assert (res == GKM_DATA_SUCCESS);
 
 	/* Unlock the keyring, which should load again */
-	rv = gck_credential_create (module, gck_session_get_manager (session), GCK_OBJECT (collection),
+	rv = gkm_credential_create (module, gkm_session_get_manager (session), GKM_OBJECT (collection),
 	                            NULL, 0, &cred);
 	g_assert (rv == CKR_OK);
-	gck_session_add_session_object (session, NULL, GCK_OBJECT (cred));
+	gkm_session_add_session_object (session, NULL, GKM_OBJECT (cred));
 	g_object_unref (cred);
 }
 
 DEFINE_TEST(secret_collection_memory_unlock_bad_password)
 {
-	GckCredential *cred;
-	GckDataResult res;
+	GkmCredential *cred;
+	GkmDataResult res;
 	CK_RV rv;
 
 	/* Load the data in the file */
-	res = gck_secret_collection_load (collection);
-	g_assert (res == GCK_DATA_SUCCESS);
+	res = gkm_secret_collection_load (collection);
+	g_assert (res == GKM_DATA_SUCCESS);
 
 	/* Unlock the keyring, which should load again */
-	rv = gck_credential_create (module, gck_session_get_manager (session), GCK_OBJECT (collection),
+	rv = gkm_credential_create (module, gkm_session_get_manager (session), GKM_OBJECT (collection),
 	                            (guchar*)"wrong", 5, &cred);
 	g_assert (rv == CKR_PIN_INCORRECT);
 }
@@ -355,7 +355,7 @@ DEFINE_TEST(secret_collection_memory_unlock_bad_password)
 DEFINE_TEST(secret_collection_factory)
 {
 	CK_OBJECT_CLASS klass = CKO_G_COLLECTION;
-	GckObject *object;
+	GkmObject *object;
 
 	CK_ATTRIBUTE attrs[] = {
 		{ CKA_CLASS, &klass, sizeof (klass) },
@@ -363,12 +363,12 @@ DEFINE_TEST(secret_collection_factory)
 		{ CKA_G_CREDENTIAL, &credential, sizeof (credential) },
 	};
 
-	object = gck_session_create_object_for_factory (session, GCK_FACTORY_SECRET_COLLECTION, NULL,
+	object = gkm_session_create_object_for_factory (session, GKM_FACTORY_SECRET_COLLECTION, NULL,
 	                                                attrs, G_N_ELEMENTS (attrs));
 	g_assert (object != NULL);
-	g_assert (GCK_IS_SECRET_COLLECTION (object));
+	g_assert (GKM_IS_SECRET_COLLECTION (object));
 
-	g_assert_cmpstr (gck_secret_object_get_label (GCK_SECRET_OBJECT (object)), ==, "blah");
+	g_assert_cmpstr (gkm_secret_object_get_label (GKM_SECRET_OBJECT (object)), ==, "blah");
 	g_object_unref (object);
 }
 
@@ -376,19 +376,19 @@ DEFINE_TEST(secret_collection_factory_unnamed)
 {
 	CK_OBJECT_CLASS klass = CKO_G_COLLECTION;
 	const gchar *identifier;
-	GckObject *object;
+	GkmObject *object;
 
 	CK_ATTRIBUTE attrs[] = {
 		{ CKA_CLASS, &klass, sizeof (klass) },
 		{ CKA_G_CREDENTIAL, &credential, sizeof (credential) },
 	};
 
-	object = gck_session_create_object_for_factory (session, GCK_FACTORY_SECRET_COLLECTION, NULL,
+	object = gkm_session_create_object_for_factory (session, GKM_FACTORY_SECRET_COLLECTION, NULL,
 	                                                attrs, G_N_ELEMENTS (attrs));
 	g_assert (object != NULL);
-	g_assert (GCK_IS_SECRET_COLLECTION (object));
+	g_assert (GKM_IS_SECRET_COLLECTION (object));
 
-	identifier = gck_secret_object_get_identifier (GCK_SECRET_OBJECT (object));
+	identifier = gkm_secret_object_get_identifier (GKM_SECRET_OBJECT (object));
 	g_assert_cmpstr (identifier, !=, "");
 	g_object_unref (object);
 }
@@ -397,7 +397,7 @@ DEFINE_TEST(secret_collection_factory_token)
 {
 	CK_OBJECT_CLASS klass = CKO_G_COLLECTION;
 	const gchar *identifier;
-	GckObject *object;
+	GkmObject *object;
 	CK_BBOOL token = CK_TRUE;
 
 	CK_ATTRIBUTE attrs[] = {
@@ -407,12 +407,12 @@ DEFINE_TEST(secret_collection_factory_token)
 		{ CKA_G_CREDENTIAL, &credential, sizeof (credential) },
 	};
 
-	object = gck_session_create_object_for_factory (session, GCK_FACTORY_SECRET_COLLECTION, NULL,
+	object = gkm_session_create_object_for_factory (session, GKM_FACTORY_SECRET_COLLECTION, NULL,
 	                                                attrs, G_N_ELEMENTS (attrs));
 	g_assert (object != NULL);
-	g_assert (GCK_IS_SECRET_COLLECTION (object));
+	g_assert (GKM_IS_SECRET_COLLECTION (object));
 
-	identifier = gck_secret_object_get_identifier (GCK_SECRET_OBJECT (object));
+	identifier = gkm_secret_object_get_identifier (GKM_SECRET_OBJECT (object));
 	g_assert (strstr (identifier, "blah"));
 	g_object_unref (object);
 }
@@ -421,7 +421,7 @@ DEFINE_TEST(secret_collection_factory_duplicate)
 {
 	CK_OBJECT_CLASS klass = CKO_G_COLLECTION;
 	const gchar *identifier1, *identifier2;
-	GckObject *object;
+	GkmObject *object;
 
 	CK_ATTRIBUTE attrs[] = {
 		{ CKA_G_CREDENTIAL, &credential, sizeof (credential) },
@@ -429,23 +429,23 @@ DEFINE_TEST(secret_collection_factory_duplicate)
 		{ CKA_LABEL, "blah", 4 },
 	};
 
-	object = gck_session_create_object_for_factory (session, GCK_FACTORY_SECRET_COLLECTION, NULL,
+	object = gkm_session_create_object_for_factory (session, GKM_FACTORY_SECRET_COLLECTION, NULL,
 	                                                attrs, G_N_ELEMENTS (attrs));
 	g_assert (object != NULL);
-	g_assert (GCK_IS_SECRET_COLLECTION (object));
+	g_assert (GKM_IS_SECRET_COLLECTION (object));
 
-	identifier1 = gck_secret_object_get_identifier (GCK_SECRET_OBJECT (object));
+	identifier1 = gkm_secret_object_get_identifier (GKM_SECRET_OBJECT (object));
 	g_assert (strstr (identifier1, "blah"));
 	g_object_unref (object);
 
 	/* Use second credential for second object */
 	attrs[0].pValue = &credential2;
-	object = gck_session_create_object_for_factory (session, GCK_FACTORY_SECRET_COLLECTION, NULL,
+	object = gkm_session_create_object_for_factory (session, GKM_FACTORY_SECRET_COLLECTION, NULL,
 	                                                attrs, G_N_ELEMENTS (attrs));
 	g_assert (object != NULL);
-	g_assert (GCK_IS_SECRET_COLLECTION (object));
+	g_assert (GKM_IS_SECRET_COLLECTION (object));
 
-	identifier2 = gck_secret_object_get_identifier (GCK_SECRET_OBJECT (object));
+	identifier2 = gkm_secret_object_get_identifier (GKM_SECRET_OBJECT (object));
 	g_assert (strstr (identifier2, "blah"));
 	g_object_unref (object);
 
@@ -457,7 +457,7 @@ DEFINE_TEST(secret_collection_factory_item)
 	CK_OBJECT_CLASS c_klass = CKO_G_COLLECTION;
 	CK_OBJECT_CLASS i_klass = CKO_SECRET_KEY;
 	const gchar *identifier;
-	GckObject *object;
+	GkmObject *object;
 	CK_BBOOL token = CK_TRUE;
 
 	CK_ATTRIBUTE c_attrs[] = {
@@ -474,27 +474,27 @@ DEFINE_TEST(secret_collection_factory_item)
 		{ CKA_LABEL, "Item", 4 },
 	};
 
-	object = gck_session_create_object_for_factory (session, GCK_FACTORY_SECRET_COLLECTION, NULL,
+	object = gkm_session_create_object_for_factory (session, GKM_FACTORY_SECRET_COLLECTION, NULL,
 	                                                c_attrs, G_N_ELEMENTS (c_attrs));
 	g_assert (object != NULL);
-	g_assert (GCK_IS_SECRET_COLLECTION (object));
-	identifier = gck_secret_object_get_identifier (GCK_SECRET_OBJECT (object));
+	g_assert (GKM_IS_SECRET_COLLECTION (object));
+	identifier = gkm_secret_object_get_identifier (GKM_SECRET_OBJECT (object));
 	g_object_unref (object);
 
 	i_attrs[0].pValue = (gpointer)identifier;
 	i_attrs[0].ulValueLen = strlen (identifier);
-	object = gck_session_create_object_for_factory (session, GCK_FACTORY_SECRET_ITEM, NULL,
+	object = gkm_session_create_object_for_factory (session, GKM_FACTORY_SECRET_ITEM, NULL,
 	                                                i_attrs, G_N_ELEMENTS (i_attrs));
 	g_assert (object != NULL);
-	g_assert (GCK_IS_SECRET_ITEM (object));
+	g_assert (GKM_IS_SECRET_ITEM (object));
 	g_object_unref (object);
 }
 
 DEFINE_TEST(secret_collection_token_remove)
 {
 	CK_OBJECT_CLASS klass = CKO_G_COLLECTION;
-	GckTransaction *transaction;
-	GckObject *object;
+	GkmTransaction *transaction;
+	GkmObject *object;
 	CK_BBOOL token = CK_TRUE;
 
 	CK_ATTRIBUTE attrs[] = {
@@ -504,15 +504,15 @@ DEFINE_TEST(secret_collection_token_remove)
 		{ CKA_G_CREDENTIAL, &credential, sizeof (credential) },
 	};
 
-	object = gck_session_create_object_for_factory (session, GCK_FACTORY_SECRET_COLLECTION, NULL,
+	object = gkm_session_create_object_for_factory (session, GKM_FACTORY_SECRET_COLLECTION, NULL,
 	                                                attrs, G_N_ELEMENTS (attrs));
 	g_assert (object != NULL);
-	g_assert (GCK_IS_SECRET_COLLECTION (object));
+	g_assert (GKM_IS_SECRET_COLLECTION (object));
 
-	transaction = gck_transaction_new ();
-	gck_module_remove_token_object (module, transaction, object);
-	g_assert (!gck_transaction_get_failed (transaction));
-	gck_transaction_complete (transaction);
+	transaction = gkm_transaction_new ();
+	gkm_module_remove_token_object (module, transaction, object);
+	g_assert (!gkm_transaction_get_failed (transaction));
+	gkm_transaction_complete (transaction);
 	g_object_unref (transaction);
 	g_object_unref (object);
 }
@@ -521,9 +521,9 @@ DEFINE_TEST(secret_collection_token_item_remove)
 {
 	CK_OBJECT_CLASS c_klass = CKO_G_COLLECTION;
 	CK_OBJECT_CLASS i_klass = CKO_SECRET_KEY;
-	GckTransaction *transaction;
+	GkmTransaction *transaction;
 	const gchar *identifier;
-	GckObject *object;
+	GkmObject *object;
 	CK_BBOOL token = CK_TRUE;
 
 	CK_ATTRIBUTE c_attrs[] = {
@@ -540,24 +540,24 @@ DEFINE_TEST(secret_collection_token_item_remove)
 		{ CKA_LABEL, "Item", 4 },
 	};
 
-	object = gck_session_create_object_for_factory (session, GCK_FACTORY_SECRET_COLLECTION, NULL,
+	object = gkm_session_create_object_for_factory (session, GKM_FACTORY_SECRET_COLLECTION, NULL,
 	                                                c_attrs, G_N_ELEMENTS (c_attrs));
 	g_assert (object != NULL);
-	g_assert (GCK_IS_SECRET_COLLECTION (object));
-	identifier = gck_secret_object_get_identifier (GCK_SECRET_OBJECT (object));
+	g_assert (GKM_IS_SECRET_COLLECTION (object));
+	identifier = gkm_secret_object_get_identifier (GKM_SECRET_OBJECT (object));
 	g_object_unref (object);
 
 	i_attrs[0].pValue = (gpointer)identifier;
 	i_attrs[0].ulValueLen = strlen (identifier);
-	object = gck_session_create_object_for_factory (session, GCK_FACTORY_SECRET_ITEM, NULL,
+	object = gkm_session_create_object_for_factory (session, GKM_FACTORY_SECRET_ITEM, NULL,
 	                                                i_attrs, G_N_ELEMENTS (i_attrs));
 	g_assert (object != NULL);
-	g_assert (GCK_IS_SECRET_ITEM (object));
+	g_assert (GKM_IS_SECRET_ITEM (object));
 
-	transaction = gck_transaction_new ();
-	gck_module_remove_token_object (module, transaction, object);
-	g_assert (!gck_transaction_get_failed (transaction));
-	gck_transaction_complete (transaction);
+	transaction = gkm_transaction_new ();
+	gkm_module_remove_token_object (module, transaction, object);
+	g_assert (!gkm_transaction_get_failed (transaction));
+	gkm_transaction_complete (transaction);
 	g_object_unref (transaction);
 	g_object_unref (object);
 }
diff --git a/pkcs11/secret-store/tests/unit-test-secret-compat.c b/pkcs11/secret-store/tests/unit-test-secret-compat.c
index 2960203..96629fd 100644
--- a/pkcs11/secret-store/tests/unit-test-secret-compat.c
+++ b/pkcs11/secret-store/tests/unit-test-secret-compat.c
@@ -25,7 +25,7 @@
 
 #include "run-auto-test.h"
 
-#include "gck-secret-compat.h"
+#include "gkm-secret-compat.h"
 
 #include <glib.h>
 
@@ -35,56 +35,56 @@
 
 DEFINE_TEST(access_free)
 {
-	GckSecretAccess *ac;
+	GkmSecretAccess *ac;
 
-	ac = g_new0 (GckSecretAccess, 1);
+	ac = g_new0 (GkmSecretAccess, 1);
 	ac->pathname = g_strdup ("/path");
 	ac->display_name = g_strdup ("Display");
-	ac->types_allowed = GCK_SECRET_ACCESS_READ;
-	
-	gck_secret_compat_access_free (ac);
+	ac->types_allowed = GKM_SECRET_ACCESS_READ;
+
+	gkm_secret_compat_access_free (ac);
 }
 
 DEFINE_TEST(acl_free)
 {
-	GckSecretAccess *ac;
+	GkmSecretAccess *ac;
 	GList *acl = NULL;
 	int i;
-	
+
 	for (i = 0; i < 10; ++i) {
-		ac = g_new0 (GckSecretAccess, 1);
+		ac = g_new0 (GkmSecretAccess, 1);
 		ac->pathname = g_strdup ("/path");
 		ac->display_name = g_strdup ("Display");
-		ac->types_allowed = GCK_SECRET_ACCESS_READ;
+		ac->types_allowed = GKM_SECRET_ACCESS_READ;
 		acl = g_list_prepend (acl, ac);
 	}
-	
-	gck_secret_compat_acl_free (acl);
+
+	gkm_secret_compat_acl_free (acl);
 }
 
 DEFINE_TEST(parse_item_type)
 {
 	guint type;
 
-	type = gck_secret_compat_parse_item_type ("org.freedesktop.Secret.Generic");
+	type = gkm_secret_compat_parse_item_type ("org.freedesktop.Secret.Generic");
 	g_assert_cmpuint (type, ==, 0);
-	type = gck_secret_compat_parse_item_type ("org.gnome.keyring.NetworkPassword");
+	type = gkm_secret_compat_parse_item_type ("org.gnome.keyring.NetworkPassword");
 	g_assert_cmpuint (type, ==, 1);
-	type = gck_secret_compat_parse_item_type ("org.gnome.keyring.Note");
+	type = gkm_secret_compat_parse_item_type ("org.gnome.keyring.Note");
 	g_assert_cmpuint (type, ==, 2);
-	type = gck_secret_compat_parse_item_type ("org.gnome.keyring.ChainedKeyring");
+	type = gkm_secret_compat_parse_item_type ("org.gnome.keyring.ChainedKeyring");
 	g_assert_cmpuint (type, ==, 3);
-	type = gck_secret_compat_parse_item_type ("org.gnome.keyring.EncryptionKey");
+	type = gkm_secret_compat_parse_item_type ("org.gnome.keyring.EncryptionKey");
 	g_assert_cmpuint (type, ==, 4);
-	type = gck_secret_compat_parse_item_type ("org.gnome.keyring.PkStorage");
+	type = gkm_secret_compat_parse_item_type ("org.gnome.keyring.PkStorage");
 	g_assert_cmpuint (type, ==, 0x100);
 
 	/* Invalid returns generic secret */
-	type = gck_secret_compat_parse_item_type ("invalid");
+	type = gkm_secret_compat_parse_item_type ("invalid");
 	g_assert_cmpuint (type, ==, 0);
 
 	/* Null returns generic secret */
-	type = gck_secret_compat_parse_item_type (NULL);
+	type = gkm_secret_compat_parse_item_type (NULL);
 	g_assert_cmpuint (type, ==, 0);
 }
 
@@ -92,24 +92,24 @@ DEFINE_TEST(format_item_type)
 {
 	const gchar *type;
 
-	type = gck_secret_compat_format_item_type (0);
+	type = gkm_secret_compat_format_item_type (0);
 	g_assert_cmpstr (type, ==, "org.freedesktop.Secret.Generic");
-	type = gck_secret_compat_format_item_type (1);
+	type = gkm_secret_compat_format_item_type (1);
 	g_assert_cmpstr (type, ==, "org.gnome.keyring.NetworkPassword");
-	type = gck_secret_compat_format_item_type (2);
+	type = gkm_secret_compat_format_item_type (2);
 	g_assert_cmpstr (type, ==, "org.gnome.keyring.Note");
-	type = gck_secret_compat_format_item_type (3);
+	type = gkm_secret_compat_format_item_type (3);
 	g_assert_cmpstr (type, ==, "org.gnome.keyring.ChainedKeyring");
-	type = gck_secret_compat_format_item_type (4);
+	type = gkm_secret_compat_format_item_type (4);
 	g_assert_cmpstr (type, ==, "org.gnome.keyring.EncryptionKey");
-	type = gck_secret_compat_format_item_type (0x100);
+	type = gkm_secret_compat_format_item_type (0x100);
 	g_assert_cmpstr (type, ==, "org.gnome.keyring.PkStorage");
 
 	/* Higher bits shouldn't make a difference */
-	type = gck_secret_compat_format_item_type (0xF0000001);
+	type = gkm_secret_compat_format_item_type (0xF0000001);
 	g_assert_cmpstr (type, ==, "org.gnome.keyring.NetworkPassword");
 
 	/* Unrecognized should be null */
-	type = gck_secret_compat_format_item_type (32);
+	type = gkm_secret_compat_format_item_type (32);
 	g_assert (type == NULL);
 }
diff --git a/pkcs11/secret-store/tests/unit-test-secret-data.c b/pkcs11/secret-store/tests/unit-test-secret-data.c
index 9ca3ff5..eacb76e 100644
--- a/pkcs11/secret-store/tests/unit-test-secret-data.c
+++ b/pkcs11/secret-store/tests/unit-test-secret-data.c
@@ -25,10 +25,10 @@
 
 #include "run-auto-test.h"
 
-#include "gck-secret-data.h"
+#include "gkm-secret-data.h"
 
-#include "gck/gck-secret.h"
-#include "gck/gck-transaction.h"
+#include "gkm/gkm-secret.h"
+#include "gkm/gkm-transaction.h"
 
 #include <glib.h>
 
@@ -38,44 +38,44 @@
 
 DEFINE_TEST(secret_data_new)
 {
-	GckSecretData *data = g_object_new (GCK_TYPE_SECRET_DATA, NULL);
-	g_assert (GCK_IS_SECRET_DATA (data));
+	GkmSecretData *data = g_object_new (GKM_TYPE_SECRET_DATA, NULL);
+	g_assert (GKM_IS_SECRET_DATA (data));
 	g_object_unref (data);
 }
 
 DEFINE_TEST(secret_data_get_set)
 {
-	GckSecretData *data = g_object_new (GCK_TYPE_SECRET_DATA, NULL);
-	GckSecret *secret = gck_secret_new_from_password ("barn");
-	GckSecret *check;
-	
-	gck_secret_data_set_secret (data, "my-identifier", secret);
+	GkmSecretData *data = g_object_new (GKM_TYPE_SECRET_DATA, NULL);
+	GkmSecret *secret = gkm_secret_new_from_password ("barn");
+	GkmSecret *check;
+
+	gkm_secret_data_set_secret (data, "my-identifier", secret);
 	g_object_unref (secret);
-	
-	check = gck_secret_data_get_secret (data, "my-identifier");
-	g_assert (GCK_IS_SECRET (check));
+
+	check = gkm_secret_data_get_secret (data, "my-identifier");
+	g_assert (GKM_IS_SECRET (check));
 	g_assert (secret == check);
-	g_assert (gck_secret_equals (check, (guchar*)"barn", -1));
-	
+	g_assert (gkm_secret_equals (check, (guchar*)"barn", -1));
+
 	g_object_unref (data);
 }
 
 DEFINE_TEST(secret_data_get_raw)
 {
-	GckSecretData *data = g_object_new (GCK_TYPE_SECRET_DATA, NULL);
-	GckSecret *secret = gck_secret_new_from_password ("barn");
+	GkmSecretData *data = g_object_new (GKM_TYPE_SECRET_DATA, NULL);
+	GkmSecret *secret = gkm_secret_new_from_password ("barn");
 	const guchar *raw;
 	gsize n_raw;
 
-	gck_secret_data_set_secret (data, "my-identifier", secret);
+	gkm_secret_data_set_secret (data, "my-identifier", secret);
 	g_object_unref (secret);
 
-	raw = gck_secret_data_get_raw (data, "my-identifier", &n_raw);
+	raw = gkm_secret_data_get_raw (data, "my-identifier", &n_raw);
 	g_assert (raw);
 	g_assert_cmpuint (n_raw, ==, 4);
 	g_assert (memcmp (raw, "barn", 4) == 0);
 
-	raw = gck_secret_data_get_raw (data, "not-identifier", &n_raw);
+	raw = gkm_secret_data_get_raw (data, "not-identifier", &n_raw);
 	g_assert (raw == NULL);
 
 	g_object_unref (data);
@@ -83,37 +83,37 @@ DEFINE_TEST(secret_data_get_raw)
 
 DEFINE_TEST(secret_data_remove)
 {
-	GckSecretData *data = g_object_new (GCK_TYPE_SECRET_DATA, NULL);
-	GckSecret *secret = gck_secret_new_from_password ("barn");
+	GkmSecretData *data = g_object_new (GKM_TYPE_SECRET_DATA, NULL);
+	GkmSecret *secret = gkm_secret_new_from_password ("barn");
 
-	gck_secret_data_set_secret (data, "my-identifier", secret);
+	gkm_secret_data_set_secret (data, "my-identifier", secret);
 	g_object_unref (secret);
-	
-	secret = gck_secret_data_get_secret (data, "my-identifier");
-	g_assert (GCK_IS_SECRET (secret));
 
-	gck_secret_data_remove_secret (data, "my-identifier");
-	secret = gck_secret_data_get_secret (data, "my-identifier");
+	secret = gkm_secret_data_get_secret (data, "my-identifier");
+	g_assert (GKM_IS_SECRET (secret));
+
+	gkm_secret_data_remove_secret (data, "my-identifier");
+	secret = gkm_secret_data_get_secret (data, "my-identifier");
 	g_assert (!secret);
-	
+
 	g_object_unref (data);
 }
 
 DEFINE_TEST(secret_data_set_transacted)
 {
-	GckTransaction *transaction = gck_transaction_new ();
-	GckSecretData *data = g_object_new (GCK_TYPE_SECRET_DATA, NULL);
-	GckSecret *secret = gck_secret_new_from_password ("barn");
+	GkmTransaction *transaction = gkm_transaction_new ();
+	GkmSecretData *data = g_object_new (GKM_TYPE_SECRET_DATA, NULL);
+	GkmSecret *secret = gkm_secret_new_from_password ("barn");
 
 	/* Transaction, but not complete */
-	gck_secret_data_set_transacted (data, transaction, "my-identifier", secret);
-	g_assert (!gck_transaction_get_failed (transaction));
-	g_assert (gck_secret_data_get_secret (data, "my-identifier") == secret);
+	gkm_secret_data_set_transacted (data, transaction, "my-identifier", secret);
+	g_assert (!gkm_transaction_get_failed (transaction));
+	g_assert (gkm_secret_data_get_secret (data, "my-identifier") == secret);
 
 	/* Transaction complete */
-	gck_transaction_complete (transaction);
-	g_assert (!gck_transaction_get_failed (transaction));
-	g_assert (gck_secret_data_get_secret (data, "my-identifier") == secret);
+	gkm_transaction_complete (transaction);
+	g_assert (!gkm_transaction_get_failed (transaction));
+	g_assert (gkm_secret_data_get_secret (data, "my-identifier") == secret);
 
 	g_object_unref (data);
 	g_object_unref (secret);
@@ -122,24 +122,24 @@ DEFINE_TEST(secret_data_set_transacted)
 
 DEFINE_TEST(secret_data_set_transacted_replace)
 {
-	GckTransaction *transaction = gck_transaction_new ();
-	GckSecretData *data = g_object_new (GCK_TYPE_SECRET_DATA, NULL);
-	GckSecret *old = gck_secret_new_from_password ("old");
-	GckSecret *secret = gck_secret_new_from_password ("secret");
+	GkmTransaction *transaction = gkm_transaction_new ();
+	GkmSecretData *data = g_object_new (GKM_TYPE_SECRET_DATA, NULL);
+	GkmSecret *old = gkm_secret_new_from_password ("old");
+	GkmSecret *secret = gkm_secret_new_from_password ("secret");
 
 	/* The old secret */
-	gck_secret_data_set_secret (data, "my-identifier", old);
-	g_assert (gck_secret_data_get_secret (data, "my-identifier") == old);
+	gkm_secret_data_set_secret (data, "my-identifier", old);
+	g_assert (gkm_secret_data_get_secret (data, "my-identifier") == old);
 
 	/* Transaction, but not complete */
-	gck_secret_data_set_transacted (data, transaction, "my-identifier", secret);
-	g_assert (!gck_transaction_get_failed (transaction));
-	g_assert (gck_secret_data_get_secret (data, "my-identifier") == secret);
+	gkm_secret_data_set_transacted (data, transaction, "my-identifier", secret);
+	g_assert (!gkm_transaction_get_failed (transaction));
+	g_assert (gkm_secret_data_get_secret (data, "my-identifier") == secret);
 
 	/* Transaction complete */
-	gck_transaction_complete (transaction);
-	g_assert (!gck_transaction_get_failed (transaction));
-	g_assert (gck_secret_data_get_secret (data, "my-identifier") == secret);
+	gkm_transaction_complete (transaction);
+	g_assert (!gkm_transaction_get_failed (transaction));
+	g_assert (gkm_secret_data_get_secret (data, "my-identifier") == secret);
 
 	g_object_unref (old);
 	g_object_unref (data);
@@ -149,20 +149,20 @@ DEFINE_TEST(secret_data_set_transacted_replace)
 
 DEFINE_TEST(secret_data_set_transacted_fail)
 {
-	GckTransaction *transaction = gck_transaction_new ();
-	GckSecretData *data = g_object_new (GCK_TYPE_SECRET_DATA, NULL);
-	GckSecret *secret = gck_secret_new_from_password ("barn");
+	GkmTransaction *transaction = gkm_transaction_new ();
+	GkmSecretData *data = g_object_new (GKM_TYPE_SECRET_DATA, NULL);
+	GkmSecret *secret = gkm_secret_new_from_password ("barn");
 
 	/* Transaction, but not complete */
-	gck_secret_data_set_transacted (data, transaction, "my-identifier", secret);
-	g_assert (!gck_transaction_get_failed (transaction));
-	g_assert (gck_secret_data_get_secret (data, "my-identifier") == secret);
+	gkm_secret_data_set_transacted (data, transaction, "my-identifier", secret);
+	g_assert (!gkm_transaction_get_failed (transaction));
+	g_assert (gkm_secret_data_get_secret (data, "my-identifier") == secret);
 
 	/* Transaction fails here */
-	gck_transaction_fail (transaction, CKR_CANCEL);
-	gck_transaction_complete (transaction);
-	g_assert (gck_transaction_get_failed (transaction));
-	g_assert (gck_secret_data_get_secret (data, "my-identifier") == NULL);
+	gkm_transaction_fail (transaction, CKR_CANCEL);
+	gkm_transaction_complete (transaction);
+	g_assert (gkm_transaction_get_failed (transaction));
+	g_assert (gkm_secret_data_get_secret (data, "my-identifier") == NULL);
 
 	g_object_unref (data);
 	g_object_unref (secret);
@@ -171,25 +171,25 @@ DEFINE_TEST(secret_data_set_transacted_fail)
 
 DEFINE_TEST(secret_data_set_transacted_fail_revert)
 {
-	GckTransaction *transaction = gck_transaction_new ();
-	GckSecretData *data = g_object_new (GCK_TYPE_SECRET_DATA, NULL);
-	GckSecret *old = gck_secret_new_from_password ("old");
-	GckSecret *secret = gck_secret_new_from_password ("secret");
+	GkmTransaction *transaction = gkm_transaction_new ();
+	GkmSecretData *data = g_object_new (GKM_TYPE_SECRET_DATA, NULL);
+	GkmSecret *old = gkm_secret_new_from_password ("old");
+	GkmSecret *secret = gkm_secret_new_from_password ("secret");
 
 	/* The old secret */
-	gck_secret_data_set_secret (data, "my-identifier", old);
-	g_assert (gck_secret_data_get_secret (data, "my-identifier") == old);
+	gkm_secret_data_set_secret (data, "my-identifier", old);
+	g_assert (gkm_secret_data_get_secret (data, "my-identifier") == old);
 
 	/* Transaction, but not complete */
-	gck_secret_data_set_transacted (data, transaction, "my-identifier", secret);
-	g_assert (!gck_transaction_get_failed (transaction));
-	g_assert (gck_secret_data_get_secret (data, "my-identifier") == secret);
+	gkm_secret_data_set_transacted (data, transaction, "my-identifier", secret);
+	g_assert (!gkm_transaction_get_failed (transaction));
+	g_assert (gkm_secret_data_get_secret (data, "my-identifier") == secret);
 
 	/* Transaction fails here */
-	gck_transaction_fail (transaction, CKR_CANCEL);
-	gck_transaction_complete (transaction);
-	g_assert (gck_transaction_get_failed (transaction));
-	g_assert (gck_secret_data_get_secret (data, "my-identifier") == old);
+	gkm_transaction_fail (transaction, CKR_CANCEL);
+	gkm_transaction_complete (transaction);
+	g_assert (gkm_transaction_get_failed (transaction));
+	g_assert (gkm_secret_data_get_secret (data, "my-identifier") == old);
 
 	g_object_unref (old);
 	g_object_unref (data);
@@ -199,17 +199,17 @@ DEFINE_TEST(secret_data_set_transacted_fail_revert)
 
 DEFINE_TEST(secret_data_get_set_master)
 {
-	GckSecretData *data = g_object_new (GCK_TYPE_SECRET_DATA, NULL);
-	GckSecret *master = gck_secret_new_from_password ("master");
-	GckSecret *check;
-	
-	gck_secret_data_set_master (data, master);
+	GkmSecretData *data = g_object_new (GKM_TYPE_SECRET_DATA, NULL);
+	GkmSecret *master = gkm_secret_new_from_password ("master");
+	GkmSecret *check;
+
+	gkm_secret_data_set_master (data, master);
 	g_object_unref (master);
-	
-	check = gck_secret_data_get_master (data);
-	g_assert (GCK_IS_SECRET (check));
+
+	check = gkm_secret_data_get_master (data);
+	g_assert (GKM_IS_SECRET (check));
 	g_assert (master == check);
-	g_assert (gck_secret_equals (check, (guchar*)"master", -1));
-	
+	g_assert (gkm_secret_equals (check, (guchar*)"master", -1));
+
 	g_object_unref (data);
 }
diff --git a/pkcs11/secret-store/tests/unit-test-secret-fields.c b/pkcs11/secret-store/tests/unit-test-secret-fields.c
index 8090106..f74b49d 100644
--- a/pkcs11/secret-store/tests/unit-test-secret-fields.c
+++ b/pkcs11/secret-store/tests/unit-test-secret-fields.c
@@ -25,7 +25,7 @@
 
 #include "run-auto-test.h"
 
-#include "gck-secret-fields.h"
+#include "gkm-secret-fields.h"
 
 #include "pkcs11/pkcs11i.h"
 
@@ -37,33 +37,33 @@
 
 DEFINE_TEST(fields_new)
 {
-	GHashTable *fields = gck_secret_fields_new ();
+	GHashTable *fields = gkm_secret_fields_new ();
 	g_hash_table_unref (fields);
 }
 
 DEFINE_TEST(fields_boxed)
 {
-	GType boxed = gck_secret_fields_boxed_type ();
-	GType check = gck_secret_fields_boxed_type ();
+	GType boxed = gkm_secret_fields_boxed_type ();
+	GType check = gkm_secret_fields_boxed_type ();
 	g_assert (boxed == check);
 }
 
 DEFINE_TEST(fields_add_get_values)
 {
-	GHashTable *fields = gck_secret_fields_new ();
+	GHashTable *fields = gkm_secret_fields_new ();
 	const gchar *value;
 
-	gck_secret_fields_add (fields, "one", "value1");
-	gck_secret_fields_take (fields, g_strdup ("two"), g_strdup ("value2"));
-	gck_secret_fields_add (fields, "three", NULL);
+	gkm_secret_fields_add (fields, "one", "value1");
+	gkm_secret_fields_take (fields, g_strdup ("two"), g_strdup ("value2"));
+	gkm_secret_fields_add (fields, "three", NULL);
 
-	value = gck_secret_fields_get (fields, "one");
+	value = gkm_secret_fields_get (fields, "one");
 	g_assert_cmpstr (value, ==, "value1");
 
-	value = gck_secret_fields_get (fields, "two");
+	value = gkm_secret_fields_get (fields, "two");
 	g_assert_cmpstr (value, ==, "value2");
 
-	value = gck_secret_fields_get (fields, "three");
+	value = gkm_secret_fields_get (fields, "three");
 	g_assert_cmpstr (value, ==, "");
 
 	g_hash_table_unref (fields);
@@ -76,7 +76,7 @@ DEFINE_TEST(fields_parse)
 	const gchar *value;
 	CK_RV rv;
 
-	rv = gck_secret_fields_parse (&attr, &fields);
+	rv = gkm_secret_fields_parse (&attr, &fields);
 	g_assert (rv == CKR_OK);
 
 	g_assert_cmpuint (g_hash_table_size (fields), ==, 3);
@@ -96,7 +96,7 @@ DEFINE_TEST(fields_parse_empty)
 	GHashTable *fields;
 	CK_RV rv;
 
-	rv = gck_secret_fields_parse (&attr, &fields);
+	rv = gkm_secret_fields_parse (&attr, &fields);
 	g_assert (rv == CKR_OK);
 
 	g_assert_cmpuint (g_hash_table_size (fields), == , 0);
@@ -110,7 +110,7 @@ DEFINE_TEST(fields_parse_null_invalid)
 	GHashTable *fields;
 	CK_RV rv;
 
-	rv = gck_secret_fields_parse (&attr, &fields);
+	rv = gkm_secret_fields_parse (&attr, &fields);
 	g_assert (rv == CKR_ATTRIBUTE_VALUE_INVALID);
 }
 
@@ -120,7 +120,7 @@ DEFINE_TEST(fields_parse_missing_value)
 	GHashTable *fields;
 	CK_RV rv;
 
-	rv = gck_secret_fields_parse (&attr, &fields);
+	rv = gkm_secret_fields_parse (&attr, &fields);
 	g_assert (rv == CKR_ATTRIBUTE_VALUE_INVALID);
 }
 
@@ -130,7 +130,7 @@ DEFINE_TEST(fields_parse_missing_terminator)
 	GHashTable *fields;
 	CK_RV rv;
 
-	rv = gck_secret_fields_parse (&attr, &fields);
+	rv = gkm_secret_fields_parse (&attr, &fields);
 	g_assert (rv == CKR_ATTRIBUTE_VALUE_INVALID);
 }
 
@@ -140,7 +140,7 @@ DEFINE_TEST(fields_parse_not_utf8)
 	GHashTable *fields;
 	CK_RV rv;
 
-	rv = gck_secret_fields_parse (&attr, &fields);
+	rv = gkm_secret_fields_parse (&attr, &fields);
 	g_assert (rv == CKR_ATTRIBUTE_VALUE_INVALID);
 }
 
@@ -151,10 +151,10 @@ DEFINE_TEST(fields_serialize)
 	GHashTable *fields;
 	CK_RV rv;
 
-	fields = gck_secret_fields_new ();
-	gck_secret_fields_add (fields, "one", "value1");
+	fields = gkm_secret_fields_new ();
+	gkm_secret_fields_add (fields, "one", "value1");
 
-	rv = gck_secret_fields_serialize (&attr, fields);
+	rv = gkm_secret_fields_serialize (&attr, fields);
 	g_assert (rv == CKR_OK);
 	g_assert (attr.ulValueLen == 11);
 	g_assert (memcmp (buffer, "one\0value1\0", 11) == 0);
@@ -168,10 +168,10 @@ DEFINE_TEST(fields_serialize_length)
 	GHashTable *fields;
 	CK_RV rv;
 
-	fields = gck_secret_fields_new ();
-	gck_secret_fields_add (fields, "one", "value1");
+	fields = gkm_secret_fields_new ();
+	gkm_secret_fields_add (fields, "one", "value1");
 
-	rv = gck_secret_fields_serialize (&attr, fields);
+	rv = gkm_secret_fields_serialize (&attr, fields);
 	g_assert (rv == CKR_OK);
 	g_assert (attr.ulValueLen == 11);
 
@@ -184,10 +184,10 @@ DEFINE_TEST(fields_add_get_compat_uint32)
 	gboolean ret;
 	guint32 value;
 
-	fields = gck_secret_fields_new ();
-	gck_secret_fields_add_compat_uint32 (fields, "field", 992);
+	fields = gkm_secret_fields_new ();
+	gkm_secret_fields_add_compat_uint32 (fields, "field", 992);
 
-	ret = gck_secret_fields_get_compat_uint32 (fields, "field", &value);
+	ret = gkm_secret_fields_get_compat_uint32 (fields, "field", &value);
 	g_assert (ret == TRUE);
 	g_assert_cmpuint (value, ==, 992);
 
@@ -200,10 +200,10 @@ DEFINE_TEST(fields_get_compat_uint32_fail)
 	gboolean ret;
 	guint32 value;
 
-	fields = gck_secret_fields_new ();
-	gck_secret_fields_add (fields, "test", "value");
+	fields = gkm_secret_fields_new ();
+	gkm_secret_fields_add (fields, "test", "value");
 
-	ret = gck_secret_fields_get_compat_uint32 (fields, "test", &value);
+	ret = gkm_secret_fields_get_compat_uint32 (fields, "test", &value);
 	g_assert (ret == FALSE);
 
 	g_hash_table_unref (fields);
@@ -215,10 +215,10 @@ DEFINE_TEST(fields_get_compat_hashed_string)
 	gboolean ret;
 	gchar *value;
 
-	fields = gck_secret_fields_new ();
-	gck_secret_fields_add (fields, "test", "value");
+	fields = gkm_secret_fields_new ();
+	gkm_secret_fields_add (fields, "test", "value");
 
-	ret = gck_secret_fields_get_compat_hashed_string (fields, "test", &value);
+	ret = gkm_secret_fields_get_compat_hashed_string (fields, "test", &value);
 	g_assert (ret == TRUE); /* Must be the same as the old gnome-keyring code */
 	g_assert_cmpstr (value, ==, "2063c1608d6e0baf80249c42e2be5804");
 	g_free (value);
@@ -232,10 +232,10 @@ DEFINE_TEST(fields_get_compat_hashed_already)
 	gboolean ret;
 	gchar *value;
 
-	fields = gck_secret_fields_new ();
-	gck_secret_fields_add_compat_hashed_string (fields, "test", "e991664529cd0caeb6e9fce8fac3d611");
+	fields = gkm_secret_fields_new ();
+	gkm_secret_fields_add_compat_hashed_string (fields, "test", "e991664529cd0caeb6e9fce8fac3d611");
 
-	ret = gck_secret_fields_get_compat_hashed_string (fields, "test", &value);
+	ret = gkm_secret_fields_get_compat_hashed_string (fields, "test", &value);
 	g_assert (ret == TRUE); /* What went in comes out */
 	g_assert_cmpstr (value, ==, "e991664529cd0caeb6e9fce8fac3d611");
 	g_free (value);
@@ -250,10 +250,10 @@ DEFINE_TEST(fields_get_compat_hashed_uint32)
 	guint32 value;
 	guint32 val = 992;
 
-	fields = gck_secret_fields_new ();
-	gck_secret_fields_add_compat_uint32 (fields, "test", val);
+	fields = gkm_secret_fields_new ();
+	gkm_secret_fields_add_compat_uint32 (fields, "test", val);
 
-	ret = gck_secret_fields_get_compat_hashed_uint32 (fields, "test", &value);
+	ret = gkm_secret_fields_get_compat_hashed_uint32 (fields, "test", &value);
 	g_assert (ret == TRUE); /* Must be the same as the old gnome-keyring code */
 	g_assert_cmpuint (value, ==, 0x18273645 ^ val ^ (val << 16 | val >> 16));
 
@@ -267,10 +267,10 @@ DEFINE_TEST(fields_get_compat_hashed_uint32_already)
 	guint32 value;
 	guint32 val = 0x1bc735a5;
 
-	fields = gck_secret_fields_new ();
-	gck_secret_fields_add_compat_hashed_uint32 (fields, "test", val);
+	fields = gkm_secret_fields_new ();
+	gkm_secret_fields_add_compat_hashed_uint32 (fields, "test", val);
 
-	ret = gck_secret_fields_get_compat_hashed_uint32 (fields, "test", &value);
+	ret = gkm_secret_fields_get_compat_hashed_uint32 (fields, "test", &value);
 	g_assert (ret == TRUE); /* What went in comes out */
 	g_assert_cmpuint (value, ==, val);
 
@@ -282,13 +282,13 @@ DEFINE_TEST(fields_get_names)
 	GHashTable *fields;
 	GList *names, *l;
 
-	fields = gck_secret_fields_new ();
+	fields = gkm_secret_fields_new ();
 
-	gck_secret_fields_add (fields, "one", "11111");
-	gck_secret_fields_add_compat_uint32 (fields, "two", 2);
-	gck_secret_fields_add_compat_hashed_string (fields, "test", "2063c1608d6e0baf80249c42e2be5804");
+	gkm_secret_fields_add (fields, "one", "11111");
+	gkm_secret_fields_add_compat_uint32 (fields, "two", 2);
+	gkm_secret_fields_add_compat_hashed_string (fields, "test", "2063c1608d6e0baf80249c42e2be5804");
 
-	names = gck_secret_fields_get_names (fields);
+	names = gkm_secret_fields_get_names (fields);
 	g_assert_cmpuint (g_list_length (names), ==, 3);
 
 	for (l = names; l; l = g_list_next (l)) {
@@ -309,20 +309,20 @@ DEFINE_TEST(fields_match)
 	GHashTable *needle;
 	gboolean ret;
 
-	haystack = gck_secret_fields_new ();
-	gck_secret_fields_add (haystack, "one", "11111");
-	gck_secret_fields_add_compat_uint32 (haystack, "two", 2);
-	gck_secret_fields_add_compat_hashed_string (haystack, "test", "2063c1608d6e0baf80249c42e2be5804"); /* Hashed 'value' */
-	gck_secret_fields_add_compat_hashed_uint32 (haystack, "number", 0x1bc735a5); /* Hashed 992 */
-	gck_secret_fields_add (haystack, "extra", "an extra value");
+	haystack = gkm_secret_fields_new ();
+	gkm_secret_fields_add (haystack, "one", "11111");
+	gkm_secret_fields_add_compat_uint32 (haystack, "two", 2);
+	gkm_secret_fields_add_compat_hashed_string (haystack, "test", "2063c1608d6e0baf80249c42e2be5804"); /* Hashed 'value' */
+	gkm_secret_fields_add_compat_hashed_uint32 (haystack, "number", 0x1bc735a5); /* Hashed 992 */
+	gkm_secret_fields_add (haystack, "extra", "an extra value");
 
-	needle = gck_secret_fields_new ();
-	gck_secret_fields_add (needle, "one", "11111");
-	gck_secret_fields_add (needle, "two", "2");
-	gck_secret_fields_add (needle, "test", "value");
-	gck_secret_fields_add (needle, "number", "992");
+	needle = gkm_secret_fields_new ();
+	gkm_secret_fields_add (needle, "one", "11111");
+	gkm_secret_fields_add (needle, "two", "2");
+	gkm_secret_fields_add (needle, "test", "value");
+	gkm_secret_fields_add (needle, "number", "992");
 
-	ret = gck_secret_fields_match (haystack, needle);
+	ret = gkm_secret_fields_match (haystack, needle);
 	g_assert (ret == TRUE);
 
 	g_hash_table_unref (haystack);
@@ -335,13 +335,13 @@ DEFINE_TEST(fields_match_mismatch_value)
 	GHashTable *needle;
 	gboolean ret;
 
-	haystack = gck_secret_fields_new ();
-	gck_secret_fields_add (haystack, "field", "value");
+	haystack = gkm_secret_fields_new ();
+	gkm_secret_fields_add (haystack, "field", "value");
 
-	needle = gck_secret_fields_new ();
-	gck_secret_fields_add (needle, "field", "another");
+	needle = gkm_secret_fields_new ();
+	gkm_secret_fields_add (needle, "field", "another");
 
-	ret = gck_secret_fields_match (haystack, needle);
+	ret = gkm_secret_fields_match (haystack, needle);
 	g_assert (ret == FALSE);
 
 	g_hash_table_unref (haystack);
@@ -354,13 +354,13 @@ DEFINE_TEST(fields_match_mismatch_field)
 	GHashTable *needle;
 	gboolean ret;
 
-	haystack = gck_secret_fields_new ();
-	gck_secret_fields_add (haystack, "test", "value");
+	haystack = gkm_secret_fields_new ();
+	gkm_secret_fields_add (haystack, "test", "value");
 
-	needle = gck_secret_fields_new ();
-	gck_secret_fields_add (needle, "field", "value");
+	needle = gkm_secret_fields_new ();
+	gkm_secret_fields_add (needle, "field", "value");
 
-	ret = gck_secret_fields_match (haystack, needle);
+	ret = gkm_secret_fields_match (haystack, needle);
 	g_assert (ret == FALSE);
 
 	g_hash_table_unref (haystack);
@@ -373,13 +373,13 @@ DEFINE_TEST(fields_match_wrong_hashed)
 	GHashTable *needle;
 	gboolean ret;
 
-	haystack = gck_secret_fields_new ();
-	gck_secret_fields_add_compat_hashed_uint32 (haystack, "number", 0x1bc735a5); /* Hashed 992 */
+	haystack = gkm_secret_fields_new ();
+	gkm_secret_fields_add_compat_hashed_uint32 (haystack, "number", 0x1bc735a5); /* Hashed 992 */
 
-	needle = gck_secret_fields_new ();
-	gck_secret_fields_add (needle, "number", "1000");
+	needle = gkm_secret_fields_new ();
+	gkm_secret_fields_add (needle, "number", "1000");
 
-	ret = gck_secret_fields_match (haystack, needle);
+	ret = gkm_secret_fields_match (haystack, needle);
 	g_assert (ret == FALSE);
 
 	g_hash_table_unref (haystack);
diff --git a/pkcs11/secret-store/tests/unit-test-secret-item.c b/pkcs11/secret-store/tests/unit-test-secret-item.c
index 2560028..f804b88 100644
--- a/pkcs11/secret-store/tests/unit-test-secret-item.c
+++ b/pkcs11/secret-store/tests/unit-test-secret-item.c
@@ -26,13 +26,13 @@
 #include "run-auto-test.h"
 #include "test-secret-module.h"
 
-#include "gck-secret-collection.h"
-#include "gck-secret-fields.h"
-#include "gck-secret-item.h"
+#include "gkm-secret-collection.h"
+#include "gkm-secret-fields.h"
+#include "gkm-secret-item.h"
 
-#include "gck/gck-credential.h"
-#include "gck/gck-session.h"
-#include "gck/gck-transaction.h"
+#include "gkm/gkm-credential.h"
+#include "gkm/gkm-session.h"
+#include "gkm/gkm-transaction.h"
 
 #include "pkcs11/pkcs11i.h"
 
@@ -42,16 +42,16 @@
 #include <stdio.h>
 #include <string.h>
 
-static GckModule *module = NULL;
-static GckSession *session = NULL;
-static GckSecretCollection *collection = NULL;
+static GkmModule *module = NULL;
+static GkmSession *session = NULL;
+static GkmSecretCollection *collection = NULL;
 
 DEFINE_SETUP(secret_item)
 {
 	module = test_secret_module_initialize_and_enter ();
 	session = test_secret_module_open_session (TRUE);
 
-	collection = g_object_new (GCK_TYPE_SECRET_COLLECTION,
+	collection = g_object_new (GKM_TYPE_SECRET_COLLECTION,
 	                           "module", module,
 	                           "identifier", "test",
 	                           NULL);
@@ -72,120 +72,120 @@ DEFINE_TEARDOWN(secret_item)
 static void
 unlock_collection(void)
 {
-	GckCredential *cred;
-	GckObject *object;
+	GkmCredential *cred;
+	GkmObject *object;
 	CK_RV rv;
 
 	/* Create credential, which unlocks collection */
-	object = GCK_OBJECT (collection);
-	rv = gck_credential_create (gck_object_get_module (object),
-	                            gck_session_get_manager (session),
+	object = GKM_OBJECT (collection);
+	rv = gkm_credential_create (gkm_object_get_module (object),
+	                            gkm_session_get_manager (session),
 	                            object, NULL, 0, &cred);
 	g_assert (rv == CKR_OK);
 
-	gck_session_add_session_object (session, NULL, GCK_OBJECT (cred));
+	gkm_session_add_session_object (session, NULL, GKM_OBJECT (cred));
 	g_object_unref (cred);
 }
 
 DEFINE_TEST(secret_item_new)
 {
-	GckSecretItem *item;
+	GkmSecretItem *item;
 
-	item = gck_secret_collection_new_item (collection, "the-identifier");
-	g_assert (GCK_IS_SECRET_ITEM (item));
-	g_assert_cmpstr (gck_secret_object_get_identifier (GCK_SECRET_OBJECT (item)), ==, "the-identifier");
+	item = gkm_secret_collection_new_item (collection, "the-identifier");
+	g_assert (GKM_IS_SECRET_ITEM (item));
+	g_assert_cmpstr (gkm_secret_object_get_identifier (GKM_SECRET_OBJECT (item)), ==, "the-identifier");
 }
 
 DEFINE_TEST(secret_item_create)
 {
-	GckTransaction *transaction;
-	GckSecretItem *item;
+	GkmTransaction *transaction;
+	GkmSecretItem *item;
 
-	transaction = gck_transaction_new ();
-	item = gck_secret_collection_create_item (collection, transaction);
-	g_assert (GCK_IS_SECRET_ITEM (item));
+	transaction = gkm_transaction_new ();
+	item = gkm_secret_collection_create_item (collection, transaction);
+	g_assert (GKM_IS_SECRET_ITEM (item));
 	g_object_ref (item);
-	g_assert (gck_secret_collection_has_item (collection, item));
+	g_assert (gkm_secret_collection_has_item (collection, item));
 
-	gck_transaction_complete (transaction);
+	gkm_transaction_complete (transaction);
 	g_object_unref (transaction);
 
 	/* Should still be there */
-	g_assert (gck_secret_collection_has_item (collection, item));
+	g_assert (gkm_secret_collection_has_item (collection, item));
 	g_object_unref (item);
 }
 
 DEFINE_TEST(secret_item_create_failed)
 {
-	GckTransaction *transaction;
-	GckSecretItem *item;
+	GkmTransaction *transaction;
+	GkmSecretItem *item;
 
-	transaction = gck_transaction_new ();
-	item = gck_secret_collection_create_item (collection, transaction);
-	g_assert (GCK_IS_SECRET_ITEM (item));
+	transaction = gkm_transaction_new ();
+	item = gkm_secret_collection_create_item (collection, transaction);
+	g_assert (GKM_IS_SECRET_ITEM (item));
 	g_object_ref (item);
-	g_assert (gck_secret_collection_has_item (collection, item));
+	g_assert (gkm_secret_collection_has_item (collection, item));
 
-	gck_transaction_fail (transaction, CKR_GENERAL_ERROR);
-	gck_transaction_complete (transaction);
+	gkm_transaction_fail (transaction, CKR_GENERAL_ERROR);
+	gkm_transaction_complete (transaction);
 	g_object_unref (transaction);
 
 	/* Should no longer be there */
-	g_assert (!gck_secret_collection_has_item (collection, item));
+	g_assert (!gkm_secret_collection_has_item (collection, item));
 	g_object_unref (item);
 }
 
 DEFINE_TEST(secret_item_destroy)
 {
-	GckTransaction *transaction;
-	GckSecretItem *item;
+	GkmTransaction *transaction;
+	GkmSecretItem *item;
 
-	item = gck_secret_collection_new_item (collection, "the-identifier");
-	g_assert (gck_secret_collection_has_item (collection, item));
+	item = gkm_secret_collection_new_item (collection, "the-identifier");
+	g_assert (gkm_secret_collection_has_item (collection, item));
 	g_object_ref (item);
 
-	transaction = gck_transaction_new ();
-	gck_secret_collection_destroy_item (collection, transaction, item);
-	g_assert (!gck_secret_collection_has_item (collection, item));
+	transaction = gkm_transaction_new ();
+	gkm_secret_collection_destroy_item (collection, transaction, item);
+	g_assert (!gkm_secret_collection_has_item (collection, item));
 
-	gck_transaction_complete (transaction);
+	gkm_transaction_complete (transaction);
 	g_object_unref (transaction);
 
 	/* Should not be there */
-	g_assert (!gck_secret_collection_has_item (collection, item));
+	g_assert (!gkm_secret_collection_has_item (collection, item));
 	g_object_unref (item);
 }
 
 DEFINE_TEST(secret_item_destroy_failed)
 {
-	GckTransaction *transaction;
-	GckSecretItem *item;
+	GkmTransaction *transaction;
+	GkmSecretItem *item;
 
-	item = gck_secret_collection_new_item (collection, "the-identifier");
-	g_assert (gck_secret_collection_has_item (collection, item));
+	item = gkm_secret_collection_new_item (collection, "the-identifier");
+	g_assert (gkm_secret_collection_has_item (collection, item));
 	g_object_ref (item);
 
-	transaction = gck_transaction_new ();
-	gck_secret_collection_destroy_item (collection, transaction, item);
-	g_assert (!gck_secret_collection_has_item (collection, item));
+	transaction = gkm_transaction_new ();
+	gkm_secret_collection_destroy_item (collection, transaction, item);
+	g_assert (!gkm_secret_collection_has_item (collection, item));
 
-	gck_transaction_fail (transaction, CKR_GENERAL_ERROR);
-	gck_transaction_complete (transaction);
+	gkm_transaction_fail (transaction, CKR_GENERAL_ERROR);
+	gkm_transaction_complete (transaction);
 	g_object_unref (transaction);
 
 	/* Should be there */
-	g_assert (gck_secret_collection_has_item (collection, item));
+	g_assert (gkm_secret_collection_has_item (collection, item));
 	g_object_unref (item);
 }
 
 DEFINE_TEST(secret_item_collection_get)
 {
-	GckSecretItem *item, *check;
+	GkmSecretItem *item, *check;
 
-	item = gck_secret_collection_new_item (collection, "the-identifier");
-	g_assert (GCK_IS_SECRET_ITEM (item));
+	item = gkm_secret_collection_new_item (collection, "the-identifier");
+	g_assert (GKM_IS_SECRET_ITEM (item));
 
-	check = gck_secret_collection_get_item (collection, "the-identifier");
+	check = gkm_secret_collection_get_item (collection, "the-identifier");
 	g_assert (item == check);
 }
 
@@ -194,14 +194,14 @@ DEFINE_TEST(secret_item_collection_items)
 	GList *l, *items;
 	const gchar *identifier;
 
-	gck_secret_collection_new_item (collection, "one-identifier");
-	gck_secret_collection_new_item (collection, "two-identifier");
-	gck_secret_collection_new_item (collection, "three-identifier");
+	gkm_secret_collection_new_item (collection, "one-identifier");
+	gkm_secret_collection_new_item (collection, "two-identifier");
+	gkm_secret_collection_new_item (collection, "three-identifier");
 
-	items = gck_secret_collection_get_items (collection);
+	items = gkm_secret_collection_get_items (collection);
 	g_assert_cmpuint (g_list_length (items), ==, 3);
 	for (l = items; l; l = g_list_next (l)) {
-		identifier = gck_secret_object_get_identifier (l->data);
+		identifier = gkm_secret_object_get_identifier (l->data);
 		if (!g_str_equal (identifier, "one-identifier") &&
 		    !g_str_equal (identifier, "two-identifier") &&
 		    !g_str_equal (identifier, "three-identifier"))
@@ -213,67 +213,67 @@ DEFINE_TEST(secret_item_collection_items)
 
 DEFINE_TEST(secret_item_collection_remove)
 {
-	GckSecretItem *item;
+	GkmSecretItem *item;
 
-	item = gck_secret_collection_new_item (collection, "the-identifier");
-	g_assert (gck_secret_collection_get_item (collection, "the-identifier") == item);
+	item = gkm_secret_collection_new_item (collection, "the-identifier");
+	g_assert (gkm_secret_collection_get_item (collection, "the-identifier") == item);
 
-	gck_secret_collection_remove_item (collection, item);
-	g_assert (gck_secret_collection_get_item (collection, "the-identifier") == NULL);
+	gkm_secret_collection_remove_item (collection, item);
+	g_assert (gkm_secret_collection_get_item (collection, "the-identifier") == NULL);
 }
 
 DEFINE_TEST(secret_item_is_locked)
 {
-	GckSecretItem *item;
+	GkmSecretItem *item;
 
-	item = gck_secret_collection_new_item (collection, "the-identifier");
-	g_assert (gck_secret_object_is_locked (GCK_SECRET_OBJECT (item), session) == 
-	          gck_secret_object_is_locked (GCK_SECRET_OBJECT (collection), session));
+	item = gkm_secret_collection_new_item (collection, "the-identifier");
+	g_assert (gkm_secret_object_is_locked (GKM_SECRET_OBJECT (item), session) ==
+	          gkm_secret_object_is_locked (GKM_SECRET_OBJECT (collection), session));
 
 	unlock_collection();
 
-	g_assert (gck_secret_object_is_locked (GCK_SECRET_OBJECT (item), session) == FALSE);
+	g_assert (gkm_secret_object_is_locked (GKM_SECRET_OBJECT (item), session) == FALSE);
 }
 
 DEFINE_TEST(secret_item_get_collection)
 {
-	GckSecretItem *item;
-	item = gck_secret_collection_new_item (collection, "the-identifier");
-	g_assert (gck_secret_item_get_collection (item) == collection);
+	GkmSecretItem *item;
+	item = gkm_secret_collection_new_item (collection, "the-identifier");
+	g_assert (gkm_secret_item_get_collection (item) == collection);
 }
 
 DEFINE_TEST(secret_item_tracks_collection)
 {
-	GckSecretItem *item;
-	item = gck_secret_collection_new_item (collection, "the-identifier");
+	GkmSecretItem *item;
+	item = gkm_secret_collection_new_item (collection, "the-identifier");
 	g_object_ref (item);
 
 	unlock_collection();
 
 	/* At this point the item should be 'unlocked' */
-	g_assert (gck_secret_object_is_locked (GCK_SECRET_OBJECT (item), session) == FALSE);
+	g_assert (gkm_secret_object_is_locked (GKM_SECRET_OBJECT (item), session) == FALSE);
 
 	g_object_unref (collection);
 	collection = NULL;
 
 	/* Collection went away */
-	g_assert (gck_secret_item_get_collection (item) == NULL);
-	g_assert (gck_secret_object_is_locked (GCK_SECRET_OBJECT (item), session) == TRUE);
+	g_assert (gkm_secret_item_get_collection (item) == NULL);
+	g_assert (gkm_secret_object_is_locked (GKM_SECRET_OBJECT (item), session) == TRUE);
 
 	g_object_unref (item);
 }
 
 DEFINE_TEST(secret_item_get_set_fields)
 {
-	GHashTable *fields = gck_secret_fields_new ();
+	GHashTable *fields = gkm_secret_fields_new ();
 	GHashTable *check;
-	GckSecretItem *item;
+	GkmSecretItem *item;
 
-	item = gck_secret_collection_new_item (collection, "the-identifier");
-	gck_secret_item_set_fields (item, fields);
-	gck_secret_item_set_fields (item, fields);
+	item = gkm_secret_collection_new_item (collection, "the-identifier");
+	gkm_secret_item_set_fields (item, fields);
+	gkm_secret_item_set_fields (item, fields);
 
-	check = gck_secret_item_get_fields (item);
+	check = gkm_secret_item_get_fields (item);
 	g_assert (check == fields);
 
 	g_hash_table_unref (fields);
@@ -283,11 +283,11 @@ DEFINE_TEST(secret_item_collection_attr)
 {
 	gchar buffer[32];
 	CK_ATTRIBUTE check = { CKA_G_COLLECTION, buffer, 32 };
-	GckSecretItem *item;
+	GkmSecretItem *item;
 	CK_RV rv;
 
-	item = gck_secret_collection_new_item (collection, "the-identifier");
-	rv = gck_object_get_attribute (GCK_OBJECT (item), session, &check);
+	item = gkm_secret_collection_new_item (collection, "the-identifier");
+	rv = gkm_object_get_attribute (GKM_OBJECT (item), session, &check);
 	g_assert (rv == CKR_OK);
 	g_assert (check.ulValueLen == 4);
 	g_assert (memcmp (buffer, "test", 4) == 0);
@@ -295,24 +295,24 @@ DEFINE_TEST(secret_item_collection_attr)
 
 DEFINE_TEST(secret_item_secret_attr)
 {
-	GckTransaction *transaction = gck_transaction_new ();
+	GkmTransaction *transaction = gkm_transaction_new ();
 	CK_ATTRIBUTE attr = { CKA_VALUE, "hello", 5 };
 	gchar buffer[32];
 	CK_ATTRIBUTE check = { CKA_VALUE, buffer, 32 };
-	GckSecretItem *item;
+	GkmSecretItem *item;
 	CK_RV rv;
 
 	unlock_collection ();
 
-	item = gck_secret_collection_new_item (collection, "the-identifier");
-	gck_object_set_attribute (GCK_OBJECT (item), session, transaction, &attr);
-	g_assert (gck_transaction_get_failed (transaction) == FALSE);
-	gck_transaction_complete (transaction);
-	g_assert (gck_transaction_get_result (transaction) == CKR_OK);
+	item = gkm_secret_collection_new_item (collection, "the-identifier");
+	gkm_object_set_attribute (GKM_OBJECT (item), session, transaction, &attr);
+	g_assert (gkm_transaction_get_failed (transaction) == FALSE);
+	gkm_transaction_complete (transaction);
+	g_assert (gkm_transaction_get_result (transaction) == CKR_OK);
 
 	g_object_unref (transaction);
 
-	rv = gck_object_get_attribute (GCK_OBJECT (item), session, &check);
+	rv = gkm_object_get_attribute (GKM_OBJECT (item), session, &check);
 	g_assert (rv == CKR_OK);
 	g_assert (check.ulValueLen == 5);
 	g_assert (memcmp (buffer, "hello", 5) == 0);
@@ -320,116 +320,116 @@ DEFINE_TEST(secret_item_secret_attr)
 
 DEFINE_TEST(secret_item_secret_attr_locked)
 {
-	GckTransaction *transaction = gck_transaction_new ();
+	GkmTransaction *transaction = gkm_transaction_new ();
 	CK_ATTRIBUTE attr = { CKA_VALUE, "hello", 5 };
 	gchar buffer[32];
 	CK_ATTRIBUTE check = { CKA_VALUE, buffer, 32 };
-	GckSecretItem *item;
+	GkmSecretItem *item;
 	CK_RV rv;
 
-	item = gck_secret_collection_new_item (collection, "the-identifier");
-	gck_object_set_attribute (GCK_OBJECT (item), session, transaction, &attr);
-	g_assert (gck_transaction_get_failed (transaction) == TRUE);
-	gck_transaction_complete (transaction);
-	g_assert (gck_transaction_get_result (transaction) == CKR_USER_NOT_LOGGED_IN);
+	item = gkm_secret_collection_new_item (collection, "the-identifier");
+	gkm_object_set_attribute (GKM_OBJECT (item), session, transaction, &attr);
+	g_assert (gkm_transaction_get_failed (transaction) == TRUE);
+	gkm_transaction_complete (transaction);
+	g_assert (gkm_transaction_get_result (transaction) == CKR_USER_NOT_LOGGED_IN);
 
 	g_object_unref (transaction);
 
-	rv = gck_object_get_attribute (GCK_OBJECT (item), session, &check);
+	rv = gkm_object_get_attribute (GKM_OBJECT (item), session, &check);
 	g_assert (rv == CKR_USER_NOT_LOGGED_IN);
 }
 
 DEFINE_TEST(secret_item_fields_attr)
 {
-	GckTransaction *transaction = gck_transaction_new ();
+	GkmTransaction *transaction = gkm_transaction_new ();
 	CK_ATTRIBUTE attr = { CKA_G_FIELDS, "name1\0value1\0name2\0value2", 26 };
 	gchar buffer[32];
 	CK_ATTRIBUTE check = { CKA_G_FIELDS, buffer, 32 };
-	GckSecretItem *item;
+	GkmSecretItem *item;
 	GHashTable *fields;
 	const gchar *value;
 	CK_RV rv;
 
 	unlock_collection ();
 
-	item = gck_secret_collection_new_item (collection, "the-identifier");
-	gck_object_set_attribute (GCK_OBJECT (item), session, transaction, &attr);
-	g_assert (gck_transaction_get_failed (transaction) == FALSE);
-	gck_transaction_complete (transaction);
-	g_assert (gck_transaction_get_result (transaction) == CKR_OK);
+	item = gkm_secret_collection_new_item (collection, "the-identifier");
+	gkm_object_set_attribute (GKM_OBJECT (item), session, transaction, &attr);
+	g_assert (gkm_transaction_get_failed (transaction) == FALSE);
+	gkm_transaction_complete (transaction);
+	g_assert (gkm_transaction_get_result (transaction) == CKR_OK);
 
 	g_object_unref (transaction);
 
-	rv = gck_object_get_attribute (GCK_OBJECT (item), session, &check);
+	rv = gkm_object_get_attribute (GKM_OBJECT (item), session, &check);
 	g_assert (rv == CKR_OK);
 	g_assert (check.ulValueLen == 26);
 	g_assert (memcmp (buffer, "name1\0value1\0name2\0value2", 26) == 0);
 
-	fields = gck_secret_item_get_fields (item);
+	fields = gkm_secret_item_get_fields (item);
 	g_assert (fields);
-	value = gck_secret_fields_get (fields, "name1");
+	value = gkm_secret_fields_get (fields, "name1");
 	g_assert_cmpstr (value, ==, "value1");
-	value = gck_secret_fields_get (fields, "name2");
+	value = gkm_secret_fields_get (fields, "name2");
 	g_assert_cmpstr (value, ==, "value2");
 }
 
 DEFINE_TEST(secret_item_fields_attr_locked)
 {
-	GckTransaction *transaction = gck_transaction_new ();
+	GkmTransaction *transaction = gkm_transaction_new ();
 	CK_ATTRIBUTE attr = { CKA_G_FIELDS, "name1\0value1\0name2\0value2", 26 };
-	GckSecretItem *item;
+	GkmSecretItem *item;
 
-	item = gck_secret_collection_new_item (collection, "the-identifier");
-	gck_object_set_attribute (GCK_OBJECT (item), session, transaction, &attr);
-	g_assert (gck_transaction_get_failed (transaction) == TRUE);
-	gck_transaction_complete (transaction);
-	g_assert (gck_transaction_get_result (transaction) == CKR_USER_NOT_LOGGED_IN);
+	item = gkm_secret_collection_new_item (collection, "the-identifier");
+	gkm_object_set_attribute (GKM_OBJECT (item), session, transaction, &attr);
+	g_assert (gkm_transaction_get_failed (transaction) == TRUE);
+	gkm_transaction_complete (transaction);
+	g_assert (gkm_transaction_get_result (transaction) == CKR_USER_NOT_LOGGED_IN);
 
 	g_object_unref (transaction);
 }
 
 DEFINE_TEST(secret_item_fields_attr_reverts)
 {
-	GckTransaction *transaction = gck_transaction_new ();
+	GkmTransaction *transaction = gkm_transaction_new ();
 	CK_ATTRIBUTE attr = { CKA_G_FIELDS, "new\0value\0", 10 };
 	gchar buffer[32];
 	CK_ATTRIBUTE check = { CKA_G_FIELDS, buffer, 32 };
-	GckSecretItem *item;
+	GkmSecretItem *item;
 	GHashTable *fields;
 	CK_RV rv;
 
 	unlock_collection ();
 
-	item = gck_secret_collection_new_item (collection, "the-identifier");
+	item = gkm_secret_collection_new_item (collection, "the-identifier");
 
 	/* Set the old value like so */
-	fields = gck_secret_fields_new ();
-	gck_secret_fields_add (fields, "old", "value");
-	gck_secret_item_set_fields (item, fields);
+	fields = gkm_secret_fields_new ();
+	gkm_secret_fields_add (fields, "old", "value");
+	gkm_secret_item_set_fields (item, fields);
 	g_hash_table_unref (fields);
 
 	/* Should show old value */
-	rv = gck_object_get_attribute (GCK_OBJECT (item), session, &check);
+	rv = gkm_object_get_attribute (GKM_OBJECT (item), session, &check);
 	g_assert (rv == CKR_OK);
 	g_assert (check.ulValueLen == 10);
 	g_assert (memcmp (buffer, "old\0value\0", 10) == 0);
 
 	/* Set the new values */
-	gck_object_set_attribute (GCK_OBJECT (item), session, transaction, &attr);
-	g_assert (gck_transaction_get_failed (transaction) == FALSE);
+	gkm_object_set_attribute (GKM_OBJECT (item), session, transaction, &attr);
+	g_assert (gkm_transaction_get_failed (transaction) == FALSE);
 
 	/* Should have the new value */
-	rv = gck_object_get_attribute (GCK_OBJECT (item), session, &check);
+	rv = gkm_object_get_attribute (GKM_OBJECT (item), session, &check);
 	g_assert (rv == CKR_OK);
 	g_assert (check.ulValueLen == 10);
 	g_assert (memcmp (buffer, "new\0value\0", 10) == 0);
 
 	/* Fail the transaction */
-	gck_transaction_fail (transaction, CKR_CANCEL);
-	gck_transaction_complete (transaction);
+	gkm_transaction_fail (transaction, CKR_CANCEL);
+	gkm_transaction_complete (transaction);
 
 	/* Should show the old value */
-	rv = gck_object_get_attribute (GCK_OBJECT (item), session, &check);
+	rv = gkm_object_get_attribute (GKM_OBJECT (item), session, &check);
 	g_assert (rv == CKR_OK);
 	g_assert (check.ulValueLen == 10);
 	g_assert (memcmp (buffer, "old\0value\0", 10) == 0);
diff --git a/pkcs11/secret-store/tests/unit-test-secret-object.c b/pkcs11/secret-store/tests/unit-test-secret-object.c
index 13afa30..ae7e694 100644
--- a/pkcs11/secret-store/tests/unit-test-secret-object.c
+++ b/pkcs11/secret-store/tests/unit-test-secret-object.c
@@ -26,9 +26,9 @@
 #include "run-auto-test.h"
 #include "test-secret-module.h"
 
-#include "gck-secret-object.h"
+#include "gkm-secret-object.h"
 
-#include "gck/gck-transaction.h"
+#include "gkm/gkm-transaction.h"
 
 #include "pkcs11/pkcs11i.h"
 
@@ -38,21 +38,21 @@
 #include <stdio.h>
 #include <string.h>
 
-static GckModule *module = NULL;
-static GckSession *session = NULL;
-static GckSecretObject *object = NULL;
+static GkmModule *module = NULL;
+static GkmSession *session = NULL;
+static GkmSecretObject *object = NULL;
 
 DEFINE_SETUP(secret_object)
 {
 	module = test_secret_module_initialize_and_enter ();
 	session = test_secret_module_open_session (TRUE);
 
-	object = g_object_new (GCK_TYPE_SECRET_OBJECT,
+	object = g_object_new (GKM_TYPE_SECRET_OBJECT,
 	                       "module", module,
 	                       "identifier", "my-identifier",
 	                       NULL);
 
-	g_assert (GCK_IS_SECRET_OBJECT (object));
+	g_assert (GKM_IS_SECRET_OBJECT (object));
 }
 
 DEFINE_TEARDOWN(secret_object)
@@ -67,14 +67,14 @@ DEFINE_TEARDOWN(secret_object)
 
 DEFINE_TEST(secret_object_is_locked)
 {
-	/* Plain GckSecretObject is never locked */
-	g_assert (!gck_secret_object_is_locked (object, session));
+	/* Plain GkmSecretObject is never locked */
+	g_assert (!gkm_secret_object_is_locked (object, session));
 }
 
 DEFINE_TEST(secret_object_identifier_prop)
 {
 	const gchar *identifier;
-	identifier = gck_secret_object_get_identifier (object);
+	identifier = gkm_secret_object_get_identifier (object);
 	g_assert_cmpstr (identifier, ==, "my-identifier");
 }
 
@@ -82,7 +82,7 @@ static void
 was_notified (GObject *obj, GParamSpec *pspec, gpointer user_data)
 {
 	gboolean* notified = user_data;
-	g_assert (GCK_SECRET_OBJECT (obj) == object);
+	g_assert (GKM_SECRET_OBJECT (obj) == object);
 	g_assert (user_data);
 	*notified = TRUE;
 }
@@ -96,13 +96,13 @@ DEFINE_TEST(secret_object_created_prop)
 	g_signal_connect (object, "notify::created", G_CALLBACK (was_notified), &notified);
 
 	/* Default value */
-	created = gck_secret_object_get_created (object);
+	created = gkm_secret_object_get_created (object);
 	g_assert (created == 0);
 
 	/* Set a new value */
-	gck_secret_object_set_created (object, 1247930171);
+	gkm_secret_object_set_created (object, 1247930171);
 	g_assert (notified);
-	created = gck_secret_object_get_created (object);
+	created = gkm_secret_object_get_created (object);
 	g_assert (created == 1247930171);
 }
 
@@ -115,13 +115,13 @@ DEFINE_TEST(secret_object_modified_prop)
 	g_signal_connect (object, "notify::modified", G_CALLBACK (was_notified), &notified);
 
 	/* Default value */
-	modified = gck_secret_object_get_modified (object);
+	modified = gkm_secret_object_get_modified (object);
 	g_assert (modified == 0);
 
 	/* Set a new value */
-	gck_secret_object_set_modified (object, 1247930171);
+	gkm_secret_object_set_modified (object, 1247930171);
 	g_assert (notified);
-	modified = gck_secret_object_get_modified (object);
+	modified = gkm_secret_object_get_modified (object);
 	g_assert (modified == 1247930171);
 }
 
@@ -129,8 +129,8 @@ DEFINE_TEST(secret_object_was_modified)
 {
 	GTimeVal tv;
 	g_get_current_time (&tv);
-	gck_secret_object_was_modified (object);
-	g_assert (tv.tv_sec == gck_secret_object_get_modified (object));
+	gkm_secret_object_was_modified (object);
+	g_assert (tv.tv_sec == gkm_secret_object_get_modified (object));
 }
 
 DEFINE_TEST(secret_object_label_prop)
@@ -142,13 +142,13 @@ DEFINE_TEST(secret_object_label_prop)
 	g_signal_connect (object, "notify::label", G_CALLBACK (was_notified), &notified);
 
 	/* Default value */
-	label = gck_secret_object_get_label (object);
+	label = gkm_secret_object_get_label (object);
 	g_assert_cmpstr (label, ==, "");
 
 	/* Set a new value */
-	gck_secret_object_set_label (object, "hello");
+	gkm_secret_object_set_label (object, "hello");
 	g_assert (notified);
-	label = gck_secret_object_get_label (object);
+	label = gkm_secret_object_get_label (object);
 	g_assert_cmpstr (label, ==, "hello");
 }
 
@@ -158,7 +158,7 @@ DEFINE_TEST(secret_object_identifier_get_attr)
 	CK_ATTRIBUTE attr = { CKA_ID, buffer, 32 };
 	CK_RV rv;
 
-	rv = gck_object_get_attribute (GCK_OBJECT (object), session, &attr);
+	rv = gkm_object_get_attribute (GKM_OBJECT (object), session, &attr);
 	g_assert (rv == CKR_OK);
 	g_assert (attr.ulValueLen == 13);
 	g_assert (memcmp (buffer, "my-identifier", 13) == 0);
@@ -170,8 +170,8 @@ DEFINE_TEST(secret_object_label_get_attr)
 	CK_ATTRIBUTE attr = { CKA_LABEL, buffer, 32 };
 	CK_RV rv;
 
-	gck_secret_object_set_label (object, "hello");
-	rv = gck_object_get_attribute (GCK_OBJECT (object), session, &attr);
+	gkm_secret_object_set_label (object, "hello");
+	rv = gkm_object_get_attribute (GKM_OBJECT (object), session, &attr);
 	g_assert (rv == CKR_OK);
 	g_assert (attr.ulValueLen == 5);
 	g_assert (memcmp (buffer, "hello", 5) == 0);
@@ -180,20 +180,20 @@ DEFINE_TEST(secret_object_label_get_attr)
 DEFINE_TEST(secret_object_label_set_attr)
 {
 	CK_ATTRIBUTE attr = { CKA_LABEL, "hello", 5 };
-	GckTransaction *transaction = gck_transaction_new ();
+	GkmTransaction *transaction = gkm_transaction_new ();
 
 	/* Monitor for changes */
 	gboolean notified = FALSE;
 	g_signal_connect (object, "notify::label", G_CALLBACK (was_notified), &notified);
 
-	gck_object_set_attribute (GCK_OBJECT (object), session, transaction, &attr);
-	g_assert (!gck_transaction_get_failed (transaction));
+	gkm_object_set_attribute (GKM_OBJECT (object), session, transaction, &attr);
+	g_assert (!gkm_transaction_get_failed (transaction));
 	g_assert (!notified); /* Not notified yet */
 
-	g_assert_cmpstr (gck_secret_object_get_label (object), ==, "hello");
+	g_assert_cmpstr (gkm_secret_object_get_label (object), ==, "hello");
 
-	gck_transaction_complete (transaction);
-	g_assert_cmpstr (gck_secret_object_get_label (object), ==, "hello");
+	gkm_transaction_complete (transaction);
+	g_assert_cmpstr (gkm_secret_object_get_label (object), ==, "hello");
 	g_assert (notified); /* Notified after transaction complete */
 
 	g_object_unref (transaction);
@@ -202,29 +202,29 @@ DEFINE_TEST(secret_object_label_set_attr)
 DEFINE_TEST(secret_object_label_set_attr_fail)
 {
 	CK_ATTRIBUTE attr = { CKA_LABEL, "hello", 5 };
-	GckTransaction *transaction = gck_transaction_new ();
+	GkmTransaction *transaction = gkm_transaction_new ();
 	gboolean notified = FALSE;
 
 	/* Set an old value */
-	gck_secret_object_set_label (object, "old");
+	gkm_secret_object_set_label (object, "old");
 
 	/* Monitor for changes */
 	g_signal_connect (object, "notify::label", G_CALLBACK (was_notified), &notified);
 
 	/* Set a new value */
-	gck_object_set_attribute (GCK_OBJECT (object), session, transaction, &attr);
-	g_assert (!gck_transaction_get_failed (transaction));
+	gkm_object_set_attribute (GKM_OBJECT (object), session, transaction, &attr);
+	g_assert (!gkm_transaction_get_failed (transaction));
 	g_assert (!notified); /* Not notified yet */
 
 	/* Temporarily has new value */
-	g_assert_cmpstr (gck_secret_object_get_label (object), ==, "hello");
+	g_assert_cmpstr (gkm_secret_object_get_label (object), ==, "hello");
 
 	/* Fail and complete transaction */
-	gck_transaction_fail (transaction, CKR_CANCEL);
-	gck_transaction_complete (transaction);
+	gkm_transaction_fail (transaction, CKR_CANCEL);
+	gkm_transaction_complete (transaction);
 
 	/* Back to old value */
-	g_assert_cmpstr (gck_secret_object_get_label (object), ==, "old");
+	g_assert_cmpstr (gkm_secret_object_get_label (object), ==, "old");
 	g_assert (!notified); /* Should never have notified */
 
 	g_object_unref (transaction);
@@ -236,8 +236,8 @@ DEFINE_TEST(secret_object_modified_get_attr)
 	CK_ATTRIBUTE attr = { CKA_G_MODIFIED, buffer, 32 };
 	CK_RV rv;
 
-	gck_secret_object_set_modified (object, 1247930171);
-	rv = gck_object_get_attribute (GCK_OBJECT (object), session, &attr);
+	gkm_secret_object_set_modified (object, 1247930171);
+	rv = gkm_object_get_attribute (GKM_OBJECT (object), session, &attr);
 	g_assert (rv == CKR_OK);
 	g_assert (attr.ulValueLen == 16);
 	g_assert (memcmp (buffer, "2009071815161100", 16) == 0);
@@ -249,8 +249,8 @@ DEFINE_TEST(secret_object_created_get_attr)
 	CK_ATTRIBUTE attr = { CKA_G_CREATED, buffer, 32 };
 	CK_RV rv;
 
-	gck_secret_object_set_created (object, 1247930171);
-	rv = gck_object_get_attribute (GCK_OBJECT (object), session, &attr);
+	gkm_secret_object_set_created (object, 1247930171);
+	rv = gkm_object_get_attribute (GKM_OBJECT (object), session, &attr);
 	g_assert (rv == CKR_OK);
 	g_assert (attr.ulValueLen == 16);
 	g_assert (memcmp (buffer, "2009071815161100", 16) == 0);
@@ -262,7 +262,7 @@ DEFINE_TEST(secret_object_locked_get_attr)
 	CK_ATTRIBUTE attr = { CKA_G_LOCKED, buffer, 32 };
 	CK_RV rv;
 
-	rv = gck_object_get_attribute (GCK_OBJECT (object), session, &attr);
+	rv = gkm_object_get_attribute (GKM_OBJECT (object), session, &attr);
 	g_assert (rv == CKR_OK);
 	g_assert (attr.ulValueLen == 1);
 	g_assert (memcmp (buffer, "\0", 1) == 0);
diff --git a/pkcs11/secret-store/tests/unit-test-secret-search.c b/pkcs11/secret-store/tests/unit-test-secret-search.c
index 51006e0..6b57089 100644
--- a/pkcs11/secret-store/tests/unit-test-secret-search.c
+++ b/pkcs11/secret-store/tests/unit-test-secret-search.c
@@ -26,13 +26,13 @@
 #include "run-auto-test.h"
 #include "test-secret-module.h"
 
-#include "gck-secret-collection.h"
-#include "gck-secret-fields.h"
-#include "gck-secret-item.h"
-#include "gck-secret-search.h"
+#include "gkm-secret-collection.h"
+#include "gkm-secret-fields.h"
+#include "gkm-secret-item.h"
+#include "gkm-secret-search.h"
 
-#include "gck/gck-session.h"
-#include "gck/gck-transaction.h"
+#include "gkm/gkm-session.h"
+#include "gkm/gkm-transaction.h"
 
 #include "pkcs11/pkcs11i.h"
 
@@ -42,11 +42,11 @@
 #include <stdio.h>
 #include <string.h>
 
-static GckModule *module = NULL;
-static GckSession *session = NULL;
-static GckFactory *factory = NULL;
-static GckSecretCollection *collection = NULL;
-static GckSecretItem *item = NULL;
+static GkmModule *module = NULL;
+static GkmSession *session = NULL;
+static GkmFactory *factory = NULL;
+static GkmSecretCollection *collection = NULL;
+static GkmSecretItem *item = NULL;
 
 DEFINE_SETUP(secret_search)
 {
@@ -54,24 +54,24 @@ DEFINE_SETUP(secret_search)
 
 	module = test_secret_module_initialize_and_enter ();
 	session = test_secret_module_open_session (TRUE);
-	factory = GCK_FACTORY_SECRET_SEARCH;
+	factory = GKM_FACTORY_SECRET_SEARCH;
 	g_assert (factory);
 
-	collection = g_object_new (GCK_TYPE_SECRET_COLLECTION,
+	collection = g_object_new (GKM_TYPE_SECRET_COLLECTION,
 	                           "module", module,
-	                           "manager", gck_session_get_manager (session),
+	                           "manager", gkm_session_get_manager (session),
 	                           "identifier", "test-collection",
 	                           NULL);
 
 	/* Create an item */
-	item = gck_secret_collection_new_item (collection, "test-item");
-	fields = gck_secret_fields_new ();
-	gck_secret_fields_add (fields, "name1", "value1");
-	gck_secret_fields_add (fields, "name2", "value2");
-	gck_secret_item_set_fields (item, fields);
+	item = gkm_secret_collection_new_item (collection, "test-item");
+	fields = gkm_secret_fields_new ();
+	gkm_secret_fields_add (fields, "name1", "value1");
+	gkm_secret_fields_add (fields, "name2", "value2");
+	gkm_secret_item_set_fields (item, fields);
 	g_hash_table_unref (fields);
 
-	gck_object_expose (GCK_OBJECT (collection), TRUE);
+	gkm_object_expose (GKM_OBJECT (collection), TRUE);
 }
 
 DEFINE_TEARDOWN(secret_search)
@@ -86,11 +86,11 @@ DEFINE_TEARDOWN(secret_search)
 DEFINE_TEST(create_search_incomplete)
 {
 	CK_ATTRIBUTE attrs[1];
-	GckObject *object = NULL;
-	GckTransaction *transaction = gck_transaction_new ();
+	GkmObject *object = NULL;
+	GkmTransaction *transaction = gkm_transaction_new ();
 
-	object = gck_session_create_object_for_factory (session, factory, transaction, attrs, 0);
-	g_assert (gck_transaction_complete_and_unref (transaction) == CKR_TEMPLATE_INCOMPLETE);
+	object = gkm_session_create_object_for_factory (session, factory, transaction, attrs, 0);
+	g_assert (gkm_transaction_complete_and_unref (transaction) == CKR_TEMPLATE_INCOMPLETE);
 	g_assert (object == NULL);
 }
 
@@ -100,63 +100,63 @@ DEFINE_TEST(create_search_bad_fields)
 	        { CKA_G_FIELDS, "bad-value", 9 },
 	};
 
-	GckObject *object = NULL;
-	GckTransaction *transaction = gck_transaction_new ();
+	GkmObject *object = NULL;
+	GkmTransaction *transaction = gkm_transaction_new ();
 
-	object = gck_session_create_object_for_factory (session, factory, transaction, attrs, 1);
-	g_assert (gck_transaction_complete_and_unref (transaction) == CKR_ATTRIBUTE_VALUE_INVALID);
+	object = gkm_session_create_object_for_factory (session, factory, transaction, attrs, 1);
+	g_assert (gkm_transaction_complete_and_unref (transaction) == CKR_ATTRIBUTE_VALUE_INVALID);
 	g_assert (object == NULL);
 }
 
 DEFINE_TEST(create_search)
 {
-	CK_ATTRIBUTE attrs[] = { 
+	CK_ATTRIBUTE attrs[] = {
 	        { CKA_G_FIELDS, "test\0value\0two\0value2", 22 },
 	};
 
 	const gchar *identifier;
-	GckObject *object = NULL;
+	GkmObject *object = NULL;
 	GHashTable *fields;
 	gpointer vdata;
 	gulong vulong;
 	gboolean vbool;
 	gsize vsize;
 
-	object = gck_session_create_object_for_factory (session, factory, NULL, attrs, 1);
+	object = gkm_session_create_object_for_factory (session, factory, NULL, attrs, 1);
 	g_assert (object != NULL);
-	g_assert (GCK_IS_SECRET_SEARCH (object));
+	g_assert (GKM_IS_SECRET_SEARCH (object));
 
-	if (!gck_object_get_attribute_ulong (object, session, CKA_CLASS, &vulong))
+	if (!gkm_object_get_attribute_ulong (object, session, CKA_CLASS, &vulong))
 		g_assert_not_reached ();
 	g_assert (vulong == CKO_G_SEARCH);
 
-	if (!gck_object_get_attribute_boolean (object, session, CKA_MODIFIABLE, &vbool))
+	if (!gkm_object_get_attribute_boolean (object, session, CKA_MODIFIABLE, &vbool))
 		g_assert_not_reached ();
 	g_assert (vbool == CK_TRUE);
 
-	vdata = gck_object_get_attribute_data (object, session, CKA_G_FIELDS, &vsize);
+	vdata = gkm_object_get_attribute_data (object, session, CKA_G_FIELDS, &vsize);
 	g_assert (vdata);
 	g_assert (vsize == attrs[0].ulValueLen);
 	g_free (vdata);
 
-	vdata = gck_object_get_attribute_data (object, session, CKA_G_COLLECTION, &vsize);
+	vdata = gkm_object_get_attribute_data (object, session, CKA_G_COLLECTION, &vsize);
 	g_assert (vdata);
 	g_assert (vsize == 0);
 	g_free (vdata);
 
 	/* No objects matched */
-	vdata = gck_object_get_attribute_data (object, session, CKA_G_MATCHED, &vsize);
+	vdata = gkm_object_get_attribute_data (object, session, CKA_G_MATCHED, &vsize);
 	g_assert (vdata);
 	g_assert (vsize == 0);
 	g_free (vdata);
 
 	/* Get the fields object and check */
-	fields = gck_secret_search_get_fields (GCK_SECRET_SEARCH (object));
+	fields = gkm_secret_search_get_fields (GKM_SECRET_SEARCH (object));
 	g_assert (fields);
-	g_assert_cmpstr (gck_secret_fields_get (fields, "test"), ==, "value");
+	g_assert_cmpstr (gkm_secret_fields_get (fields, "test"), ==, "value");
 
 	/* No collection */
-	identifier = gck_secret_search_get_collection_id (GCK_SECRET_SEARCH (object));
+	identifier = gkm_secret_search_get_collection_id (GKM_SECRET_SEARCH (object));
 	g_assert (identifier == NULL);
 
 	g_object_unref (object);
@@ -168,19 +168,19 @@ DEFINE_TEST(create_search_and_match)
 	        { CKA_G_FIELDS, "name1\0value1\0name2\0value2", 26 },
 	};
 
-	GckObject *object = NULL;
+	GkmObject *object = NULL;
 	gpointer vdata;
 	gsize vsize;
 
-	object = gck_session_create_object_for_factory (session, factory, NULL, attrs, 1);
+	object = gkm_session_create_object_for_factory (session, factory, NULL, attrs, 1);
 	g_assert (object != NULL);
-	g_assert (GCK_IS_SECRET_SEARCH (object));
+	g_assert (GKM_IS_SECRET_SEARCH (object));
 
 	/* One object matched */
-	vdata = gck_object_get_attribute_data (object, session, CKA_G_MATCHED, &vsize);
+	vdata = gkm_object_get_attribute_data (object, session, CKA_G_MATCHED, &vsize);
 	g_assert (vdata);
 	g_assert (vsize == sizeof (CK_OBJECT_HANDLE));
-	g_assert (*((CK_OBJECT_HANDLE_PTR)vdata) == gck_object_get_handle (GCK_OBJECT (item)));
+	g_assert (*((CK_OBJECT_HANDLE_PTR)vdata) == gkm_object_get_handle (GKM_OBJECT (item)));
 	g_free (vdata);
 
 	g_object_unref (object);
@@ -192,37 +192,37 @@ DEFINE_TEST(create_search_and_change_to_match)
 	        { CKA_G_FIELDS, "name1\0value1", 13 },
 	};
 
-	GckObject *object = NULL;
+	GkmObject *object = NULL;
 	GHashTable *fields;
 	gpointer vdata;
 	gsize vsize;
 
 	/* Make it not match */
-	fields = gck_secret_fields_new ();
-	gck_secret_item_set_fields (item, fields);
+	fields = gkm_secret_fields_new ();
+	gkm_secret_item_set_fields (item, fields);
 	g_hash_table_unref (fields);
 
-	object = gck_session_create_object_for_factory (session, factory, NULL, attrs, 1);
+	object = gkm_session_create_object_for_factory (session, factory, NULL, attrs, 1);
 	g_assert (object != NULL);
-	g_assert (GCK_IS_SECRET_SEARCH (object));
+	g_assert (GKM_IS_SECRET_SEARCH (object));
 
 	/* Nothing matched */
-	vdata = gck_object_get_attribute_data (object, session, CKA_G_MATCHED, &vsize);
+	vdata = gkm_object_get_attribute_data (object, session, CKA_G_MATCHED, &vsize);
 	g_assert (vsize == 0);
 	g_free (vdata);
 
 	/* Make it match */
-	fields = gck_secret_fields_new ();
-	gck_secret_fields_add (fields, "name1", "value1");
-	gck_secret_fields_add (fields, "name2", "value2");
-	gck_secret_item_set_fields (item, fields);
+	fields = gkm_secret_fields_new ();
+	gkm_secret_fields_add (fields, "name1", "value1");
+	gkm_secret_fields_add (fields, "name2", "value2");
+	gkm_secret_item_set_fields (item, fields);
 	g_hash_table_unref (fields);
 
 	/* One object matched */
-	vdata = gck_object_get_attribute_data (object, session, CKA_G_MATCHED, &vsize);
+	vdata = gkm_object_get_attribute_data (object, session, CKA_G_MATCHED, &vsize);
 	g_assert (vdata);
 	g_assert (vsize == sizeof (CK_OBJECT_HANDLE));
-	g_assert (*((CK_OBJECT_HANDLE_PTR)vdata) == gck_object_get_handle (GCK_OBJECT (item)));
+	g_assert (*((CK_OBJECT_HANDLE_PTR)vdata) == gkm_object_get_handle (GKM_OBJECT (item)));
 	g_free (vdata);
 
 	g_object_unref (object);
@@ -234,29 +234,29 @@ DEFINE_TEST(create_search_and_change_to_not_match)
 	        { CKA_G_FIELDS, "name1\0value1", 13 },
 	};
 
-	GckObject *object = NULL;
+	GkmObject *object = NULL;
 	GHashTable *fields;
 	gpointer vdata;
 	gsize vsize;
 
-	object = gck_session_create_object_for_factory (session, factory, NULL, attrs, 1);
+	object = gkm_session_create_object_for_factory (session, factory, NULL, attrs, 1);
 	g_assert (object != NULL);
-	g_assert (GCK_IS_SECRET_SEARCH (object));
+	g_assert (GKM_IS_SECRET_SEARCH (object));
 
 	/* One object matched */
-	vdata = gck_object_get_attribute_data (object, session, CKA_G_MATCHED, &vsize);
+	vdata = gkm_object_get_attribute_data (object, session, CKA_G_MATCHED, &vsize);
 	g_assert (vdata);
 	g_assert (vsize == sizeof (CK_OBJECT_HANDLE));
-	g_assert (*((CK_OBJECT_HANDLE_PTR)vdata) == gck_object_get_handle (GCK_OBJECT (item)));
+	g_assert (*((CK_OBJECT_HANDLE_PTR)vdata) == gkm_object_get_handle (GKM_OBJECT (item)));
 	g_free (vdata);
 
 	/* Make it not match */
-	fields = gck_secret_fields_new ();
-	gck_secret_item_set_fields (item, fields);
+	fields = gkm_secret_fields_new ();
+	gkm_secret_item_set_fields (item, fields);
 	g_hash_table_unref (fields);
 
 	/* Nothing matched */
-	vdata = gck_object_get_attribute_data (object, session, CKA_G_MATCHED, &vsize);
+	vdata = gkm_object_get_attribute_data (object, session, CKA_G_MATCHED, &vsize);
 	g_assert (vsize == 0);
 	g_free (vdata);
 
@@ -270,11 +270,11 @@ DEFINE_TEST(create_search_for_bad_collection)
 	        { CKA_G_COLLECTION, "bad-collection", 14 },
 	};
 
-	GckObject *object = NULL;
-	GckTransaction *transaction = gck_transaction_new ();
+	GkmObject *object = NULL;
+	GkmTransaction *transaction = gkm_transaction_new ();
 
-	object = gck_session_create_object_for_factory (session, factory, transaction, attrs, 2);
-	g_assert (gck_transaction_complete_and_unref (transaction) == CKR_OK);
+	object = gkm_session_create_object_for_factory (session, factory, transaction, attrs, 2);
+	g_assert (gkm_transaction_complete_and_unref (transaction) == CKR_OK);
 
 	g_object_unref (object);
 }
@@ -286,26 +286,26 @@ DEFINE_TEST(create_search_for_collection)
 	        { CKA_G_COLLECTION, "test-collection", 15 },
 	};
 
-	GckObject *object = NULL;
+	GkmObject *object = NULL;
 	gpointer vdata;
 	gsize vsize;
 
-	object = gck_session_create_object_for_factory (session, factory, NULL, attrs, 2);
+	object = gkm_session_create_object_for_factory (session, factory, NULL, attrs, 2);
 	g_assert (object != NULL);
-	g_assert (GCK_IS_SECRET_SEARCH (object));
+	g_assert (GKM_IS_SECRET_SEARCH (object));
 
 	/* Should have the collection set properly */
-	vdata = gck_object_get_attribute_data (object, session, CKA_G_COLLECTION , &vsize);
+	vdata = gkm_object_get_attribute_data (object, session, CKA_G_COLLECTION , &vsize);
 	g_assert (vdata);
 	g_assert (vsize == 15);
 	g_assert (memcmp (vdata, "test-collection", 15) == 0);
 	g_free (vdata);
 
 	/* One object matched */
-	vdata = gck_object_get_attribute_data (object, session, CKA_G_MATCHED, &vsize);
+	vdata = gkm_object_get_attribute_data (object, session, CKA_G_MATCHED, &vsize);
 	g_assert (vdata);
 	g_assert (vsize == sizeof (CK_OBJECT_HANDLE));
-	g_assert (*((CK_OBJECT_HANDLE_PTR)vdata) == gck_object_get_handle (GCK_OBJECT (item)));
+	g_assert (*((CK_OBJECT_HANDLE_PTR)vdata) == gkm_object_get_handle (GKM_OBJECT (item)));
 	g_free (vdata);
 
 	g_object_unref (object);
@@ -318,33 +318,33 @@ DEFINE_TEST(create_search_for_collection_no_match)
 	        { CKA_G_COLLECTION, "test-collection", 15 },
 	};
 
-	GckObject *object = NULL;
-	GckSecretCollection *ocoll;
-	GckSecretItem *oitem;
+	GkmObject *object = NULL;
+	GkmSecretCollection *ocoll;
+	GkmSecretItem *oitem;
 	GHashTable *fields;
 	gpointer vdata;
 	gsize vsize;
 
-	ocoll = g_object_new (GCK_TYPE_SECRET_COLLECTION,
+	ocoll = g_object_new (GKM_TYPE_SECRET_COLLECTION,
 	                      "module", module,
-	                      "manager", gck_session_get_manager (session),
+	                      "manager", gkm_session_get_manager (session),
 	                      "identifier", "other-collection",
 	                      NULL);
-	oitem = gck_secret_collection_new_item (ocoll, "other-item");
-	gck_object_expose (GCK_OBJECT (ocoll), TRUE);
+	oitem = gkm_secret_collection_new_item (ocoll, "other-item");
+	gkm_object_expose (GKM_OBJECT (ocoll), TRUE);
 
 	/* Make it match, but remember, wrong collection*/
-	fields = gck_secret_fields_new ();
-	gck_secret_fields_add (fields, "test", "value");
-	gck_secret_item_set_fields (oitem, fields);
+	fields = gkm_secret_fields_new ();
+	gkm_secret_fields_add (fields, "test", "value");
+	gkm_secret_item_set_fields (oitem, fields);
 	g_hash_table_unref (fields);
 
-	object = gck_session_create_object_for_factory (session, factory, NULL, attrs, 2);
+	object = gkm_session_create_object_for_factory (session, factory, NULL, attrs, 2);
 	g_assert (object != NULL);
-	g_assert (GCK_IS_SECRET_SEARCH (object));
+	g_assert (GKM_IS_SECRET_SEARCH (object));
 
 	/* No objects matched */
-	vdata = gck_object_get_attribute_data (object, session, CKA_G_MATCHED, &vsize);
+	vdata = gkm_object_get_attribute_data (object, session, CKA_G_MATCHED, &vsize);
 	g_assert (vsize == 0);
 	g_free (vdata);
 
diff --git a/pkcs11/secret-store/tests/unit-test-secret-textual.c b/pkcs11/secret-store/tests/unit-test-secret-textual.c
index e317199..3e94005 100644
--- a/pkcs11/secret-store/tests/unit-test-secret-textual.c
+++ b/pkcs11/secret-store/tests/unit-test-secret-textual.c
@@ -26,13 +26,13 @@
 #include "run-auto-test.h"
 #include "test-secret-module.h"
 
-#include "gck-secret-collection.h"
-#include "gck-secret-data.h"
-#include "gck-secret-fields.h"
-#include "gck-secret-item.h"
-#include "gck-secret-textual.h"
+#include "gkm-secret-collection.h"
+#include "gkm-secret-data.h"
+#include "gkm-secret-fields.h"
+#include "gkm-secret-item.h"
+#include "gkm-secret-textual.h"
 
-#include "gck/gck-secret.h"
+#include "gkm/gkm-secret.h"
 
 #include "pkcs11/pkcs11i.h"
 
@@ -42,26 +42,26 @@
 #include <stdio.h>
 #include <string.h>
 
-static GckModule *module = NULL;
-static GckSession *session = NULL;
-static GckSecretCollection *collection = NULL;
-static GckSecretData *sdata = NULL;
+static GkmModule *module = NULL;
+static GkmSession *session = NULL;
+static GkmSecretCollection *collection = NULL;
+static GkmSecretData *sdata = NULL;
 
 DEFINE_SETUP(textual)
 {
 	module = test_secret_module_initialize_and_enter ();
 	session = test_secret_module_open_session (TRUE);
 
-	collection = g_object_new (GCK_TYPE_SECRET_COLLECTION,
+	collection = g_object_new (GKM_TYPE_SECRET_COLLECTION,
 	                           "module", module,
 	                           "identifier", "test",
 	                           "label", "brigadooooooooooooon",
 	                           NULL);
-	
-	sdata = g_object_new (GCK_TYPE_SECRET_DATA, NULL);
 
-	g_assert (GCK_IS_SECRET_COLLECTION (collection));
-	
+	sdata = g_object_new (GKM_TYPE_SECRET_DATA, NULL);
+
+	g_assert (GKM_IS_SECRET_COLLECTION (collection));
+
 }
 
 DEFINE_TEARDOWN(textual)
@@ -81,85 +81,85 @@ DEFINE_TEARDOWN(textual)
 
 DEFINE_TEST(textual_read)
 {
-	GckDataResult res;
+	GkmDataResult res;
 	guchar *data;
 	gsize n_data;
 
 	data = test_data_read ("plain.keyring", &n_data);
-	res = gck_secret_textual_read (collection, sdata, data, n_data);
+	res = gkm_secret_textual_read (collection, sdata, data, n_data);
 	g_free (data);
 
 	test_secret_collection_validate (collection, sdata);
 
-	g_assert (res == GCK_DATA_SUCCESS);
+	g_assert (res == GKM_DATA_SUCCESS);
 }
 
 DEFINE_TEST(textual_read_wrong_format)
 {
-	GckDataResult res;
+	GkmDataResult res;
 	guchar *data;
 	gsize n_data;
 
 	data = test_data_read ("encrypted.keyring", &n_data);
-	res = gck_secret_textual_read (collection, sdata, data, n_data);
+	res = gkm_secret_textual_read (collection, sdata, data, n_data);
 	g_free (data);
 
-	g_assert (res == GCK_DATA_UNRECOGNIZED);
+	g_assert (res == GKM_DATA_UNRECOGNIZED);
 }
 
 DEFINE_TEST(textual_read_bad_number)
 {
-	GckSecretItem *item;
-	GckDataResult res;
+	GkmSecretItem *item;
+	GkmDataResult res;
 	const gchar *value;
 	guchar *data;
 	gsize n_data;
 
 	data = test_data_read ("plain-bad-number.keyring", &n_data);
-	res = gck_secret_textual_read (collection, sdata, data, n_data);
+	res = gkm_secret_textual_read (collection, sdata, data, n_data);
 	g_free (data);
 
-	g_assert (res == GCK_DATA_SUCCESS);
+	g_assert (res == GKM_DATA_SUCCESS);
 
-	item = gck_secret_collection_get_item (collection, "1");
-	g_assert (GCK_IS_SECRET_ITEM (item));
-	value = gck_secret_fields_get (gck_secret_item_get_fields (item), "bad-number");
+	item = gkm_secret_collection_get_item (collection, "1");
+	g_assert (GKM_IS_SECRET_ITEM (item));
+	value = gkm_secret_fields_get (gkm_secret_item_get_fields (item), "bad-number");
 	g_assert (value == NULL);
-	value = gck_secret_fields_get (gck_secret_item_get_fields (item), "missing-number");
+	value = gkm_secret_fields_get (gkm_secret_item_get_fields (item), "missing-number");
 	g_assert (value == NULL);
 }
 
 DEFINE_TEST(textual_write)
 {
-	GckDataResult res;
+	GkmDataResult res;
 	guchar *data;
 	gsize n_data;
 
 	test_secret_collection_populate (collection, sdata);
 
-	res = gck_secret_textual_write (collection, sdata, &data, &n_data);
-	g_assert (res == GCK_DATA_SUCCESS);
+	res = gkm_secret_textual_write (collection, sdata, &data, &n_data);
+	g_assert (res == GKM_DATA_SUCCESS);
 	g_assert (data);
 	g_assert (n_data);
 
 	/* Try parsing it again */
-	res = gck_secret_textual_read (collection, sdata, data, n_data);
-	g_assert (res == GCK_DATA_SUCCESS);
+	res = gkm_secret_textual_read (collection, sdata, data, n_data);
+	g_assert (res == GKM_DATA_SUCCESS);
 }
 
 DEFINE_TEST(textual_remove_unavailable)
 {
-	GckDataResult res;
+	GkmDataResult res;
 	GList *items;
 	guchar *data;
 	gsize n_data;
 
 	data = test_data_read ("plain.keyring", &n_data);
-	res = gck_secret_textual_read (collection, sdata, data, n_data);
-	g_assert (res == GCK_DATA_SUCCESS);
+	res = gkm_secret_textual_read (collection, sdata, data, n_data);
+	g_assert (res == GKM_DATA_SUCCESS);
 
 	/* Two items from the file */
-	items = gck_secret_collection_get_items (collection);
+	items = gkm_secret_collection_get_items (collection);
 	g_assert_cmpint (g_list_length (items), ==, 2);
 	g_list_free (items);
 
@@ -167,16 +167,16 @@ DEFINE_TEST(textual_remove_unavailable)
 	test_secret_collection_populate (collection, sdata);
 
 	/* Should have added three more */
-	items = gck_secret_collection_get_items (collection);
+	items = gkm_secret_collection_get_items (collection);
 	g_assert_cmpint (g_list_length (items), ==, 5);
 	g_list_free (items);
 
 	/* Re-read the keyring */
-	res = gck_secret_textual_read (collection, sdata, data, n_data);
-	g_assert (res == GCK_DATA_SUCCESS);
+	res = gkm_secret_textual_read (collection, sdata, data, n_data);
+	g_assert (res == GKM_DATA_SUCCESS);
 
 	/* And we're back to two */
-	items = gck_secret_collection_get_items (collection);
+	items = gkm_secret_collection_get_items (collection);
 	g_assert_cmpint (g_list_length (items), ==, 2);
 	g_list_free (items);
 
diff --git a/pkcs11/ssh-store/Makefile.am b/pkcs11/ssh-store/Makefile.am
index 2b7c5ab..b62e7f9 100644
--- a/pkcs11/ssh-store/Makefile.am
+++ b/pkcs11/ssh-store/Makefile.am
@@ -6,39 +6,39 @@ INCLUDES = \
     	$(GOBJECT_CFLAGS) \
 	$(LIBGCRYPT_CFLAGS) \
 	$(GLIB_CFLAGS)
-	
-			
+
+
 # ------------------------------------------------------------------------------
 # The ssh-store component code
 
 noinst_LTLIBRARIES = \
-	libgck-ssh-store.la
+	libgkm-ssh-store.la
 
-libgck_ssh_store_la_SOURCES = \
-	gck-ssh-store.h \
-	gck-ssh-module.c gck-ssh-module.h \
-	gck-ssh-openssh.c gck-ssh-openssh.h \
-	gck-ssh-private-key.c gck-ssh-private-key.h \
-	gck-ssh-public-key.c gck-ssh-public-key.h
+libgkm_ssh_store_la_SOURCES = \
+	gkm-ssh-store.h \
+	gkm-ssh-module.c gkm-ssh-module.h \
+	gkm-ssh-openssh.c gkm-ssh-openssh.h \
+	gkm-ssh-private-key.c gkm-ssh-private-key.h \
+	gkm-ssh-public-key.c gkm-ssh-public-key.h
 
 # ------------------------------------------------------------------------------
-# The standalone module 
+# The standalone module
 
 moduledir = $(libdir)/gnome-keyring/devel/
 
 module_LTLIBRARIES = \
-	gck-ssh-store-standalone.la
+	gkm-ssh-store-standalone.la
 
-gck_ssh_store_standalone_la_LDFLAGS = \
+gkm_ssh_store_standalone_la_LDFLAGS = \
 	-module -avoid-version \
 	-no-undefined -export-symbols-regex 'C_GetFunctionList'
 
-gck_ssh_store_standalone_la_SOURCES = \
-	gck-ssh-standalone.c
+gkm_ssh_store_standalone_la_SOURCES = \
+	gkm-ssh-standalone.c
 
-gck_ssh_store_standalone_la_LIBADD = \
-	libgck-ssh-store.la \
-	$(top_builddir)/pkcs11/gck/libgck.la \
+gkm_ssh_store_standalone_la_LIBADD = \
+	libgkm-ssh-store.la \
+	$(top_builddir)/pkcs11/gkm/libgkm.la \
 	$(GOBJECT_LIBS) \
 	$(GTHREAD_LIBS) \
 	$(GLIB_LIBS) \
@@ -51,7 +51,7 @@ gck_ssh_store_standalone_la_LIBADD = \
 if WITH_TESTS
 TESTS_DIR = tests
 else
-TESTS_DIR = 
+TESTS_DIR =
 endif
 
 SUBDIRS = . $(TESTS_DIR)
diff --git a/pkcs11/ssh-store/gck-ssh-module.c b/pkcs11/ssh-store/gkm-ssh-module.c
similarity index 58%
rename from pkcs11/ssh-store/gck-ssh-module.c
rename to pkcs11/ssh-store/gkm-ssh-module.c
index 1f851a3..0bbe3e1 100644
--- a/pkcs11/ssh-store/gck-ssh-module.c
+++ b/pkcs11/ssh-store/gkm-ssh-module.c
@@ -1,44 +1,44 @@
-/* 
+/*
  * 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"
 
-#include "gck-ssh-module.h"
-#include "gck-ssh-private-key.h"
-#include "gck-ssh-public-key.h"
+#include "gkm-ssh-module.h"
+#include "gkm-ssh-private-key.h"
+#include "gkm-ssh-public-key.h"
 
 #include "egg/egg-error.h"
 
-#include "gck/gck-file-tracker.h"
+#include "gkm/gkm-file-tracker.h"
 
 #include <string.h>
 
-struct _GckSshModule {
-	GckModule parent;
-	GckFileTracker *tracker;
+struct _GkmSshModule {
+	GkmModule parent;
+	GkmFileTracker *tracker;
 	gchar *directory;
 	GHashTable *keys_by_path;
 };
 
-static const CK_SLOT_INFO gck_ssh_module_slot_info = {
+static const CK_SLOT_INFO gkm_ssh_module_slot_info = {
 	"SSH Keys",
 	"Gnome Keyring",
 	CKF_TOKEN_PRESENT,
@@ -46,7 +46,7 @@ static const CK_SLOT_INFO gck_ssh_module_slot_info = {
 	{ 0, 0 }
 };
 
-static const CK_TOKEN_INFO gck_ssh_module_token_info = {
+static const CK_TOKEN_INFO gkm_ssh_module_token_info = {
 	"SSH Keys",
 	"Gnome Keyring",
 	"1.0",
@@ -68,49 +68,49 @@ static const CK_TOKEN_INFO gck_ssh_module_token_info = {
 };
 
 
-G_DEFINE_TYPE (GckSshModule, gck_ssh_module, GCK_TYPE_MODULE);
+G_DEFINE_TYPE (GkmSshModule, gkm_ssh_module, GKM_TYPE_MODULE);
 
-GckModule*  _gck_ssh_store_get_module_for_testing (void);
+GkmModule*  _gkm_ssh_store_get_module_for_testing (void);
 
 /* -----------------------------------------------------------------------------
- * ACTUAL PKCS#11 Module Implementation 
+ * ACTUAL PKCS#11 Module Implementation
  */
 
 /* Include all the module entry points */
-#include "gck/gck-module-ep.h"
-GCK_DEFINE_MODULE (gck_ssh_module, GCK_TYPE_SSH_MODULE);
+#include "gkm/gkm-module-ep.h"
+GKM_DEFINE_MODULE (gkm_ssh_module, GKM_TYPE_SSH_MODULE);
 
 /* -----------------------------------------------------------------------------
- * INTERNAL 
+ * INTERNAL
  */
 
 static gchar*
 private_path_for_public (const gchar *public_path)
 {
 	gsize length;
-	
+
 	g_assert (public_path);
-	
+
 	length = strlen (public_path);
 	if (length > 4 && g_str_equal (public_path + (length - 4), ".pub"))
 		return g_strndup (public_path, length - 4);
-	
+
 	return NULL;
 }
 
 static void
-file_load (GckFileTracker *tracker, const gchar *path, GckSshModule *self)
+file_load (GkmFileTracker *tracker, const gchar *path, GkmSshModule *self)
 {
-	GckSshPrivateKey *key;
+	GkmSshPrivateKey *key;
 	gchar *private_path;
-	GckManager *manager;
+	GkmManager *manager;
 	GError *error = NULL;
 	gchar *unique;
-	
+
 	g_return_if_fail (path);
-	g_return_if_fail (GCK_IS_SSH_MODULE (self));
-	
-	manager = gck_module_get_manager (GCK_MODULE (self));
+	g_return_if_fail (GKM_IS_SSH_MODULE (self));
+
+	manager = gkm_module_get_manager (GKM_MODULE (self));
 
 	private_path = private_path_for_public (path);
 	if (!private_path || !g_file_test (private_path, G_FILE_TEST_IS_REGULAR)) {
@@ -118,62 +118,62 @@ file_load (GckFileTracker *tracker, const gchar *path, GckSshModule *self)
 		g_free (private_path);
 		return;
 	}
-	
+
 	/* Create a key if necessary */
 	key = g_hash_table_lookup (self->keys_by_path, path);
 	if (key == NULL) {
 		unique = g_strdup_printf ("ssh-store:%s", private_path);
-		key = gck_ssh_private_key_new (GCK_MODULE (self), unique);
+		key = gkm_ssh_private_key_new (GKM_MODULE (self), unique);
 		g_free (unique);
-		
+
 		g_hash_table_replace (self->keys_by_path, g_strdup (path), key);
 	}
-	
+
 	/* Parse the data into the key */
-	if (!gck_ssh_private_key_parse (key, path, private_path, &error)) {
+	if (!gkm_ssh_private_key_parse (key, path, private_path, &error)) {
 		if (error) {
 			g_message ("couldn't parse data: %s: %s", path, egg_error_message (error));
 			g_clear_error (&error);
 		}
-		gck_object_expose (GCK_OBJECT (key), FALSE);
+		gkm_object_expose (GKM_OBJECT (key), FALSE);
 
 	/* When successful register with the object manager */
 	} else {
-		gck_object_expose (GCK_OBJECT (key), TRUE);
+		gkm_object_expose (GKM_OBJECT (key), TRUE);
 	}
 
 	g_free (private_path);
 }
 
 static void
-file_remove (GckFileTracker *tracker, const gchar *path, GckSshModule *self)
+file_remove (GkmFileTracker *tracker, const gchar *path, GkmSshModule *self)
 {
 	g_return_if_fail (path);
-	g_return_if_fail (GCK_IS_SSH_MODULE (self));
+	g_return_if_fail (GKM_IS_SSH_MODULE (self));
 	g_hash_table_remove (self->keys_by_path, path);
 }
 
 
 /* -----------------------------------------------------------------------------
- * OBJECT 
+ * OBJECT
  */
 
-static const CK_SLOT_INFO* 
-gck_ssh_module_real_get_slot_info (GckModule *self)
+static const CK_SLOT_INFO*
+gkm_ssh_module_real_get_slot_info (GkmModule *self)
 {
-	return &gck_ssh_module_slot_info;
+	return &gkm_ssh_module_slot_info;
 }
 
 static const CK_TOKEN_INFO*
-gck_ssh_module_real_get_token_info (GckModule *self)
+gkm_ssh_module_real_get_token_info (GkmModule *self)
 {
-	return &gck_ssh_module_token_info;
+	return &gkm_ssh_module_token_info;
 }
 
-static void 
-gck_ssh_module_real_parse_argument (GckModule *base, const gchar *name, const gchar *value)
+static void
+gkm_ssh_module_real_parse_argument (GkmModule *base, const gchar *name, const gchar *value)
 {
-	GckSshModule *self = GCK_SSH_MODULE (base);
+	GkmSshModule *self = GKM_SSH_MODULE (base);
 	if (g_str_equal (name, "directory")) {
 		g_free (self->directory);
 		self->directory = g_strdup (value);
@@ -181,79 +181,79 @@ gck_ssh_module_real_parse_argument (GckModule *base, const gchar *name, const gc
 }
 
 static CK_RV
-gck_ssh_module_real_refresh_token (GckModule *base)
+gkm_ssh_module_real_refresh_token (GkmModule *base)
 {
-	GckSshModule *self = GCK_SSH_MODULE (base);
-	gck_file_tracker_refresh (self->tracker, FALSE);
+	GkmSshModule *self = GKM_SSH_MODULE (base);
+	gkm_file_tracker_refresh (self->tracker, FALSE);
 	return CKR_OK;
 }
 
-static GObject* 
-gck_ssh_module_constructor (GType type, guint n_props, GObjectConstructParam *props) 
+static GObject*
+gkm_ssh_module_constructor (GType type, guint n_props, GObjectConstructParam *props)
 {
-	GckSshModule *self = GCK_SSH_MODULE (G_OBJECT_CLASS (gck_ssh_module_parent_class)->constructor(type, n_props, props));
-	g_return_val_if_fail (self, NULL);	
+	GkmSshModule *self = GKM_SSH_MODULE (G_OBJECT_CLASS (gkm_ssh_module_parent_class)->constructor(type, n_props, props));
+	g_return_val_if_fail (self, NULL);
 
 	if (!self->directory)
 		self->directory = g_strdup ("~/.ssh");
-	self->tracker = gck_file_tracker_new (self->directory, "*.pub", NULL);
+	self->tracker = gkm_file_tracker_new (self->directory, "*.pub", NULL);
 	g_signal_connect (self->tracker, "file-added", G_CALLBACK (file_load), self);
 	g_signal_connect (self->tracker, "file-changed", G_CALLBACK (file_load), self);
 	g_signal_connect (self->tracker, "file-removed", G_CALLBACK (file_remove), self);
-	
+
 	return G_OBJECT (self);
 }
 
 static void
-gck_ssh_module_init (GckSshModule *self)
+gkm_ssh_module_init (GkmSshModule *self)
 {
 	self->keys_by_path = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
 }
 
 static void
-gck_ssh_module_dispose (GObject *obj)
+gkm_ssh_module_dispose (GObject *obj)
 {
-	GckSshModule *self = GCK_SSH_MODULE (obj);
-	
+	GkmSshModule *self = GKM_SSH_MODULE (obj);
+
 	if (self->tracker)
 		g_object_unref (self->tracker);
 	self->tracker = NULL;
-	
+
 	g_hash_table_remove_all (self->keys_by_path);
-    
-	G_OBJECT_CLASS (gck_ssh_module_parent_class)->dispose (obj);
+
+	G_OBJECT_CLASS (gkm_ssh_module_parent_class)->dispose (obj);
 }
 
 static void
-gck_ssh_module_finalize (GObject *obj)
+gkm_ssh_module_finalize (GObject *obj)
 {
-	GckSshModule *self = GCK_SSH_MODULE (obj);
-	
+	GkmSshModule *self = GKM_SSH_MODULE (obj);
+
 	g_assert (self->tracker == NULL);
-	
+
 	g_hash_table_destroy (self->keys_by_path);
 	self->keys_by_path = NULL;
-	
+
 	g_free (self->directory);
 	self->directory = NULL;
 
-	G_OBJECT_CLASS (gck_ssh_module_parent_class)->finalize (obj);
+	G_OBJECT_CLASS (gkm_ssh_module_parent_class)->finalize (obj);
 }
 
 static void
-gck_ssh_module_class_init (GckSshModuleClass *klass)
+gkm_ssh_module_class_init (GkmSshModuleClass *klass)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	GckModuleClass *module_class = GCK_MODULE_CLASS (klass);
-	
-	gobject_class->constructor = gck_ssh_module_constructor;
-	gobject_class->dispose = gck_ssh_module_dispose;
-	gobject_class->finalize = gck_ssh_module_finalize;
-	
-	module_class->get_slot_info = gck_ssh_module_real_get_slot_info;
-	module_class->get_token_info = gck_ssh_module_real_get_token_info;
-	module_class->parse_argument = gck_ssh_module_real_parse_argument;
-	module_class->refresh_token = gck_ssh_module_real_refresh_token;
+	GkmModuleClass *module_class = GKM_MODULE_CLASS (klass);
+
+	gobject_class->constructor = gkm_ssh_module_constructor;
+	gobject_class->dispose = gkm_ssh_module_dispose;
+	gobject_class->finalize = gkm_ssh_module_finalize;
+
+	module_class->get_slot_info = gkm_ssh_module_real_get_slot_info;
+	module_class->get_token_info = gkm_ssh_module_real_get_token_info;
+	module_class->parse_argument = gkm_ssh_module_real_parse_argument;
+	module_class->refresh_token = gkm_ssh_module_real_refresh_token;
 }
 
 /* ----------------------------------------------------------------------------
@@ -261,14 +261,14 @@ gck_ssh_module_class_init (GckSshModuleClass *klass)
  */
 
 CK_FUNCTION_LIST_PTR
-gck_ssh_store_get_functions (void)
+gkm_ssh_store_get_functions (void)
 {
-	gck_crypto_initialize ();
-	return gck_ssh_module_function_list;
+	gkm_crypto_initialize ();
+	return gkm_ssh_module_function_list;
 }
 
-GckModule*
-_gck_ssh_store_get_module_for_testing (void)
+GkmModule*
+_gkm_ssh_store_get_module_for_testing (void)
 {
 	return pkcs11_module;
 }
diff --git a/pkcs11/ssh-store/gkm-ssh-module.h b/pkcs11/ssh-store/gkm-ssh-module.h
new file mode 100644
index 0000000..50421a1
--- /dev/null
+++ b/pkcs11/ssh-store/gkm-ssh-module.h
@@ -0,0 +1,46 @@
+/*
+ * 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 __GKM_SSH_MODULE_H__
+#define __GKM_SSH_MODULE_H__
+
+#include <glib-object.h>
+
+#include "gkm-ssh-store.h"
+#include "gkm/gkm-module.h"
+
+#define GKM_TYPE_SSH_MODULE               (gkm_ssh_module_get_type ())
+#define GKM_SSH_MODULE(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_SSH_MODULE, GkmSshModule))
+#define GKM_SSH_MODULE_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_SSH_MODULE, GkmSshModuleClass))
+#define GKM_IS_SSH_MODULE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_SSH_MODULE))
+#define GKM_IS_SSH_MODULE_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_SSH_MODULE))
+#define GKM_SSH_MODULE_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_SSH_MODULE, GkmSshModuleClass))
+
+typedef struct _GkmSshModule GkmSshModule;
+typedef struct _GkmSshModuleClass GkmSshModuleClass;
+
+struct _GkmSshModuleClass {
+	GkmModuleClass parent_class;
+};
+
+GType               gkm_ssh_module_get_type               (void);
+
+#endif /* __GKM_SSH_MODULE_H__ */
diff --git a/pkcs11/ssh-store/gck-ssh-openssh.c b/pkcs11/ssh-store/gkm-ssh-openssh.c
similarity index 88%
rename from pkcs11/ssh-store/gck-ssh-openssh.c
rename to pkcs11/ssh-store/gkm-ssh-openssh.c
index 14195ff..44953ea 100644
--- a/pkcs11/ssh-store/gck-ssh-openssh.c
+++ b/pkcs11/ssh-store/gkm-ssh-openssh.c
@@ -1,9 +1,9 @@
 
-#include "gck-ssh-openssh.h"
+#include "gkm-ssh-openssh.h"
 
-#include "gck/gck-data-asn1.h"
-#include "gck/gck-data-der.h"
-#include "gck/gck-data-types.h"
+#include "gkm/gkm-data-asn1.h"
+#include "gkm/gkm-data-der.h"
+#include "gkm/gkm-data-types.h"
 
 #include "egg/egg-buffer.h"
 #include "egg/egg-openssl.h"
@@ -12,7 +12,7 @@
 typedef struct _ParsePrivate {
 	gcry_sexp_t sexp;
 	gboolean seen;
-	GckDataResult result;
+	GkmDataResult result;
 	const gchar *password;
 	gssize n_password;
 } ParsePrivate;
@@ -38,14 +38,14 @@ read_mpi (EggBuffer *req, gsize *offset, gcry_mpi_t *mpi)
 	const guchar *data;
 	gsize len;
 	gcry_error_t gcry;
-	
+
 	if (!egg_buffer_get_byte_array (req, *offset, offset, &data, &len))
 		return FALSE;
-		
+
 	gcry = gcry_mpi_scan (mpi, GCRYMPI_FMT_USG, data, len, NULL);
 	if (gcry)
 		return FALSE;
-		
+
 	return TRUE;
 }
 
@@ -56,18 +56,18 @@ read_mpi (EggBuffer *req, gsize *offset, gcry_mpi_t *mpi)
 	"    (q %m)"     \
 	"    (g %m)"     \
 	"    (y %m)))"
-	
+
 static gboolean
 read_public_dsa (EggBuffer *req, gsize *offset, gcry_sexp_t *sexp)
 {
 	gcry_mpi_t p, q, g, y;
 	int gcry;
-	
+
 	if (!read_mpi (req, offset, &p) ||
 	    !read_mpi (req, offset, &q) ||
 	    !read_mpi (req, offset, &g) ||
 	    !read_mpi (req, offset, &y))
-	    	return FALSE;
+		return FALSE;
 
 	gcry = gcry_sexp_build (sexp, NULL, SEXP_PUBLIC_DSA, p, q, g, y);
 	if (gcry) {
@@ -79,7 +79,7 @@ read_public_dsa (EggBuffer *req, gsize *offset, gcry_sexp_t *sexp)
 	gcry_mpi_release (q);
 	gcry_mpi_release (g);
 	gcry_mpi_release (y);
-		
+
 	return TRUE;
 }
 
@@ -88,16 +88,16 @@ read_public_dsa (EggBuffer *req, gsize *offset, gcry_sexp_t *sexp)
 	"  (rsa"         \
 	"    (n %m)"     \
 	"    (e %m)))"
-	
+
 static gboolean
 read_public_rsa (EggBuffer *req, gsize *offset, gcry_sexp_t *sexp)
 {
 	gcry_mpi_t n, e;
 	int gcry;
-	
+
 	if (!read_mpi (req, offset, &e) ||
 	    !read_mpi (req, offset, &n))
-	    	return FALSE;
+		return FALSE;
 
 	gcry = gcry_sexp_build (sexp, NULL, SEXP_PUBLIC_RSA, n, e);
 	if (gcry) {
@@ -107,7 +107,7 @@ read_public_rsa (EggBuffer *req, gsize *offset, gcry_sexp_t *sexp)
 
 	gcry_mpi_release (n);
 	gcry_mpi_release (e);
-		
+
 	return TRUE;
 }
 
@@ -117,19 +117,19 @@ read_public (EggBuffer *req, gsize *offset, gcry_sexp_t *key, int *algo)
 	gboolean ret;
 	gchar *stype;
 	int alg;
-	
+
 	/* The string algorithm */
 	if (!egg_buffer_get_string (req, *offset, offset, &stype, (EggBufferAllocator)g_realloc))
 		return FALSE;
-	
+
 	alg = keytype_to_algo (stype);
 	g_free (stype);
-	
+
 	if (!alg) {
 		g_warning ("unsupported algorithm from SSH: %s", stype);
 		return FALSE;
 	}
-	
+
 	switch (alg) {
 	case GCRY_PK_RSA:
 		ret = read_public_rsa (req, offset, key);
@@ -141,48 +141,48 @@ read_public (EggBuffer *req, gsize *offset, gcry_sexp_t *key, int *algo)
 		g_assert_not_reached ();
 		return FALSE;
 	}
-	
+
 	if (!ret) {
 		g_warning ("couldn't read incoming SSH private key");
 		return FALSE;
 	}
-	
+
 	if (algo)
 		*algo = alg;
 	return TRUE;
 }
 
-static GckDataResult
+static GkmDataResult
 load_encrypted_key (const guchar *data, gsize n_data, const gchar *dekinfo,
                     const gchar *password, gssize n_password, gcry_sexp_t *skey)
 {
 	guchar *decrypted = NULL;
 	gsize n_decrypted = 0;
-	GckDataResult ret;
+	GkmDataResult ret;
 	gboolean res;
 	gint length;
-	
-	/* Decrypt, this will result in garble if invalid password */	
-	res = egg_openssl_decrypt_block (dekinfo, password, n_password, 
+
+	/* Decrypt, this will result in garble if invalid password */
+	res = egg_openssl_decrypt_block (dekinfo, password, n_password,
 	                                      data, n_data, &decrypted, &n_decrypted);
 	if (!res)
 		return FALSE;
-			
+
 	g_assert (decrypted);
-		
+
 	/* Unpad the DER data */
 	length = egg_asn1_element_length (decrypted, n_decrypted);
 	if (length > 0)
 		n_decrypted = length;
-	
+
 	/* Try to parse */
-	ret = gck_data_der_read_private_key (decrypted, n_decrypted, skey);
+	ret = gkm_data_der_read_private_key (decrypted, n_decrypted, skey);
 	egg_secure_free (decrypted);
 
-	if (ret != GCK_DATA_UNRECOGNIZED)
+	if (ret != GKM_DATA_UNRECOGNIZED)
 		return ret;
-	
-	return GCK_DATA_LOCKED;
+
+	return GKM_DATA_LOCKED;
 }
 
 static gboolean
@@ -198,7 +198,7 @@ is_private_key_type (GQuark type)
 		PEM_DSA_PRIVATE_KEY = g_quark_from_static_string ("DSA PRIVATE KEY");
 		g_once_init_leave (&quarks_inited, 1);
 	}
-	
+
 	/* Only handle SSHv2 private keys */
 	return (type == PEM_RSA_PRIVATE_KEY || type == PEM_DSA_PRIVATE_KEY);
 }
@@ -209,7 +209,7 @@ parsed_pem_block (GQuark type, const guchar *data, gsize n_data,
 {
 	ParsePrivate *ctx = (ParsePrivate*)user_data;
 	const gchar *dekinfo;
-	
+
 	if (!is_private_key_type (type))
 		return;
 
@@ -218,16 +218,16 @@ parsed_pem_block (GQuark type, const guchar *data, gsize n_data,
 	/* Only parse first key in the file */
 	if (ctx->sexp)
 		return;
-	
+
 	/* If it's encrypted ... */
 	dekinfo = egg_openssl_get_dekinfo (headers);
 	if (dekinfo) {
-		ctx->result = load_encrypted_key (data, n_data, dekinfo, ctx->password, 
+		ctx->result = load_encrypted_key (data, n_data, dekinfo, ctx->password,
 		                                  ctx->n_password, &ctx->sexp);
-		
+
 	/* not encryted, just load the data */
 	} else {
-		ctx->result = gck_data_der_read_private_key (data, n_data, &ctx->sexp);
+		ctx->result = gkm_data_der_read_private_key (data, n_data, &ctx->sexp);
 	}
 }
 
@@ -236,12 +236,12 @@ digest_pem_block (GQuark type, const guchar *data, gsize n_data,
                   GHashTable *headers, gpointer user_data)
 {
 	gchar **result = (gchar**)user_data;
-	
+
 	g_assert (result);
-	
+
 	if (!is_private_key_type (type))
 		return;
-	
+
 	/* Only digest the first key in the file */
 	if (*result != NULL)
 		return;
@@ -253,8 +253,8 @@ digest_pem_block (GQuark type, const guchar *data, gsize n_data,
  * PUBLIC
  */
 
-GckDataResult
-gck_ssh_openssh_parse_public_key (const guchar *data, gsize n_data,
+GkmDataResult
+gkm_ssh_openssh_parse_public_key (const guchar *data, gsize n_data,
                                   gcry_sexp_t *sexp, gchar **comment)
 {
 	EggBuffer buf;
@@ -269,7 +269,7 @@ gck_ssh_openssh_parse_public_key (const guchar *data, gsize n_data,
 
 	g_return_val_if_fail (data, FALSE);
 	g_return_val_if_fail (sexp, FALSE);
-	
+
 	/* Look for a key line */
 	for (;;) {
 		/* Eat space at the front */
@@ -277,15 +277,15 @@ gck_ssh_openssh_parse_public_key (const guchar *data, gsize n_data,
 			++data;
 			--n_data;
 		}
-	
+
 		/* Not a comment or blank line? Then parse... */
-		if (data[0] != '#') 
+		if (data[0] != '#')
 			break;
-		
+
 		/* Skip to the next line */
 		at = memchr (data, '\n', n_data);
-		if (!at) 
-			return GCK_DATA_UNRECOGNIZED;
+		if (!at)
+			return GKM_DATA_UNRECOGNIZED;
 		at += 1;
 		n_data -= (at - data);
 		data = at;
@@ -295,14 +295,14 @@ gck_ssh_openssh_parse_public_key (const guchar *data, gsize n_data,
 	at = memchr (data, '\n', n_data);
 	if (at != NULL)
 		n_data = at - data;
-	
+
 	/* Find the first space */
 	at = memchr (data, ' ', n_data);
 	if (!at) {
 		g_message ("SSH public key missing space");
-		return GCK_DATA_UNRECOGNIZED;
+		return GKM_DATA_UNRECOGNIZED;
 	}
-	
+
 	/* Parse the key type */
 	val = g_strndup ((gchar*)data, at - data);
 	algo = keytype_to_algo (val);
@@ -313,8 +313,8 @@ gck_ssh_openssh_parse_public_key (const guchar *data, gsize n_data,
 	}
 	g_free (val);
 	if (!algo)
-		return GCK_DATA_UNRECOGNIZED;
-	
+		return GKM_DATA_UNRECOGNIZED;
+
 	/* Skip more whitespace */
 	n_data -= (at - data);
 	data = at;
@@ -327,12 +327,12 @@ gck_ssh_openssh_parse_public_key (const guchar *data, gsize n_data,
 	at = memchr (data, ' ', n_data);
 	if (at == NULL)
 		at = data + n_data;
-	
+
 	/* Decode the base64 key */
 	save = state = 0;
 	decoded = g_malloc (n_data * 3 / 4);
 	n_decoded = g_base64_decode_step ((gchar*)data, n_data, decoded, &state, &save);
-	
+
 	/* Parse the actual key */
 	egg_buffer_init_static (&buf, decoded, n_decoded);
 	offset = 0;
@@ -340,7 +340,7 @@ gck_ssh_openssh_parse_public_key (const guchar *data, gsize n_data,
 	g_free (decoded);
 	if (!ret) {
 		g_message ("failed to parse base64 part of SSH key");
-		return GCK_DATA_FAILURE;
+		return GKM_DATA_FAILURE;
 	}
 
 	/* Skip more whitespace */
@@ -350,17 +350,17 @@ gck_ssh_openssh_parse_public_key (const guchar *data, gsize n_data,
 		++data;
 		--n_data;
 	}
-	
+
 	/* If there's data left, its the comment */
 	if (comment)
 		*comment = n_data ? g_strndup ((gchar*)data, n_data) : NULL;
 
-	return GCK_DATA_SUCCESS;
+	return GKM_DATA_SUCCESS;
 }
 
-GckDataResult
-gck_ssh_openssh_parse_private_key (const guchar *data, gsize n_data, 
-                                   const gchar *password, gssize n_password, 
+GkmDataResult
+gkm_ssh_openssh_parse_private_key (const guchar *data, gsize n_data,
+                                   const gchar *password, gssize n_password,
                                    gcry_sexp_t *sexp)
 {
 	ParsePrivate ctx;
@@ -372,21 +372,21 @@ gck_ssh_openssh_parse_private_key (const guchar *data, gsize n_data,
 	ctx.sexp = NULL;
 	ctx.password = password;
 	ctx.n_password = n_password;
-	
+
 	num = egg_openssl_pem_parse (data, n_data, parsed_pem_block, &ctx);
 
 	/* Didn't find any private key there */
 	if (num == 0 || !ctx.seen) {
 		g_message ("no private keys found in file");
-		return GCK_DATA_UNRECOGNIZED;
+		return GKM_DATA_UNRECOGNIZED;
 	}
-	
+
 	*sexp = ctx.sexp;
 	return ctx.result;
 }
 
 gchar*
-gck_ssh_openssh_digest_private_key (const guchar *data, gsize n_data)
+gkm_ssh_openssh_digest_private_key (const guchar *data, gsize n_data)
 {
 	gchar *result = NULL;
 	egg_openssl_pem_parse (data, n_data, digest_pem_block, &result);
diff --git a/pkcs11/ssh-store/gck-ssh-openssh.h b/pkcs11/ssh-store/gkm-ssh-openssh.h
similarity index 66%
rename from pkcs11/ssh-store/gck-ssh-openssh.h
rename to pkcs11/ssh-store/gkm-ssh-openssh.h
index 36d71eb..2a2a7d0 100644
--- a/pkcs11/ssh-store/gck-ssh-openssh.h
+++ b/pkcs11/ssh-store/gkm-ssh-openssh.h
@@ -1,24 +1,24 @@
-#ifndef GCKSSHOPENSSH_H_
-#define GCKSSHOPENSSH_H_
+#ifndef GKM_SSHOPENSSH_H_
+#define GKM_SSHOPENSSH_H_
 
 #include <glib.h>
 
 #include <gcrypt.h>
 
-#include "gck/gck-data-types.h"
+#include "gkm/gkm-data-types.h"
 
-GckDataResult         gck_ssh_openssh_parse_public_key                   (const guchar *data, 
+GkmDataResult         gkm_ssh_openssh_parse_public_key                   (const guchar *data,
                                                                           gsize n_data,
-                                                                          gcry_sexp_t *sexp, 
+                                                                          gcry_sexp_t *sexp,
                                                                           gchar **comment);
 
-GckDataResult         gck_ssh_openssh_parse_private_key                  (const guchar *data, 
+GkmDataResult         gkm_ssh_openssh_parse_private_key                  (const guchar *data,
                                                                           gsize n_data,
                                                                           const gchar *password,
                                                                           gssize n_password,
                                                                           gcry_sexp_t *sexp);
 
-gchar*                gck_ssh_openssh_digest_private_key                 (const guchar *data,
+gchar*                gkm_ssh_openssh_digest_private_key                 (const guchar *data,
                                                                           gsize n_data);
 
-#endif /* GCKSSHOPENSSH_H_ */
+#endif /* GKM_SSHOPENSSH_H_ */
diff --git a/pkcs11/ssh-store/gkm-ssh-private-key.c b/pkcs11/ssh-store/gkm-ssh-private-key.c
new file mode 100644
index 0000000..b633a56
--- /dev/null
+++ b/pkcs11/ssh-store/gkm-ssh-private-key.c
@@ -0,0 +1,378 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+
+#include "gkm-ssh-openssh.h"
+#include "gkm-ssh-private-key.h"
+
+#include "gkm/gkm-attributes.h"
+#include "gkm/gkm-credential.h"
+#include "gkm/gkm-manager.h"
+#include "gkm/gkm-module.h"
+#include "gkm/gkm-object.h"
+#include "gkm/gkm-sexp.h"
+#include "gkm/gkm-util.h"
+
+#include "pkcs11/pkcs11i.h"
+
+#include <glib/gi18n.h>
+
+enum {
+	PROP_0,
+	PROP_LABEL,
+	PROP_PUBLIC_KEY
+};
+
+struct _GkmSshPrivateKey {
+	GkmPrivateXsaKey parent;
+
+	GkmSshPublicKey *pubkey;
+	gchar *label;
+	guchar *private_data;
+	gsize n_private_data;
+
+	gboolean is_encrypted;
+};
+
+G_DEFINE_TYPE (GkmSshPrivateKey, gkm_ssh_private_key, GKM_TYPE_PRIVATE_XSA_KEY);
+
+/* -----------------------------------------------------------------------------
+ * INTERNAL
+ */
+
+static CK_RV
+unlock_private_key (GkmSshPrivateKey *self, const gchar *password,
+                    gssize n_password, GkmSexp **result)
+{
+	GkmDataResult res;
+	gcry_sexp_t sexp;
+	GkmSexp *wrapper;
+
+	g_assert (GKM_IS_SSH_PRIVATE_KEY (self));
+
+	res = gkm_ssh_openssh_parse_private_key (self->private_data,
+	                                         self->n_private_data,
+	                                         password, n_password, &sexp);
+
+	switch (res) {
+	case GKM_DATA_LOCKED:
+		self->is_encrypted = TRUE;
+		return CKR_PIN_INCORRECT;
+	case GKM_DATA_FAILURE:
+		g_message ("couldn't parse private SSH key: %s", self->label);
+		return CKR_GENERAL_ERROR;
+	case GKM_DATA_UNRECOGNIZED:
+		g_message ("invalid or unrecognized private SSH key: %s", self->label);
+		return CKR_FUNCTION_FAILED;
+	case GKM_DATA_SUCCESS:
+		break;
+	default:
+		g_assert_not_reached();
+	}
+
+	if (!password || !password[0])
+		self->is_encrypted = FALSE;
+
+	wrapper = gkm_sexp_new (sexp);
+	*result = wrapper;
+
+	return CKR_OK;
+}
+
+static void
+realize_and_take_data (GkmSshPrivateKey *self, gcry_sexp_t sexp, gchar *comment,
+                       guchar *private_data, gsize n_private_data)
+{
+	GkmSexp *wrapper;
+
+	g_assert (GKM_IS_SSH_PRIVATE_KEY (self));
+
+	/* The base public key gets setup. */
+	wrapper = gkm_sexp_new (sexp);
+	gkm_sexp_key_set_base (GKM_SEXP_KEY (self), wrapper);
+	gkm_sexp_key_set_base (GKM_SEXP_KEY (self->pubkey), wrapper);
+	gkm_sexp_unref (wrapper);
+
+	/* Own the comment */
+	gkm_ssh_public_key_set_label (self->pubkey, comment);
+	gkm_ssh_private_key_set_label (self, comment);
+	g_free (comment);
+
+	/* Own the data */
+	g_free (self->private_data);
+	self->private_data = private_data;
+	self->n_private_data = n_private_data;
+
+	/* Try to parse the private data, and note if it's not actually encrypted */
+	self->is_encrypted = TRUE;
+	if (unlock_private_key (self, "", 0, &wrapper) == CKR_OK) {
+		self->is_encrypted = FALSE;
+		gkm_private_xsa_key_set_unlocked_private (GKM_PRIVATE_XSA_KEY (self), wrapper);
+		gkm_sexp_unref (wrapper);
+	}
+}
+
+/* -----------------------------------------------------------------------------
+ * OBJECT
+ */
+
+static CK_RV
+gkm_ssh_private_key_get_attribute (GkmObject *base, GkmSession *session, CK_ATTRIBUTE_PTR attr)
+{
+	GkmSshPrivateKey *self = GKM_SSH_PRIVATE_KEY (base);
+	gchar *digest;
+	CK_RV rv;
+
+	switch (attr->type) {
+	case CKA_LABEL:
+		return gkm_attribute_set_string (attr, self->label);
+
+	/* COMPAT: Previous versions of gnome-keyring used this to save unlock passwords */
+	case CKA_GNOME_INTERNAL_SHA1:
+		if (!self->private_data)
+			return CKR_ATTRIBUTE_TYPE_INVALID;
+		digest = gkm_ssh_openssh_digest_private_key (self->private_data, self->n_private_data);
+		rv = gkm_attribute_set_string (attr, digest);
+		g_free (digest);
+		return rv;
+	}
+
+	return GKM_OBJECT_CLASS (gkm_ssh_private_key_parent_class)->get_attribute (base, session, attr);
+}
+
+static CK_RV
+gkm_ssh_private_key_unlock (GkmObject *base, GkmCredential *cred)
+{
+	GkmSshPrivateKey *self = GKM_SSH_PRIVATE_KEY (base);
+	const gchar *password;
+	GkmSexp *wrapper;
+	gsize n_password;
+	CK_RV rv;
+
+	if (!self->is_encrypted)
+		return CKR_OK;
+
+	password = gkm_credential_get_password (cred, &n_password);
+	rv = unlock_private_key (self, password, n_password, &wrapper);
+
+	if (rv == CKR_OK) {
+		gkm_private_xsa_key_set_locked_private (GKM_PRIVATE_XSA_KEY (self), cred, wrapper);
+		gkm_sexp_unref (wrapper);
+	}
+
+	return rv;
+}
+
+static void
+gkm_ssh_private_key_expose (GkmObject *base, gboolean expose)
+{
+	GKM_OBJECT_CLASS (gkm_ssh_private_key_parent_class)->expose_object (base, expose);
+	gkm_object_expose (GKM_OBJECT (GKM_SSH_PRIVATE_KEY (base)->pubkey), expose);
+}
+
+static GObject*
+gkm_ssh_private_key_constructor (GType type, guint n_props, GObjectConstructParam *props)
+{
+	GkmSshPrivateKey *self = GKM_SSH_PRIVATE_KEY (G_OBJECT_CLASS (gkm_ssh_private_key_parent_class)->constructor(type, n_props, props));
+	GkmObject *object;
+	gchar *unique;
+
+	g_return_val_if_fail (self, NULL);
+
+	object = GKM_OBJECT (self);
+	unique = g_strdup_printf ("%s.pub", gkm_object_get_unique (object));
+	self->pubkey = gkm_ssh_public_key_new (gkm_object_get_module (object), unique);
+	g_free (unique);
+
+	return G_OBJECT (self);
+}
+
+static void
+gkm_ssh_private_key_init (GkmSshPrivateKey *self)
+{
+
+}
+
+static void
+gkm_ssh_private_key_dispose (GObject *obj)
+{
+	GkmSshPrivateKey *self = GKM_SSH_PRIVATE_KEY (obj);
+
+	if (self->pubkey)
+		g_object_unref (self->pubkey);
+	self->pubkey = NULL;
+
+	G_OBJECT_CLASS (gkm_ssh_private_key_parent_class)->dispose (obj);
+}
+
+static void
+gkm_ssh_private_key_finalize (GObject *obj)
+{
+	GkmSshPrivateKey *self = GKM_SSH_PRIVATE_KEY (obj);
+
+	g_assert (self->pubkey == NULL);
+
+	g_free (self->private_data);
+	self->private_data = NULL;
+
+	g_free (self->label);
+	self->label = NULL;
+
+	G_OBJECT_CLASS (gkm_ssh_private_key_parent_class)->finalize (obj);
+}
+
+static void
+gkm_ssh_private_key_set_property (GObject *obj, guint prop_id, const GValue *value,
+                           GParamSpec *pspec)
+{
+	GkmSshPrivateKey *self = GKM_SSH_PRIVATE_KEY (obj);
+
+	switch (prop_id) {
+	case PROP_LABEL:
+		gkm_ssh_private_key_set_label (self, g_value_get_string (value));
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+gkm_ssh_private_key_get_property (GObject *obj, guint prop_id, GValue *value,
+                           GParamSpec *pspec)
+{
+	GkmSshPrivateKey *self = GKM_SSH_PRIVATE_KEY (obj);
+
+	switch (prop_id) {
+	case PROP_LABEL:
+		g_value_set_string (value, gkm_ssh_private_key_get_label (self));
+		break;
+	case PROP_PUBLIC_KEY:
+		g_value_set_object (value, gkm_ssh_private_key_get_public_key (self));
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+gkm_ssh_private_key_class_init (GkmSshPrivateKeyClass *klass)
+{
+	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+	GkmObjectClass *gkm_class = GKM_OBJECT_CLASS (klass);
+
+	gobject_class->constructor = gkm_ssh_private_key_constructor;
+	gobject_class->dispose = gkm_ssh_private_key_dispose;
+	gobject_class->finalize = gkm_ssh_private_key_finalize;
+	gobject_class->set_property = gkm_ssh_private_key_set_property;
+	gobject_class->get_property = gkm_ssh_private_key_get_property;
+
+	gkm_class->get_attribute = gkm_ssh_private_key_get_attribute;
+	gkm_class->unlock = gkm_ssh_private_key_unlock;
+	gkm_class->expose_object = gkm_ssh_private_key_expose;
+
+	g_object_class_install_property (gobject_class, PROP_LABEL,
+	           g_param_spec_string ("label", "Label", "Object Label",
+	                                "", G_PARAM_READWRITE));
+
+	g_object_class_install_property (gobject_class, PROP_PUBLIC_KEY,
+	           g_param_spec_object ("public-key", "Public Key", "Public key belonging to this private key",
+	                                GKM_TYPE_SSH_PUBLIC_KEY, G_PARAM_READABLE));
+}
+
+/* -----------------------------------------------------------------------------
+ * PUBLIC
+ */
+
+GkmSshPrivateKey*
+gkm_ssh_private_key_new (GkmModule *module, const gchar *unique)
+{
+	return g_object_new (GKM_TYPE_SSH_PRIVATE_KEY, "unique", unique,
+	                     "module", module, "manager", gkm_module_get_manager (module), NULL);
+}
+
+gboolean
+gkm_ssh_private_key_parse (GkmSshPrivateKey *self, const gchar *public_path,
+                           const gchar *private_path, GError **error)
+{
+	guchar *public_data, *private_data;
+	gsize n_public_data, n_private_data;
+	GkmDataResult res;
+	gcry_sexp_t sexp;
+	gchar *comment;
+
+	g_return_val_if_fail (GKM_IS_SSH_PRIVATE_KEY (self), FALSE);
+	g_return_val_if_fail (private_path, FALSE);
+	g_return_val_if_fail (!error || !*error, FALSE);
+
+	/* Read in the public key */
+	if (!g_file_get_contents (public_path, (gchar**)&public_data, &n_public_data, error))
+		return FALSE;
+
+	/* Parse it */
+	res = gkm_ssh_openssh_parse_public_key (public_data, n_public_data, &sexp, &comment);
+	g_free (public_data);
+
+	if (res == GKM_DATA_UNRECOGNIZED) {
+		return FALSE;
+	} else if (res != GKM_DATA_SUCCESS) {
+		g_set_error_literal (error, GKM_DATA_ERROR, res, _("Couldn't parse public SSH key"));
+		return FALSE;
+	}
+
+	/* Read in the private key */
+	if (!g_file_get_contents (private_path, (gchar**)&private_data, &n_private_data, error)) {
+		g_free (comment);
+		gcry_sexp_release (sexp);
+		return FALSE;
+	}
+
+	if (comment == NULL)
+		comment = g_path_get_basename (private_path);
+
+	realize_and_take_data (self, sexp, comment, private_data, n_private_data);
+	return TRUE;
+}
+
+const gchar*
+gkm_ssh_private_key_get_label (GkmSshPrivateKey *self)
+{
+	g_return_val_if_fail (GKM_IS_SSH_PRIVATE_KEY (self), NULL);
+	return self->label;
+}
+
+void
+gkm_ssh_private_key_set_label (GkmSshPrivateKey *self, const gchar *label)
+{
+	g_return_if_fail (GKM_IS_SSH_PRIVATE_KEY (self));
+	g_free (self->label);
+	self->label = g_strdup (label);
+	g_object_notify (G_OBJECT (self), "label");
+}
+
+GkmSshPublicKey*
+gkm_ssh_private_key_get_public_key (GkmSshPrivateKey *self)
+{
+	g_return_val_if_fail (GKM_IS_SSH_PRIVATE_KEY (self), NULL);
+	return self->pubkey;
+}
diff --git a/pkcs11/ssh-store/gkm-ssh-private-key.h b/pkcs11/ssh-store/gkm-ssh-private-key.h
new file mode 100644
index 0000000..39dbf6d
--- /dev/null
+++ b/pkcs11/ssh-store/gkm-ssh-private-key.h
@@ -0,0 +1,62 @@
+/*
+ * 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 __GKM_SSH_PRIVATE_KEY_H__
+#define __GKM_SSH_PRIVATE_KEY_H__
+
+#include <glib-object.h>
+
+#include "gkm-ssh-public-key.h"
+
+#include "gkm/gkm-private-xsa-key.h"
+
+#define GKM_TYPE_SSH_PRIVATE_KEY               (gkm_ssh_private_key_get_type ())
+#define GKM_SSH_PRIVATE_KEY(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_SSH_PRIVATE_KEY, GkmSshPrivateKey))
+#define GKM_SSH_PRIVATE_KEY_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_SSH_PRIVATE_KEY, GkmSshPrivateKeyClass))
+#define GKM_IS_SSH_PRIVATE_KEY(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_SSH_PRIVATE_KEY))
+#define GKM_IS_SSH_PRIVATE_KEY_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_SSH_PRIVATE_KEY))
+#define GKM_SSH_PRIVATE_KEY_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_SSH_PRIVATE_KEY, GkmSshPrivateKeyClass))
+
+typedef struct _GkmSshPrivateKey GkmSshPrivateKey;
+typedef struct _GkmSshPrivateKeyClass GkmSshPrivateKeyClass;
+
+struct _GkmSshPrivateKeyClass {
+	GkmPrivateXsaKeyClass parent_class;
+};
+
+GType               gkm_ssh_private_key_get_type               (void);
+
+GkmSshPrivateKey*   gkm_ssh_private_key_new                    (GkmModule *module,
+                                                                const gchar *unique);
+
+gboolean            gkm_ssh_private_key_parse                  (GkmSshPrivateKey *self,
+                                                                const gchar *public_path,
+                                                                const gchar *private_path,
+                                                                GError **error);
+
+const gchar*        gkm_ssh_private_key_get_label              (GkmSshPrivateKey *key);
+
+void                gkm_ssh_private_key_set_label              (GkmSshPrivateKey *key,
+                                                                const gchar *label);
+
+GkmSshPublicKey*    gkm_ssh_private_key_get_public_key         (GkmSshPrivateKey *self);
+
+#endif /* __GKM_SSH_PRIVATE_KEY_H__ */
diff --git a/pkcs11/ssh-store/gkm-ssh-public-key.c b/pkcs11/ssh-store/gkm-ssh-public-key.c
new file mode 100644
index 0000000..346df16
--- /dev/null
+++ b/pkcs11/ssh-store/gkm-ssh-public-key.c
@@ -0,0 +1,153 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+
+#include "gkm-ssh-public-key.h"
+
+#include "gkm/gkm-attributes.h"
+#include "gkm/gkm-module.h"
+#include "gkm/gkm-object.h"
+#include "gkm/gkm-util.h"
+
+#include <glib/gi18n.h>
+
+enum {
+	PROP_0,
+	PROP_LABEL
+};
+
+struct _GkmSshPublicKey {
+	GkmPublicXsaKey parent;
+	gchar *label;
+};
+
+G_DEFINE_TYPE (GkmSshPublicKey, gkm_ssh_public_key, GKM_TYPE_PUBLIC_XSA_KEY);
+
+/* -----------------------------------------------------------------------------
+ * OBJECT
+ */
+
+static CK_RV
+gkm_ssh_public_key_get_attribute (GkmObject *base, GkmSession *session, CK_ATTRIBUTE_PTR attr)
+{
+	GkmSshPublicKey *self = GKM_SSH_PUBLIC_KEY (base);
+
+	switch (attr->type) {
+	case CKA_LABEL:
+		return gkm_attribute_set_string (attr, self->label ? self->label : "");
+	}
+
+	return GKM_OBJECT_CLASS (gkm_ssh_public_key_parent_class)->get_attribute (base, session, attr);
+}
+
+static void
+gkm_ssh_public_key_init (GkmSshPublicKey *self)
+{
+
+}
+
+static void
+gkm_ssh_public_key_finalize (GObject *obj)
+{
+	GkmSshPublicKey *self = GKM_SSH_PUBLIC_KEY (obj);
+
+	g_free (self->label);
+	self->label = NULL;
+
+	G_OBJECT_CLASS (gkm_ssh_public_key_parent_class)->finalize (obj);
+}
+
+static void
+gkm_ssh_public_key_set_property (GObject *obj, guint prop_id, const GValue *value,
+                           GParamSpec *pspec)
+{
+	GkmSshPublicKey *self = GKM_SSH_PUBLIC_KEY (obj);
+
+	switch (prop_id) {
+	case PROP_LABEL:
+		gkm_ssh_public_key_set_label (self, g_value_get_string (value));
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+gkm_ssh_public_key_get_property (GObject *obj, guint prop_id, GValue *value,
+                           GParamSpec *pspec)
+{
+	GkmSshPublicKey *self = GKM_SSH_PUBLIC_KEY (obj);
+
+	switch (prop_id) {
+	case PROP_LABEL:
+		g_value_set_string (value, gkm_ssh_public_key_get_label (self));
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+gkm_ssh_public_key_class_init (GkmSshPublicKeyClass *klass)
+{
+	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+	GkmObjectClass *gkm_class = GKM_OBJECT_CLASS (klass);
+
+	gobject_class->finalize = gkm_ssh_public_key_finalize;
+	gobject_class->set_property = gkm_ssh_public_key_set_property;
+	gobject_class->get_property = gkm_ssh_public_key_get_property;
+
+	gkm_class->get_attribute = gkm_ssh_public_key_get_attribute;
+
+	g_object_class_install_property (gobject_class, PROP_LABEL,
+	           g_param_spec_string ("label", "Label", "Object Label",
+	                                "", G_PARAM_READWRITE));
+}
+
+/* -----------------------------------------------------------------------------
+ * PUBLIC
+ */
+
+GkmSshPublicKey*
+gkm_ssh_public_key_new (GkmModule *module, const gchar *unique)
+{
+	return g_object_new (GKM_TYPE_SSH_PUBLIC_KEY, "unique", unique,
+	                     "module", module, "manager", gkm_module_get_manager (module), NULL);
+}
+
+const gchar*
+gkm_ssh_public_key_get_label (GkmSshPublicKey *self)
+{
+	g_return_val_if_fail (GKM_IS_SSH_PUBLIC_KEY (self), NULL);
+	return self->label;
+}
+
+void
+gkm_ssh_public_key_set_label (GkmSshPublicKey *self, const gchar *label)
+{
+	g_return_if_fail (GKM_IS_SSH_PUBLIC_KEY (self));
+	g_free (self->label);
+	self->label = g_strdup (label);
+	g_object_notify (G_OBJECT (self), "label");
+}
diff --git a/pkcs11/ssh-store/gkm-ssh-public-key.h b/pkcs11/ssh-store/gkm-ssh-public-key.h
new file mode 100644
index 0000000..c3a3a51
--- /dev/null
+++ b/pkcs11/ssh-store/gkm-ssh-public-key.h
@@ -0,0 +1,53 @@
+/*
+ * 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 __GKM_SSH_PUBLIC_KEY_H__
+#define __GKM_SSH_PUBLIC_KEY_H__
+
+#include <glib-object.h>
+
+#include "gkm/gkm-public-xsa-key.h"
+
+#define GKM_TYPE_SSH_PUBLIC_KEY               (gkm_ssh_public_key_get_type ())
+#define GKM_SSH_PUBLIC_KEY(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_SSH_PUBLIC_KEY, GkmSshPublicKey))
+#define GKM_SSH_PUBLIC_KEY_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_SSH_PUBLIC_KEY, GkmSshPublicKeyClass))
+#define GKM_IS_SSH_PUBLIC_KEY(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_SSH_PUBLIC_KEY))
+#define GKM_IS_SSH_PUBLIC_KEY_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_SSH_PUBLIC_KEY))
+#define GKM_SSH_PUBLIC_KEY_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_SSH_PUBLIC_KEY, GkmSshPublicKeyClass))
+
+typedef struct _GkmSshPublicKey GkmSshPublicKey;
+typedef struct _GkmSshPublicKeyClass GkmSshPublicKeyClass;
+
+struct _GkmSshPublicKeyClass {
+	GkmPublicXsaKeyClass parent_class;
+};
+
+GType               gkm_ssh_public_key_get_type               (void);
+
+GkmSshPublicKey*    gkm_ssh_public_key_new                    (GkmModule *self,
+                                                               const gchar *unique);
+
+const gchar*        gkm_ssh_public_key_get_label              (GkmSshPublicKey *key);
+
+void                gkm_ssh_public_key_set_label              (GkmSshPublicKey *key,
+                                                               const gchar *label);
+
+#endif /* __GKM_SSH_PUBLIC_KEY_H__ */
diff --git a/pkcs11/ssh-store/gck-ssh-standalone.c b/pkcs11/ssh-store/gkm-ssh-standalone.c
similarity index 84%
rename from pkcs11/ssh-store/gck-ssh-standalone.c
rename to pkcs11/ssh-store/gkm-ssh-standalone.c
index 848370b..2d9798f 100644
--- a/pkcs11/ssh-store/gck-ssh-standalone.c
+++ b/pkcs11/ssh-store/gkm-ssh-standalone.c
@@ -1,5 +1,5 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* gck-ssh-standalone.h - The SSH PKCS#11 code as a standalone module
+/* gkm-ssh-standalone.h - The SSH PKCS#11 code as a standalone module
 
    Copyright (C) 2008, Stef Walter
 
@@ -23,9 +23,9 @@
 
 #include "config.h"
 
-#include "gck-ssh-store.h"
+#include "gkm-ssh-store.h"
 
-#include "gck/gck-crypto.h"
+#include "gkm/gkm-crypto.h"
 
 #include "egg/egg-secure-memory.h"
 
@@ -35,11 +35,11 @@
 
 /* Module callbacks for secure memory */
 static GStaticMutex memory_mutex = G_STATIC_MUTEX_INIT;
-void egg_memory_lock (void) 
+void egg_memory_lock (void)
 	{ g_static_mutex_lock (&memory_mutex); }
-void egg_memory_unlock (void) 
+void egg_memory_unlock (void)
 	{ g_static_mutex_unlock (&memory_mutex); }
-void* egg_memory_fallback (void *p, size_t sz) 
+void* egg_memory_fallback (void *p, size_t sz)
 	{ return g_realloc (p, sz); }
 
 CK_RV
@@ -47,11 +47,11 @@ C_GetFunctionList (CK_FUNCTION_LIST_PTR_PTR list)
 {
 	if (!list)
 		return CKR_ARGUMENTS_BAD;
-	
+
 	g_type_init ();
 	if (!g_thread_supported ())
 		g_thread_init (NULL);
-	
-	*list = gck_ssh_store_get_functions ();
+
+	*list = gkm_ssh_store_get_functions ();
 	return CKR_OK;
 }
diff --git a/pkcs11/user-store/gck-user-store.h b/pkcs11/ssh-store/gkm-ssh-store.h
similarity index 79%
rename from pkcs11/user-store/gck-user-store.h
rename to pkcs11/ssh-store/gkm-ssh-store.h
index 1f48c64..71bdb98 100644
--- a/pkcs11/user-store/gck-user-store.h
+++ b/pkcs11/ssh-store/gkm-ssh-store.h
@@ -1,29 +1,29 @@
-/* 
+/*
  * 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.
  */
 
-#ifndef __GCK_USER_STORE_H__
-#define __GCK_USER_STORE_H__
+#ifndef __GKM_SSH_STORE_H__
+#define __GKM_SSH_STORE_H__
 
 #include "pkcs11/pkcs11.h"
 
-CK_FUNCTION_LIST_PTR  gck_user_store_get_functions  (void);
+CK_FUNCTION_LIST_PTR  gkm_ssh_store_get_functions  (void);
 
-#endif /* __GCK_USER_STORE_H__ */
+#endif /* __GKM_SSH_STORE_H__ */
diff --git a/pkcs11/ssh-store/tests/Makefile.am b/pkcs11/ssh-store/tests/Makefile.am
index 3ea22a6..eaccd14 100644
--- a/pkcs11/ssh-store/tests/Makefile.am
+++ b/pkcs11/ssh-store/tests/Makefile.am
@@ -3,11 +3,11 @@ UNIT_AUTO = \
 	unit-test-private-key.c \
 	test-ssh-module.c test-ssh-module.h
 
-UNIT_PROMPT = 
+UNIT_PROMPT =
 
 UNIT_LIBS =  \
-	$(top_builddir)/pkcs11/ssh-store/libgck-ssh-store.la \
-	$(top_builddir)/pkcs11/gck/libgck.la \
+	$(top_builddir)/pkcs11/ssh-store/libgkm-ssh-store.la \
+	$(top_builddir)/pkcs11/gkm/libgkm.la \
 	$(top_builddir)/egg/libegg.la
 
 include $(top_srcdir)/tests/gtest.make
diff --git a/pkcs11/ssh-store/tests/test-ssh-module.c b/pkcs11/ssh-store/tests/test-ssh-module.c
index 44a5dbd..437f80d 100644
--- a/pkcs11/ssh-store/tests/test-ssh-module.c
+++ b/pkcs11/ssh-store/tests/test-ssh-module.c
@@ -24,34 +24,34 @@
 #include "config.h"
 #include "test-ssh-module.h"
 
-#include "gck/gck-module.h"
+#include "gkm/gkm-module.h"
 
-#include "ssh-store/gck-ssh-store.h"
+#include "ssh-store/gkm-ssh-store.h"
 
 #include "run-auto-test.h"
 
 static GMutex *mutex = NULL;
 
-GckModule*  _gck_ssh_store_get_module_for_testing (void);
-GMutex* _gck_module_get_scary_mutex_that_you_should_not_touch (GckModule *module);
+GkmModule*  _gkm_ssh_store_get_module_for_testing (void);
+GMutex* _gkm_module_get_scary_mutex_that_you_should_not_touch (GkmModule *module);
 
-GckModule*
+GkmModule*
 test_ssh_module_initialize_and_enter (void)
 {
 	CK_FUNCTION_LIST_PTR funcs;
-	GckModule *module;
+	GkmModule *module;
 	CK_RV rv;
-	
-	funcs = gck_ssh_store_get_functions ();
+
+	funcs = gkm_ssh_store_get_functions ();
 	rv = (funcs->C_Initialize) (NULL);
 	g_return_val_if_fail (rv == CKR_OK, NULL);
-	
-	module = _gck_ssh_store_get_module_for_testing ();
+
+	module = _gkm_ssh_store_get_module_for_testing ();
 	g_return_val_if_fail (module, NULL);
-	
-	mutex = _gck_module_get_scary_mutex_that_you_should_not_touch (module);
+
+	mutex = _gkm_module_get_scary_mutex_that_you_should_not_touch (module);
 	test_ssh_module_enter ();
-	
+
 	return module;
 }
 
@@ -60,10 +60,10 @@ test_ssh_module_leave_and_finalize (void)
 {
 	CK_FUNCTION_LIST_PTR funcs;
 	CK_RV rv;
-	
+
 	test_ssh_module_leave ();
-	
-	funcs = gck_ssh_store_get_functions ();
+
+	funcs = gkm_ssh_store_get_functions ();
 	rv = (funcs->C_Finalize) (NULL);
 	g_return_if_fail (rv == CKR_OK);
 }
@@ -72,7 +72,7 @@ void
 test_ssh_module_leave (void)
 {
 	g_assert (mutex);
-	g_mutex_unlock (mutex);	
+	g_mutex_unlock (mutex);
 }
 
 void
@@ -82,25 +82,25 @@ test_ssh_module_enter (void)
 	g_mutex_lock (mutex);
 }
 
-GckSession*
+GkmSession*
 test_ssh_module_open_session (gboolean writable)
 {
 	CK_ULONG flags = CKF_SERIAL_SESSION;
 	CK_SESSION_HANDLE handle;
-	GckModule *module;
-	GckSession *session;
+	GkmModule *module;
+	GkmSession *session;
 	CK_RV rv;
-	
-	module = _gck_ssh_store_get_module_for_testing ();
+
+	module = _gkm_ssh_store_get_module_for_testing ();
 	g_return_val_if_fail (module, NULL);
 
 	if (writable)
 		flags |= CKF_RW_SESSION;
-	
-	rv = gck_module_C_OpenSession (module, 1, flags, NULL, NULL, &handle);
+
+	rv = gkm_module_C_OpenSession (module, 1, flags, NULL, NULL, &handle);
 	g_assert (rv == CKR_OK);
 
-	session = gck_module_lookup_session (module, handle);
+	session = gkm_module_lookup_session (module, handle);
 	g_assert (session);
 
 	return session;
@@ -108,6 +108,6 @@ test_ssh_module_open_session (gboolean writable)
 
 DEFINE_EXTERNAL(ssh_module)
 {
-	CK_FUNCTION_LIST_PTR funcs = gck_ssh_store_get_functions ();
+	CK_FUNCTION_LIST_PTR funcs = gkm_ssh_store_get_functions ();
 	test_p11_module (funcs, "p11-tests.conf");
 }
diff --git a/pkcs11/ssh-store/tests/test-ssh-module.h b/pkcs11/ssh-store/tests/test-ssh-module.h
index f0565dd..fa46efd 100644
--- a/pkcs11/ssh-store/tests/test-ssh-module.h
+++ b/pkcs11/ssh-store/tests/test-ssh-module.h
@@ -26,7 +26,7 @@
 
 #include <glib.h>
 
-#include "gck/gck-types.h"
+#include "gkm/gkm-types.h"
 
 #include "pkcs11.h"
 
@@ -34,10 +34,10 @@ void                   test_ssh_module_leave                    (void);
 
 void                   test_ssh_module_enter                    (void);
 
-GckModule*             test_ssh_module_initialize_and_enter     (void);
+GkmModule*             test_ssh_module_initialize_and_enter     (void);
 
 void                   test_ssh_module_leave_and_finalize       (void);
 
-GckSession*            test_ssh_module_open_session             (gboolean writable);
+GkmSession*            test_ssh_module_open_session             (gboolean writable);
 
 #endif /* TEST_SSH_MODULE_H_ */
diff --git a/pkcs11/ssh-store/tests/unit-test-private-key.c b/pkcs11/ssh-store/tests/unit-test-private-key.c
index feae993..5618929 100644
--- a/pkcs11/ssh-store/tests/unit-test-private-key.c
+++ b/pkcs11/ssh-store/tests/unit-test-private-key.c
@@ -24,16 +24,16 @@
 #include "run-auto-test.h"
 #include "test-ssh-module.h"
 
-#include "gck/gck-credential.h"
-#include "gck/gck-session.h"
-#include "gck/gck-module.h"
+#include "gkm/gkm-credential.h"
+#include "gkm/gkm-session.h"
+#include "gkm/gkm-module.h"
 
-#include "ssh-store/gck-ssh-private-key.h"
+#include "ssh-store/gkm-ssh-private-key.h"
 
 #include "pkcs11g.h"
 
-static GckModule *module = NULL;
-static GckSession *session = NULL;
+static GkmModule *module = NULL;
+static GkmSession *session = NULL;
 
 DEFINE_SETUP(private_key_setup)
 {
@@ -50,19 +50,19 @@ DEFINE_TEARDOWN(private_key_teardown)
 
 DEFINE_TEST(private_key_parse_plain)
 {
-	GckSshPrivateKey *key;
+	GkmSshPrivateKey *key;
 	gchar *pub_path, *priv_path;
 	gboolean ret;
-	
-	key = gck_ssh_private_key_new (module, "my-unique");
-	g_assert (GCK_IS_SSH_PRIVATE_KEY (key));
+
+	key = gkm_ssh_private_key_new (module, "my-unique");
+	g_assert (GKM_IS_SSH_PRIVATE_KEY (key));
 
 	pub_path = test_data_filename ("id_dsa_plain.pub");
 	priv_path = test_data_filename ("id_dsa_plain");
-	
-	ret = gck_ssh_private_key_parse (key, pub_path, priv_path, NULL);
+
+	ret = gkm_ssh_private_key_parse (key, pub_path, priv_path, NULL);
 	g_assert (ret == TRUE);
-	
+
 	g_object_unref (key);
 	g_free (pub_path);
 	g_free (priv_path);
@@ -71,25 +71,25 @@ DEFINE_TEST(private_key_parse_plain)
 
 DEFINE_TEST(private_key_parse_and_unlock)
 {
-	GckSshPrivateKey *key;
-	GckCredential *cred;
+	GkmSshPrivateKey *key;
+	GkmCredential *cred;
 	gchar *pub_path, *priv_path;
 	gboolean ret;
 	CK_RV rv;
-	
-	key = gck_ssh_private_key_new (module, "my-unique");
-	g_assert (GCK_IS_SSH_PRIVATE_KEY (key));
+
+	key = gkm_ssh_private_key_new (module, "my-unique");
+	g_assert (GKM_IS_SSH_PRIVATE_KEY (key));
 
 	pub_path = test_data_filename ("id_dsa_encrypted.pub");
 	priv_path = test_data_filename ("id_dsa_encrypted");
-	
-	ret = gck_ssh_private_key_parse (key, pub_path, priv_path, NULL);
+
+	ret = gkm_ssh_private_key_parse (key, pub_path, priv_path, NULL);
 	g_assert (ret == TRUE);
 
 	g_free (pub_path);
 	g_free (priv_path);
 
-	rv = gck_credential_create (module, NULL, GCK_OBJECT (key), (guchar*)"password", 8, &cred);
+	rv = gkm_credential_create (module, NULL, GKM_OBJECT (key), (guchar*)"password", 8, &cred);
 	g_assert (rv == CKR_OK);
 
 	g_object_unref (cred);
diff --git a/pkcs11/ssh-store/tests/unit-test-ssh-openssh.c b/pkcs11/ssh-store/tests/unit-test-ssh-openssh.c
index 3b27120..ee86cca 100644
--- a/pkcs11/ssh-store/tests/unit-test-ssh-openssh.c
+++ b/pkcs11/ssh-store/tests/unit-test-ssh-openssh.c
@@ -25,9 +25,9 @@
 
 #include "run-auto-test.h"
 
-#include "gck-ssh-openssh.h"
+#include "gkm-ssh-openssh.h"
 
-#include "gck/gck-sexp.h"
+#include "gkm/gkm-sexp.h"
 
 #include <glib.h>
 
@@ -58,26 +58,26 @@ DEFINE_TEST(parse_public)
 	int algorithm;
 	gboolean is_private;
 	guint i;
-	GckDataResult res;
-	
-	
+	GkmDataResult res;
+
+
 	for (i = 0; i < G_N_ELEMENTS (PUBLIC_FILES); ++i) {
-		
+
 		data = test_data_read (PUBLIC_FILES[i], &n_data);
-		
-		res = gck_ssh_openssh_parse_public_key (data, n_data, &sexp, &comment);
-		if (res != GCK_DATA_SUCCESS) {
+
+		res = gkm_ssh_openssh_parse_public_key (data, n_data, &sexp, &comment);
+		if (res != GKM_DATA_SUCCESS) {
 			g_warning ("couldn't parse public key: %s", PUBLIC_FILES[i]);
-			g_assert_cmpint (res, ==, GCK_DATA_SUCCESS);
+			g_assert_cmpint (res, ==, GKM_DATA_SUCCESS);
 		}
 
-		if (!gck_sexp_parse_key (sexp, &algorithm, &is_private, NULL))
+		if (!gkm_sexp_parse_key (sexp, &algorithm, &is_private, NULL))
 			g_assert_not_reached ();
-		
+
 		g_assert_cmpstr (comment, ==, COMMENT);
 		g_assert_cmpint (algorithm, !=, 0);
 		g_assert (!is_private);
-		
+
 		g_free (data);
 		g_free (comment);
 		gcry_sexp_release (sexp);
@@ -92,25 +92,25 @@ DEFINE_TEST(parse_private)
 	int algorithm;
 	gboolean is_private;
 	guint i;
-	GckDataResult res;
-	
-	
+	GkmDataResult res;
+
+
 	for (i = 0; i < G_N_ELEMENTS (PRIVATE_FILES); ++i) {
-		
+
 		data = test_data_read (PRIVATE_FILES[i], &n_data);
-		
-		res = gck_ssh_openssh_parse_private_key (data, n_data, "password", 8, &sexp);
-		if (res != GCK_DATA_SUCCESS) {
+
+		res = gkm_ssh_openssh_parse_private_key (data, n_data, "password", 8, &sexp);
+		if (res != GKM_DATA_SUCCESS) {
 			g_warning ("couldn't parse private key: %s", PRIVATE_FILES[i]);
-			g_assert_cmpint (res, ==, GCK_DATA_SUCCESS);
+			g_assert_cmpint (res, ==, GKM_DATA_SUCCESS);
 		}
 
-		if (!gck_sexp_parse_key (sexp, &algorithm, &is_private, NULL))
+		if (!gkm_sexp_parse_key (sexp, &algorithm, &is_private, NULL))
 			g_assert_not_reached ();
-		
+
 		g_assert_cmpint (algorithm, !=, 0);
 		g_assert (is_private);
-		
+
 		g_free (data);
 		gcry_sexp_release (sexp);
 	}
diff --git a/pkcs11/template/gck-xxx.c b/pkcs11/template/gkm-xxx.c
similarity index 60%
rename from pkcs11/template/gck-xxx.c
rename to pkcs11/template/gkm-xxx.c
index 1e084e0..4405c94 100644
--- a/pkcs11/template/gck-xxx.c
+++ b/pkcs11/template/gkm-xxx.c
@@ -1,27 +1,27 @@
-/* 
+/*
  * 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"
 
-#include "gck-xxx.h"
+#include "gkm-xxx.h"
 
 enum {
 	PROP_0,
@@ -35,60 +35,60 @@ enum {
 
 static guint signals[LAST_SIGNAL] = { 0 };
 
-struct _GckXxx {
+struct _GkmXxx {
 	GObject parent;
 };
 
-G_DEFINE_TYPE (GckXxx, gck_xxx, G_TYPE_OBJECT);
+G_DEFINE_TYPE (GkmXxx, gkm_xxx, G_TYPE_OBJECT);
 
 /* -----------------------------------------------------------------------------
- * INTERNAL 
+ * INTERNAL
  */
 
 /* -----------------------------------------------------------------------------
- * OBJECT 
+ * OBJECT
  */
 
 
-static GObject* 
-gck_xxx_constructor (GType type, guint n_props, GObjectConstructParam *props) 
+static GObject*
+gkm_xxx_constructor (GType type, guint n_props, GObjectConstructParam *props)
 {
-	GckXxx *self = GCK_XXX (G_OBJECT_CLASS (gck_xxx_parent_class)->constructor(type, n_props, props));
-	g_return_val_if_fail (self, NULL);	
+	GkmXxx *self = GKM_XXX (G_OBJECT_CLASS (gkm_xxx_parent_class)->constructor(type, n_props, props));
+	g_return_val_if_fail (self, NULL);
+
 
 
-	
 	return G_OBJECT (self);
 }
 
 static void
-gck_xxx_init (GckXxx *self)
+gkm_xxx_init (GkmXxx *self)
 {
 
 }
 
 static void
-gck_xxx_dispose (GObject *obj)
+gkm_xxx_dispose (GObject *obj)
 {
-	GckXxx *self = GCK_XXX (obj);
-    
-	G_OBJECT_CLASS (gck_xxx_parent_class)->dispose (obj);
+	GkmXxx *self = GKM_XXX (obj);
+
+	G_OBJECT_CLASS (gkm_xxx_parent_class)->dispose (obj);
 }
 
 static void
-gck_xxx_finalize (GObject *obj)
+gkm_xxx_finalize (GObject *obj)
 {
-	GckXxx *self = GCK_XXX (obj);
+	GkmXxx *self = GKM_XXX (obj);
 
-	G_OBJECT_CLASS (gck_xxx_parent_class)->finalize (obj);
+	G_OBJECT_CLASS (gkm_xxx_parent_class)->finalize (obj);
 }
 
 static void
-gck_xxx_set_property (GObject *obj, guint prop_id, const GValue *value, 
+gkm_xxx_set_property (GObject *obj, guint prop_id, const GValue *value,
                            GParamSpec *pspec)
 {
-	GckXxx *self = GCK_XXX (obj);
-	
+	GkmXxx *self = GKM_XXX (obj);
+
 	switch (prop_id) {
 	case PROP_XXX:
 		break;
@@ -99,11 +99,11 @@ gck_xxx_set_property (GObject *obj, guint prop_id, const GValue *value,
 }
 
 static void
-gck_xxx_get_property (GObject *obj, guint prop_id, GValue *value, 
+gkm_xxx_get_property (GObject *obj, guint prop_id, GValue *value,
                            GParamSpec *pspec)
 {
-	GckXxx *self = GCK_XXX (obj);
-	
+	GkmXxx *self = GKM_XXX (obj);
+
 	switch (prop_id) {
 	case PROP_XXX:
 		break;
@@ -114,31 +114,31 @@ gck_xxx_get_property (GObject *obj, guint prop_id, GValue *value,
 }
 
 static void
-gck_xxx_class_init (GckXxxClass *klass)
+gkm_xxx_class_init (GkmXxxClass *klass)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-    
-	gobject_class->constructor = gck_xxx_constructor;
-	gobject_class->dispose = gck_xxx_dispose;
-	gobject_class->finalize = gck_xxx_finalize;
-	gobject_class->set_property = gck_xxx_set_property;
-	gobject_class->get_property = gck_xxx_get_property;
-    
+
+	gobject_class->constructor = gkm_xxx_constructor;
+	gobject_class->dispose = gkm_xxx_dispose;
+	gobject_class->finalize = gkm_xxx_finalize;
+	gobject_class->set_property = gkm_xxx_set_property;
+	gobject_class->get_property = gkm_xxx_get_property;
+
 	g_object_class_install_property (gobject_class, PROP_XXX,
 	           g_param_spec_pointer ("xxx", "Xxx", "Xxx.", G_PARAM_READWRITE));
-    
-	signals[SIGNAL] = g_signal_new ("signal", GCK_TYPE_XXX, 
-	                                G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GckXxxClass, signal),
-	                                NULL, NULL, g_cclosure_marshal_VOID__OBJECT, 
+
+	signals[SIGNAL] = g_signal_new ("signal", GKM_TYPE_XXX,
+	                                G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GkmXxxClass, signal),
+	                                NULL, NULL, g_cclosure_marshal_VOID__OBJECT,
 	                                G_TYPE_NONE, 0);
 }
 
 /* -----------------------------------------------------------------------------
- * PUBLIC 
+ * PUBLIC
  */
 
-GckXxx*
-gck_xxx_new (void)
+GkmXxx*
+gkm_xxx_new (void)
 {
-	return g_object_new (GCK_TYPE_XXX, NULL);
+	return g_object_new (GKM_TYPE_XXX, NULL);
 }
diff --git a/pkcs11/template/gkm-xxx.h b/pkcs11/template/gkm-xxx.h
new file mode 100644
index 0000000..6ee705b
--- /dev/null
+++ b/pkcs11/template/gkm-xxx.h
@@ -0,0 +1,49 @@
+/*
+ * 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 __GKM_XXX_H__
+#define __GKM_XXX_H__
+
+#include <glib-object.h>
+
+#define GKM_TYPE_XXX               (gkm_xxx_get_type ())
+#define GKM_XXX(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_XXX, GkmXxx))
+#define GKM_XXX_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_XXX, GkmXxxClass))
+#define GKM_IS_XXX(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_XXX))
+#define GKM_IS_XXX_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_XXX))
+#define GKM_XXX_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_XXX, GkmXxxClass))
+
+typedef struct _GkmXxx GkmXxx;
+typedef struct _GkmXxxClass GkmXxxClass;
+
+struct _GkmXxxClass {
+	GObjectClass parent_class;
+
+	/* signals --------------------------------------------------------- */
+
+	void (*signal) (GkmXxx *xxx);
+};
+
+GType               gkm_xxx_get_type               (void);
+
+GkmXxx*             gkm_xxx_new                    (void);
+
+#endif /* __GKM_XXX_H__ */
diff --git a/pkcs11/template/gck-zzz.c b/pkcs11/template/gkm-zzz.c
similarity index 82%
rename from pkcs11/template/gck-zzz.c
rename to pkcs11/template/gkm-zzz.c
index 9759c60..de52c49 100644
--- a/pkcs11/template/gck-zzz.c
+++ b/pkcs11/template/gkm-zzz.c
@@ -1,48 +1,48 @@
-/* 
+/*
  * 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"
 
-#include "gkr-zzz.h"
+#include "gkm-zzz.h"
 
 static void
-gkr_zzz_base_init (gpointer gobject_class)
+gkm_zzz_base_init (gpointer gobject_class)
 {
 	static gboolean initialized = FALSE;
 	if (!initialized) {
 		/* Add properties and signals to the interface */
-		
-		
+
+
 		initialized = TRUE;
 	}
 }
 
 GType
-gkr_zzz_get_type (void)
+gkm_zzz_get_type (void)
 {
 	static GType type = 0;
 	if (!type) {
 		static const GTypeInfo info = {
-			sizeof (GkrZzzIFace),
-			gkr_zzz_base_init,               /* base init */
+			sizeof (GkmZzzIFace),
+			gkm_zzz_base_init,               /* base init */
 			NULL,             /* base finalize */
 			NULL,             /* class_init */
 			NULL,             /* class finalize */
@@ -51,10 +51,9 @@ gkr_zzz_get_type (void)
 			0,                /* n_preallocs */
 			NULL,             /* instance init */
 		};
-		type = g_type_register_static (G_TYPE_INTERFACE, "GkrZzzIFace", &info, 0);
+		type = g_type_register_static (G_TYPE_INTERFACE, "GkmZzzIFace", &info, 0);
 		g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
 	}
-	
+
 	return type;
 }
-
diff --git a/pkcs11/template/gck-zzz.h b/pkcs11/template/gkm-zzz.h
similarity index 96%
rename from pkcs11/template/gck-zzz.h
rename to pkcs11/template/gkm-zzz.h
index ddeb235..60dd29f 100644
--- a/pkcs11/template/gck-zzz.h
+++ b/pkcs11/template/gkm-zzz.h
@@ -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.
  */
 
 #ifndef __GKR_ZZZ_H__
@@ -43,4 +43,3 @@ GType                  gkr_zzz_get_type                          (void) G_GNUC_C
 G_END_DECLS
 
 #endif /* __GKR_ZZZ_H__ */
-
diff --git a/pkcs11/user-store/Makefile.am b/pkcs11/user-store/Makefile.am
index 636d528..0ee726c 100644
--- a/pkcs11/user-store/Makefile.am
+++ b/pkcs11/user-store/Makefile.am
@@ -6,39 +6,39 @@ INCLUDES = \
     	$(GOBJECT_CFLAGS) \
 	$(LIBGCRYPT_CFLAGS) \
 	$(GLIB_CFLAGS)
-	
-			
+
+
 # ------------------------------------------------------------------------------
 # The user-store component code
 
 noinst_LTLIBRARIES = \
-	libgck-user-store.la
+	libgkm-user-store.la
 
-libgck_user_store_la_SOURCES = \
-	gck-user-store.h \
-	gck-user-module.c gck-user-module.h \
-	gck-user-private-key.c gck-user-private-key.h \
-	gck-user-public-key.c gck-user-public-key.h \
-	gck-user-storage.c gck-user-storage.h
+libgkm_user_store_la_SOURCES = \
+	gkm-user-store.h \
+	gkm-user-module.c gkm-user-module.h \
+	gkm-user-private-key.c gkm-user-private-key.h \
+	gkm-user-public-key.c gkm-user-public-key.h \
+	gkm-user-storage.c gkm-user-storage.h
 
 # ------------------------------------------------------------------------------
-# The standalone module 
+# The standalone module
 
 moduledir = $(libdir)/gnome-keyring/devel/
 
 module_LTLIBRARIES = \
-	gck-user-store-standalone.la
+	gkm-user-store-standalone.la
 
-gck_user_store_standalone_la_LDFLAGS = \
+gkm_user_store_standalone_la_LDFLAGS = \
 	-module -avoid-version \
 	-no-undefined -export-symbols-regex 'C_GetFunctionList'
 
-gck_user_store_standalone_la_SOURCES = \
-	gck-user-standalone.c
+gkm_user_store_standalone_la_SOURCES = \
+	gkm-user-standalone.c
 
-gck_user_store_standalone_la_LIBADD = \
-	libgck-user-store.la \
-	$(top_builddir)/pkcs11/gck/libgck.la \
+gkm_user_store_standalone_la_LIBADD = \
+	libgkm-user-store.la \
+	$(top_builddir)/pkcs11/gkm/libgkm.la \
 	$(GOBJECT_LIBS) \
 	$(GTHREAD_LIBS) \
 	$(GLIB_LIBS) \
@@ -51,7 +51,7 @@ gck_user_store_standalone_la_LIBADD = \
 if WITH_TESTS
 TESTS_DIR = tests
 else
-TESTS_DIR = 
+TESTS_DIR =
 endif
 
 SUBDIRS = . $(TESTS_DIR)
diff --git a/pkcs11/user-store/gkm-user-module.c b/pkcs11/user-store/gkm-user-module.c
new file mode 100644
index 0000000..18af745
--- /dev/null
+++ b/pkcs11/user-store/gkm-user-module.c
@@ -0,0 +1,350 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+
+#include "gkm-user-module.h"
+#include "gkm-user-private-key.h"
+#include "gkm-user-public-key.h"
+#include "gkm-user-storage.h"
+#include "gkm-user-store.h"
+
+#include "gkm/gkm-certificate.h"
+#include "gkm/gkm-data-asn1.h"
+#include "gkm/gkm-manager.h"
+#include "gkm/gkm-secret.h"
+#include "gkm/gkm-transaction.h"
+#include "gkm/gkm-util.h"
+
+#include <string.h>
+
+struct _GkmUserModule {
+	GkmModule parent;
+	GkmUserStorage *storage;
+	gchar *directory;
+	GHashTable *unlocked_apps;
+	CK_TOKEN_INFO token_info;
+};
+
+static const CK_SLOT_INFO user_module_slot_info = {
+	"User Keys",
+	"Gnome Keyring",
+	CKF_TOKEN_PRESENT,
+	{ 0, 0 },
+	{ 0, 0 }
+};
+
+static const CK_TOKEN_INFO user_module_token_info = {
+	"User Keys",
+	"Gnome Keyring",
+	"1.0",
+	"1:USER:DEFAULT", /* Unique serial number for manufacturer */
+	CKF_TOKEN_INITIALIZED | CKF_USER_PIN_INITIALIZED | CKF_LOGIN_REQUIRED,
+	CK_EFFECTIVELY_INFINITE,
+	CK_EFFECTIVELY_INFINITE,
+	CK_EFFECTIVELY_INFINITE,
+	CK_EFFECTIVELY_INFINITE,
+	1024,
+	1,
+	CK_UNAVAILABLE_INFORMATION,
+	CK_UNAVAILABLE_INFORMATION,
+	CK_UNAVAILABLE_INFORMATION,
+	CK_UNAVAILABLE_INFORMATION,
+	{ 0, 0 },
+	{ 0, 0 },
+	""
+};
+
+#define UNUSED_VALUE (GUINT_TO_POINTER (1))
+
+G_DEFINE_TYPE (GkmUserModule, gkm_user_module, GKM_TYPE_MODULE);
+
+/* -----------------------------------------------------------------------------
+ * ACTUAL PKCS#11 Module Implementation
+ */
+
+/* Include all the module entry points */
+#include "gkm/gkm-module-ep.h"
+GKM_DEFINE_MODULE (gkm_user_module, GKM_TYPE_USER_MODULE);
+
+/* -----------------------------------------------------------------------------
+ * INTERNAL
+ */
+
+/* -----------------------------------------------------------------------------
+ * OBJECT
+ */
+
+static const CK_SLOT_INFO*
+gkm_user_module_real_get_slot_info (GkmModule *base)
+{
+	return &user_module_slot_info;
+}
+
+static const CK_TOKEN_INFO*
+gkm_user_module_real_get_token_info (GkmModule *base)
+{
+	GkmUserModule *self = GKM_USER_MODULE (base);
+
+	/* Update the info with current info */
+	self->token_info.flags = gkm_user_storage_token_flags (self->storage);
+
+	return &self->token_info;
+}
+
+static void
+gkm_user_module_real_parse_argument (GkmModule *base, const gchar *name, const gchar *value)
+{
+	GkmUserModule *self = GKM_USER_MODULE (base);
+	if (g_str_equal (name, "directory")) {
+		g_free (self->directory);
+		self->directory = g_strdup (value);
+	}
+}
+
+static CK_RV
+gkm_user_module_real_refresh_token (GkmModule *base)
+{
+	GkmUserModule *self = GKM_USER_MODULE (base);
+	gkm_user_storage_refresh (self->storage);
+	return CKR_OK;
+}
+
+static void
+gkm_user_module_real_add_token_object (GkmModule *base, GkmTransaction *transaction, GkmObject *object)
+{
+	GkmUserModule *self = GKM_USER_MODULE (base);
+	gkm_user_storage_create (self->storage, transaction, object);
+}
+
+static void
+gkm_user_module_real_store_token_object (GkmModule *base, GkmTransaction *transaction, GkmObject *object)
+{
+	/* Not necessary */
+}
+
+static void
+gkm_user_module_real_remove_token_object (GkmModule *base, GkmTransaction *transaction, GkmObject *object)
+{
+	GkmUserModule *self = GKM_USER_MODULE (base);
+	gkm_user_storage_destroy (self->storage, transaction, object);
+}
+
+static CK_RV
+gkm_user_module_real_login_change (GkmModule *base, CK_SLOT_ID slot_id, CK_UTF8CHAR_PTR old_pin,
+                                   CK_ULONG n_old_pin, CK_UTF8CHAR_PTR new_pin, CK_ULONG n_new_pin)
+{
+	GkmUserModule *self = GKM_USER_MODULE (base);
+	GkmSecret *old_login, *new_login;
+	GkmTransaction *transaction;
+	CK_RV rv;
+
+	/*
+	 * Remember this doesn't affect the currently logged in user. Logged in
+	 * sessions will remain logged in, and vice versa.
+	 */
+
+	old_login = gkm_secret_new_from_login (old_pin, n_old_pin);
+	new_login = gkm_secret_new_from_login (new_pin, n_new_pin);
+
+	transaction = gkm_transaction_new ();
+
+	gkm_user_storage_relock (self->storage, transaction, old_login, new_login);
+
+	g_object_unref (old_login);
+	g_object_unref (new_login);
+
+	gkm_transaction_complete (transaction);
+	rv = gkm_transaction_get_result (transaction);
+	g_object_unref (transaction);
+
+	return rv;
+}
+
+static CK_RV
+gkm_user_module_real_login_user (GkmModule *base, CK_SLOT_ID slot_id, CK_UTF8CHAR_PTR pin, CK_ULONG n_pin)
+{
+	GkmUserModule *self = GKM_USER_MODULE (base);
+	GkmSecret *login;
+	CK_RV rv;
+
+	/* See if this application has logged in */
+	if (g_hash_table_lookup (self->unlocked_apps, &slot_id))
+		return CKR_USER_ALREADY_LOGGED_IN;
+
+	login = gkm_user_storage_get_login (self->storage);
+
+	/* No application is logged in */
+	if (g_hash_table_size (self->unlocked_apps) == 0) {
+
+		g_return_val_if_fail (login == NULL, CKR_GENERAL_ERROR);
+
+		/* So actually unlock the store */
+		login = gkm_secret_new_from_login (pin, n_pin);
+		rv = gkm_user_storage_unlock (self->storage, login);
+		g_object_unref (login);
+
+	/* An application is already logged in */
+	} else {
+
+		g_return_val_if_fail (login != NULL, CKR_GENERAL_ERROR);
+
+		/* Compare our pin to the one used originally */
+		if (!gkm_secret_equals (login, pin, n_pin))
+			rv = CKR_PIN_INCORRECT;
+		else
+			rv = CKR_OK;
+	}
+
+	/* Note that this application logged in */
+	if (rv == CKR_OK) {
+		g_hash_table_insert (self->unlocked_apps, gkm_util_ulong_alloc (slot_id), UNUSED_VALUE);
+		rv = GKM_MODULE_CLASS (gkm_user_module_parent_class)->login_user (base, slot_id, pin, n_pin);
+	}
+
+	return rv;
+}
+
+static CK_RV
+gkm_user_module_real_login_so (GkmModule *base, CK_SLOT_ID slot_id, CK_UTF8CHAR_PTR pin, CK_ULONG n_pin)
+{
+	GkmUserModule *self = GKM_USER_MODULE (base);
+
+	/* See if this application has unlocked, in which case we can't login */
+	if (g_hash_table_lookup (self->unlocked_apps, &slot_id))
+		return CKR_USER_ALREADY_LOGGED_IN;
+
+	/* Note that for an SO login, we don't actually unlock, and pin is always blank */
+	if (n_pin != 0)
+		return CKR_PIN_INCORRECT;
+
+	return GKM_MODULE_CLASS (gkm_user_module_parent_class)->login_so (base, slot_id, pin, n_pin);
+}
+
+static CK_RV
+gkm_user_module_real_logout_user (GkmModule *base, CK_SLOT_ID slot_id)
+{
+	GkmUserModule *self = GKM_USER_MODULE (base);
+	CK_RV rv;
+
+	if (!g_hash_table_remove (self->unlocked_apps, &slot_id))
+		return CKR_USER_NOT_LOGGED_IN;
+
+	if (g_hash_table_size (self->unlocked_apps) > 0)
+		return CKR_OK;
+
+	rv = gkm_user_storage_lock (self->storage);
+	if (rv == CKR_OK)
+		rv = GKM_MODULE_CLASS (gkm_user_module_parent_class)->logout_user (base, slot_id);
+
+	return rv;
+}
+
+static GObject*
+gkm_user_module_constructor (GType type, guint n_props, GObjectConstructParam *props)
+{
+	GkmUserModule *self = GKM_USER_MODULE (G_OBJECT_CLASS (gkm_user_module_parent_class)->constructor(type, n_props, props));
+	g_return_val_if_fail (self, NULL);
+
+	if (!self->directory)
+		self->directory = g_build_filename (g_get_home_dir (), ".gnome2", "keyrings", NULL);
+	self->storage = gkm_user_storage_new (GKM_MODULE (self), self->directory);
+
+	return G_OBJECT (self);
+}
+
+static void
+gkm_user_module_init (GkmUserModule *self)
+{
+	self->unlocked_apps = g_hash_table_new_full (gkm_util_ulong_hash, gkm_util_ulong_equal, gkm_util_ulong_free, NULL);
+
+	/* Our default token info, updated as module runs */
+	memcpy (&self->token_info, &user_module_token_info, sizeof (CK_TOKEN_INFO));
+
+	/* For creating stored keys */
+	gkm_module_register_factory (GKM_MODULE (self), GKM_FACTORY_USER_PRIVATE_KEY);
+	gkm_module_register_factory (GKM_MODULE (self), GKM_FACTORY_USER_PUBLIC_KEY);
+}
+
+static void
+gkm_user_module_dispose (GObject *obj)
+{
+	GkmUserModule *self = GKM_USER_MODULE (obj);
+
+	if (self->storage)
+		g_object_unref (self->storage);
+	self->storage = NULL;
+
+	g_hash_table_remove_all (self->unlocked_apps);
+
+	G_OBJECT_CLASS (gkm_user_module_parent_class)->dispose (obj);
+}
+
+static void
+gkm_user_module_finalize (GObject *obj)
+{
+	GkmUserModule *self = GKM_USER_MODULE (obj);
+
+	g_assert (self->storage == NULL);
+
+	g_assert (self->unlocked_apps);
+	g_hash_table_destroy (self->unlocked_apps);
+	self->unlocked_apps = NULL;
+
+	g_free (self->directory);
+	self->directory = NULL;
+
+	G_OBJECT_CLASS (gkm_user_module_parent_class)->finalize (obj);
+}
+
+static void
+gkm_user_module_class_init (GkmUserModuleClass *klass)
+{
+	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+	GkmModuleClass *module_class = GKM_MODULE_CLASS (klass);
+
+	gobject_class->constructor = gkm_user_module_constructor;
+	gobject_class->dispose = gkm_user_module_dispose;
+	gobject_class->finalize = gkm_user_module_finalize;
+
+	module_class->get_slot_info = gkm_user_module_real_get_slot_info;
+	module_class->get_token_info = gkm_user_module_real_get_token_info;
+	module_class->parse_argument = gkm_user_module_real_parse_argument;
+	module_class->refresh_token = gkm_user_module_real_refresh_token;
+	module_class->add_token_object = gkm_user_module_real_add_token_object;
+	module_class->store_token_object = gkm_user_module_real_store_token_object;
+	module_class->remove_token_object = gkm_user_module_real_remove_token_object;
+	module_class->login_user = gkm_user_module_real_login_user;
+	module_class->login_so = gkm_user_module_real_login_so;
+	module_class->logout_user = gkm_user_module_real_logout_user;
+	module_class->login_change = gkm_user_module_real_login_change;
+}
+
+/* ----------------------------------------------------------------------------
+ * PUBLIC
+ */
+
+CK_FUNCTION_LIST_PTR
+gkm_user_store_get_functions (void)
+{
+	gkm_crypto_initialize ();
+	return gkm_user_module_function_list;
+}
diff --git a/pkcs11/user-store/gkm-user-module.h b/pkcs11/user-store/gkm-user-module.h
new file mode 100644
index 0000000..9f0575a
--- /dev/null
+++ b/pkcs11/user-store/gkm-user-module.h
@@ -0,0 +1,45 @@
+/*
+ * 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 __GKM_USER_MODULE_H__
+#define __GKM_USER_MODULE_H__
+
+#include <glib-object.h>
+
+#include "gkm/gkm-module.h"
+
+#define GKM_TYPE_USER_MODULE               (gkm_user_module_get_type ())
+#define GKM_USER_MODULE(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_USER_MODULE, GkmUserModule))
+#define GKM_USER_MODULE_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_USER_MODULE, GkmUserModuleClass))
+#define GKM_IS_USER_MODULE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_USER_MODULE))
+#define GKM_IS_USER_MODULE_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_USER_MODULE))
+#define GKM_USER_MODULE_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_USER_MODULE, GkmUserModuleClass))
+
+typedef struct _GkmUserModule GkmUserModule;
+typedef struct _GkmUserModuleClass GkmUserModuleClass;
+
+struct _GkmUserModuleClass {
+	GkmModuleClass parent_class;
+};
+
+GType               gkm_user_module_get_type               (void);
+
+#endif /* __GKM_USER_MODULE_H__ */
diff --git a/pkcs11/user-store/gck-user-private-key.c b/pkcs11/user-store/gkm-user-private-key.c
similarity index 50%
rename from pkcs11/user-store/gck-user-private-key.c
rename to pkcs11/user-store/gkm-user-private-key.c
index 5ee57a3..68f8705 100644
--- a/pkcs11/user-store/gck-user-private-key.c
+++ b/pkcs11/user-store/gkm-user-private-key.c
@@ -1,39 +1,39 @@
-/* 
+/*
  * 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"
 
-#include "gck-user-private-key.h"
+#include "gkm-user-private-key.h"
 
-#include "gck/gck-attributes.h"
-#include "gck/gck-crypto.h"
-#include "gck/gck-data-der.h"
-#include "gck/gck-factory.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"
-#include "gck/gck-util.h"
+#include "gkm/gkm-attributes.h"
+#include "gkm/gkm-crypto.h"
+#include "gkm/gkm-data-der.h"
+#include "gkm/gkm-factory.h"
+#include "gkm/gkm-manager.h"
+#include "gkm/gkm-object.h"
+#include "gkm/gkm-secret.h"
+#include "gkm/gkm-serializable.h"
+#include "gkm/gkm-session.h"
+#include "gkm/gkm-sexp.h"
+#include "gkm/gkm-util.h"
 
 #include <glib/gi18n.h>
 
@@ -41,129 +41,129 @@ enum {
 	PROP_0,
 };
 
-struct _GckUserPrivateKey {
-	GckPrivateXsaKey parent;
+struct _GkmUserPrivateKey {
+	GkmPrivateXsaKey parent;
 
 	guchar *private_data;
 	gsize n_private_data;
-	
-	GckSexp *private_sexp;
+
+	GkmSexp *private_sexp;
 	gboolean is_encrypted;
-	GckSecret *login;
+	GkmSecret *login;
 };
 
-static void gck_user_private_key_serializable (GckSerializableIface *iface);
+static void gkm_user_private_key_serializable (GkmSerializableIface *iface);
 
-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));
+G_DEFINE_TYPE_EXTENDED (GkmUserPrivateKey, gkm_user_private_key, GKM_TYPE_PRIVATE_XSA_KEY, 0,
+               G_IMPLEMENT_INTERFACE (GKM_TYPE_SERIALIZABLE, gkm_user_private_key_serializable));
 
 /* -----------------------------------------------------------------------------
- * INTERNAL 
+ * INTERNAL
  */
 
-static GckObject*
-factory_create_private_key (GckSession *session, GckTransaction *transaction, 
+static GkmObject*
+factory_create_private_key (GkmSession *session, GkmTransaction *transaction,
                             CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
 {
-	GckUserPrivateKey *key;
-	GckSexp *sexp;
+	GkmUserPrivateKey *key;
+	GkmSexp *sexp;
 
 	g_return_val_if_fail (attrs || !n_attrs, NULL);
 
-	sexp = gck_private_xsa_key_create_sexp (session, transaction, attrs, n_attrs);
+	sexp = gkm_private_xsa_key_create_sexp (session, transaction, attrs, n_attrs);
 	if (sexp == NULL)
 		return NULL;
 
-	key = g_object_new (GCK_TYPE_USER_PRIVATE_KEY, "base-sexp", sexp,
-	                    "module", gck_session_get_module (session),
-	                    "manager", gck_manager_for_template (attrs, n_attrs, session),
+	key = g_object_new (GKM_TYPE_USER_PRIVATE_KEY, "base-sexp", sexp,
+	                    "module", gkm_session_get_module (session),
+	                    "manager", gkm_manager_for_template (attrs, n_attrs, session),
 	                    NULL);
 	g_return_val_if_fail (!key->private_sexp, NULL);
-	key->private_sexp = gck_sexp_ref (sexp);
+	key->private_sexp = gkm_sexp_ref (sexp);
 
-	gck_sexp_unref (sexp);
+	gkm_sexp_unref (sexp);
 
-	gck_session_complete_object_creation (session, transaction, GCK_OBJECT (key),
+	gkm_session_complete_object_creation (session, transaction, GKM_OBJECT (key),
 	                                      TRUE, attrs, n_attrs);
-	return GCK_OBJECT (key);
+	return GKM_OBJECT (key);
 }
 
 /* -----------------------------------------------------------------------------
- * OBJECT 
+ * OBJECT
  */
 
 static CK_RV
-gck_user_private_key_real_get_attribute (GckObject *base, GckSession *session, CK_ATTRIBUTE_PTR attr)
+gkm_user_private_key_real_get_attribute (GkmObject *base, GkmSession *session, CK_ATTRIBUTE_PTR attr)
 {
 	switch (attr->type) {
 	case CKA_ALWAYS_AUTHENTICATE:
-		return gck_attribute_set_bool (attr, FALSE);
+		return gkm_attribute_set_bool (attr, FALSE);
 	}
-	
-	return GCK_OBJECT_CLASS (gck_user_private_key_parent_class)->get_attribute (base, session, attr);
+
+	return GKM_OBJECT_CLASS (gkm_user_private_key_parent_class)->get_attribute (base, session, attr);
 }
 
-static GckSexp* 
-gck_user_private_key_real_acquire_crypto_sexp (GckSexpKey *base, GckSession *unused)
+static GkmSexp*
+gkm_user_private_key_real_acquire_crypto_sexp (GkmSexpKey *base, GkmSession *unused)
 {
-	GckUserPrivateKey *self = GCK_USER_PRIVATE_KEY (base);
+	GkmUserPrivateKey *self = GKM_USER_PRIVATE_KEY (base);
 	gcry_sexp_t sexp;
-	GckDataResult res;
+	GkmDataResult res;
 	const gchar *password;
 	gsize n_password;
-	
+
 	/* Non encrypted case */
 	if (self->private_sexp)
-		return gck_sexp_ref (self->private_sexp);
+		return gkm_sexp_ref (self->private_sexp);
 
 	g_return_val_if_fail (self->login, NULL);
 	g_return_val_if_fail (self->is_encrypted, NULL);
-	
-	password = gck_secret_get_password (self->login, &n_password);
-	res = gck_data_der_read_private_pkcs8 (self->private_data, self->n_private_data, 
+
+	password = gkm_secret_get_password (self->login, &n_password);
+	res = gkm_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);
-	
-	return gck_sexp_new (sexp);
+	g_return_val_if_fail (res == GKM_DATA_SUCCESS, NULL);
+
+	return gkm_sexp_new (sexp);
 }
 
 static void
-gck_user_private_key_init (GckUserPrivateKey *self)
+gkm_user_private_key_init (GkmUserPrivateKey *self)
 {
-	
+
 }
 
 static void
-gck_user_private_key_dispose (GObject *obj)
+gkm_user_private_key_dispose (GObject *obj)
 {
-	GckUserPrivateKey *self = GCK_USER_PRIVATE_KEY (obj);
-	
+	GkmUserPrivateKey *self = GKM_USER_PRIVATE_KEY (obj);
+
 	if (self->login)
 		g_object_unref (self->login);
 	self->login = NULL;
-    
-	G_OBJECT_CLASS (gck_user_private_key_parent_class)->dispose (obj);
+
+	G_OBJECT_CLASS (gkm_user_private_key_parent_class)->dispose (obj);
 }
 
 static void
-gck_user_private_key_finalize (GObject *obj)
+gkm_user_private_key_finalize (GObject *obj)
 {
-	GckUserPrivateKey *self = GCK_USER_PRIVATE_KEY (obj);
-	
+	GkmUserPrivateKey *self = GKM_USER_PRIVATE_KEY (obj);
+
 	g_assert (self->login == NULL);
-	
+
 	g_free (self->private_data);
 	self->private_data = NULL;
-	
+
 	if (self->private_sexp)
-		gck_sexp_unref (self->private_sexp);
+		gkm_sexp_unref (self->private_sexp);
 	self->private_sexp = NULL;
-	
-	G_OBJECT_CLASS (gck_user_private_key_parent_class)->finalize (obj);
+
+	G_OBJECT_CLASS (gkm_user_private_key_parent_class)->finalize (obj);
 }
 
 static void
-gck_user_private_key_set_property (GObject *obj, guint prop_id, const GValue *value, 
+gkm_user_private_key_set_property (GObject *obj, guint prop_id, const GValue *value,
                            GParamSpec *pspec)
 {
 	switch (prop_id) {
@@ -174,7 +174,7 @@ gck_user_private_key_set_property (GObject *obj, guint prop_id, const GValue *va
 }
 
 static void
-gck_user_private_key_get_property (GObject *obj, guint prop_id, GValue *value, 
+gkm_user_private_key_get_property (GObject *obj, guint prop_id, GValue *value,
                            GParamSpec *pspec)
 {
 	switch (prop_id) {
@@ -185,85 +185,85 @@ gck_user_private_key_get_property (GObject *obj, guint prop_id, GValue *value,
 }
 
 static void
-gck_user_private_key_class_init (GckUserPrivateKeyClass *klass)
+gkm_user_private_key_class_init (GkmUserPrivateKeyClass *klass)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	GckObjectClass *gck_class = GCK_OBJECT_CLASS (klass);
-	GckSexpKeyClass *key_class = GCK_SEXP_KEY_CLASS (klass);
-
-	gobject_class->dispose = gck_user_private_key_dispose;
-	gobject_class->finalize = gck_user_private_key_finalize;
-	gobject_class->set_property = gck_user_private_key_set_property;
-	gobject_class->get_property = gck_user_private_key_get_property;
-	
-	gck_class->get_attribute = gck_user_private_key_real_get_attribute;
-	
-	key_class->acquire_crypto_sexp = gck_user_private_key_real_acquire_crypto_sexp;
+	GkmObjectClass *gkm_class = GKM_OBJECT_CLASS (klass);
+	GkmSexpKeyClass *key_class = GKM_SEXP_KEY_CLASS (klass);
+
+	gobject_class->dispose = gkm_user_private_key_dispose;
+	gobject_class->finalize = gkm_user_private_key_finalize;
+	gobject_class->set_property = gkm_user_private_key_set_property;
+	gobject_class->get_property = gkm_user_private_key_get_property;
+
+	gkm_class->get_attribute = gkm_user_private_key_real_get_attribute;
+
+	key_class->acquire_crypto_sexp = gkm_user_private_key_real_acquire_crypto_sexp;
 }
 
 static gboolean
-gck_user_private_key_real_load (GckSerializable *base, GckSecret *login, const guchar *data, gsize n_data)
+gkm_user_private_key_real_load (GkmSerializable *base, GkmSecret *login, const guchar *data, gsize n_data)
 {
-	GckUserPrivateKey *self = GCK_USER_PRIVATE_KEY (base);
-	GckDataResult res;
+	GkmUserPrivateKey *self = GKM_USER_PRIVATE_KEY (base);
+	GkmDataResult res;
 	gcry_sexp_t sexp, pub;
-	GckSexp *wrapper;
+	GkmSexp *wrapper;
 	const gchar *password;
 	gsize n_password;
 
-	g_return_val_if_fail (GCK_IS_USER_PRIVATE_KEY (self), FALSE);
+	g_return_val_if_fail (GKM_IS_USER_PRIVATE_KEY (self), FALSE);
 	g_return_val_if_fail (data, FALSE);
-	
-	res = gck_data_der_read_private_pkcs8 (data, n_data, NULL, 0, &sexp);
-	
+
+	res = gkm_data_der_read_private_pkcs8 (data, n_data, NULL, 0, &sexp);
+
 	/* An unencrypted pkcs8 file */
-	if (res == GCK_DATA_SUCCESS) {
+	if (res == GKM_DATA_SUCCESS) {
 		self->is_encrypted = FALSE;
-	
+
 	/* If it's locked, then use our token password */
-	} else if (res == GCK_DATA_LOCKED) {
+	} else if (res == GKM_DATA_LOCKED) {
 		self->is_encrypted = TRUE;
-		
+
 		if (!login) {
 			g_message ("encountered private key but no private key present");
 			return FALSE;
 		}
-	
-		password = gck_secret_get_password (login, &n_password);
-		res = gck_data_der_read_private_pkcs8 (data, n_data, password, n_password, &sexp);
+
+		password = gkm_secret_get_password (login, &n_password);
+		res = gkm_data_der_read_private_pkcs8 (data, n_data, password, n_password, &sexp);
 	}
 
 	switch (res) {
-	case GCK_DATA_LOCKED:
+	case GKM_DATA_LOCKED:
 		g_message ("private key is encrypted with wrong password");
 		return FALSE;
-	case GCK_DATA_FAILURE:
+	case GKM_DATA_FAILURE:
 		g_message ("couldn't parse private key");
 		return FALSE;
-	case GCK_DATA_UNRECOGNIZED:
+	case GKM_DATA_UNRECOGNIZED:
 		g_message ("invalid or unrecognized private key");
 		return FALSE;
-	case GCK_DATA_SUCCESS:
+	case GKM_DATA_SUCCESS:
 		break;
 	default:
 		g_assert_not_reached();
 	}
-	
+
 	/* Calculate a public key as our 'base' */
-	if (!gck_sexp_key_to_public (sexp, &pub))
+	if (!gkm_sexp_key_to_public (sexp, &pub))
 		g_return_val_if_reached (FALSE);
-	
+
 	/* Keep the public part of the key around for answering queries */
-	wrapper = gck_sexp_new (pub);
-	gck_sexp_key_set_base (GCK_SEXP_KEY (self), wrapper);
-	gck_sexp_unref (wrapper);
-	
+	wrapper = gkm_sexp_new (pub);
+	gkm_sexp_key_set_base (GKM_SEXP_KEY (self), wrapper);
+	gkm_sexp_unref (wrapper);
+
 	/* Encrypted private key, keep login and data */
 	if (self->is_encrypted) {
 		g_free (self->private_data);
 		self->n_private_data = n_data;
 		self->private_data = g_memdup (data, n_data);
-		
+
 		g_object_ref (login);
 		if (self->login)
 			g_object_unref (self->login);
@@ -274,73 +274,73 @@ gck_user_private_key_real_load (GckSerializable *base, GckSecret *login, const g
 
 	/* Not encrypted, just keep the parsed key */
 	} else {
-		wrapper = gck_sexp_new (sexp);
+		wrapper = gkm_sexp_new (sexp);
 		if (self->private_sexp)
-			gck_sexp_unref (self->private_sexp);
+			gkm_sexp_unref (self->private_sexp);
 		self->private_sexp = wrapper;
-		
+
 		if (self->login)
 			g_object_unref (login);
 		self->login = NULL;
 	}
-	
+
 	return TRUE;
 }
 
-static gboolean 
-gck_user_private_key_real_save (GckSerializable *base, GckSecret *login, guchar **data, gsize *n_data)
+static gboolean
+gkm_user_private_key_real_save (GkmSerializable *base, GkmSecret *login, guchar **data, gsize *n_data)
 {
-	GckUserPrivateKey *self = GCK_USER_PRIVATE_KEY (base);
+	GkmUserPrivateKey *self = GKM_USER_PRIVATE_KEY (base);
 	const gchar *password;
 	gsize n_password;
-	GckSexp *sexp;
-	
-	g_return_val_if_fail (GCK_IS_USER_PRIVATE_KEY (self), FALSE);
+	GkmSexp *sexp;
+
+	g_return_val_if_fail (GKM_IS_USER_PRIVATE_KEY (self), FALSE);
 	g_return_val_if_fail (data, FALSE);
 	g_return_val_if_fail (n_data, FALSE);
-	
-	sexp = gck_user_private_key_real_acquire_crypto_sexp (GCK_SEXP_KEY (self), NULL);
+
+	sexp = gkm_user_private_key_real_acquire_crypto_sexp (GKM_SEXP_KEY (self), NULL);
 	g_return_val_if_fail (sexp, FALSE);
-	
-	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);
+
+	password = gkm_secret_get_password (login, &n_password);
+	if (password == NULL)
+		*data = gkm_data_der_write_private_pkcs8_plain (gkm_sexp_get (sexp), n_data);
 	else
-		*data = gck_data_der_write_private_pkcs8_crypted (gck_sexp_get (sexp), password,
+		*data = gkm_data_der_write_private_pkcs8_crypted (gkm_sexp_get (sexp), password,
 		                                                  n_password, n_data);
-	
-	gck_sexp_unref (sexp);
+
+	gkm_sexp_unref (sexp);
 	return *data != NULL;
 }
 
-static void 
-gck_user_private_key_serializable (GckSerializableIface *iface)
+static void
+gkm_user_private_key_serializable (GkmSerializableIface *iface)
 {
 	iface->extension = ".pkcs8";
-	iface->load = gck_user_private_key_real_load;
-	iface->save = gck_user_private_key_real_save;
+	iface->load = gkm_user_private_key_real_load;
+	iface->save = gkm_user_private_key_real_save;
 }
 
 /* -----------------------------------------------------------------------------
- * PUBLIC 
+ * PUBLIC
  */
 
-GckFactory*
-gck_user_private_key_get_factory (void)
+GkmFactory*
+gkm_user_private_key_get_factory (void)
 {
 	static CK_OBJECT_CLASS klass = CKO_PRIVATE_KEY;
 	static CK_BBOOL token = CK_TRUE;
 
 	static CK_ATTRIBUTE attributes[] = {
 		{ CKA_CLASS, &klass, sizeof (klass) },
-		{ CKA_TOKEN, &token, sizeof (token) }, 
+		{ CKA_TOKEN, &token, sizeof (token) },
 	};
 
-	static GckFactory factory = {
+	static GkmFactory factory = {
 		attributes,
 		G_N_ELEMENTS (attributes),
 		factory_create_private_key
 	};
-	
+
 	return &factory;
 }
diff --git a/pkcs11/user-store/gkm-user-private-key.h b/pkcs11/user-store/gkm-user-private-key.h
new file mode 100644
index 0000000..fbe6834
--- /dev/null
+++ b/pkcs11/user-store/gkm-user-private-key.h
@@ -0,0 +1,52 @@
+/*
+ * 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 __GKM_USER_PRIVATE_KEY_H__
+#define __GKM_USER_PRIVATE_KEY_H__
+
+#include <glib-object.h>
+
+#include "gkm-user-private-key.h"
+
+#include "gkm/gkm-secret.h"
+#include "gkm/gkm-private-xsa-key.h"
+
+#define GKM_FACTORY_USER_PRIVATE_KEY            (gkm_user_private_key_get_factory ())
+
+#define GKM_TYPE_USER_PRIVATE_KEY               (gkm_user_private_key_get_type ())
+#define GKM_USER_PRIVATE_KEY(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_USER_PRIVATE_KEY, GkmUserPrivateKey))
+#define GKM_USER_PRIVATE_KEY_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_USER_PRIVATE_KEY, GkmUserPrivateKeyClass))
+#define GKM_IS_USER_PRIVATE_KEY(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_USER_PRIVATE_KEY))
+#define GKM_IS_USER_PRIVATE_KEY_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_USER_PRIVATE_KEY))
+#define GKM_USER_PRIVATE_KEY_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_USER_PRIVATE_KEY, GkmUserPrivateKeyClass))
+
+typedef struct _GkmUserPrivateKey GkmUserPrivateKey;
+typedef struct _GkmUserPrivateKeyClass GkmUserPrivateKeyClass;
+
+struct _GkmUserPrivateKeyClass {
+	GkmPrivateXsaKeyClass parent_class;
+};
+
+GType               gkm_user_private_key_get_type               (void);
+
+GkmFactory*         gkm_user_private_key_get_factory            (void);
+
+#endif /* __GKM_USER_PRIVATE_KEY_H__ */
diff --git a/pkcs11/user-store/gkm-user-public-key.c b/pkcs11/user-store/gkm-user-public-key.c
new file mode 100644
index 0000000..1761c74
--- /dev/null
+++ b/pkcs11/user-store/gkm-user-public-key.c
@@ -0,0 +1,205 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+
+#include "gkm-user-public-key.h"
+
+#include "gkm/gkm-attributes.h"
+#include "gkm/gkm-data-der.h"
+#include "gkm/gkm-factory.h"
+#include "gkm/gkm-serializable.h"
+#include "gkm/gkm-session.h"
+#include "gkm/gkm-object.h"
+#include "gkm/gkm-util.h"
+
+#include <glib/gi18n.h>
+
+struct _GkmUserPublicKey {
+	GkmPublicXsaKey parent;
+};
+
+static void gkm_user_public_key_serializable (GkmSerializableIface *iface);
+
+G_DEFINE_TYPE_EXTENDED (GkmUserPublicKey, gkm_user_public_key, GKM_TYPE_PUBLIC_XSA_KEY, 0,
+               G_IMPLEMENT_INTERFACE (GKM_TYPE_SERIALIZABLE, gkm_user_public_key_serializable));
+
+/* -----------------------------------------------------------------------------
+ * INTERNAL
+ */
+
+static GkmObject*
+factory_create_public_key (GkmSession *session, GkmTransaction *transaction,
+                           CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
+{
+	GkmObject *object = NULL;
+	GkmSexp *sexp;
+
+	g_return_val_if_fail (attrs || !n_attrs, NULL);
+
+	sexp = gkm_public_xsa_key_create_sexp (session, transaction, attrs, n_attrs);
+	if (sexp != NULL) {
+		object = g_object_new (GKM_TYPE_USER_PUBLIC_KEY, "base-sexp", sexp,
+		                       "module", gkm_session_get_module (session),
+		                       "manager", gkm_manager_for_template (attrs, n_attrs, session),
+		                       NULL);
+		gkm_sexp_unref (sexp);
+		gkm_session_complete_object_creation (session, transaction, object,
+		                                      TRUE, attrs, n_attrs);
+	}
+
+	return object;
+}
+
+/* -----------------------------------------------------------------------------
+ * OBJECT
+ */
+
+static void
+gkm_user_public_key_init (GkmUserPublicKey *self)
+{
+
+}
+
+static void
+gkm_user_public_key_finalize (GObject *obj)
+{
+	/* GkmUserPublicKey *self = GKM_USER_PUBLIC_KEY (obj); */
+	G_OBJECT_CLASS (gkm_user_public_key_parent_class)->finalize (obj);
+}
+
+static void
+gkm_user_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;
+	}
+}
+
+static void
+gkm_user_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
+gkm_user_public_key_class_init (GkmUserPublicKeyClass *klass)
+{
+	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+	gobject_class->finalize = gkm_user_public_key_finalize;
+	gobject_class->set_property = gkm_user_public_key_set_property;
+	gobject_class->get_property = gkm_user_public_key_get_property;
+}
+
+
+static gboolean
+gkm_user_public_key_real_load (GkmSerializable *base, GkmSecret *login, const guchar *data, gsize n_data)
+{
+	GkmUserPublicKey *self = GKM_USER_PUBLIC_KEY (base);
+	GkmDataResult res;
+	GkmSexp *wrapper;
+	gcry_sexp_t sexp;
+
+	g_return_val_if_fail (GKM_IS_USER_PUBLIC_KEY (self), FALSE);
+	g_return_val_if_fail (data, FALSE);
+
+	res = gkm_data_der_read_public_key (data, n_data, &sexp);
+
+	switch (res) {
+	case GKM_DATA_LOCKED:
+		g_message ("public key is locked");
+		return FALSE;
+	case GKM_DATA_FAILURE:
+		g_message ("couldn't parse public key");
+		return FALSE;
+	case GKM_DATA_UNRECOGNIZED:
+		g_message ("invalid or unrecognized public key");
+		return FALSE;
+	case GKM_DATA_SUCCESS:
+		break;
+	default:
+		g_assert_not_reached();
+	}
+
+	wrapper = gkm_sexp_new (sexp);
+	gkm_sexp_key_set_base (GKM_SEXP_KEY (self), wrapper);
+	gkm_sexp_unref (wrapper);
+
+	return TRUE;
+}
+
+static gboolean
+gkm_user_public_key_real_save (GkmSerializable *base, GkmSecret *login, guchar **data, gsize *n_data)
+{
+	GkmUserPublicKey *self = GKM_USER_PUBLIC_KEY (base);
+	GkmSexp *wrapper;
+
+	g_return_val_if_fail (GKM_IS_USER_PUBLIC_KEY (self), FALSE);
+	g_return_val_if_fail (data, FALSE);
+	g_return_val_if_fail (n_data, FALSE);
+
+	wrapper = gkm_sexp_key_get_base (GKM_SEXP_KEY (self));
+	g_return_val_if_fail (wrapper, FALSE);
+
+	*data = gkm_data_der_write_public_key (gkm_sexp_get (wrapper), n_data);
+	return *data != NULL;
+}
+
+static void
+gkm_user_public_key_serializable (GkmSerializableIface *iface)
+{
+	iface->extension = ".pub";
+	iface->load = gkm_user_public_key_real_load;
+	iface->save = gkm_user_public_key_real_save;
+}
+
+/* -----------------------------------------------------------------------------
+ * PUBLIC
+ */
+
+GkmFactory*
+gkm_user_public_key_get_factory (void)
+{
+	static CK_OBJECT_CLASS klass = CKO_PUBLIC_KEY;
+	static CK_BBOOL token = CK_TRUE;
+
+	static CK_ATTRIBUTE attributes[] = {
+		{ CKA_CLASS, &klass, sizeof (klass) },
+		{ CKA_TOKEN, &token, sizeof (token) },
+	};
+
+	static GkmFactory factory = {
+		attributes,
+		G_N_ELEMENTS (attributes),
+		factory_create_public_key
+	};
+
+	return &factory;
+}
diff --git a/pkcs11/user-store/gkm-user-public-key.h b/pkcs11/user-store/gkm-user-public-key.h
new file mode 100644
index 0000000..a9122ec
--- /dev/null
+++ b/pkcs11/user-store/gkm-user-public-key.h
@@ -0,0 +1,51 @@
+/*
+ * 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 __GKM_USER_PUBLIC_KEY_H__
+#define __GKM_USER_PUBLIC_KEY_H__
+
+#include <glib-object.h>
+
+#include "gkm/gkm-public-xsa-key.h"
+
+#define GKM_FACTORY_USER_PUBLIC_KEY            (gkm_user_public_key_get_factory ())
+
+#define GKM_TYPE_USER_PUBLIC_KEY               (gkm_user_public_key_get_type ())
+#define GKM_USER_PUBLIC_KEY(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_USER_PUBLIC_KEY, GkmUserPublicKey))
+#define GKM_USER_PUBLIC_KEY_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_USER_PUBLIC_KEY, GkmUserPublicKeyClass))
+#define GKM_IS_USER_PUBLIC_KEY(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_USER_PUBLIC_KEY))
+#define GKM_IS_USER_PUBLIC_KEY_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_USER_PUBLIC_KEY))
+#define GKM_USER_PUBLIC_KEY_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_USER_PUBLIC_KEY, GkmUserPublicKeyClass))
+
+typedef struct _GkmUserPublicKey GkmUserPublicKey;
+typedef struct _GkmUserPublicKeyClass GkmUserPublicKeyClass;
+
+struct _GkmUserPublicKeyClass {
+	GkmPublicXsaKeyClass parent_class;
+};
+
+GType                gkm_user_public_key_get_type               (void);
+
+GkmFactory*          gkm_user_public_key_get_factory            (void);
+
+GkmUserPublicKey*    gkm_user_public_key_new                    (const gchar *unique);
+
+#endif /* __GKM_USER_PUBLIC_KEY_H__ */
diff --git a/pkcs11/user-store/gck-user-standalone.c b/pkcs11/user-store/gkm-user-standalone.c
similarity index 84%
rename from pkcs11/user-store/gck-user-standalone.c
rename to pkcs11/user-store/gkm-user-standalone.c
index 841bab7..7cbd558 100644
--- a/pkcs11/user-store/gck-user-standalone.c
+++ b/pkcs11/user-store/gkm-user-standalone.c
@@ -1,5 +1,5 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* gck-user-standalone.h - The user-store PKCS#11 code as a standalone module
+/* gkm-user-standalone.h - The user-store PKCS#11 code as a standalone module
 
    Copyright (C) 2008, Stef Walter
 
@@ -23,9 +23,9 @@
 
 #include "config.h"
 
-#include "gck-user-store.h"
+#include "gkm-user-store.h"
 
-#include "gck/gck-crypto.h"
+#include "gkm/gkm-crypto.h"
 
 #include "egg/egg-secure-memory.h"
 
@@ -35,11 +35,11 @@
 
 /* Module callbacks for secure memory */
 static GStaticMutex memory_mutex = G_STATIC_MUTEX_INIT;
-void egg_memory_lock (void) 
+void egg_memory_lock (void)
 	{ g_static_mutex_lock (&memory_mutex); }
-void egg_memory_unlock (void) 
+void egg_memory_unlock (void)
 	{ g_static_mutex_unlock (&memory_mutex); }
-void* egg_memory_fallback (void *p, size_t sz) 
+void* egg_memory_fallback (void *p, size_t sz)
 	{ return g_realloc (p, sz); }
 
 CK_RV
@@ -47,11 +47,11 @@ C_GetFunctionList (CK_FUNCTION_LIST_PTR_PTR list)
 {
 	if (!list)
 		return CKR_ARGUMENTS_BAD;
-	
+
 	g_type_init ();
 	if (!g_thread_supported ())
 		g_thread_init (NULL);
-	
-	*list = gck_user_store_get_functions ();
+
+	*list = gkm_user_store_get_functions ();
 	return CKR_OK;
 }
diff --git a/pkcs11/user-store/gck-user-storage.c b/pkcs11/user-store/gkm-user-storage.c
similarity index 62%
rename from pkcs11/user-store/gck-user-storage.c
rename to pkcs11/user-store/gkm-user-storage.c
index 3d46e6f..148e883 100644
--- a/pkcs11/user-store/gck-user-storage.c
+++ b/pkcs11/user-store/gkm-user-storage.c
@@ -1,38 +1,38 @@
-/* 
+/*
  * 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"
 
-#include "gck-user-storage.h"
-#include "gck-user-private-key.h"
-#include "gck-user-public-key.h"
+#include "gkm-user-storage.h"
+#include "gkm-user-private-key.h"
+#include "gkm-user-public-key.h"
 
-#include "gck/gck-certificate.h"
-#include "gck/gck-data-asn1.h"
-#include "gck/gck-data-file.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"
+#include "gkm/gkm-certificate.h"
+#include "gkm/gkm-data-asn1.h"
+#include "gkm/gkm-data-file.h"
+#include "gkm/gkm-manager.h"
+#include "gkm/gkm-module.h"
+#include "gkm/gkm-secret.h"
+#include "gkm/gkm-serializable.h"
+#include "gkm/gkm-util.h"
 
 #include "egg/egg-error.h"
 #include "egg/egg-hex.h"
@@ -57,38 +57,38 @@ enum {
 	PROP_LOGIN
 };
 
-struct _GckUserStorage {
-	GckStore parent;
+struct _GkmUserStorage {
+	GkmStore parent;
 
-	GckModule *module;
-	GckManager *manager;
+	GkmModule *module;
+	GkmManager *manager;
 
 	/* Information about file data */
 	gchar *directory;
 	gchar *filename;
-	GckDataFile *file;
+	GkmDataFile *file;
 	time_t last_mtime;
-	GckSecret *login;
-	
+	GkmSecret *login;
+
 	/* Mapping of objects loaded */
 	GHashTable *object_to_identifier;
 	GHashTable *identifier_to_object;
-	
+
 	/* Valid when in write state */
-	GckTransaction *transaction;
+	GkmTransaction *transaction;
 	gchar *write_path;
 	gint write_fd;
 	gint read_fd;
 };
 
-G_DEFINE_TYPE (GckUserStorage, gck_user_storage, GCK_TYPE_STORE);
+G_DEFINE_TYPE (GkmUserStorage, gkm_user_storage, GKM_TYPE_STORE);
 
 #define MAX_LOCK_TRIES 20
 
 #define UNWANTED_IDENTIFIER_CHARS  ":/\\<>|\t\n\r\v "
 
 /* -----------------------------------------------------------------------------
- * HELPERS 
+ * HELPERS
  */
 
 #ifndef HAVE_FLOCK
@@ -96,11 +96,11 @@ G_DEFINE_TYPE (GckUserStorage, gck_user_storage, GCK_TYPE_STORE);
 #define LOCK_EX 2
 #define LOCK_NB 4
 #define LOCK_UN 8
-	
+
 static int flock(int fd, int operation)
 {
 	struct flock flock;
-	
+
 	switch (operation & ~LOCK_NB) {
 	case LOCK_SH:
 		flock.l_type = F_RDLCK;
@@ -115,17 +115,17 @@ static int flock(int fd, int operation)
 		errno = EINVAL;
 		return -1;
 	}
-	
+
 	flock.l_whence = 0;
 	flock.l_start = 0;
 	flock.l_len = 0;
-	
+
 	return fcntl (fd, (operation & LOCK_NB) ? F_SETLK : F_SETLKW, &flock);
 }
-#endif /* !HAVE_FLOCK */ 
+#endif /* !HAVE_FLOCK */
 
 /* -----------------------------------------------------------------------------
- * INTERNAL 
+ * INTERNAL
  */
 
 
@@ -134,51 +134,51 @@ name_for_subject (const guchar *subject, gsize n_subject)
 {
 	ASN1_TYPE asn;
 	gchar *name;
-	
+
 	g_assert (subject);
 	g_assert (n_subject);
-	
+
 	asn = egg_asn1_decode ("PKIX1.Name", subject, n_subject);
 	g_return_val_if_fail (asn, NULL);
-	
+
 	name = egg_asn1_read_dn_part (asn, "rdnSequence", "CN");
 	asn1_delete_structure (&asn);
-	
+
 	return name;
 }
 
 static gchar*
-identifier_for_object (GckObject *object)
+identifier_for_object (GkmObject *object)
 {
-	GckSerializableIface *serial;
+	GkmSerializableIface *serial;
 	const gchar *ext;
 	gchar *identifier;
 	gchar *name = NULL;
 	guchar *data;
 	gsize n_data;
-	
-	g_assert (GCK_IS_OBJECT (object));
-	g_assert (GCK_IS_SERIALIZABLE (object));
-	
+
+	g_assert (GKM_IS_OBJECT (object));
+	g_assert (GKM_IS_SERIALIZABLE (object));
+
 	/* Figure out the extension and prefix */
-	serial = GCK_SERIALIZABLE_GET_INTERFACE (object);
+	serial = GKM_SERIALIZABLE_GET_INTERFACE (object);
 	ext = serial->extension;
 	g_return_val_if_fail (ext, NULL);
-	
+
 	/* First we try to use the CN of a subject */
-	data = gck_object_get_attribute_data (object, NULL, CKA_SUBJECT, &n_data);
-	if (data && n_data) 
+	data = gkm_object_get_attribute_data (object, NULL, CKA_SUBJECT, &n_data);
+	if (data && n_data)
 		name = name_for_subject (data, n_data);
 	g_free (data);
-	
+
 	/* Next we try hex encoding the ID */
 	if (name == NULL) {
-		data = gck_object_get_attribute_data (object, NULL, CKA_ID, &n_data);
+		data = gkm_object_get_attribute_data (object, NULL, CKA_ID, &n_data);
 		if (data && n_data)
 			name = egg_hex_encode (data, n_data);
 		g_free (data);
 	}
-	
+
 	/* Build up the identifier */
 	identifier = g_strconcat (name, ext, NULL);
 	g_strdelimit (identifier, UNWANTED_IDENTIFIER_CHARS, '_');
@@ -191,14 +191,14 @@ static GType
 type_from_extension (const gchar *extension)
 {
 	g_assert (extension);
-	
+
 	if (strcmp (extension, ".pkcs8") == 0)
-		return GCK_TYPE_USER_PRIVATE_KEY;
+		return GKM_TYPE_USER_PRIVATE_KEY;
 	else if (strcmp (extension, ".pub") == 0)
-		return GCK_TYPE_USER_PUBLIC_KEY;
+		return GKM_TYPE_USER_PUBLIC_KEY;
 	else if (strcmp (extension, ".cer") == 0)
-		return GCK_TYPE_CERTIFICATE;
-	
+		return GKM_TYPE_CERTIFICATE;
+
 	return 0;
 }
 
@@ -207,67 +207,67 @@ static GType
 type_from_identifier (const gchar *identifier)
 {
 	const gchar *ext;
-	
+
 	g_assert (identifier);
-	
+
 	ext = strrchr (identifier, '.');
 	if (ext == NULL)
 		return 0;
-	
+
 	return type_from_extension (ext);
 }
 
 static gboolean
-complete_lock_file (GckTransaction *transaction, GObject *object, gpointer data)
+complete_lock_file (GkmTransaction *transaction, GObject *object, gpointer data)
 {
 	int fd = GPOINTER_TO_INT (data);
-	
+
 	/* This also unlocks the file */
 	close (fd);
-	
+
 	/* Completed successfully */
 	return TRUE;
 }
 
 static gint
-begin_lock_file (GckUserStorage *self, GckTransaction *transaction)
+begin_lock_file (GkmUserStorage *self, GkmTransaction *transaction)
 {
 	guint tries = 0;
 	gint fd = -1;
-	
-	/* 
+
+	/*
 	 * In this function we don't actually put the object into a 'write' state,
 	 * that's the callers job if necessary.
-	 */ 
+	 */
 
-	g_assert (GCK_IS_USER_STORAGE (self));
-	g_assert (GCK_IS_TRANSACTION (transaction));
+	g_assert (GKM_IS_USER_STORAGE (self));
+	g_assert (GKM_IS_TRANSACTION (transaction));
 
-	g_return_val_if_fail (!gck_transaction_get_failed (transaction), -1);
+	g_return_val_if_fail (!gkm_transaction_get_failed (transaction), -1);
 
 	/* File lock retry loop */
 	for (tries = 0; TRUE; ++tries) {
 		if (tries > MAX_LOCK_TRIES) {
 			g_message ("couldn't write to store file: %s: file is locked", self->filename);
-			gck_transaction_fail (transaction, CKR_FUNCTION_FAILED);
+			gkm_transaction_fail (transaction, CKR_FUNCTION_FAILED);
 			return -1;
 		}
 
 		fd = open (self->filename, O_RDONLY | O_CREAT, S_IRUSR | S_IWUSR);
 		if (fd == -1) {
 			g_message ("couldn't open store file: %s: %s", self->filename, g_strerror (errno));
-			gck_transaction_fail (transaction, CKR_FUNCTION_FAILED);
+			gkm_transaction_fail (transaction, CKR_FUNCTION_FAILED);
 			return -1;
 		}
-	
+
 		if (flock (fd, LOCK_EX | LOCK_NB) < 0) {
 			if (errno != EWOULDBLOCK) {
 				g_message ("couldn't lock store file: %s: %s", self->filename, g_strerror (errno));
 				close (fd);
-				gck_transaction_fail (transaction, CKR_FUNCTION_FAILED);
+				gkm_transaction_fail (transaction, CKR_FUNCTION_FAILED);
 				return -1;
 			}
-				
+
 			close (fd);
 			fd = -1;
 			g_usleep (200000);
@@ -275,7 +275,7 @@ begin_lock_file (GckUserStorage *self, GckTransaction *transaction)
 		}
 
 		/* Successfully opened file */;
-		gck_transaction_add (transaction, self, complete_lock_file, GINT_TO_POINTER (fd));
+		gkm_transaction_add (transaction, self, complete_lock_file, GINT_TO_POINTER (fd));
 		return fd;
 	}
 
@@ -283,18 +283,18 @@ begin_lock_file (GckUserStorage *self, GckTransaction *transaction)
 }
 
 static gboolean
-complete_write_state (GckTransaction *transaction, GObject *object, gpointer unused)
+complete_write_state (GkmTransaction *transaction, GObject *object, gpointer unused)
 {
-	GckUserStorage *self = GCK_USER_STORAGE (object);
+	GkmUserStorage *self = GKM_USER_STORAGE (object);
 	gboolean ret = TRUE;
 	struct stat sb;
-	
-	g_return_val_if_fail (GCK_IS_USER_STORAGE (object), FALSE);
-	g_return_val_if_fail (GCK_IS_TRANSACTION (transaction), FALSE);
+
+	g_return_val_if_fail (GKM_IS_USER_STORAGE (object), FALSE);
+	g_return_val_if_fail (GKM_IS_TRANSACTION (transaction), FALSE);
 	g_return_val_if_fail (self->transaction == transaction, FALSE);
-	
+
 	/* Transaction succeeded, overwrite the old with the new */
-	if (!gck_transaction_get_failed (transaction)) {
+	if (!gkm_transaction_get_failed (transaction)) {
 
 		if (g_rename (self->write_path, self->filename) == -1) {
 			g_warning ("couldn't rename temporary store file: %s", self->write_path);
@@ -303,43 +303,43 @@ complete_write_state (GckTransaction *transaction, GObject *object, gpointer unu
 			if (fstat (self->write_fd, &sb) >= 0)
 				self->last_mtime = sb.st_mtime;
 		}
-	} 
-	
+	}
+
 	/* read_fd is closed by complete_lock_file */
-	
+
 	if (self->write_fd != -1)
 		close (self->write_fd);
 	self->write_fd = -1;
-	
+
 	g_free (self->write_path);
 	self->write_path = NULL;
 
 	g_object_unref (self->transaction);
 	self->transaction = NULL;
-	
+
 	return ret;
 }
 
 static gboolean
-begin_write_state (GckUserStorage *self, GckTransaction *transaction)
+begin_write_state (GkmUserStorage *self, GkmTransaction *transaction)
 {
-	g_assert (GCK_IS_USER_STORAGE (self));
-	g_assert (GCK_IS_TRANSACTION (transaction));
+	g_assert (GKM_IS_USER_STORAGE (self));
+	g_assert (GKM_IS_TRANSACTION (transaction));
+
+	g_return_val_if_fail (!gkm_transaction_get_failed (transaction), FALSE);
 
-	g_return_val_if_fail (!gck_transaction_get_failed (transaction), FALSE);
-	
 	/* Already in write state for this transaction? */
 	if (self->transaction != NULL) {
 		g_return_val_if_fail (self->transaction == transaction, FALSE);
 		return TRUE;
 	}
-	
+
 	/* Lock file for the transaction */
 	self->read_fd = begin_lock_file (self, transaction);
 	if (self->read_fd == -1)
 		return FALSE;
 
-	gck_transaction_add (transaction, self, complete_write_state, NULL);
+	gkm_transaction_add (transaction, self, complete_write_state, NULL);
 	self->transaction = g_object_ref (transaction);
 
 	/* Open the new file */
@@ -348,168 +348,168 @@ begin_write_state (GckUserStorage *self, GckTransaction *transaction)
 	self->write_fd = g_mkstemp (self->write_path);
 	if (self->write_fd == -1) {
 		g_message ("couldn't open new temporary store file: %s: %s", self->write_path, g_strerror (errno));
-		gck_transaction_fail (transaction, CKR_FUNCTION_FAILED);
+		gkm_transaction_fail (transaction, CKR_FUNCTION_FAILED);
 		return FALSE;
 	}
-	
+
 	return TRUE;
 }
 
 static gboolean
-complete_modification_state (GckTransaction *transaction, GObject *object, gpointer unused)
+complete_modification_state (GkmTransaction *transaction, GObject *object, gpointer unused)
 {
-	GckUserStorage *self = GCK_USER_STORAGE (object);
-	GckDataResult res;
-	
-	if (!gck_transaction_get_failed (transaction)) {
-		res = gck_data_file_write_fd (self->file, self->write_fd, self->login);
+	GkmUserStorage *self = GKM_USER_STORAGE (object);
+	GkmDataResult res;
+
+	if (!gkm_transaction_get_failed (transaction)) {
+		res = gkm_data_file_write_fd (self->file, self->write_fd, self->login);
 		switch(res) {
-		case GCK_DATA_FAILURE:
-		case GCK_DATA_UNRECOGNIZED:
+		case GKM_DATA_FAILURE:
+		case GKM_DATA_UNRECOGNIZED:
 			g_warning ("couldn't write to temporary store file: %s", self->write_path);
 			return FALSE;
-		case GCK_DATA_LOCKED:
+		case GKM_DATA_LOCKED:
 			g_warning ("couldn't encrypt temporary store file: %s", self->write_path);
 			return FALSE;
-		case GCK_DATA_SUCCESS:
+		case GKM_DATA_SUCCESS:
 			break;
 		default:
 			g_assert_not_reached ();
 		}
 	}
-	
+
 	return TRUE;
 }
 
 static gboolean
-begin_modification_state (GckUserStorage *self, GckTransaction *transaction)
+begin_modification_state (GkmUserStorage *self, GkmTransaction *transaction)
 {
-	GckDataResult res;
+	GkmDataResult res;
 	struct stat sb;
 	CK_RV rv;
-	
+
 	if (!begin_write_state (self, transaction))
 		return FALSE;
-	
+
 	/* See if file needs updating */
 	if (fstat (self->read_fd, &sb) >= 0 && sb.st_mtime != self->last_mtime) {
-		
-		res = gck_data_file_read_fd (self->file, self->read_fd, self->login);
+
+		res = gkm_data_file_read_fd (self->file, self->read_fd, self->login);
 		switch (res) {
-		case GCK_DATA_FAILURE:
+		case GKM_DATA_FAILURE:
 			g_message ("failure updating user store file: %s", self->filename);
 			rv = CKR_FUNCTION_FAILED;
 			break;
-		case GCK_DATA_LOCKED:
+		case GKM_DATA_LOCKED:
 			rv = CKR_USER_NOT_LOGGED_IN;
 			break;
-		case GCK_DATA_UNRECOGNIZED:
+		case GKM_DATA_UNRECOGNIZED:
 			g_message ("unrecognized or invalid user store file: %s", self->filename);
 			rv = CKR_FUNCTION_FAILED;
 			break;
-		case GCK_DATA_SUCCESS:
+		case GKM_DATA_SUCCESS:
 			rv = CKR_OK;
 			break;
 		default:
 			g_assert_not_reached ();
 			break;
 		}
-		
+
 		if (rv != CKR_OK) {
-			gck_transaction_fail (transaction, rv);
+			gkm_transaction_fail (transaction, rv);
 			return FALSE;
 		}
 	}
-	
+
 	/* Write out the data once completed with modifications */
-	gck_transaction_add (transaction, self, complete_modification_state, NULL);
-	
+	gkm_transaction_add (transaction, self, complete_modification_state, NULL);
+
 	return TRUE;
 }
 
 static void
-take_object_ownership (GckUserStorage *self, const gchar *identifier, GckObject *object)
+take_object_ownership (GkmUserStorage *self, const gchar *identifier, GkmObject *object)
 {
 	gchar *str;
-	
-	g_assert (GCK_IS_USER_STORAGE (self));
-	g_assert (GCK_IS_OBJECT (object));
-	
+
+	g_assert (GKM_IS_USER_STORAGE (self));
+	g_assert (GKM_IS_OBJECT (object));
+
 	g_assert (g_hash_table_lookup (self->identifier_to_object, identifier) == NULL);
 	g_assert (g_hash_table_lookup (self->object_to_identifier, object) == NULL);
-	
+
 	str = g_strdup (identifier);
 	object = g_object_ref (object);
-	
+
 	g_hash_table_replace (self->identifier_to_object, str, object);
 	g_hash_table_replace (self->object_to_identifier, object, str);;
-	
+
 	g_object_set (object, "store", self, NULL);
-	gck_object_expose (object, TRUE);
+	gkm_object_expose (object, TRUE);
 }
 
 static gboolean
-check_object_hash (GckUserStorage *self, const gchar *identifier, const guchar *data, gsize n_data)
+check_object_hash (GkmUserStorage *self, const gchar *identifier, const guchar *data, gsize n_data)
 {
 	gconstpointer value;
-	GckDataResult res;
+	GkmDataResult res;
 	gboolean result;
 	gsize n_value;
 	gchar *digest;
-	
-	g_assert (GCK_IS_USER_STORAGE (self));
+
+	g_assert (GKM_IS_USER_STORAGE (self));
 	g_assert (identifier);
 	g_assert (data);
-	
+
 	digest = g_compute_checksum_for_data (G_CHECKSUM_SHA1, data, n_data);
 	g_return_val_if_fail (digest, FALSE);
-	
-	res = gck_data_file_read_value (self->file, identifier, CKA_GNOME_INTERNAL_SHA1, &value, &n_value);
-	g_return_val_if_fail (res == GCK_DATA_SUCCESS, FALSE);
-	
+
+	res = gkm_data_file_read_value (self->file, identifier, CKA_GNOME_INTERNAL_SHA1, &value, &n_value);
+	g_return_val_if_fail (res == GKM_DATA_SUCCESS, FALSE);
+
 	result = (strlen (digest) == n_value && memcmp (digest, value, n_value) == 0);
 	g_free (digest);
-	
+
 	return result;
 }
 
 static void
-store_object_hash (GckUserStorage *self, GckTransaction *transaction, const gchar *identifier, 
+store_object_hash (GkmUserStorage *self, GkmTransaction *transaction, const gchar *identifier,
                    const guchar *data, gsize n_data)
 {
-	GckDataResult res;
+	GkmDataResult res;
 	gchar *digest;
-	
-	g_assert (GCK_IS_USER_STORAGE (self));
-	g_assert (GCK_IS_TRANSACTION (transaction));
+
+	g_assert (GKM_IS_USER_STORAGE (self));
+	g_assert (GKM_IS_TRANSACTION (transaction));
 	g_assert (identifier);
 	g_assert (data);
-	
+
 	digest = g_compute_checksum_for_data (G_CHECKSUM_SHA1, data, n_data);
 	if (digest == NULL) {
-		gck_transaction_fail (transaction, CKR_GENERAL_ERROR);
+		gkm_transaction_fail (transaction, CKR_GENERAL_ERROR);
 		g_return_if_reached ();
 	}
-	
-	res = gck_data_file_write_value (self->file, identifier, CKA_GNOME_INTERNAL_SHA1, digest, strlen (digest));
+
+	res = gkm_data_file_write_value (self->file, identifier, CKA_GNOME_INTERNAL_SHA1, digest, strlen (digest));
 	g_free (digest);
-	
-	if (res != GCK_DATA_SUCCESS)
-		gck_transaction_fail (transaction, CKR_GENERAL_ERROR);
+
+	if (res != GKM_DATA_SUCCESS)
+		gkm_transaction_fail (transaction, CKR_GENERAL_ERROR);
 }
 
-static void 
-data_file_entry_added (GckDataFile *store, const gchar *identifier, GckUserStorage *self)
+static void
+data_file_entry_added (GkmDataFile *store, const gchar *identifier, GkmUserStorage *self)
 {
 	GError *error = NULL;
-	GckObject *object;
+	GkmObject *object;
 	gboolean ret;
 	guchar *data;
 	gsize n_data;
 	GType type;
 	gchar *path;
 
-	g_return_if_fail (GCK_IS_USER_STORAGE (self));
+	g_return_if_fail (GKM_IS_USER_STORAGE (self));
 	g_return_if_fail (identifier);
 
 	/* Already have this object? */
@@ -523,62 +523,62 @@ data_file_entry_added (GckDataFile *store, const gchar *identifier, GckUserStora
 		g_warning ("don't know how to load file in user store: %s", identifier);
 		return;
 	}
-	
+
 	/* Read the file in */
 	path = g_build_filename (self->directory, identifier, NULL);
 	ret = g_file_get_contents (path, (gchar**)&data, &n_data, &error);
 	g_free (path);
-	
+
 	if (ret == FALSE) {
-		g_warning ("couldn't read file in user store: %s: %s", identifier, 
+		g_warning ("couldn't read file in user store: %s: %s", identifier,
 		           egg_error_message (error));
 		g_clear_error (&error);
 		return;
 	}
-	
+
 	/* Make sure that the object wasn't tampered with */
 	if (!check_object_hash (self, identifier, data, n_data)) {
 		g_message ("file in user store doesn't match hash: %s", identifier);
 		return;
 	}
-	
+
 	/* Create a new object for this identifier */
 	object = g_object_new (type, "unique", identifier, "module", self->module,
-	                       "manager", gck_module_get_manager (self->module), NULL);
-	g_return_if_fail (GCK_IS_SERIALIZABLE (object));
-	g_return_if_fail (GCK_SERIALIZABLE_GET_INTERFACE (object)->extension);
+	                       "manager", gkm_module_get_manager (self->module), NULL);
+	g_return_if_fail (GKM_IS_SERIALIZABLE (object));
+	g_return_if_fail (GKM_SERIALIZABLE_GET_INTERFACE (object)->extension);
 
 	/* And load the data into it */
-	if (gck_serializable_load (GCK_SERIALIZABLE (object), self->login, data, n_data)) 
+	if (gkm_serializable_load (GKM_SERIALIZABLE (object), self->login, data, n_data))
 		take_object_ownership (self, identifier, object);
-	else 
+	else
 		g_message ("failed to load file in user store: %s", identifier);
-	
+
 	g_free (data);
 	g_object_unref (object);
 }
 
-static void 
-data_file_entry_changed (GckDataFile *store, const gchar *identifier, CK_ATTRIBUTE_TYPE type, GckUserStorage *self)
+static void
+data_file_entry_changed (GkmDataFile *store, const gchar *identifier, CK_ATTRIBUTE_TYPE type, GkmUserStorage *self)
 {
-	GckObject *object;
-	
-	g_return_if_fail (GCK_IS_USER_STORAGE (self));
+	GkmObject *object;
+
+	g_return_if_fail (GKM_IS_USER_STORAGE (self));
 	g_return_if_fail (identifier);
-	
+
 	object = g_hash_table_lookup (self->identifier_to_object, identifier);
 	if (object != NULL)
-		gck_object_notify_attribute (object, type);
+		gkm_object_notify_attribute (object, type);
 }
 
-static void 
-data_file_entry_removed (GckDataFile *store, const gchar *identifier, GckUserStorage *self)
+static void
+data_file_entry_removed (GkmDataFile *store, const gchar *identifier, GkmUserStorage *self)
 {
-	GckObject *object;
-		
-	g_return_if_fail (GCK_IS_USER_STORAGE (self));
+	GkmObject *object;
+
+	g_return_if_fail (GKM_IS_USER_STORAGE (self));
 	g_return_if_fail (identifier);
-	
+
 	object = g_hash_table_lookup (self->identifier_to_object, identifier);
 	if (object != NULL) {
 		g_object_set (object, "store", NULL, NULL);
@@ -590,112 +590,112 @@ data_file_entry_removed (GckDataFile *store, const gchar *identifier, GckUserSto
 }
 
 static void
-relock_object (GckUserStorage *self, GckTransaction *transaction, const gchar *path, 
-               const gchar *identifier, GckSecret *old_login, GckSecret *new_login)
+relock_object (GkmUserStorage *self, GkmTransaction *transaction, const gchar *path,
+               const gchar *identifier, GkmSecret *old_login, GkmSecret *new_login)
 {
 	GError *error = NULL;
-	GckObject *object;
+	GkmObject *object;
 	guchar *data;
 	gsize n_data;
 	GType type;
-	
-	g_assert (GCK_IS_USER_STORAGE (self));
-	g_assert (GCK_IS_TRANSACTION (transaction));
+
+	g_assert (GKM_IS_USER_STORAGE (self));
+	g_assert (GKM_IS_TRANSACTION (transaction));
 	g_assert (identifier);
 	g_assert (path);
-	
-	g_assert (!gck_transaction_get_failed (transaction));
+
+	g_assert (!gkm_transaction_get_failed (transaction));
 
 	/* Figure out the type of object */
 	type = type_from_identifier (identifier);
 	if (type == 0) {
 		g_warning ("don't know how to relock file in user store: %s", identifier);
-		gck_transaction_fail (transaction, CKR_GENERAL_ERROR);
+		gkm_transaction_fail (transaction, CKR_GENERAL_ERROR);
 		return;
 	}
-	
+
 	/* Create a dummy object for this identifier */
 	object = g_object_new (type, "unique", identifier, "module", self->module, NULL);
-	if (!GCK_IS_SERIALIZABLE (object)) {
+	if (!GKM_IS_SERIALIZABLE (object)) {
 		g_warning ("cannot relock unserializable object for file in user store: %s", identifier);
-		gck_transaction_fail (transaction, CKR_GENERAL_ERROR);
+		gkm_transaction_fail (transaction, CKR_GENERAL_ERROR);
 		return;
 	}
-	
+
 	/* Read in the data for the object */
 	if (!g_file_get_contents (path, (gchar**)&data, &n_data, &error)) {
 		g_message ("couldn't load file in user store in order to relock: %s: %s", identifier,
 		           egg_error_message (error));
 		g_clear_error (&error);
 		g_object_unref (object);
-		gck_transaction_fail (transaction, CKR_GENERAL_ERROR);
+		gkm_transaction_fail (transaction, CKR_GENERAL_ERROR);
 		return;
 	}
-	
+
 	/* Make sure the data matches the hash */
 	if (!check_object_hash (self, identifier, data, n_data)) {
 		g_message ("file in data store doesn't match hash: %s", identifier);
-		gck_transaction_fail (transaction, CKR_GENERAL_ERROR);
+		gkm_transaction_fail (transaction, CKR_GENERAL_ERROR);
 		return;
 	}
-	
+
 	/* Load it into our temporary object */
-	if (!gck_serializable_load (GCK_SERIALIZABLE (object), old_login, data, n_data)) {
+	if (!gkm_serializable_load (GKM_SERIALIZABLE (object), old_login, data, n_data)) {
 		g_message ("unrecognized or invalid user store file: %s", identifier);
-		gck_transaction_fail (transaction, CKR_FUNCTION_FAILED);
+		gkm_transaction_fail (transaction, CKR_FUNCTION_FAILED);
 		g_free (data);
 		g_object_unref (object);
 		return;
-	} 
-	
+	}
+
 	g_free (data);
 	data = NULL;
-		
+
 	/* Read it out of our temporary object */
-	if (!gck_serializable_save (GCK_SERIALIZABLE (object), new_login, &data, &n_data)) {
+	if (!gkm_serializable_save (GKM_SERIALIZABLE (object), new_login, &data, &n_data)) {
 		g_warning ("unable to serialize data with new login: %s", identifier);
-		gck_transaction_fail (transaction, CKR_GENERAL_ERROR);
+		gkm_transaction_fail (transaction, CKR_GENERAL_ERROR);
 		g_object_unref (object);
 		g_free (data);
 		return;
 	}
-	
+
 	g_object_unref (object);
-	
+
 	/* And write it back out to the file */
-	gck_transaction_write_file (transaction, path, data, n_data);
-	
+	gkm_transaction_write_file (transaction, path, data, n_data);
+
 	/* Create and save the hash here */
-	if (!gck_transaction_get_failed (transaction))
+	if (!gkm_transaction_get_failed (transaction))
 		store_object_hash (self, transaction, identifier, data, n_data);
-	
+
 	g_free (data);
 
 }
 
 typedef struct _RelockArgs {
-	GckUserStorage *self;
-	GckTransaction *transaction;
-	GckSecret *old_login;
-	GckSecret *new_login;
+	GkmUserStorage *self;
+	GkmTransaction *transaction;
+	GkmSecret *old_login;
+	GkmSecret *new_login;
 } RelockArgs;
 
 static void
-relock_each_object (GckDataFile *file, const gchar *identifier, gpointer data)
+relock_each_object (GkmDataFile *file, const gchar *identifier, gpointer data)
 {
 	RelockArgs *args = data;
 	gchar *path;
 	guint section;
-	
-	g_assert (GCK_IS_USER_STORAGE (args->self));
-	if (gck_transaction_get_failed (args->transaction))
+
+	g_assert (GKM_IS_USER_STORAGE (args->self));
+	if (gkm_transaction_get_failed (args->transaction))
 		return;
-	
-	if (!gck_data_file_lookup_entry (file, identifier, &section))
+
+	if (!gkm_data_file_lookup_entry (file, identifier, &section))
 		g_return_if_reached ();
 
 	/* Only operate on private files */
-	if (section != GCK_DATA_FILE_SECTION_PRIVATE)
+	if (section != GKM_DATA_FILE_SECTION_PRIVATE)
 		return;
 
 	path = g_build_filename (args->self->directory, identifier, NULL);
@@ -704,15 +704,15 @@ relock_each_object (GckDataFile *file, const gchar *identifier, gpointer data)
 }
 
 static CK_RV
-refresh_with_login (GckUserStorage *self, GckSecret *login)
+refresh_with_login (GkmUserStorage *self, GkmSecret *login)
 {
-	GckDataResult res;
+	GkmDataResult res;
 	struct stat sb;
 	CK_RV rv;
 	int fd;
-	
-	g_assert (GCK_USER_STORAGE (self));
-	
+
+	g_assert (GKM_USER_STORAGE (self));
+
 	/* Open the file for reading */
 	fd = open (self->filename, O_RDONLY, 0);
 	if (fd == -1) {
@@ -724,75 +724,75 @@ refresh_with_login (GckUserStorage *self, GckSecret *login)
 	}
 
 	/* Try and update the last read time */
-	if (fstat (fd, &sb) >= 0) 
+	if (fstat (fd, &sb) >= 0)
 		self->last_mtime = sb.st_mtime;
-	
-	res = gck_data_file_read_fd (self->file, fd, login);
+
+	res = gkm_data_file_read_fd (self->file, fd, login);
 	switch (res) {
-	case GCK_DATA_FAILURE:
+	case GKM_DATA_FAILURE:
 		g_message ("failure reading from file: %s", self->filename);
 		rv = CKR_FUNCTION_FAILED;
 		break;
-	case GCK_DATA_LOCKED:
+	case GKM_DATA_LOCKED:
 		rv = CKR_USER_NOT_LOGGED_IN;
 		break;
-	case GCK_DATA_UNRECOGNIZED:
+	case GKM_DATA_UNRECOGNIZED:
 		g_message ("unrecognized or invalid user store file: %s", self->filename);
 		rv = CKR_FUNCTION_FAILED;
 		break;
-	case GCK_DATA_SUCCESS:
+	case GKM_DATA_SUCCESS:
 		rv = CKR_OK;
 		break;
 	default:
 		g_assert_not_reached ();
 		break;
 	}
-	
+
 	/* Force a reread on next write */
 	if (rv == CKR_FUNCTION_FAILED)
 		self->last_mtime = 0;
-	
+
 	close (fd);
 	return rv;
 }
 
 /* -----------------------------------------------------------------------------
- * OBJECT 
+ * OBJECT
  */
 
-static CK_RV 
-gck_user_storage_real_read_value (GckStore *base, GckObject *object, CK_ATTRIBUTE_PTR attr)
+static CK_RV
+gkm_user_storage_real_read_value (GkmStore *base, GkmObject *object, CK_ATTRIBUTE_PTR attr)
 {
-	GckUserStorage *self = GCK_USER_STORAGE (base);
+	GkmUserStorage *self = GKM_USER_STORAGE (base);
 	const gchar *identifier;
-	GckDataResult res;
+	GkmDataResult res;
 	gconstpointer value;
 	gsize n_value;
 	CK_RV rv;
-	
-	g_return_val_if_fail (GCK_IS_USER_STORAGE (self), CKR_GENERAL_ERROR);
-	g_return_val_if_fail (GCK_IS_OBJECT (object), CKR_GENERAL_ERROR);
+
+	g_return_val_if_fail (GKM_IS_USER_STORAGE (self), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (GKM_IS_OBJECT (object), CKR_GENERAL_ERROR);
 	g_return_val_if_fail (attr, CKR_GENERAL_ERROR);
 
 	identifier = g_hash_table_lookup (self->object_to_identifier, object);
 	if (!identifier)
 		return CKR_ATTRIBUTE_TYPE_INVALID;
-	
+
 	if (self->last_mtime == 0) {
-		rv = gck_user_storage_refresh (self);
+		rv = gkm_user_storage_refresh (self);
 		if (rv != CKR_OK)
 			return rv;
 	}
-	
-	res = gck_data_file_read_value (self->file, identifier, attr->type, &value, &n_value);
+
+	res = gkm_data_file_read_value (self->file, identifier, attr->type, &value, &n_value);
 	switch (res) {
-	case GCK_DATA_FAILURE:
+	case GKM_DATA_FAILURE:
 		g_return_val_if_reached (CKR_GENERAL_ERROR);
-	case GCK_DATA_UNRECOGNIZED:
+	case GKM_DATA_UNRECOGNIZED:
 		return CKR_ATTRIBUTE_TYPE_INVALID;
-	case GCK_DATA_LOCKED:
+	case GKM_DATA_LOCKED:
 		return CKR_USER_NOT_LOGGED_IN;
-	case GCK_DATA_SUCCESS:
+	case GKM_DATA_SUCCESS:
 		/* Yes, we don't fill a buffer, just return pointer */
 		attr->pValue = (CK_VOID_PTR)value;
 		attr->ulValueLen = n_value;
@@ -802,135 +802,135 @@ gck_user_storage_real_read_value (GckStore *base, GckObject *object, CK_ATTRIBUT
 	}
 }
 
-static void 
-gck_user_storage_real_write_value (GckStore *base, GckTransaction *transaction, GckObject *object, CK_ATTRIBUTE_PTR attr)
+static void
+gkm_user_storage_real_write_value (GkmStore *base, GkmTransaction *transaction, GkmObject *object, CK_ATTRIBUTE_PTR attr)
 {
-	GckUserStorage *self = GCK_USER_STORAGE (base);
+	GkmUserStorage *self = GKM_USER_STORAGE (base);
 	const gchar *identifier;
-	GckDataResult res;
+	GkmDataResult res;
 	CK_RV rv;
-	
-	g_return_if_fail (GCK_IS_USER_STORAGE (self));
-	g_return_if_fail (GCK_IS_OBJECT (object));
-	g_return_if_fail (GCK_IS_TRANSACTION (transaction));
-	g_return_if_fail (!gck_transaction_get_failed (transaction));
+
+	g_return_if_fail (GKM_IS_USER_STORAGE (self));
+	g_return_if_fail (GKM_IS_OBJECT (object));
+	g_return_if_fail (GKM_IS_TRANSACTION (transaction));
+	g_return_if_fail (!gkm_transaction_get_failed (transaction));
 	g_return_if_fail (attr);
 
 	identifier = g_hash_table_lookup (self->object_to_identifier, object);
 	if (!identifier) {
-		gck_transaction_fail (transaction, CKR_ATTRIBUTE_READ_ONLY);
+		gkm_transaction_fail (transaction, CKR_ATTRIBUTE_READ_ONLY);
 		return;
 	}
-	
+
 	if (self->last_mtime == 0) {
-		rv = gck_user_storage_refresh (self);
+		rv = gkm_user_storage_refresh (self);
 		if (rv != CKR_OK) {
-			gck_transaction_fail (transaction, rv);
+			gkm_transaction_fail (transaction, rv);
 			return;
 		}
 	}
 
-	res = gck_data_file_write_value (self->file, identifier, attr->type, attr->pValue, attr->ulValueLen);
+	res = gkm_data_file_write_value (self->file, identifier, attr->type, attr->pValue, attr->ulValueLen);
 	switch (res) {
-	case GCK_DATA_FAILURE:
+	case GKM_DATA_FAILURE:
 		rv = CKR_FUNCTION_FAILED;
 		break;
-	case GCK_DATA_UNRECOGNIZED:
+	case GKM_DATA_UNRECOGNIZED:
 		rv = CKR_ATTRIBUTE_READ_ONLY;
 		break;
-	case GCK_DATA_LOCKED:
+	case GKM_DATA_LOCKED:
 		rv = CKR_USER_NOT_LOGGED_IN;
 		break;
-	case GCK_DATA_SUCCESS:
+	case GKM_DATA_SUCCESS:
 		rv = CKR_OK;
 		break;
 	default:
 		g_assert_not_reached ();
-	}	
+	}
 
 	if (rv != CKR_OK)
-		gck_transaction_fail (transaction, rv);
+		gkm_transaction_fail (transaction, rv);
 }
 
-static GObject* 
-gck_user_storage_constructor (GType type, guint n_props, GObjectConstructParam *props) 
+static GObject*
+gkm_user_storage_constructor (GType type, guint n_props, GObjectConstructParam *props)
 {
-	GckUserStorage *self = GCK_USER_STORAGE (G_OBJECT_CLASS (gck_user_storage_parent_class)->constructor(type, n_props, props));
-	g_return_val_if_fail (self, NULL);	
+	GkmUserStorage *self = GKM_USER_STORAGE (G_OBJECT_CLASS (gkm_user_storage_parent_class)->constructor(type, n_props, props));
+	g_return_val_if_fail (self, NULL);
 
 	g_return_val_if_fail (self->directory, NULL);
 	self->filename = g_build_filename (self->directory, "user.keystore", NULL);
-	
+
 	g_return_val_if_fail (self->manager, NULL);
 	g_return_val_if_fail (self->module, NULL);
-	
+
 	return G_OBJECT (self);
 }
 
 static void
-gck_user_storage_init (GckUserStorage *self)
+gkm_user_storage_init (GkmUserStorage *self)
 {
-	self->file = gck_data_file_new ();
+	self->file = gkm_data_file_new ();
 	g_signal_connect (self->file, "entry-added", G_CALLBACK (data_file_entry_added), self);
 	g_signal_connect (self->file, "entry-changed", G_CALLBACK (data_file_entry_changed), self);
 	g_signal_connect (self->file, "entry-removed", G_CALLBACK (data_file_entry_removed), self);
-	
+
 	/* Each one owns the key and contains weak ref to other's key as its value */
-	self->object_to_identifier = g_hash_table_new_full (g_direct_hash, g_direct_equal, gck_util_dispose_unref, NULL);
+	self->object_to_identifier = g_hash_table_new_full (g_direct_hash, g_direct_equal, gkm_util_dispose_unref, NULL);
 	self->identifier_to_object = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
-	
+
 	self->read_fd = -1;
 	self->write_fd = -1;
 }
 
 static void
-gck_user_storage_dispose (GObject *obj)
+gkm_user_storage_dispose (GObject *obj)
 {
-	GckUserStorage *self = GCK_USER_STORAGE (obj);
-	
+	GkmUserStorage *self = GKM_USER_STORAGE (obj);
+
 	if (self->manager)
 		g_object_unref (self->manager);
 	self->manager = NULL;
-	
+
 	g_signal_handlers_disconnect_by_func (self->file, data_file_entry_added, self);
 	g_signal_handlers_disconnect_by_func (self->file, data_file_entry_changed, self);
 	g_signal_handlers_disconnect_by_func (self->file, data_file_entry_removed, self);
-	
+
 	g_hash_table_remove_all (self->object_to_identifier);
 	g_hash_table_remove_all (self->identifier_to_object);
-	
-	G_OBJECT_CLASS (gck_user_storage_parent_class)->dispose (obj);
+
+	G_OBJECT_CLASS (gkm_user_storage_parent_class)->dispose (obj);
 }
 
 static void
-gck_user_storage_finalize (GObject *obj)
+gkm_user_storage_finalize (GObject *obj)
 {
-	GckUserStorage *self = GCK_USER_STORAGE (obj);
-	
+	GkmUserStorage *self = GKM_USER_STORAGE (obj);
+
 	g_assert (self->file);
 	g_object_unref (self->file);
 	self->file = NULL;
-	
+
 	g_free (self->filename);
 	self->filename = NULL;
-	
+
 	g_assert (self->directory);
 	g_free (self->directory);
 	self->directory = NULL;
-	
+
 	g_assert (self->object_to_identifier);
 	g_hash_table_destroy (self->object_to_identifier);
 	g_hash_table_destroy (self->identifier_to_object);
 
-	G_OBJECT_CLASS (gck_user_storage_parent_class)->finalize (obj);
+	G_OBJECT_CLASS (gkm_user_storage_parent_class)->finalize (obj);
 }
 
 static void
-gck_user_storage_set_property (GObject *obj, guint prop_id, const GValue *value, 
+gkm_user_storage_set_property (GObject *obj, guint prop_id, const GValue *value,
                            GParamSpec *pspec)
 {
-	GckUserStorage *self = GCK_USER_STORAGE (obj);
-	
+	GkmUserStorage *self = GKM_USER_STORAGE (obj);
+
 	switch (prop_id) {
 	case PROP_DIRECTORY:
 		g_return_if_fail (!self->directory);
@@ -953,23 +953,23 @@ gck_user_storage_set_property (GObject *obj, guint prop_id, const GValue *value,
 }
 
 static void
-gck_user_storage_get_property (GObject *obj, guint prop_id, GValue *value, 
+gkm_user_storage_get_property (GObject *obj, guint prop_id, GValue *value,
                                GParamSpec *pspec)
 {
-	GckUserStorage *self = GCK_USER_STORAGE (obj);
-	
+	GkmUserStorage *self = GKM_USER_STORAGE (obj);
+
 	switch (prop_id) {
 	case PROP_DIRECTORY:
-		g_value_set_string (value, gck_user_storage_get_directory (self));
+		g_value_set_string (value, gkm_user_storage_get_directory (self));
 		break;
 	case PROP_MODULE:
 		g_value_set_object (value, self->module);
 		break;
 	case PROP_MANAGER:
-		g_value_set_object (value, gck_user_storage_get_manager (self));
+		g_value_set_object (value, gkm_user_storage_get_manager (self));
 		break;
 	case PROP_LOGIN:
-		g_value_set_object (value, gck_user_storage_get_login (self));
+		g_value_set_object (value, gkm_user_storage_get_login (self));
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -978,99 +978,99 @@ gck_user_storage_get_property (GObject *obj, guint prop_id, GValue *value,
 }
 
 static void
-gck_user_storage_class_init (GckUserStorageClass *klass)
+gkm_user_storage_class_init (GkmUserStorageClass *klass)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	GckStoreClass *store_class = GCK_STORE_CLASS (klass);
-    
-	gobject_class->constructor = gck_user_storage_constructor;
-	gobject_class->dispose = gck_user_storage_dispose;
-	gobject_class->finalize = gck_user_storage_finalize;
-	gobject_class->set_property = gck_user_storage_set_property;
-	gobject_class->get_property = gck_user_storage_get_property;
-	
-	store_class->read_value = gck_user_storage_real_read_value;
-	store_class->write_value = gck_user_storage_real_write_value;
-    
+	GkmStoreClass *store_class = GKM_STORE_CLASS (klass);
+
+	gobject_class->constructor = gkm_user_storage_constructor;
+	gobject_class->dispose = gkm_user_storage_dispose;
+	gobject_class->finalize = gkm_user_storage_finalize;
+	gobject_class->set_property = gkm_user_storage_set_property;
+	gobject_class->get_property = gkm_user_storage_get_property;
+
+	store_class->read_value = gkm_user_storage_real_read_value;
+	store_class->write_value = gkm_user_storage_real_write_value;
+
 	g_object_class_install_property (gobject_class, PROP_DIRECTORY,
-	           g_param_spec_string ("directory", "Storage Directory", "Directory for storage", 
+	           g_param_spec_string ("directory", "Storage Directory", "Directory for storage",
 	                                NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-    
+
 	g_object_class_install_property (gobject_class, PROP_MODULE,
-	           g_param_spec_object ("module", "Module", "Module for objects", 
-	                                GCK_TYPE_MODULE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+	           g_param_spec_object ("module", "Module", "Module for objects",
+	                                GKM_TYPE_MODULE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
 
 	g_object_class_install_property (gobject_class, PROP_MANAGER,
-	           g_param_spec_object ("manager", "Object Manager", "Object Manager", 
-	                                GCK_TYPE_MANAGER, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+	           g_param_spec_object ("manager", "Object Manager", "Object Manager",
+	                                GKM_TYPE_MANAGER, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
 
 	g_object_class_install_property (gobject_class, PROP_LOGIN,
-	           g_param_spec_object ("login", "Login", "Login used to unlock", 
-	                                GCK_TYPE_SECRET, G_PARAM_READABLE));
+	           g_param_spec_object ("login", "Login", "Login used to unlock",
+	                                GKM_TYPE_SECRET, G_PARAM_READABLE));
 }
 
 /* -----------------------------------------------------------------------------
- * PUBLIC 
+ * PUBLIC
  */
 
-GckUserStorage*
-gck_user_storage_new (GckModule *module, const gchar *directory)
+GkmUserStorage*
+gkm_user_storage_new (GkmModule *module, const gchar *directory)
 {
-	GckManager *manager;
-	
-	g_return_val_if_fail (GCK_IS_MODULE (module), NULL);
+	GkmManager *manager;
+
+	g_return_val_if_fail (GKM_IS_MODULE (module), NULL);
 	g_return_val_if_fail (directory, NULL);
 
-	manager = gck_module_get_manager (module);
-	g_return_val_if_fail (GCK_IS_MANAGER (manager), NULL);
+	manager = gkm_module_get_manager (module);
+	g_return_val_if_fail (GKM_IS_MANAGER (manager), NULL);
 
-	return g_object_new (GCK_TYPE_USER_STORAGE,
+	return g_object_new (GKM_TYPE_USER_STORAGE,
 	                     "module", module,
-	                     "manager", manager, 
-	                     "directory", directory, 
+	                     "manager", manager,
+	                     "directory", directory,
 	                     NULL);
 }
 
 CK_RV
-gck_user_storage_refresh (GckUserStorage *self)
+gkm_user_storage_refresh (GkmUserStorage *self)
 {
-	g_return_val_if_fail (GCK_USER_STORAGE (self), CKR_GENERAL_ERROR);
+	g_return_val_if_fail (GKM_USER_STORAGE (self), CKR_GENERAL_ERROR);
 	return refresh_with_login (self, self->login);
 }
 
 void
-gck_user_storage_create (GckUserStorage *self, GckTransaction *transaction, GckObject *object)
+gkm_user_storage_create (GkmUserStorage *self, GkmTransaction *transaction, GkmObject *object)
 {
 	gboolean is_private;
-	GckDataResult res;
+	GkmDataResult res;
 	gchar *identifier;
 	guchar *data;
 	gsize n_data;
 	gchar *path;
-	
-	g_return_if_fail (GCK_IS_USER_STORAGE (self));
-	g_return_if_fail (GCK_IS_TRANSACTION (transaction));
-	g_return_if_fail (!gck_transaction_get_failed (transaction));
-	g_return_if_fail (GCK_IS_OBJECT (object));
-	
+
+	g_return_if_fail (GKM_IS_USER_STORAGE (self));
+	g_return_if_fail (GKM_IS_TRANSACTION (transaction));
+	g_return_if_fail (!gkm_transaction_get_failed (transaction));
+	g_return_if_fail (GKM_IS_OBJECT (object));
+
 	/* Make sure we haven't already stored it */
 	identifier = g_hash_table_lookup (self->object_to_identifier, object);
 	g_return_if_fail (identifier == NULL);
-	
+
 	/* Double check that the object is in fact serializable */
-	if (!GCK_IS_SERIALIZABLE (object)) {
+	if (!GKM_IS_SERIALIZABLE (object)) {
 		g_warning ("can't store object of type '%s' on token", G_OBJECT_TYPE_NAME (object));
-		gck_transaction_fail (transaction, CKR_GENERAL_ERROR);
+		gkm_transaction_fail (transaction, CKR_GENERAL_ERROR);
 		g_return_if_reached ();
 	}
-	
-	/* Figure out whether this is a private object */ 
-	if (!gck_object_get_attribute_boolean (object, NULL, CKA_PRIVATE, &is_private))
+
+	/* Figure out whether this is a private object */
+	if (!gkm_object_get_attribute_boolean (object, NULL, CKA_PRIVATE, &is_private))
 		is_private = FALSE;
-	
+
 	/* Can't serialize private if we're not unlocked */
 	if (is_private && !self->login) {
-		gck_transaction_fail (transaction, CKR_USER_NOT_LOGGED_IN);
+		gkm_transaction_fail (transaction, CKR_USER_NOT_LOGGED_IN);
 		return;
 	}
 
@@ -1080,278 +1080,278 @@ gck_user_storage_create (GckUserStorage *self, GckTransaction *transaction, GckO
 
 	/* Create an identifier guaranteed unique by this transaction */
 	identifier = identifier_for_object (object);
-	if (gck_data_file_unique_entry (self->file, &identifier) != GCK_DATA_SUCCESS) {
-		gck_transaction_fail (transaction, CKR_FUNCTION_FAILED);
+	if (gkm_data_file_unique_entry (self->file, &identifier) != GKM_DATA_SUCCESS) {
+		gkm_transaction_fail (transaction, CKR_FUNCTION_FAILED);
 		g_return_if_reached ();
 	}
-	
+
 	/* We don't want to get signals about this item being added */
 	g_signal_handlers_block_by_func (self->file, data_file_entry_added, self);
 	g_signal_handlers_block_by_func (self->file, data_file_entry_changed, self);
-	
-	res = gck_data_file_create_entry (self->file, identifier, 
-	                                  is_private ? GCK_DATA_FILE_SECTION_PRIVATE : GCK_DATA_FILE_SECTION_PUBLIC);
-	
+
+	res = gkm_data_file_create_entry (self->file, identifier,
+	                                  is_private ? GKM_DATA_FILE_SECTION_PRIVATE : GKM_DATA_FILE_SECTION_PUBLIC);
+
 	g_signal_handlers_unblock_by_func (self->file, data_file_entry_added, self);
 	g_signal_handlers_unblock_by_func (self->file, data_file_entry_changed, self);
 
 	switch(res) {
-	case GCK_DATA_FAILURE:
-	case GCK_DATA_UNRECOGNIZED:
+	case GKM_DATA_FAILURE:
+	case GKM_DATA_UNRECOGNIZED:
 		g_free (identifier);
-		gck_transaction_fail (transaction, CKR_FUNCTION_FAILED);
+		gkm_transaction_fail (transaction, CKR_FUNCTION_FAILED);
 		return;
-	case GCK_DATA_LOCKED:
+	case GKM_DATA_LOCKED:
 		g_free (identifier);
-		gck_transaction_fail (transaction, CKR_USER_NOT_LOGGED_IN);
+		gkm_transaction_fail (transaction, CKR_USER_NOT_LOGGED_IN);
 		return;
-	case GCK_DATA_SUCCESS:
+	case GKM_DATA_SUCCESS:
 		break;
 	default:
 		g_assert_not_reached ();
 	}
-	
+
 	/* Serialize the object in question */
-	if (!gck_serializable_save (GCK_SERIALIZABLE (object), is_private ? self->login : NULL, &data, &n_data)) {
-		gck_transaction_fail (transaction, CKR_FUNCTION_FAILED);
+	if (!gkm_serializable_save (GKM_SERIALIZABLE (object), is_private ? self->login : NULL, &data, &n_data)) {
+		gkm_transaction_fail (transaction, CKR_FUNCTION_FAILED);
 		g_return_if_reached ();
 	}
 
 	path = g_build_filename (self->directory, identifier, NULL);
-	gck_transaction_write_file (transaction, path, data, n_data);
-	
+	gkm_transaction_write_file (transaction, path, data, n_data);
+
 	/* Make sure we write in the object hash */
-	if (!gck_transaction_get_failed (transaction))
+	if (!gkm_transaction_get_failed (transaction))
 		store_object_hash (self, transaction, identifier, data, n_data);
 
 	/* Now we decide to own the object */
-	if (!gck_transaction_get_failed (transaction))
+	if (!gkm_transaction_get_failed (transaction))
 		take_object_ownership (self, identifier, object);
-	
+
 	g_free (identifier);
 	g_free (path);
 	g_free (data);
 }
 
 void
-gck_user_storage_destroy (GckUserStorage *self, GckTransaction *transaction, GckObject *object)
+gkm_user_storage_destroy (GkmUserStorage *self, GkmTransaction *transaction, GkmObject *object)
 {
-	GckDataResult res;
+	GkmDataResult res;
 	gchar *identifier;
 	gchar *path;
-	
-	g_return_if_fail (GCK_IS_USER_STORAGE (self));
-	g_return_if_fail (GCK_IS_TRANSACTION (transaction));
-	g_return_if_fail (!gck_transaction_get_failed (transaction));
+
+	g_return_if_fail (GKM_IS_USER_STORAGE (self));
+	g_return_if_fail (GKM_IS_TRANSACTION (transaction));
+	g_return_if_fail (!gkm_transaction_get_failed (transaction));
 	g_return_if_fail (object);
-	
+
 	/* Lookup the object identifier */
 	identifier = g_hash_table_lookup (self->object_to_identifier, object);
 	g_return_if_fail (identifier);
-	
+
 	if (!begin_modification_state (self, transaction))
 		return;
 
 	/* First actually delete the file */
 	path = g_build_filename (self->directory, identifier, NULL);
-	gck_transaction_remove_file (transaction, path);
+	gkm_transaction_remove_file (transaction, path);
 	g_free (path);
-	
-	if (gck_transaction_get_failed (transaction))
+
+	if (gkm_transaction_get_failed (transaction))
 		return;
 
 	/* Now delete the entry from our store */
-	res = gck_data_file_destroy_entry (self->file, identifier);
+	res = gkm_data_file_destroy_entry (self->file, identifier);
 	switch(res) {
-	case GCK_DATA_FAILURE:
-	case GCK_DATA_UNRECOGNIZED:
-		gck_transaction_fail (transaction, CKR_FUNCTION_FAILED);
+	case GKM_DATA_FAILURE:
+	case GKM_DATA_UNRECOGNIZED:
+		gkm_transaction_fail (transaction, CKR_FUNCTION_FAILED);
 		return;
-	case GCK_DATA_LOCKED:
-		gck_transaction_fail (transaction, CKR_USER_NOT_LOGGED_IN);
+	case GKM_DATA_LOCKED:
+		gkm_transaction_fail (transaction, CKR_USER_NOT_LOGGED_IN);
 		return;
-	case GCK_DATA_SUCCESS:
+	case GKM_DATA_SUCCESS:
 		break;
 	default:
 		g_assert_not_reached ();
 	}
-	
+
 	/* Actual removal of object happened as a callback above */
 	g_return_if_fail (g_hash_table_lookup (self->object_to_identifier, object) == NULL);
 }
 
 void
-gck_user_storage_relock (GckUserStorage *self, GckTransaction *transaction, 
-                         GckSecret *old_login, GckSecret *new_login)
+gkm_user_storage_relock (GkmUserStorage *self, GkmTransaction *transaction,
+                         GkmSecret *old_login, GkmSecret *new_login)
 {
-	GckDataFile *file;
-	GckDataResult res;
+	GkmDataFile *file;
+	GkmDataResult res;
 	RelockArgs args;
-	
-	g_return_if_fail (GCK_IS_USER_STORAGE (self));
-	g_return_if_fail (GCK_IS_TRANSACTION (transaction));
-	
+
+	g_return_if_fail (GKM_IS_USER_STORAGE (self));
+	g_return_if_fail (GKM_IS_TRANSACTION (transaction));
+
 	/* Reload the file with the old password and start transaction */
 	if (!begin_write_state (self, transaction))
 		return;
-	
-	file = gck_data_file_new ();
-	
+
+	file = gkm_data_file_new ();
+
 	/* Read in from the old file */
-	res = gck_data_file_read_fd (file, self->read_fd, old_login);
+	res = gkm_data_file_read_fd (file, self->read_fd, old_login);
 	switch(res) {
-	case GCK_DATA_FAILURE:
-	case GCK_DATA_UNRECOGNIZED:
-		gck_transaction_fail (transaction, CKR_FUNCTION_FAILED);
+	case GKM_DATA_FAILURE:
+	case GKM_DATA_UNRECOGNIZED:
+		gkm_transaction_fail (transaction, CKR_FUNCTION_FAILED);
 		return;
-	case GCK_DATA_LOCKED:
-		gck_transaction_fail (transaction, CKR_PIN_INCORRECT);
+	case GKM_DATA_LOCKED:
+		gkm_transaction_fail (transaction, CKR_PIN_INCORRECT);
 		return;
-	case GCK_DATA_SUCCESS:
+	case GKM_DATA_SUCCESS:
 		break;
 	default:
 		g_assert_not_reached ();
 	}
-	
+
 	/* Write out to new path as new file */
-	res = gck_data_file_write_fd (file, self->write_fd, new_login);
+	res = gkm_data_file_write_fd (file, self->write_fd, new_login);
 	switch(res) {
-	case GCK_DATA_FAILURE:
-	case GCK_DATA_UNRECOGNIZED:
-		gck_transaction_fail (transaction, CKR_FUNCTION_FAILED);
+	case GKM_DATA_FAILURE:
+	case GKM_DATA_UNRECOGNIZED:
+		gkm_transaction_fail (transaction, CKR_FUNCTION_FAILED);
 		return;
-	case GCK_DATA_LOCKED:
-		gck_transaction_fail (transaction, CKR_PIN_INVALID);
+	case GKM_DATA_LOCKED:
+		gkm_transaction_fail (transaction, CKR_PIN_INVALID);
 		return;
-	case GCK_DATA_SUCCESS:
+	case GKM_DATA_SUCCESS:
 		break;
 	default:
 		g_assert_not_reached ();
 	}
-	
+
 	/* Now go through all objects in the file, and load and reencode them */
 	args.transaction = transaction;
 	args.old_login = old_login;
 	args.new_login = new_login;
-	gck_data_file_foreach_entry (file, relock_each_object, &args);
-	
-	if (!gck_transaction_get_failed (transaction) && self->login) {
+	gkm_data_file_foreach_entry (file, relock_each_object, &args);
+
+	if (!gkm_transaction_get_failed (transaction) && self->login) {
 		if (new_login)
 			g_object_ref (new_login);
 		g_object_unref (self->login);
 		self->login = new_login;
 		g_object_notify (G_OBJECT (self), "login");
 	}
-	
+
 	g_object_unref (file);
 }
 
 CK_RV
-gck_user_storage_unlock (GckUserStorage *self, GckSecret *login)
+gkm_user_storage_unlock (GkmUserStorage *self, GkmSecret *login)
 {
 	CK_RV rv;
-	
-	g_return_val_if_fail (GCK_IS_USER_STORAGE (self), CKR_GENERAL_ERROR);
+
+	g_return_val_if_fail (GKM_IS_USER_STORAGE (self), CKR_GENERAL_ERROR);
 	g_return_val_if_fail (!self->transaction, CKR_GENERAL_ERROR);
-	
+
 	if (self->login)
 		return CKR_USER_ALREADY_LOGGED_IN;
-	
+
 	self->login = login;
-	
+
 	rv = refresh_with_login (self, login);
 	if (rv == CKR_USER_NOT_LOGGED_IN)
 		rv = CKR_PIN_INCORRECT;
-	
+
 	/* Take on new login for good */
 	if (rv == CKR_OK) {
 		g_assert (self->login == login);
 		if (self->login)
 			g_object_ref (self->login);
 		g_object_notify (G_OBJECT (self), "login");
-		
+
 	/* Failed, so keep our previous NULL login */
 	} else {
 		self->login = NULL;
 	}
-	
+
 	return rv;
 }
 
 CK_RV
-gck_user_storage_lock (GckUserStorage *self)
+gkm_user_storage_lock (GkmUserStorage *self)
 {
-	GckSecret *prev;
+	GkmSecret *prev;
 	CK_RV rv;
-	
-	g_return_val_if_fail (GCK_IS_USER_STORAGE (self), CKR_GENERAL_ERROR);
+
+	g_return_val_if_fail (GKM_IS_USER_STORAGE (self), CKR_GENERAL_ERROR);
 	g_return_val_if_fail (!self->transaction, CKR_GENERAL_ERROR);
-	
+
 	if (!self->login)
 		return CKR_USER_NOT_LOGGED_IN;
-	
+
 	/* While loading set new NULL login */
 	prev = self->login;
 	self->login = NULL;
-	
+
 	rv = refresh_with_login (self, NULL);
-	
+
 	/* Take on new login for good */
 	if (rv == CKR_OK) {
 		g_object_unref (prev);
 		g_assert (self->login == NULL);
 		g_object_notify (G_OBJECT (self), "login");
-		
+
 	/* Failed so revert to previous login */
 	} else {
 		self->login = prev;
 	}
-	
+
 	return rv;
 }
 
-GckManager*
-gck_user_storage_get_manager (GckUserStorage *self)
+GkmManager*
+gkm_user_storage_get_manager (GkmUserStorage *self)
 {
-	g_return_val_if_fail (GCK_IS_USER_STORAGE (self), NULL);
+	g_return_val_if_fail (GKM_IS_USER_STORAGE (self), NULL);
 	return self->manager;
 }
 
 const gchar*
-gck_user_storage_get_directory (GckUserStorage *self)
+gkm_user_storage_get_directory (GkmUserStorage *self)
 {
-	g_return_val_if_fail (GCK_IS_USER_STORAGE (self), NULL);
+	g_return_val_if_fail (GKM_IS_USER_STORAGE (self), NULL);
 	return self->directory;
 }
 
-GckSecret*
-gck_user_storage_get_login (GckUserStorage *self)
+GkmSecret*
+gkm_user_storage_get_login (GkmUserStorage *self)
 {
-	g_return_val_if_fail (GCK_IS_USER_STORAGE (self), NULL);
+	g_return_val_if_fail (GKM_IS_USER_STORAGE (self), NULL);
 	return self->login;
 }
 
 gulong
-gck_user_storage_token_flags (GckUserStorage *self)
+gkm_user_storage_token_flags (GkmUserStorage *self)
 {
 	gulong flags = 0;
 	CK_RV rv;
-	
+
 	/* We don't changing SO logins, so always initialized */
 	flags |= CKF_TOKEN_INITIALIZED | CKF_LOGIN_REQUIRED;
-	
+
 	/* No file has been loaded yet? */
 	if (self->last_mtime == 0) {
-		rv = gck_user_storage_refresh (self);
+		rv = gkm_user_storage_refresh (self);
 		if (rv == CKR_USER_PIN_NOT_INITIALIZED)
 			flags |= CKF_USER_PIN_TO_BE_CHANGED;
 		else if (rv != CKR_OK)
 			g_return_val_if_reached (flags);
 	}
-	
+
 	/* No private stuff in the file? */
-	if (gck_data_file_have_section (self->file, GCK_DATA_FILE_SECTION_PRIVATE))
+	if (gkm_data_file_have_section (self->file, GKM_DATA_FILE_SECTION_PRIVATE))
 		flags |= CKF_USER_PIN_INITIALIZED;
-	
+
 	return flags;
 }
diff --git a/pkcs11/user-store/gkm-user-storage.h b/pkcs11/user-store/gkm-user-storage.h
new file mode 100644
index 0000000..3c9fa6d
--- /dev/null
+++ b/pkcs11/user-store/gkm-user-storage.h
@@ -0,0 +1,79 @@
+/*
+ * 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 __GKM_USER_STORAGE_H__
+#define __GKM_USER_STORAGE_H__
+
+#include <glib-object.h>
+
+#include "gkm/gkm-manager.h"
+#include "gkm/gkm-secret.h"
+#include "gkm/gkm-store.h"
+#include "gkm/gkm-transaction.h"
+
+#define GKM_TYPE_USER_STORAGE               (gkm_user_storage_get_type ())
+#define GKM_USER_STORAGE(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_USER_STORAGE, GkmUserStorage))
+#define GKM_USER_STORAGE_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_USER_STORAGE, GkmUserStorageClass))
+#define GKM_IS_USER_STORAGE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_USER_STORAGE))
+#define GKM_IS_USER_STORAGE_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_USER_STORAGE))
+#define GKM_USER_STORAGE_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_USER_STORAGE, GkmUserStorageClass))
+
+typedef struct _GkmUserStorage GkmUserStorage;
+typedef struct _GkmUserStorageClass GkmUserStorageClass;
+
+struct _GkmUserStorageClass {
+	GkmStoreClass parent_class;
+};
+
+GType                       gkm_user_storage_get_type               (void);
+
+GkmUserStorage*             gkm_user_storage_new                    (GkmModule *module,
+                                                                     const gchar *directory);
+
+GkmManager*                 gkm_user_storage_get_manager            (GkmUserStorage *self);
+
+const gchar*                gkm_user_storage_get_directory          (GkmUserStorage *self);
+
+GkmSecret*                  gkm_user_storage_get_login              (GkmUserStorage *self);
+
+gulong                      gkm_user_storage_token_flags            (GkmUserStorage *self);
+
+CK_RV                       gkm_user_storage_refresh                (GkmUserStorage *self);
+
+void                        gkm_user_storage_create                 (GkmUserStorage *self,
+                                                                     GkmTransaction *transaction,
+                                                                     GkmObject *object);
+
+void                        gkm_user_storage_destroy                (GkmUserStorage *self,
+                                                                     GkmTransaction *transaction,
+                                                                     GkmObject *object);
+
+void                        gkm_user_storage_relock                 (GkmUserStorage *self,
+                                                                     GkmTransaction *transaction,
+                                                                     GkmSecret *old_login,
+                                                                     GkmSecret *new_login);
+
+CK_RV                       gkm_user_storage_unlock                 (GkmUserStorage *self,
+                                                                     GkmSecret *login);
+
+CK_RV                       gkm_user_storage_lock                   (GkmUserStorage *self);
+
+#endif /* __GKM_USER_STORAGE_H__ */
diff --git a/pkcs11/roots-store/gck-roots-store.h b/pkcs11/user-store/gkm-user-store.h
similarity index 79%
rename from pkcs11/roots-store/gck-roots-store.h
rename to pkcs11/user-store/gkm-user-store.h
index f49d796..6e94fa7 100644
--- a/pkcs11/roots-store/gck-roots-store.h
+++ b/pkcs11/user-store/gkm-user-store.h
@@ -1,29 +1,29 @@
-/* 
+/*
  * 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.
  */
 
-#ifndef __GCK_ROOTS_STORE_H__
-#define __GCK_ROOTS_STORE_H__
+#ifndef __GKM_USER_STORE_H__
+#define __GKM_USER_STORE_H__
 
 #include "pkcs11/pkcs11.h"
 
-CK_FUNCTION_LIST_PTR  gck_roots_store_get_functions  (void);
+CK_FUNCTION_LIST_PTR  gkm_user_store_get_functions  (void);
 
-#endif /* __GCK_ROOTS_STORE_H__ */
+#endif /* __GKM_USER_STORE_H__ */
diff --git a/pkcs11/user-store/tests/Makefile.am b/pkcs11/user-store/tests/Makefile.am
index 1774443..4420bf4 100644
--- a/pkcs11/user-store/tests/Makefile.am
+++ b/pkcs11/user-store/tests/Makefile.am
@@ -5,8 +5,8 @@ UNIT_AUTO = \
 UNIT_PROMPT =
 
 UNIT_LIBS = \
-	$(top_builddir)/pkcs11/user-store/libgck-user-store.la \
-	$(top_builddir)/pkcs11/gck/libgck.la \
+	$(top_builddir)/pkcs11/user-store/libgkm-user-store.la \
+	$(top_builddir)/pkcs11/gkm/libgkm.la \
 	$(top_builddir)/egg/libegg.la
 
 include $(top_srcdir)/tests/gtest.make
diff --git a/pkcs11/user-store/tests/p11-tests.conf b/pkcs11/user-store/tests/p11-tests.conf
index f81687e..fda5f0d 100644
--- a/pkcs11/user-store/tests/p11-tests.conf
+++ b/pkcs11/user-store/tests/p11-tests.conf
@@ -1,2 +1,2 @@
-# Configuration for running p11-tests on this module 
-init-string = directory='test-data' 
+# Configuration for running p11-tests on this module
+init-string = directory='test-data'
diff --git a/pkcs11/user-store/tests/test-module.c b/pkcs11/user-store/tests/test-module.c
index d1dfb4e..ab3562b 100644
--- a/pkcs11/user-store/tests/test-module.c
+++ b/pkcs11/user-store/tests/test-module.c
@@ -23,12 +23,12 @@
 
 #include "config.h"
 
-#include "user-store/gck-user-store.h"
+#include "user-store/gkm-user-store.h"
 
 #include "run-auto-test.h"
 
 DEFINE_EXTERNAL(user_module)
 {
-	CK_FUNCTION_LIST_PTR funcs = gck_user_store_get_functions ();
+	CK_FUNCTION_LIST_PTR funcs = gkm_user_store_get_functions ();
 	test_p11_module (funcs, "p11-tests.conf");
 }
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 40a857f..b215205 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -23,6 +23,6 @@ gcr/gcr-certificate-details-widget.c
 gcr/gcr-importer.c
 gcr/gcr-parser.c
 gp11/gp11-misc.c
-pkcs11/gck/gck-certificate.c
-pkcs11/ssh-store/gck-ssh-private-key.c
-pkcs11/secret-store/gck-secret-collection.c
+pkcs11/gkm/gkm-certificate.c
+pkcs11/ssh-store/gkm-ssh-private-key.c
+pkcs11/secret-store/gkm-secret-collection.c



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]