seahorse r2274 - in trunk: . pkcs11



Author: nnielsen
Date: Wed Jul 16 17:28:01 2008
New Revision: 2274
URL: http://svn.gnome.org/viewvc/seahorse?rev=2274&view=rev

Log:
	* pkcs11/*:
	* Makefile.am:
	* configure.in: Initial infrastructure for PKCS11 component. 


Added:
   trunk/pkcs11/
   trunk/pkcs11/Makefile.am
   trunk/pkcs11/gp11.vapi
   trunk/pkcs11/seahorse-pkcs11-module.c
   trunk/pkcs11/seahorse-pkcs11-module.h
   trunk/pkcs11/seahorse-pkcs11.c
   trunk/pkcs11/seahorse-pkcs11.h
   trunk/pkcs11/seahorse-pkcs11.vala
   trunk/pkcs11/vala-build.stamp
Modified:
   trunk/ChangeLog
   trunk/Makefile.am

Modified: trunk/Makefile.am
==============================================================================
--- trunk/Makefile.am	(original)
+++ trunk/Makefile.am	Wed Jul 16 17:28:01 2008
@@ -2,6 +2,12 @@
 
 ACLOCAL_AMFLAGS = -I m4
 
+if WITH_PKCS11
+PKCS11_DIR = pkcs11
+else
+PKCS11_DIR = 
+endif
+
 if WITH_SSH
 SSH_DIR = ssh
 else
@@ -19,6 +25,7 @@
 	common \
 	libseahorse \
 	gkr \
+	$(PKCS11_DIR) \
 	$(PGP_DIR) \
 	$(SSH_DIR) \
 	src \

Added: trunk/pkcs11/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/pkcs11/Makefile.am	Wed Jul 16 17:28:01 2008
@@ -0,0 +1,58 @@
+
+gladedir = $(datadir)/seahorse/glade/
+localedir = $(datadir)/locale
+seahorselibexecbindir = $(libdir)/seahorse/
+
+INCLUDES = -I$(top_builddir) \
+	-I$(top_srcdir) \
+	-I$(top_srcdir)/libcryptui \
+	-I$(top_srcdir)/libseahorse \
+	$(SEAHORSE_CFLAGS) \
+	-DDATA_DIR=\""$(datadir)"\" \
+	-DSEAHORSE_GLADEDIR=\""$(gladedir)"\" \
+	-DLOCALEDIR=\"$(localedir)\" \
+	-DEXECDIR=\""$(seahorselibexecbindir)"\" \
+	-DLIBCRYPTUI_API_SUBJECT_TO_CHANGE \
+	-DGETTEXT_PACKAGE=\""seahorse\""
+
+VALA_SRCS = \
+	seahorse-pkcs11.vala
+	
+VALA_VAPIS = \
+	$(top_srcdir)/config.vapi \
+	$(top_srcdir)/libseahorse/libseahorse-c.vapi \
+	$(top_srcdir)/libseahorse/libseahorse.vapi
+
+VALA_CFILES = $(VALA_SRCS:.vala=.c)
+VALA_HFILES = $(VALA_SRCS:.vala=.h)
+
+SUFFIXES = .vala .c .h
+
+vala-build.stamp: $(VALA_SRCS) $(VALA_VAPIS)
+	$(VALAC) -C $(VALA_PKGS) $(VALA_VAPIS) $(VALA_SRCS)
+	date +'%s' > $@
+
+BUILT_SOURCES = \
+	vala-build.stamp
+	
+noinst_LTLIBRARIES = libseahorse-pkcs11.la
+
+libseahorse_pkcs11_la_SOURCES = \
+	seahorse-pkcs11-module.c seahorse-pkcs11-module.h \
+	$(VALA_CFILES) $(VALA_HFILES)
+
+libseahorse_pkcs11_la_LIBADD = \
+	$(top_builddir)/libseahorse/libseahorse.la \
+	$(top_builddir)/libcryptui/libcryptui.la
+
+glade_DATA = 
+
+EXTRA_DIST = \
+	$(glade_DATA) \
+	vala-build.stamp \
+	$(VALA_CFILES) $(VALA_HFILES) \
+	$(VALA_SRCS)
+
+vala-clean:
+	rm -f vala-build.stamp $(VALA_CFILES) $(VALA_HFILES)
+

Added: trunk/pkcs11/gp11.vapi
==============================================================================
--- (empty file)
+++ trunk/pkcs11/gp11.vapi	Wed Jul 16 17:28:01 2008
@@ -0,0 +1,178 @@
+/* 
+ * These bindings will move into gnome-keyring once vala is more accepted in 
+ * the desktop.
+ */ 
+[CCode (cheader_filename = "gp11.h", cprefix = "GP11", lower_case_cprefix = "gp11_")]
+namespace GP11 {
+
+	public weak string message_from_rv (uint rv);
+	
+	[CCode (dup_function = "gp11_attribute_dup", free_function = "gp11_attribute_free")]
+	public class Attribute {
+		public Attribute.new_boolean (uint attr_type, bool val);
+		public Attribute.new_date (uint attr_type, GLib.Date date);
+		public Attribute.new_ulong (uint attr_type, ulong val);
+		public Attribute.new_string (uint attr_type, string val);
+		public uint type { get; }
+		public bool get_boolean();
+		public ulong get_ulong();
+		public string get_string();
+		public void get_data(out void* data, out ulong length);
+	}
+
+	[CCode (ref_function = "gp11_attributes_ref", unref_function = "gp11_attributes_unref")]
+	public class Attributes {
+		public Attribute (void);
+		public bool immutable { get; }
+		public uint count { get; }
+		public Attribute at(uint index);
+		public void add(Attribute attr);
+		public void add_data(uint attr_type, void* data, gulong length);
+		public void add_boolean(uint attr_type, bool val);
+		public void add_date (uint attr_type, GLib.Date date);
+		public void add_ulong (uint attr_type, ulong val);
+		public void add_string (uint attr_type, string val);
+		public Attribute? find(uint attr_type);
+		public bool find_boolean(uint attr_type, out bool val);
+		public bool find_ulong(uint attr_type, out ulong val);
+		public bool find_string(uint attr_type, out string val);
+		public bool find_date(uint attr_type, out GLib.Date date);
+	}	
+
+	[CCode (dup_function = "gp11_module_info_dup", free_function = "gp11_module_info_free")]
+	public class ModuleInfo {
+		public uint pkcs11_version_major;
+		public uint pkcs11_version_minor;
+		public string manufacturer_id;
+		public uint flags;
+		public string library_description;
+		public uint library_version_major;
+		public uint library_version_minor;
+	}
+
+	public class Module : Glib.Object {
+		public static Module initialize(string path) throws GLib.Error;
+
+		public ModuleInfo info { get; }
+		public GLib.List<Slot> get_slots();
+	}
+
+	[CCode (dup_function = "gp11_slot_info_dup", free_function = "gp11_slot_info_free")]
+	public class SlotInfo {
+		public string slot_description;
+		public string manufacturer_id;
+		public uint flags;
+		public uint hardware_version_major;
+		public uint hardware_version_minor;
+		public uint firmware_version_major;
+		public uint firmware_version_minor;
+	}
+
+	[CCode (dup_function = "gp11_token_info_dup", free_function = "gp11_token_info_free")]
+	public class TokenInfo {
+		public string label;
+		public string manufacturer_id;
+		public string model;
+		public string serial_number;
+		public uint flags;
+		public ulong max_session_count;
+		public ulong session_count;
+		public ulong max_rw_session_count;
+		public ulong max_pin_len;
+		public ulong min_pin_len;
+		public ulong total_public_memory;
+		public ulong free_public_memory;
+		public ulong total_private_memory;
+		public ulong free_private_memory;
+		public uint hardware_version_major;
+		public uint hardware_version_minor;
+		public uint firmware_version_major;
+		public uint firmware_version_minor;
+		public uint64 utc_time;
+	}
+
+	public class Slot : Glib.Object {
+		public weak Module module { get; }
+		public uint handle { get; }
+		public SlotInfo info { get; }
+		public TokenInfo token_info { get; }
+
+		public GLib.List<uint> get_mechanisms();
+		public MechanismInfo get_mechanism_info();
+		
+		[CCode (cname = "gp11_slot_open_session_full")]
+		public Session open_session(uint flags, GLib.Cancellable cancellable = null) throws GLib.Error;
+		public void open_session_async(uint flags, GLib.Cancellable cancellable, GLib.AsyncReadyCallback callback);
+		public Session open_session_finish(GLib.AsyncResult result) throws GLib.Error;
+	}
+
+	[CCode (dup_function = "gp11_session_info_dup", free_function = "gp11_session_info_free")]
+	public class SessionInfo {
+		public ulong slot_id;
+		public uint state;
+		public uint flags;
+		public ulong device_error;
+	}
+
+	public class Session : Glib.Object {
+		public static Session from_handle(Slot slot, uint handle);
+
+		public weak Module module { get; }
+		public uint handle { get; }
+		public SessionInfo info { get; }
+		
+		[CCode (cname = "gp11_session_login_full")]
+		public void login(guint user_type, uchar[] pin, ulong pin_length, GLib.Cancellable cancellable = null) throws GLib.Error;
+		public void login_async(guint user_type, uchar[] pin, ulong pin_length, GLib.Cancellable cancellable, GLib.AsyncReadyCallback callback);
+		public void login_finish(GLib.AsyncResult result) throws GLib.Error;
+
+		[CCode (cname = "gp11_session_logout_full")]
+		public void logout(GLib.Cancellable cancellable = null) throws GLib.Error;
+		public void logout_async(GLib.Cancellable cancellable, GLib.AsyncReadyCallback callback);
+		public void logout_finish(GLib.AsyncResult result) throws GLib.Error;
+
+		[CCode (cname = "gp11_session_create_object_full")]
+		public Object create_object(Attributes attrs, GLib.Cancellable cancellable = null) throws GLib.Error;
+		public void create_object_async(Attributes attrs, GLib.Cancellable cancellable, GLib.AsyncReadyCallback callback);
+		public Object create_object_finish(GLib.AsyncResult result) throws GLib.Error;
+		
+		[CCode (cname = "gp11_session_find_objects_full")]
+		public GLib.List<Object> find_objects(Attributes attrs, GLib.Cancellable cancellable = null) throws GLib.Error;
+		public void find_objects_async(Attributes attrs, GLib.Cancellable cancellable, GLib.AsyncReadyCallback callback);
+		public GLib.List<Object> find_objects_finish(GLib.AsyncResult result) throws GLib.Error;
+	}
+
+	public class Object : Glib.Object {
+		public static Object from_handle(Session session, uint handle);
+		
+		public weak Module module { get; }
+		public weak Session session { get; }
+		public uint handle { get; }
+
+		[CCode (cname = "gp11_object_destroy_full")]
+		public void destroy(GLib.Cancellable cancellable = null) throws GLib.Error;
+		public void destroy_async(GLib.Cancellable cancellable, GLib.AsyncReadyCallback callback);
+		public void destroy_finish(GLib.AsyncResult result) throws GLib.Error;
+
+		[CCode (cname = "gp11_object_set_full")]
+		public void set_attributes(Attributes attrs, GLib.Cancellable cancellable = null) throws GLib.Error;
+		[CCode (cname = "gp11_object_set_async")]
+		public void set_attributes_async(Attributes attrs, GLib.Cancellable cancellable, GLib.AsyncReadyCallback callback);
+		[CCode (cname = "gp11_object_set_finish")]
+		public void set_attributes_finish(GLib.AsyncResult result) throws GLib.Error;
+
+		[CCode (cname = "gp11_object_get_full")]
+		public Attributes get_attributes(guint[] attr_types, GLib.Cancellable cancellable = null) throws GLib.Error;
+		[CCode (cname = "gp11_object_get_async")]
+		public void get_attributes_async(guint[] attr_types, GLib.Cancellable cancellable, GLib.AsyncReadyCallback callback);
+		[CCode (cname = "gp11_object_get_finish")]
+		public Attributes get_attributes_finish(GLib.AsyncResult result) throws GLib.Error;
+		
+		[CCode (cname = "gp11_object_get_one_full")]
+		public Attribute get_attribute(guint attr_type, GLib.Cancellable cancellable = null) throws GLib.Error;
+		[CCode (cname = "gp11_object_get_one_async")]
+		public void get_attribute_async(guint attr_type, GLib.Cancellable cancellable, GLib.AsyncReadyCallback callback);
+		[CCode (cname = "gp11_object_get_one_finish")]
+		public Attribute get_attribute_finish(GLib.AsyncResult result) throws GLib.Error;
+	}
+}

