pkcs11 0.2.4-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.autotest +23 -0
  3. data/.gemtest +0 -0
  4. data/.yardopts +1 -0
  5. data/History.txt +57 -0
  6. data/MIT-LICENSE +22 -0
  7. data/Manifest.txt +57 -0
  8. data/README.rdoc +205 -0
  9. data/Rakefile +111 -0
  10. data/ext/extconf.rb +7 -0
  11. data/ext/generate_constants.rb +57 -0
  12. data/ext/generate_structs.rb +206 -0
  13. data/ext/generate_thread_funcs.rb +72 -0
  14. data/ext/include/cryptoki.h +66 -0
  15. data/ext/include/ct-kip.h +50 -0
  16. data/ext/include/otp-pkcs11.h +125 -0
  17. data/ext/include/pkcs-11v2-20a3.h +124 -0
  18. data/ext/include/pkcs11.h +299 -0
  19. data/ext/include/pkcs11f.h +912 -0
  20. data/ext/include/pkcs11t.h +1885 -0
  21. data/ext/pk11.c +1675 -0
  22. data/ext/pk11.h +81 -0
  23. data/ext/pk11_const.c +205 -0
  24. data/ext/pk11_const_def.inc +452 -0
  25. data/ext/pk11_const_macros.h +38 -0
  26. data/ext/pk11_struct.doc +792 -0
  27. data/ext/pk11_struct_def.inc +302 -0
  28. data/ext/pk11_struct_impl.inc +302 -0
  29. data/ext/pk11_struct_macros.h +435 -0
  30. data/ext/pk11_thread_funcs.c +411 -0
  31. data/ext/pk11_thread_funcs.h +482 -0
  32. data/ext/pk11_version.h +6 -0
  33. data/lib/2.0/pkcs11_ext.so +0 -0
  34. data/lib/pkcs11.rb +9 -0
  35. data/lib/pkcs11/extensions.rb +68 -0
  36. data/lib/pkcs11/helper.rb +144 -0
  37. data/lib/pkcs11/library.rb +140 -0
  38. data/lib/pkcs11/object.rb +171 -0
  39. data/lib/pkcs11/session.rb +765 -0
  40. data/lib/pkcs11/slot.rb +102 -0
  41. data/pkcs11_protect_server/Manifest.txt +14 -0
  42. data/pkcs11_protect_server/README_PROTECT_SERVER.rdoc +89 -0
  43. data/test/fixtures/softokn/cert8.db +0 -0
  44. data/test/fixtures/softokn/key3.db +0 -0
  45. data/test/fixtures/softokn/secmod.db +0 -0
  46. data/test/helper.rb +58 -0
  47. data/test/test_pkcs11.rb +71 -0
  48. data/test/test_pkcs11_crypt.rb +220 -0
  49. data/test/test_pkcs11_object.rb +122 -0
  50. data/test/test_pkcs11_session.rb +123 -0
  51. data/test/test_pkcs11_slot.rb +78 -0
  52. data/test/test_pkcs11_structs.rb +166 -0
  53. data/test/test_pkcs11_thread.rb +44 -0
  54. metadata +213 -0
  55. metadata.gz.sig +0 -0
