Permalink
Browse files

renamed PKCS11::Safenet to PKCS11::ProtectServer - Safenet has two pr…

…oduct lines for HSMs (Luna and ProtectServer) and product names often are more stable

use '_' instead of '-' in gem name to avoid confusion with version number
  • Loading branch information...
1 parent e1ad8fb commit e5e89954f81dd6771a35c0b41467b9ca39eb62e0 @larskanis committed Aug 12, 2011
View
@@ -51,6 +51,8 @@ file 'ext/pk11_struct_def.inc' => 'ext/generate_structs.rb' do
sh "#{Config::CONFIG['ruby_install_name']} ext/generate_structs.rb --def ext/pk11_struct_def.inc --impl ext/pk11_struct_impl.inc --doc ext/pk11_struct.doc ext/include/pkcs11t.h"
end
file 'ext/pk11_struct_impl.inc' => 'ext/pk11_struct_def.inc'
+file 'ext/pk11_struct.doc' => 'ext/pk11_struct_def.inc'
+
file 'ext/pk11_const_def.inc' => 'ext/generate_constants.rb' do
sh "#{Config::CONFIG['ruby_install_name']} ext/generate_constants.rb --const ext/pk11_const_def.inc ext/include/pkcs11t.h"
end
@@ -65,7 +67,7 @@ file 'ext/pk11.h' => 'ext/pk11_thread_funcs.h'
desc "Generate static HTML documentation with YARD"
task :yardoc do
- sh "yardoc --title \"PKCS#11/Ruby Interface\" --no-private lib/**/*.rb ext/*.c ext/*.doc pkcs11-safenet/lib/**/*.rb pkcs11-safenet/ext/*.c pkcs11-safenet/ext/*.doc"
+ sh "yardoc --title \"PKCS#11/Ruby Interface\" --no-private lib/**/*.rb ext/*.c ext/*.doc pkcs11_protect_server/lib/**/*.rb pkcs11_protect_server/ext/*.c pkcs11_protect_server/ext/*.doc"
end
desc "Publish YARD to wherever you want."
View
@@ -1 +0,0 @@
---title "PKCS#11-Safenet/Ruby Interface" --no-private lib/**/*.rb ext/*.c ext/*.doc
@@ -1,14 +0,0 @@
-.yardopts
-Manifest.txt
-README.rdoc
-Rakefile
-ext/Makefile
-ext/extconf.rb
-ext/generate_constants.rb
-ext/generate_structs.rb
-ext/pk11s.c
-lib/pkcs11_safenet.rb
-lib/pkcs11_safenet/extensions.rb
-test/helper.rb
-test/test_pkcs11_safenet.rb
-test/test_pkcs11_safenet_crypt.rb
@@ -0,0 +1 @@
+--title "PKCS#11-ProtectServer/Ruby Interface" --no-private lib/**/*.rb ext/*.c ext/*.doc
@@ -0,0 +1,13 @@
+.yardopts
+Manifest.txt
+README.rdoc
+Rakefile
+ext/extconf.rb
+ext/generate_constants.rb
+ext/generate_structs.rb
+ext/pk11s.c
+lib/pkcs11_protect_server.rb
+lib/pkcs11_protect_server/extensions.rb
+test/helper.rb
+test/test_pkcs11_protect_server.rb
+test/test_pkcs11_protect_server_crypt.rb
@@ -1,7 +1,7 @@
= PKCS #11/Ruby Interface for Safenet Protect Server HSM
-* Homepage: http://github.com/larskanis/pkcs11-safenet
-* API documentation: http://pkcs11.rubyforge.org/pkcs11-safenet/
+* Homepage: http://github.com/larskanis/pkcs11
+* API documentation: http://pkcs11.rubyforge.org/pkcs11/
* API documentation of Ruby-PKCS#11: http://pkcs11.rubyforge.org/pkcs11/
* Safenet[http://www.safenet-inc.com] - Protect Server HSM
@@ -12,20 +12,20 @@ The module works on the Unix like operating systems and win32.
== Requirements
-* Safenet PTKC-SDK to compile the module
+* ProtectServer PTKC-SDK to compile the module
* pkcs11 gem installed (use: <tt>gem install pkcs11</tt> )
== Installation
- gem install pkcs11-safenet -- --with-safenet-sdk-dir=/path/to/ETcpsdk
+ gem install pkcs11_protect_server -- --with-protect-server-sdk-dir=/path/to/ETcpsdk
-This installs the Safenet-PKCS#11 extension along with pkcs11-gem either by compiling (Unix)
+This installs the ProtectServer-PKCS#11 extension along with pkcs11-gem either by compiling (Unix)
or by using the precompiled gem for Win32.
- git clone git://github.com/larskanis/pkcs11-safenet.git
- cd pkcs11-safenet
- rake gem SAFENET_SDK_DIR=/path/to/ETcpsdk
- gem install -l pkg/pkcs11-safenet -- --with-safenet-sdk-dir=/path/to/ETcpsdk
+ git clone git://github.com/larskanis/pkcs11.git
+ cd pkcs11_protect_server
+ rake gem PROTECT_SERVER_SDK_DIR=/path/to/ETcpsdk
+ gem install -l pkg/pkcs11_protect_server -- --with-protect-server-sdk-dir=/path/to/ETcpsdk
Downloads and installs the gem from git source.
@@ -34,22 +34,22 @@ Downloads and installs the gem from git source.
Open the software emulation library and login to a session:
require "rubygems"
- require "pkcs11_safenet"
+ require "pkcs11_protect_server"
- pkcs11 = PKCS11::Safenet::Library.new(:sw)
+ pkcs11 = PKCS11::ProtectServer::Library.new(:sw)
p pkcs11.info
session = pkcs11.active_slots.last.open
session.login(:USER, "1234")
# ... crypto operations
session.logout
session.close
-{PKCS11::Safenet::Library#initialize} tries to find the library file in
+{PKCS11::ProtectServer::Library#initialize} tries to find the library file in
the standard installation directory on Windows or Linux.
== Cross compiling for mswin32
-Using rake-compiler a cross compiled pkcs11-safenet-gem can be build on a linux host for
+Using rake-compiler a cross compiled pkcs11_protect_server.gem can be build on a linux host for
the win32 platform. There are no runtime dependencies to any but the standard Windows DLLs.
Install mingw32. On a debian based system this should work:
@@ -68,17 +68,17 @@ Download and cross compile ruby for win32:
rake-compiler cross-ruby VERSION=1.8.6-p287
-Download and cross compile pkcs11-safenet for win32:
+Download and cross compile pkcs11_protect_server for win32:
- rake cross native gem SAFENET_SDK_DIR=/path/to/ETcpsdk
+ rake cross native gem PROTECT_SERVER_SDK_DIR=/path/to/ETcpsdk
-If everything works, there should be pkcs11-safenet-VERSION-x86-mswin32.gem in the pkg
+If everything works, there should be pkcs11_protect_server-VERSION-x86-mswin32.gem in the pkg
directory.
== ToDo
-* implement Safenet specific function calls
+* implement ProtectServer specific function calls
* implement possibility to use callbacks
* add all structs and constants
@@ -6,7 +6,7 @@ require 'hoe'
require 'rake/extensiontask'
require 'rbconfig'
-SAFENET_SDK_DIR = ENV['SAFENET_SDK_DIR'] || '/opt/ETcpsdk'
+PROTECT_SERVER_SDK_DIR = ENV['PROTECT_SERVER_SDK_DIR'] || '/opt/ETcpsdk'
RUBY_PKCS11_EXT_DIR = File.expand_path('../ext')
GENERATED_FILES = [
@@ -20,7 +20,7 @@ GENERATED_FILES = [
]
CLEAN.include GENERATED_FILES
-CLEAN.include 'lib/pkcs11_safenet_ext.so'
+CLEAN.include 'lib/pkcs11_protect_server_ext.so'
CLEAN.include 'tmp'
def pkcs11_version
@@ -29,14 +29,14 @@ def pkcs11_version
File.read_utf(file)[version_re, 2]
end
-hoe = Hoe.spec 'pkcs11-safenet' do
+hoe = Hoe.spec 'pkcs11_protect_server' do
developer('Lars Kanis', 'kanis@comcard.de')
extra_deps << ['pkcs11', "= #{pkcs11_version}"]
extra_dev_deps << ['yard', '>= 0.6']
extra_dev_deps << ['rake-compiler', '>= 0.7']
- self.url = 'http://github.com/larskanis/pkcs11-safenet'
- self.summary = 'Safenet extensions for PKCS#11-Ruby'
+ self.url = 'http://github.com/larskanis/pkcs11'
+ self.summary = 'Safenet-ProtectServer extensions for PKCS#11-Ruby'
self.description = 'This module allows Ruby programs to use vendor extensions for Safenet Protect Server.'
self.version = pkcs11_version
@@ -51,12 +51,12 @@ end
ENV['RUBY_CC_VERSION'] ||= '1.8.6:1.9.2'
-Rake::ExtensionTask.new('pkcs11_safenet_ext', hoe.spec) do |ext|
+Rake::ExtensionTask.new('pkcs11_protect_server_ext', hoe.spec) do |ext|
ext.ext_dir = 'ext'
ext.cross_compile = true # enable cross compilation (requires cross compile toolchain)
ext.cross_platform = ['i386-mswin32', 'i386-mingw32'] # forces the Windows platform instead of the default one
- ext.config_options << "--with-safenet-sdk-dir=#{SAFENET_SDK_DIR.inspect}"
+ ext.config_options << "--with-protect-server-sdk-dir=#{PROTECT_SERVER_SDK_DIR.inspect}"
end
def copy_from_base_task(filename)
@@ -71,11 +71,13 @@ copy_from_base_task 'pk11_version.h'
file 'ext/extconf.rb' => ['ext/pk11s_struct_def.inc', 'ext/pk11s_const_def.inc', 'ext/pk11_struct_macros.h', 'ext/pk11_const_macros.h', 'ext/pk11_version.h']
file 'ext/pk11s_struct_def.inc' => 'ext/generate_structs.rb' do
- sh "#{Config::CONFIG['ruby_install_name']} ext/generate_structs.rb --def ext/pk11s_struct_def.inc --impl ext/pk11s_struct_impl.inc --doc ext/pk11s_struct.doc #{File.join(SAFENET_SDK_DIR, 'include/ctvdef.h').inspect}"
+ sh "#{Config::CONFIG['ruby_install_name']} ext/generate_structs.rb --def ext/pk11s_struct_def.inc --impl ext/pk11s_struct_impl.inc --doc ext/pk11s_struct.doc #{File.join(PROTECT_SERVER_SDK_DIR, 'include/ctvdef.h').inspect}"
end
file 'ext/pk11s_struct_impl.inc' => 'ext/pk11s_struct_def.inc'
+file 'ext/pk11s_struct.doc' => 'ext/pk11s_struct_def.inc'
+
file 'ext/pk11s_const_def.inc' => 'ext/generate_constants.rb' do
- sh "#{Config::CONFIG['ruby_install_name']} ext/generate_constants.rb --const ext/pk11s_const_def.inc #{File.join(SAFENET_SDK_DIR, 'include/ctvdef.h').inspect}"
+ sh "#{Config::CONFIG['ruby_install_name']} ext/generate_constants.rb --const ext/pk11s_const_def.inc #{File.join(PROTECT_SERVER_SDK_DIR, 'include/ctvdef.h').inspect}"
end
file 'ext/pk11s.c' => ['ext/pk11s_struct_def.inc', 'ext/pk11s_struct_impl.inc', 'ext/pk11s_const_def.inc']
@@ -1,8 +1,8 @@
require "mkmf"
require "rubygems"
-inc, lib = dir_config('safenet-sdk', '/opt/ETcpsdk/include', '/opt/ETcpsdk/lib')
-puts "using Safenet-SDK include:#{inc} lib:#{lib}"
+inc, lib = dir_config('protect-server-sdk', '/opt/ETcpsdk/include', '/opt/ETcpsdk/lib')
+puts "using ProtectServer-SDK include:#{inc} lib:#{lib}"
# inc, lib = dir_config('ruby-pkcs11')
# inc ||= Gem.required_location('pkcs11', '../ext')
@@ -13,4 +13,4 @@
find_header('pk11_struct_macros.h')
find_header('pk11_const_macros.h')
-create_makefile("pkcs11_safenet_ext");
+create_makefile("pkcs11_protect_server_ext");
@@ -5,7 +5,7 @@
require File.expand_path(File.join(File.dirname(__FILE__), '../../ext/generate_constants'))
module PKCS11
-module Safenet
+module ProtectServer
class ConstantParser < PKCS11::ConstantParser
ConstGroups = [
ConstTemplate.new(/#define\s+(CKM_[A-Z_0-9]+)\s+(.+)/, 'PKCS11_DEFINE_MECHANISM'),
@@ -37,5 +37,5 @@ def start!
if $0==__FILE__
- PKCS11::Safenet::ConstantParser.run(ARGV)
+ PKCS11::ProtectServer::ConstantParser.run(ARGV)
end
@@ -7,7 +7,7 @@
require File.expand_path(File.join(File.dirname(__FILE__), '../../ext/generate_structs'))
module PKCS11
-module Safenet
+module ProtectServer
class StructParser < PKCS11::StructParser
SIZE_CONSTANTS = {
@@ -31,7 +31,7 @@ class StructParser < PKCS11::StructParser
ULONG_PTR_TYPES = %w[CK_COUNT_PTR]
def struct_module
- 'PKCS11::Safenet'
+ 'PKCS11::ProtectServer'
end
def array_attribute_names; %w[attributes mechanism certAttr hCert]; end
@@ -71,5 +71,5 @@ def start!
if $0==__FILE__
- PKCS11::Safenet::StructParser.run(ARGV)
+ PKCS11::ProtectServer::StructParser.run(ARGV)
end
@@ -14,51 +14,51 @@
#include "pk11s_struct_impl.inc"
static VALUE mPKCS11;
-static VALUE mSafenet;
-static VALUE eSafenetError;
-static VALUE cSafenetCStruct;
+static VALUE mProtectServer;
+static VALUE eProtectServerError;
+static VALUE cProtectServerCStruct;
static VALUE cPkcs11CStruct;
static VALUE vOBJECT_CLASSES;
static VALUE vATTRIBUTES;
static VALUE vMECHANISMS;
static VALUE vRETURN_VALUES;
-#define MODULE_FOR_STRUCTS mSafenet
-#define MODULE_FOR_CONSTS mSafenet
-#define BASECLASS_FOR_ERRORS eSafenetError
-#define BASECLASS_FOR_STRUCTS cSafenetCStruct
+#define MODULE_FOR_STRUCTS mProtectServer
+#define MODULE_FOR_CONSTS mProtectServer
+#define BASECLASS_FOR_ERRORS eProtectServerError
+#define BASECLASS_FOR_STRUCTS cProtectServerCStruct
void
-Init_pkcs11_safenet_ext()
+Init_pkcs11_protect_server_ext()
{
VALUE eError;
mPKCS11 = rb_const_get(rb_cObject, rb_intern("PKCS11"));
- mSafenet = rb_define_module_under(mPKCS11, "Safenet");
+ mProtectServer = rb_define_module_under(mPKCS11, "ProtectServer");
/* Library version */
- rb_define_const( mSafenet, "VERSION", rb_str_new2(VERSION) );
+ rb_define_const( mProtectServer, "VERSION", rb_str_new2(VERSION) );
eError = rb_const_get(mPKCS11, rb_intern("Error"));
- /* Document-class: PKCS11::Safenet::Error
+ /* Document-class: PKCS11::ProtectServer::Error
*
- * Base class for all Safenet specific exceptions (CKR_*) */
- eSafenetError = rb_define_class_under(mSafenet, "Error", eError);
+ * Base class for all ProtectServer specific exceptions (CKR_*) */
+ eProtectServerError = rb_define_class_under(mProtectServer, "Error", eError);
cPkcs11CStruct = rb_const_get(mPKCS11, rb_intern("CStruct")); \
- cSafenetCStruct = rb_define_class_under(mSafenet, "CStruct", cPkcs11CStruct);
+ cProtectServerCStruct = rb_define_class_under(mProtectServer, "CStruct", cPkcs11CStruct);
#include "pk11s_struct_def.inc"
vOBJECT_CLASSES = rb_hash_new();
vATTRIBUTES = rb_hash_new();
vMECHANISMS = rb_hash_new();
vRETURN_VALUES = rb_hash_new();
- rb_define_const(mSafenet, "OBJECT_CLASSES", vOBJECT_CLASSES);
- rb_define_const(mSafenet, "ATTRIBUTES", vATTRIBUTES);
- rb_define_const(mSafenet, "MECHANISMS", vMECHANISMS);
- rb_define_const(mSafenet, "RETURN_VALUES", vRETURN_VALUES);
+ rb_define_const(mProtectServer, "OBJECT_CLASSES", vOBJECT_CLASSES);
+ rb_define_const(mProtectServer, "ATTRIBUTES", vATTRIBUTES);
+ rb_define_const(mProtectServer, "MECHANISMS", vMECHANISMS);
+ rb_define_const(mProtectServer, "RETURN_VALUES", vRETURN_VALUES);
#include "pk11s_const_def.inc"
@@ -7,5 +7,5 @@
require 'rubygems'
require 'pkcs11'
-require 'pkcs11_safenet_ext'
-require 'pkcs11_safenet/extensions'
+require 'pkcs11_protect_server_ext'
+require 'pkcs11_protect_server/extensions'
@@ -1,7 +1,7 @@
#!/usr/bin/env ruby
module PKCS11
-module Safenet
+module ProtectServer
# Derive CK_ATTRIBUTE to get converted attributes.
class CK_ATTRIBUTE < PKCS11::CK_ATTRIBUTE
ATTRIBUTES = {
@@ -27,7 +27,7 @@ def value
end
end
- # A Safenet::Library instance holds a handle to the opened +cryptoki.dll+ or +cryptoki.so+ file.
+ # A ProtectServer::Library instance holds a handle to the opened +cryptoki.dll+ or +cryptoki.so+ file.
#
# This class is derived from
# PKCS11::Library[http://pkcs11.rubyforge.org/pkcs11/PKCS11/Library.html] of pkcs11.gem.
@@ -78,15 +78,15 @@ def initialize(so_path = nil, args = {})
so_path = paths.find{|path| File.exist?(path) }
end
- raise "#{libctsw_so} not found - please install Safenet PTK-C or set ENV['CRYPTOKI_SO']" unless so_path
+ raise "#{libctsw_so} not found - please install ProtectServer PTK-C or set ENV['CRYPTOKI_SO']" unless so_path
end
@so_path = so_path
super(so_path, args)
end
def vendor_const_get(name)
- return Safenet.const_get(name) if Safenet.const_defined?(name)
+ return ProtectServer.const_get(name) if ProtectServer.const_defined?(name)
super
end
@@ -95,14 +95,14 @@ def vendor_mechanism_parameter_struct(mech)
end
def vendor_raise_on_return_value(rv)
- if ex=Safenet::RETURN_VALUES[rv]
+ if ex=ProtectServer::RETURN_VALUES[rv]
raise(ex, rv.to_s)
end
super
end
def vendor_class_CK_ATTRIBUTE
- Safenet::CK_ATTRIBUTE
+ ProtectServer::CK_ATTRIBUTE
end
end
end
Oops, something went wrong.

0 comments on commit e5e8995

Please sign in to comment.