Added: trunk/pkcs11/seahorse-pkcs11-module.c
==============================================================================
--- (empty file)
+++ trunk/pkcs11/seahorse-pkcs11-module.c	Wed Jul 16 17:28:01 2008
@@ -0,0 +1,28 @@
+/* 
+ * Seahorse
+ * 
+ * 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 "seahorse-pkcs11-module.h"
+
+const SeahorseRegisterType SEAHORSE_PKCS11_REGISTRY[] = {
+	NULL
+};

Added: trunk/pkcs11/seahorse-pkcs11-module.h
==============================================================================
--- (empty file)
+++ trunk/pkcs11/seahorse-pkcs11-module.h	Wed Jul 16 17:28:01 2008
@@ -0,0 +1,32 @@
+/* 
+ * Seahorse
+ * 
+ * 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 SEAHORSE_PKCS11_H_
+#define SEAHORSE_PKCS11_H_
+
+#include "common/seahorse-registry.h"
+
+#define SEAHORSE_PKCS11_STR                  "pkcs11"
+#define SEAHORSE_PKCS11                      (g_quark_from_static_string (SEAHORSE_PKCS11_STR))
+
+extern const SeahorseRegisterType SEAHORSE_PKCS11_REGISTRY[];
+
+#endif /*SEAHORSE_PKCS11_H_*/