Binary file
@@ -0,0 +1,23 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'autotest/restart'
4
+
5
+ # Autotest.add_hook :initialize do |at|
6
+ # at.extra_files << "../some/external/dependency.rb"
7
+ #
8
+ # at.libs << ":../some/external"
9
+ #
10
+ # at.add_exception 'vendor'
11
+ #
12
+ # at.add_mapping(/dependency.rb/) do |f, _|
13
+ # at.files_matching(/test_.*rb$/)
14
+ # end
15
+ #
16
+ # %w(TestA TestB).each do |klass|
17
+ # at.extra_class_map[klass] = "test/test_misc.rb"
18
+ # end
19
+ # end
20
+
21
+ # Autotest.add_hook :run_command do |at|
22
+ # system "rake build"
23
+ # end
File without changes
@@ -0,0 +1 @@
1
+ --title "PKCS#11/Ruby Interface" --no-private lib/**/*.rb ext/*.c ext/*.doc
@@ -0,0 +1,57 @@
1
+ === 0.2.4 / 2013-04-05
2
+
3
+ * Build and package binary x64 version for Windows in addition to x86.
4
+ * Allow to use big positive numbers (>0x80000000) in 32bit mode (Anton Fedorov)
5
+
6
+ === 0.2.3 / 2012-01-25
7
+
8
+ * fix C_WaitForSlotEvent to be a Library- instead of a Slot-method
9
+ * allow :sw/:hsm to ProtectServer::Library#load_library in the same way as #initialize
10
+ * allow Hash argument to Library#C_Initialize in the same way as #initialize
11
+
12
+ === 0.2.2 / 2011-12-12
13
+
14
+ * add ability to change PKCS11 base methods in order to use vendor defined attributes, return codes and mechanisms
15
+ * restructured C code to avoid duplicated code in vendor extension gems
16
+ * add gem pkcs11_protect_server to cover many ProtectServer specific extensions
17
+ * update test/helper to find newer libsoftokn3
18
+ * add task for generating combined docs of PKCS11 and PKCS11::ProtectServer
19
+ * changed PKCS11#slots to return all slots of the device by default
20
+ * add ability to set/get multiple attributes with Object#[] and Object#[]=
21
+
22
+ === 0.2.1 / 2011-04-21
23
+
24
+ * add some more CK_ULONG and CK_BOOL attributes
25
+ * add array of structs accessor used in CK_OTP_PARAMS
26
+ * refactured inc-file generation
27
+ * bit more documentation
28
+ * bugfix: print CKR-values as unsigned long
29
+ * bugfix: Slot#mechanism_info didn't work with Symbol
30
+
31
+
32
+ === 0.2.0 / 2011-01-18
33
+
34
+ * switch API documentation to YARD instead of RDOC
35
+ * add Ruby classes for all PKCS#11 structures
36
+ * add CopyObject
37
+ * add Get/SetOperationState
38
+ * use distinct Exception classes for different error codes
39
+ * PKCS#11 function calls don't block other ruby threads any more (only Ruby 1.9, Rubinius)
40
+ * don't wrap mechanisms any more (GetMechanismList returns plain Integers now)
41
+ * choose structs as mechanism parameter based on the given mechanism
42
+ * autogenerate many constants from C header files
43
+ * finer graded control over library loading
44
+ * several bug fixes
45
+ * more unit tests
46
+ * more documentation
47
+
48
+
49
+ === 0.1.0 / 2010-05-03
50
+
51
+ * first rubygem version
52
+ * Most functions and operations of PKCS#11 v2.2 are implemented.
53
+ * The library is based on the work of Ryosuke Kutsuna and GOTOU Yuuzou, but extended in the following ways:
54
+ - running on Unix and Windows OS
55
+ - downloadable as rubygem in source and win32 binary version
56
+ - new API, it's more ruby-like and well documented
57
+ - most functions are unit tested with help of softokn library
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2008 Ryosuke Kutsuna <ryosuke@deer-n-horse.jp>
2
+ Copyright (c) 2008 GOTOU Yuuzou <gotoyuzo@notwork.org>
3
+ Copyright (c) 2010 Lars Kanis <kanis@comcard.de>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,57 @@
1
+ .autotest
2
+ .gemtest
3
+ .yardopts
4
+ History.txt
5
+ MIT-LICENSE
6
+ Manifest.txt
7
+ README.rdoc
8
+ Rakefile
9
+ ext/extconf.rb
10
+ ext/generate_constants.rb
11
+ ext/generate_structs.rb
12
+ ext/generate_thread_funcs.rb
13
+ ext/include/cryptoki.h
14
+ ext/include/ct-kip.h
15
+ ext/include/otp-pkcs11.h
16
+ ext/include/pkcs-11v2-20a3.h
17
+ ext/include/pkcs11.h
18
+ ext/include/pkcs11f.h
19
+ ext/include/pkcs11t.h
20
+ ext/pk11.c
21
+ ext/pk11.h
22
+ ext/pk11_const.c
23
+ ext/pk11_const_macros.h
24
+ ext/pk11_struct_macros.h
25
+ ext/pk11_version.h
26
+ lib/pkcs11.rb
27
+ lib/pkcs11/extensions.rb
28
+ lib/pkcs11/helper.rb
29
+ lib/pkcs11/library.rb
30
+ lib/pkcs11/object.rb
31
+ lib/pkcs11/session.rb
32
+ lib/pkcs11/slot.rb
33
+ pkcs11_protect_server/.gemtest
34
+ pkcs11_protect_server/.yardopts
35
+ pkcs11_protect_server/Manifest.txt
36
+ pkcs11_protect_server/README_PROTECT_SERVER.rdoc
37
+ pkcs11_protect_server/Rakefile
38
+ pkcs11_protect_server/ext/extconf.rb
39
+ pkcs11_protect_server/ext/generate_constants.rb
40
+ pkcs11_protect_server/ext/generate_structs.rb
41
+ pkcs11_protect_server/ext/pk11s.c
42
+ pkcs11_protect_server/lib/pkcs11_protect_server.rb
43
+ pkcs11_protect_server/lib/pkcs11_protect_server/extensions.rb
44
+ pkcs11_protect_server/test/helper.rb
45
+ pkcs11_protect_server/test/test_pkcs11_protect_server.rb
46
+ pkcs11_protect_server/test/test_pkcs11_protect_server_crypt.rb
47
+ test/fixtures/softokn/cert8.db
48
+ test/fixtures/softokn/key3.db
49
+ test/fixtures/softokn/secmod.db
50
+ test/helper.rb
51
+ test/test_pkcs11.rb
52
+ test/test_pkcs11_crypt.rb
53
+ test/test_pkcs11_object.rb
54
+ test/test_pkcs11_session.rb
55
+ test/test_pkcs11_slot.rb
56
+ test/test_pkcs11_structs.rb
57
+ test/test_pkcs11_thread.rb
@@ -0,0 +1,205 @@
1
+ {<img src="https://travis-ci.org/larskanis/pkcs11.png?branch=master" alt="Build Status" />}[https://travis-ci.org/larskanis/pkcs11]
2
+
3
+ = PKCS #11/Ruby Interface
4
+
5
+ * Homepage: http://github.com/larskanis/pkcs11
6
+ * API documentation: http://pkcs11.rubyforge.org/pkcs11/frames.html
7
+
8
+ This module allows Ruby programs to interface with "RSA Security Inc.
9
+ PKCS #11 Cryptographic Token Interface (Cryptoki)".
10
+ PKCS #11 is the de-facto standard to access cryptographic devices.
11
+ You must have a PKCS #11 v2.20 implementation library installed in
12
+ order to use this module. Tested implementations of PKCS#11 librarys
13
+ include:
14
+ * OpenSC[http://www.opensc-project.org] supported Smart Cards
15
+ * Safenet[http://www.safenet-inc.com] - Protect Server HSMs
16
+ * Mozilla_Soft_Token[https://developer.mozilla.org/en/PKCS11] which comes with every firefox installation
17
+
18
+ This module works on the Unix like operating systems and win32.
19
+
20
+ == Installation
21
+
22
+ gem install pkcs11
23
+
24
+ This installs the PKCS#11 extension either by compiling (Unix) or by using the precompiled gem for Win32.
25
+
26
+ == Usage
27
+ Cryptoki has a reputation to be complicated to implement and use.
28
+ While this seems to be true for C, it shouldn't for Ruby.
29
+
30
+ * {PKCS11.open} opens a PKCS#11 Unix *.so file or Windows-DLL with a suitable PKCS #11 implementation
31
+ and returns a {PKCS11::Library}.
32
+ * {PKCS11::Library#slots} returns a list of {PKCS11::Slot} for all slots accessable by the library.
33
+ * {PKCS11::Slot#open} opens a {PKCS11::Session} which is used for object handling
34
+ and cryptographic operations.
35
+ * {PKCS11::Object} represents a key, data or certificate object.
36
+ * all constants defined in PKCS#11 v2.20 are available in the module {PKCS11}
37
+ and contain the associated Integer value (CKA_KEY_TYPE, CKK_AES, CKM_SHA_1 etc.)
38
+ * also all PKCS#11 v2.20 structs are available in the module {PKCS11} as proper ruby classes
39
+ ({PKCS11::CK_VERSION}, {PKCS11::CK_OTP_PARAMS} etc.)
40
+
41
+ === Example
42
+ require "rubygems"
43
+ require "pkcs11"
44
+ include PKCS11
45
+
46
+ pkcs11 = PKCS11.open("/path/to/pkcs11.so")
47
+ p pkcs11.info # => #<PKCS11::CK_INFO cryptokiVersion=...>
48
+ pkcs11.active_slots.first.open do |session|
49
+ session.login(:USER, "1234")
50
+ secret_key = session.generate_key(:DES2_KEY_GEN,
51
+ :ENCRYPT=>true, :DECRYPT=>true, :SENSITIVE=>true, :TOKEN=>true, :LABEL=>'my key')
52
+ cryptogram = session.encrypt( {:DES3_CBC_PAD=>"\0"*8}, secret_key, "some plaintext")
53
+ session.logout
54
+ end
55
+
56
+ This opens a {PKCS11::Library PKCS#11 library} and prints it's {PKCS11::CK_INFO information block}.
57
+ Then a {PKCS11::Session} to the first {PKCS11::Library#active_slots active slot} of the device is opened and
58
+ a {PKCS11::Session#login login} is done on the user account. Now, a 112 bit DES3 {PKCS11::Object key object} is generated and
59
+ some plaintext is {PKCS11::Session#encrypt encrypted} with it. A 8-byte zero IV is used. In many cases method parameters
60
+ can be Integer (like PKCS11::CKA_LABEL) or, as in the sample, Symbol (:LABEL) which is internally
61
+ converted.
62
+
63
+ Many more usage examples can be found in the unit tests of the <tt>test</tt>
64
+ directory of the project or gem.
65
+
66
+ Detail information for the API specification is provided by RSA Security Inc.
67
+ Please refer the URL: http://www.rsa.com/rsalabs/node.asp?id=2133. Browsable HTML
68
+ can be found at http://www.cryptsoft.com/pkcs11doc.
69
+
70
+ === Vendor extensions
71
+ Some vendors extend their libraries beyond the standard, in it's own way.
72
+ This can be used by vendor specific packages:
73
+ * Safenet ProtectServer: {file:pkcs11_protect_server/README_PROTECT_SERVER.rdoc}
74
+
75
+ === Threading
76
+
77
+ The pkcs11 binding fully supports native, background Ruby threads.
78
+ This of course only applies to Rubinius and Ruby 1.9.x or higher since
79
+ earlier versions of Ruby do not support native threads.
80
+
81
+ According to the standard, calling the Cryptoki library from multiple threads simultaneously,
82
+ requires to open it with flag PKCS11::CKF_OS_LOCKING_OK.
83
+ Application-supplied synchronization primitives
84
+ (CreateMutex, DestroyMutex, LockMutex, UnlockMutex) are not supported.
85
+
86
+
87
+ == Cross compiling for Windows
88
+
89
+ Using rake-compiler a cross compiled pkcs11-gem can be build on a linux host for
90
+ the win32 platform. There are no runtime dependencies to any but the standard Windows DLLs.
91
+
92
+ Install mingw32. On a debian based system this should work:
93
+
94
+ apt-get install mingw32
95
+
96
+ On MacOS X, if you have MacPorts installed:
97
+
98
+ port install i386-mingw32-gcc
99
+
100
+ Install the rake-compiler:
101
+
102
+ gem install rake-compiler
103
+
104
+ Download and cross compile ruby for win32:
105
+
106
+ rake-compiler cross-ruby VERSION=1.8.7-p352
107
+ rake-compiler cross-ruby VERSION=1.9.2-p290
108
+
109
+ Download and cross compile pkcs11 for win32 (MRI 1.8+1.9 fat gem):
110
+
111
+ rake cross native gem RUBY_CC_VERSION=1.8.7:1.9.2
112
+
113
+ If everything works, there should be pkcs11-VERSION-x86-mingw32.gem in the pkg
114
+ directory.
115
+
116
+
117
+ == ToDo
118
+
119
+ * encoding support for Ruby 1.9
120
+ * support for proprietary extensions of different vendors (done for Safenet-ProtectServer)
121
+ * PKCS#11 v2.3
122
+
123
+ == Development Status
124
+
125
+ Any operation that is possible with PKCS#11 in C, should be likewise possible in Ruby.
126
+ Otherwise it is considered as a bug in the binding.
127
+
128
+ STATE FUNCTION NOTE
129
+ ------ --------------------- ----------------------------------------
130
+ DONE C_Initialize
131
+ DONE C_Finalize
132
+ DONE C_GetInfo
133
+ DONE C_GetFunctionList
134
+ DONE C_GetSlotList
135
+ DONE C_GetSlotInfo
136
+ DONE C_GetTokenInfo
137
+ DONE C_GetMechanismList
138
+ DONE C_GetMechanismInfo
139
+ DONE C_InitToken
140
+ DONE C_InitPIN
141
+ DONE C_SetPIN
142
+ DONE C_OpenSession
143
+ DONE C_CloseSession
144
+ DONE C_CloseAllSessions
145
+ DONE C_GetSessionInfo
146
+ DONE C_GetOperationState
147
+ DONE C_SetOperationState
148
+ DONE C_Login
149
+ DONE C_Logout
150
+ DONE C_CreateObject
151
+ DONE C_CopyObject
152
+ DONE C_DestroyObject
153
+ DONE C_GetObjectSize
154
+ DONE C_GetAttributeValue
155
+ DONE C_SetAttributeValue
156
+ DONE C_FindObjectsInit
157
+ DONE C_FindObjects
158
+ DONE C_FindObjectsFinal
159
+ DONE C_EncryptInit
160
+ DONE C_Encrypt
161
+ DONE C_EncryptUpdate
162
+ DONE C_EncryptFinal
163
+ DONE C_DecryptInit
164
+ DONE C_Decrypt
165
+ DONE C_DecryptUpdate
166
+ DONE C_DecryptFinal
167
+ DONE C_DigestInit
168
+ DONE C_Digest
169
+ DONE C_DigestUpdate
170
+ DONE C_DigestKey
171
+ DONE C_DigestFinal
172
+ DONE C_SignInit
173
+ DONE C_Sign
174
+ DONE C_SignUpdate
175
+ DONE C_SignFinal
176
+ DONE C_SignRecoverInit
177
+ DONE C_SignRecover
178
+ DONE C_VerifyInit
179
+ DONE C_Verify
180
+ DONE C_VerifyUpdate
181
+ DONE C_VerifyFinal
182
+ DONE C_VerifyRecoverInit
183
+ DONE C_VerifyRecover
184
+ DONE C_DigestEncryptUpdate
185
+ DONE C_DecryptDigestUpdate
186
+ DONE C_SignEncryptUpdate
187
+ DONE C_DecryptVerifyUpdate
188
+ DONE C_GenerateKey
189
+ DONE C_GenerateKeyPair
190
+ DONE C_WrapKey
191
+ DONE C_UnwrapKey
192
+ DONE C_DeriveKey
193
+ DONE C_SeedRandom
194
+ DONE C_GenerateRandom
195
+ N/A C_GetFunctionStatus legacy function
196
+ N/A C_CancelFunction legacy function
197
+ DONE C_WaitForSlotEvent
198
+
199
+ == Authors
200
+ * Ryosuke Kutsuna <ryosuke@deer-n-horse.jp>
201
+ * GOTOU Yuuzou <gotoyuzo@notwork.org>
202
+ * Lars Kanis <kanis@comcard.de>
203
+
204
+ == Copying
205
+ See MIT-LICENSE included in the package.
@@ -0,0 +1,111 @@
1
+ # -*- coding: utf-8 -*-
2
+ # -*- ruby -*-
3
+
4
+ require 'rubygems'
5
+ require 'hoe'
6
+ require 'rake/extensiontask'
7
+ require 'rbconfig'
8
+
9
+ GENERATED_FILES = [
10
+ 'ext/pk11_struct_impl.inc',
11
+ 'ext/pk11_struct_def.inc',
12
+ 'ext/pk11_const_def.inc',
13
+ 'ext/pk11_struct.doc',
14
+ 'ext/pk11_thread_funcs.h',
15
+ 'ext/pk11_thread_funcs.c',
16
+ ]
17
+
18
+ CLEAN.include GENERATED_FILES
19
+ CLEAN.include 'lib/pkcs11_ext.so'
20
+ CLEAN.include 'tmp'
21
+
22
+ hoe = Hoe.spec 'pkcs11' do
23
+ developer('Ryosuke Kutsuna', 'ryosuke@deer-n-horse.jp')
24
+ developer('GOTOU Yuuzou', 'gotoyuzo@notwork.org')
25
+ developer('Lars Kanis', 'kanis@comcard.de')
26
+ extra_dev_deps << ['yard', '>= 0.6']
27
+ extra_dev_deps << ['rake-compiler', '>= 0.7']
28
+
29
+ self.urls = ['http://github.com/larskanis/pkcs11']
30
+ self.summary = 'PKCS#11 binding for Ruby'
31
+ self.description = 'This module allows Ruby programs to interface with "RSA Security Inc. PKCS #11 Cryptographic Token Interface (Cryptoki)".'
32
+
33
+ self.readme_file = 'README.rdoc'
34
+ self.extra_rdoc_files << self.readme_file << 'ext/pk11.c'
35
+ spec_extras[:extensions] = 'ext/extconf.rb'
36
+ spec_extras[:files] = File.read_utf("Manifest.txt").split(/\r?\n\r?/).reject{|f| f=~/^pkcs11_/ }
37
+ spec_extras[:files] += GENERATED_FILES
38
+ spec_extras[:has_rdoc] = 'yard'
39
+ self.rdoc_locations << "larskanis@rack.rubyforge.org:/var/www/gforge-projects/pkcs11/pkcs11/"
40
+ end
41
+
42
+ ENV['RUBY_CC_VERSION'] ||= '1.8.7:1.9.3:2.0.0'
43
+
44
+ Rake::ExtensionTask.new('pkcs11_ext', hoe.spec) do |ext|
45
+ ext.ext_dir = 'ext'
46
+ ext.cross_compile = true # enable cross compilation (requires cross compile toolchain)
47
+ ext.cross_platform = ['i386-mingw32', 'x64-mingw32'] # forces the Windows platform instead of the default one
48
+ end
49
+
50
+ file 'ext/extconf.rb' => ['ext/pk11_struct_def.inc', 'ext/pk11_thread_funcs.c']
51
+ file 'ext/pk11_struct_def.inc' => 'ext/generate_structs.rb' do
52
+ sh "#{RbConfig::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"
53
+ end
54
+ file 'ext/pk11_struct_impl.inc' => 'ext/pk11_struct_def.inc'
55
+ file 'ext/pk11_struct.doc' => 'ext/pk11_struct_def.inc'
56
+
57
+ file 'ext/pk11_const_def.inc' => 'ext/generate_constants.rb' do
58
+ sh "#{RbConfig::CONFIG['ruby_install_name']} ext/generate_constants.rb --const ext/pk11_const_def.inc ext/include/pkcs11t.h"
59
+ end
60
+ file 'ext/pk11.c' => ['ext/pk11_struct_def.inc', 'ext/pk11_struct_impl.inc', 'ext/pk11_struct_macros.h']
61
+ file 'ext/pk11_const.c' => ['ext/pk11_const_def.inc', 'ext/pk11_const_macros.h']
62
+
63
+ file 'ext/pk11_thread_funcs.h' => 'ext/generate_thread_funcs.rb' do
64
+ sh "#{RbConfig::CONFIG['ruby_install_name']} ext/generate_thread_funcs.rb --impl ext/pk11_thread_funcs.c --decl ext/pk11_thread_funcs.h ext/include/pkcs11f.h"
65
+ end
66
+ file 'ext/pk11_thread_funcs.c' => 'ext/pk11_thread_funcs.h'
67
+ file 'ext/pk11.h' => 'ext/pk11_thread_funcs.h'
68
+
69
+ task 'copy:pkcs11_ext:i386-mingw32:1.9.3' do |t|
70
+ sh "i686-w64-mingw32-strip -S tmp/i386-mingw32/stage/lib/1.9/pkcs11_ext.so"
71
+ end
72
+ task 'copy:pkcs11_ext:i386-mingw32:2.0.0' do |t|
73
+ sh "i686-w64-mingw32-strip -S tmp/i386-mingw32/stage/lib/2.0/pkcs11_ext.so"
74
+ end
75
+ task 'copy:pkcs11_ext:x64-mingw32:2.0.0' do |t|
76
+ sh "x86_64-w64-mingw32-strip -S tmp/x64-mingw32/stage/lib/2.0/pkcs11_ext.so"
77
+ end
78
+
79
+
80
+ task :docs_of_vendor_extensions do
81
+ Dir['pkcs11_*'].each do |dir|
82
+ chdir(dir) do
83
+ sh "rake doc_files"
84
+ end
85
+ end
86
+ end
87
+
88
+ desc "Generate static HTML documentation with YARD"
89
+ task :yardoc=>['ext/pk11_struct.doc', :docs_of_vendor_extensions] do
90
+ 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 - pkcs11_protect_server/README_PROTECT_SERVER.rdoc"
91
+ end
92
+
93
+ desc "Publish YARD to wherever you want."
94
+ task :publish_yard => [:yardoc] do
95
+ rdoc_locations = hoe.rdoc_locations
96
+ warn "no rdoc_location values" if rdoc_locations.empty?
97
+ rdoc_locations.each do |dest|
98
+ sh %{rsync -av --delete doc/ #{dest}}
99
+ end
100
+ end
101
+
102
+ # RDoc-upload task for github (currently on rubyforge)
103
+ #
104
+ # require 'grancher/task'
105
+ # Grancher::Task.new do |g|
106
+ # g.branch = 'gh-pages' # alternatively, g.refspec = 'ghpages:/refs/heads/ghpages'
107
+ # g.push_to = 'origin'
108
+ # g.directory 'doc'
109
+ # end
110
+
111
+ # vim: syntax=ruby