ECToken 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ext/ECToken/ECToken.c +1 -65
- data/lib/ECToken/version.rb +1 -1
- metadata +40 -21
data/ext/ECToken/ECToken.c
CHANGED
@@ -156,68 +156,4 @@ static VALUE encrypt(VALUE self, VALUE k, VALUE t) {
|
|
156
156
|
void Init_ECToken(void) {
|
157
157
|
VALUE klass = rb_define_class("EdgeCastToken", rb_cObject);
|
158
158
|
rb_define_singleton_method(klass, "encrypt", encrypt, 2);
|
159
|
-
}
|
160
|
-
|
161
|
-
/*int main(int argc, char **argv)
|
162
|
-
{
|
163
|
-
if (argc < 3)
|
164
|
-
{
|
165
|
-
printf("Usage: ec_encrpyt <key> <text>\n");
|
166
|
-
exit(0);
|
167
|
-
}
|
168
|
-
|
169
|
-
char *key = argv[1];
|
170
|
-
char *string = argv[2];
|
171
|
-
char estr[kMAX_TOKEN_LENGTH*4];
|
172
|
-
|
173
|
-
if (strlen(string)+1 > kMAX_TOKEN_LENGTH) // this line should protect us from the sprintf
|
174
|
-
{
|
175
|
-
int token_length = kMAX_TOKEN_LENGTH;
|
176
|
-
printf("Only max of %i char is allowed\n", token_length);
|
177
|
-
exit(0);
|
178
|
-
}
|
179
|
-
|
180
|
-
// For backward compatibility, check if somebody already passed in ec_secure=1
|
181
|
-
|
182
|
-
// search for ec_secure in string
|
183
|
-
// delete any previous instance of ec_secure=1 that resides within the string
|
184
|
-
// this application will now prepend ec_secure=LENGTH_OF_STRING
|
185
|
-
// so a valid string may end up being encrypted as ec_secure=033&ec_clientip=1.1.1.1
|
186
|
-
char* ecsecure_check_ptr = strstr(string, "ec_secure=1");
|
187
|
-
|
188
|
-
// buffer we will hold the new modified string
|
189
|
-
char newBuff[(kMAX_TOKEN_LENGTH*2)-1];
|
190
|
-
memset(newBuff,0,sizeof(newBuff));
|
191
|
-
|
192
|
-
if(ecsecure_check_ptr > 0) // we found ec_secure within the string
|
193
|
-
{
|
194
|
-
if(string == ecsecure_check_ptr)
|
195
|
-
strcpy(newBuff,ecsecure_check_ptr+=12); // found at beginning, skip over and copy the rest of the string
|
196
|
-
else // it's somewhere else in the string, scrub it out
|
197
|
-
{
|
198
|
-
*ecsecure_check_ptr = 0; // break the string into two parts, first string null terminate where we found ec_secure
|
199
|
-
sprintf(newBuff,"%s%s", string,ecsecure_check_ptr+11);
|
200
|
-
// above we combine what was before ec_secure with what is after ec_secure's start position plus 11 octets
|
201
|
-
}
|
202
|
-
}
|
203
|
-
else // there was no ec_secure found within the string, so we just copy the string
|
204
|
-
strcpy(newBuff,string);
|
205
|
-
|
206
|
-
// setup the buffer we will pass off to blowfish
|
207
|
-
char newbuffer[(kMAX_TOKEN_LENGTH*2)-1];
|
208
|
-
memset(newbuffer,0,sizeof(newbuffer));
|
209
|
-
// prepend with ec_secure=032, for example
|
210
|
-
sprintf(newbuffer, "ec_secure=%03d&%s",(int)(strlen(newBuff)+14), newBuff);
|
211
|
-
|
212
|
-
// encrypt the new buffer
|
213
|
-
bfencrypt((unsigned char*)key, strlen(key), (unsigned char*)newbuffer,
|
214
|
-
(unsigned char*)estr, strlen(newbuffer)+1);
|
215
|
-
|
216
|
-
// convert to hex string
|
217
|
-
for(unsigned int i=0; i<strlen(newbuffer); i++)
|
218
|
-
printf("%02x",estr[i]&0xff);
|
219
|
-
printf("\n");
|
220
|
-
|
221
|
-
return 0;
|
222
|
-
}*/
|
223
|
-
|
159
|
+
}
|
data/lib/ECToken/version.rb
CHANGED
metadata
CHANGED
@@ -1,50 +1,69 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: ECToken
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Darren Fung
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
17
|
+
|
18
|
+
date: 2012-06-20 00:00:00 Z
|
13
19
|
dependencies: []
|
20
|
+
|
14
21
|
description: Encrypts using BF-CFB
|
15
|
-
email:
|
22
|
+
email:
|
16
23
|
- darren@tunezy.com
|
17
24
|
executables: []
|
18
|
-
|
25
|
+
|
26
|
+
extensions:
|
19
27
|
- ext/ECToken/extconf.rb
|
20
28
|
extra_rdoc_files: []
|
21
|
-
|
29
|
+
|
30
|
+
files:
|
22
31
|
- lib/ECToken/version.rb
|
23
32
|
- lib/ECToken.rb
|
24
33
|
- ext/ECToken/ECToken.c
|
25
34
|
- ext/ECToken/extconf.rb
|
26
|
-
homepage:
|
35
|
+
homepage: ""
|
27
36
|
licenses: []
|
37
|
+
|
28
38
|
post_install_message:
|
29
39
|
rdoc_options: []
|
30
|
-
|
40
|
+
|
41
|
+
require_paths:
|
31
42
|
- lib
|
32
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
33
44
|
none: false
|
34
|
-
requirements:
|
35
|
-
- -
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
|
38
|
-
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
hash: 3
|
49
|
+
segments:
|
50
|
+
- 0
|
51
|
+
version: "0"
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
39
53
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
44
61
|
requirements: []
|
62
|
+
|
45
63
|
rubyforge_project: ECToken
|
46
|
-
rubygems_version: 1.8.
|
64
|
+
rubygems_version: 1.8.17
|
47
65
|
signing_key:
|
48
66
|
specification_version: 3
|
49
67
|
summary: Encrypts using BF-CFB
|
50
68
|
test_files: []
|
69
|
+
|