Added: trunk/pkcs11/seahorse-pkcs11.c
==============================================================================
--- (empty file)
+++ trunk/pkcs11/seahorse-pkcs11.c	Wed Jul 16 17:28:01 2008
@@ -0,0 +1,33 @@
+/* 
+ * Seahorse
+ * 
+ * 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 "seahorse-pkcs11.h"
+#include <stdlib.h>
+#include <string.h>
+
+
+
+
+
+
+
+
+

Added: trunk/pkcs11/seahorse-pkcs11.h
==============================================================================
--- (empty file)
+++ trunk/pkcs11/seahorse-pkcs11.h	Wed Jul 16 17:28:01 2008
@@ -0,0 +1,39 @@
+/* 
+ * Seahorse
+ * 
+ * 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 __SEAHORSE_PKCS11_H__
+#define __SEAHORSE_PKCS11_H__
+
+#include <glib.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+
+
+#define SEAHORSE_PKCS11_TYPE_STR "pkcs11"
+#define SEAHORSE_PKCS11_TYPE g_quark_from_string ("pkcs11")
+#define SEAHORSE_PKCS11_STOCK_ICON "seahorse-key"
+
+
+G_END_DECLS
+
+#endif

Added: trunk/pkcs11/seahorse-pkcs11.vala
==============================================================================
--- (empty file)
+++ trunk/pkcs11/seahorse-pkcs11.vala	Wed Jul 16 17:28:01 2008
@@ -0,0 +1,30 @@
+/* 
+ * Seahorse
+ * 
+ * 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.  
+ */
+
+using GLib;
+
+namespace Seahorse.Pkcs11 {
+	public static const string TYPE_STR = "pkcs11";
+	public static const Quark TYPE = Quark.from_string("pkcs11");
+	
+	/* TODO: This is dumb and needs to change */
+	public static const string STOCK_ICON = "seahorse-key";
+}

Added: trunk/pkcs11/vala-build.stamp
==============================================================================
--- (empty file)
+++ trunk/pkcs11/vala-build.stamp	Wed Jul 16 17:28:01 2008
@@ -0,0 +1 @@
+1216227443



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