YubiRuby 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/test/tc_hex.rb ADDED
@@ -0,0 +1,29 @@
1
+
2
+ class TestHex < Test::Unit::TestCase
3
+ def test_string
4
+ str = "ciao\n"
5
+ hex = "6369616f0a"
6
+ assert_equal(YubiRuby::HEX.encode(str), hex)
7
+ assert_equal(YubiRuby::HEX.decode(hex), str)
8
+ end
9
+
10
+ def test_reversible_operation
11
+ str = "ciao\n"
12
+ hex = "6369616f0a"
13
+ assert_equal(YubiRuby::HEX.decode(YubiRuby::HEX.encode(str)), str)
14
+ assert_equal(YubiRuby::HEX.encode(YubiRuby::HEX.decode(hex)), hex)
15
+ end
16
+
17
+ def test_no_hex_encoded_exception
18
+ assert_raise YubiRuby::NoHexEncodedError do YubiRuby::HEX.decode('a') end
19
+ assert_raise YubiRuby::NoHexEncodedError do YubiRuby::HEX.decode('zebr') end
20
+ assert_raise YubiRuby::NoHexEncodedError do YubiRuby::HEX.decode('!af5') end
21
+ assert_raise YubiRuby::NoHexEncodedError do YubiRuby::HEX.decode('0x12ff') end
22
+ assert !YubiRuby::HEX.hex?('a')
23
+ assert !YubiRuby::HEX.hex?('zebr')
24
+ assert !YubiRuby::HEX.hex?('!af5')
25
+ assert !YubiRuby::HEX.hex?('0x12ff')
26
+ assert YubiRuby::HEX.hex?('7af5')
27
+ assert YubiRuby::HEX.hex?('12fF')
28
+ end
29
+ end
data/test/tc_modhex.rb ADDED
@@ -0,0 +1,36 @@
1
+ class TestModHex < Test::Unit::TestCase
2
+ def test_string
3
+ str = "pippo234strd"
4
+ assert_equal(enc = str.modhex_encode, YubiRuby::ModHex.encode(str))
5
+ assert_equal(enc.modhex_decode, YubiRuby::ModHex.decode(enc))
6
+ assert_equal(str, str.modhex_encode().modhex_decode())
7
+ assert(enc.modhex?)
8
+ end
9
+
10
+ def test_reversible_operation
11
+ str = "test"
12
+ hex = "ifhgieif"
13
+ assert(hex.modhex?)
14
+ assert_equal(YubiRuby::ModHex.decode(YubiRuby::ModHex.encode(str)), str)
15
+ assert_equal(YubiRuby::ModHex.encode(YubiRuby::ModHex.decode(hex)), hex)
16
+ end
17
+
18
+ def test_no_modhex_encoded_exception
19
+ assert !YubiRuby::ModHex.modhex?('a')
20
+ assert !YubiRuby::ModHex.modhex?('zebr')
21
+ assert !YubiRuby::ModHex.modhex?('!af5')
22
+ assert !YubiRuby::ModHex.modhex?('0x12ff')
23
+ assert YubiRuby::ModHex.modhex?('ifhgieif')
24
+ assert YubiRuby::ModHex.modhex?('ichkicichv')
25
+ assert_raise YubiRuby::NoModHexEncodedError do YubiRuby::ModHex.decode('a') end
26
+ assert_raise YubiRuby::NoModHexEncodedError do YubiRuby::ModHex.decode('zebr') end
27
+ assert_raise YubiRuby::NoModHexEncodedError do YubiRuby::ModHex.decode('!af5') end
28
+ assert_raise YubiRuby::NoModHexEncodedError do YubiRuby::ModHex.decode('0x12ff') end
29
+ end
30
+
31
+ def test_length
32
+ otp = 'dbkutdgrnlvrhdiregebvkkrgtuefjru'
33
+ assert_equal(32, otp.size)
34
+ assert_equal(16, otp.modhex_decode.size)
35
+ end
36
+ end
@@ -0,0 +1,8 @@
1
+ require 'path_loader'
2
+
3
+ require "test/unit"
4
+
5
+ require "tc_modhex"
6
+ require "tc_hex"
7
+ require "tc_crc16"
8
+ require "tc_fake_yubikey"
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: YubiRuby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 0
8
+ - 0
9
+ version: 1.0.0
5
10
  platform: ruby
6
11
  authors:
7
12
  - Alessio Caiazza
@@ -9,10 +14,58 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-02-03 00:00:00 +01:00
17
+ date: 2010-03-21 00:00:00 +01:00
13
18
  default_executable:
14
- dependencies: []
15
-
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: ruby-aes-normal
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 1
29
+ - 0
30
+ version: "1.0"
31
+ type: :runtime
32
+ version_requirements: *id001
33
+ - !ruby/object:Gem::Dependency
34
+ name: bit-struct
35
+ prerelease: false
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ segments:
41
+ - 0
42
+ version: "0"
43
+ type: :runtime
44
+ version_requirements: *id002
45
+ - !ruby/object:Gem::Dependency
46
+ name: yard
47
+ prerelease: false
48
+ requirement: &id003 !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ segments:
53
+ - 0
54
+ version: "0"
55
+ type: :development
56
+ version_requirements: *id003
57
+ - !ruby/object:Gem::Dependency
58
+ name: rspec
59
+ prerelease: false
60
+ requirement: &id004 !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ segments:
65
+ - 0
66
+ version: "0"
67
+ type: :development
68
+ version_requirements: *id004
16
69
  description: |
17
70
  Yubikey integration -
18
71
 
@@ -48,6 +101,7 @@ description: |
48
101
  email: nolith@abisso.org
49
102
  executables:
50
103
  - modhex
104
+ - yubikey
51
105
  extensions:
52
106
  - ext/libyubikey/extconf.rb
53
107
  extra_rdoc_files:
@@ -55,6 +109,7 @@ extra_rdoc_files:
55
109
  - LICENSE
56
110
  - README
57
111
  - bin/modhex
112
+ - bin/yubikey
58
113
  - ext/libyubikey/extconf.rb
59
114
  - ext/libyubikey/libyubikey.c
60
115
  - ext/libyubikey/ykaes.c
@@ -63,16 +118,19 @@ extra_rdoc_files:
63
118
  - ext/libyubikey/ykmodhex.c
64
119
  - ext/libyubikey/ykparse.c
65
120
  - ext/libyubikey/yubikey.h
121
+ - lib/exceptions.rb
122
+ - lib/fake_yubikey.rb
66
123
  - lib/hex.rb
67
124
  - lib/yubiruby.rb
125
+ - tasks/yard_doc.rake
68
126
  files:
69
127
  - CHANGELOG
70
128
  - LICENSE
71
129
  - Manifest
72
130
  - README
73
131
  - Rakefile
74
- - YubiRuby.gemspec
75
132
  - bin/modhex
133
+ - bin/yubikey
76
134
  - ext/libyubikey/extconf.rb
77
135
  - ext/libyubikey/libyubikey.c
78
136
  - ext/libyubikey/ykaes.c
@@ -81,10 +139,21 @@ files:
81
139
  - ext/libyubikey/ykmodhex.c
82
140
  - ext/libyubikey/ykparse.c
83
141
  - ext/libyubikey/yubikey.h
142
+ - lib/exceptions.rb
143
+ - lib/fake_yubikey.rb
84
144
  - lib/hex.rb
85
145
  - lib/yubiruby.rb
86
- - tests/tc_modhex.rb
87
- - tests/ts_yubiruby.rb
146
+ - tasks/yard_doc.rake
147
+ - test/fake_yubikey_spec.rb
148
+ - test/hex_spec.rb
149
+ - test/modhex_spec.rb
150
+ - test/path_loader.rb
151
+ - test/tc_crc16.rb
152
+ - test/tc_fake_yubikey.rb
153
+ - test/tc_hex.rb
154
+ - test/tc_modhex.rb
155
+ - test/test_helper.rb
156
+ - YubiRuby.gemspec
88
157
  has_rdoc: true
89
158
  homepage: http://bitbucket.org/nolith/yubiruby
90
159
  licenses: []
@@ -104,20 +173,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
104
173
  requirements:
105
174
  - - ">="
106
175
  - !ruby/object:Gem::Version
176
+ segments:
177
+ - 0
107
178
  version: "0"
108
- version:
109
179
  required_rubygems_version: !ruby/object:Gem::Requirement
110
180
  requirements:
111
181
  - - ">="
112
182
  - !ruby/object:Gem::Version
183
+ segments:
184
+ - 1
185
+ - 2
113
186
  version: "1.2"
114
- version:
115
187
  requirements: []
116
188
 
117
189
  rubyforge_project: yubiruby
118
- rubygems_version: 1.3.5
190
+ rubygems_version: 1.3.6
119
191
  signing_key:
120
192
  specification_version: 3
121
193
  summary: "Yubikey integration - Includes Prototypes for low-level Yubikey OTP functions witten by Simon Josefsson <simon@josefsson.org>. Copyright (c) 2006, 2007, 2008, 2009 Yubico AB All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
122
- test_files: []
123
-
194
+ test_files:
195
+ - test/test_helper.rb
data/tests/tc_modhex.rb DELETED
@@ -1,13 +0,0 @@
1
- require "test/unit"
2
-
3
- require "libyubikey"
4
-
5
- class TestLibyubikey < Test::Unit::TestCase
6
- def test_string
7
- str = "pippo234strd"
8
- assert_equal(enc = str.modhex_encode, YubiRuby::ModHex.encode(str))
9
- assert_equal(enc.modhex_decode, YubiRuby::ModHex.decode(enc))
10
- assert_equal(str, str.modhex_encode().modhex_decode())
11
- assert(enc.modhex?)
12
- end
13
- end