webmoney 0.0.14 → 0.0.15.pre
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/ChangeLog +15 -0
- data/README.md +13 -1
- data/VERSION +1 -1
- data/lib/signer.rb +128 -0
- data/lib/webmoney.rb +22 -10
- data/rakefile +2 -11
- data/spec/benchmark.rb +12 -0
- data/spec/spec_helper.rb +6 -27
- data/spec/unit/interfaces_spec.rb +2 -2
- data/webmoney.gemspec +6 -21
- metadata +10 -24
- data/ext/wmsigner/base64.cpp +0 -144
- data/ext/wmsigner/base64.h +0 -48
- data/ext/wmsigner/cmdbase.cpp +0 -417
- data/ext/wmsigner/cmdbase.h +0 -111
- data/ext/wmsigner/crypto.cpp +0 -155
- data/ext/wmsigner/crypto.h +0 -17
- data/ext/wmsigner/extconf.rb +0 -17
- data/ext/wmsigner/md4.cpp +0 -192
- data/ext/wmsigner/md4.h +0 -41
- data/ext/wmsigner/rsalib1.cpp +0 -838
- data/ext/wmsigner/rsalib1.h +0 -81
- data/ext/wmsigner/signer.cpp +0 -309
- data/ext/wmsigner/signer.h +0 -63
- data/ext/wmsigner/stdafx.cpp +0 -8
- data/ext/wmsigner/stdafx.h +0 -33
- data/ext/wmsigner/wmsigner.cpp +0 -117
data/ext/wmsigner/stdafx.cpp
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
// stdafx.cpp : source file that includes just the standard includes
|
2
|
-
// wmsigner.pch will be the pre-compiled header
|
3
|
-
// stdafx.obj will contain the pre-compiled type information
|
4
|
-
|
5
|
-
#include "stdafx.h"
|
6
|
-
|
7
|
-
// TODO: reference any additional headers you need in STDAFX.H
|
8
|
-
// and not in this file
|
data/ext/wmsigner/stdafx.h
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
// stdafx.h : include file for standard system include files,
|
2
|
-
// or project specific include files that are used frequently, but
|
3
|
-
// are changed infrequently
|
4
|
-
//
|
5
|
-
|
6
|
-
// REMOVE COMMENT FOR DEBUG MODE
|
7
|
-
//#ifndef _DEBUG
|
8
|
-
//#define _DEBUG
|
9
|
-
//#endif
|
10
|
-
|
11
|
-
|
12
|
-
#include <stdio.h>
|
13
|
-
#include <stdlib.h>
|
14
|
-
#include <string.h>
|
15
|
-
#include <sys/types.h>
|
16
|
-
#include <errno.h>
|
17
|
-
#ifdef _WIN32
|
18
|
-
#pragma once
|
19
|
-
#include <iostream>
|
20
|
-
#include <tchar.h>
|
21
|
-
#include <windows.h>
|
22
|
-
#include <io.h>
|
23
|
-
#include <memory.h>
|
24
|
-
#pragma warning(disable : 4996)
|
25
|
-
#endif
|
26
|
-
// TODO: reference additional headers your program requires here
|
27
|
-
#ifndef TRUE
|
28
|
-
#define TRUE 1
|
29
|
-
#endif
|
30
|
-
#ifndef FALSE
|
31
|
-
#define FALSE 0
|
32
|
-
#endif
|
33
|
-
|
data/ext/wmsigner/wmsigner.cpp
DELETED
@@ -1,117 +0,0 @@
|
|
1
|
-
// Include the Ruby headers and goodies
|
2
|
-
#include <stdlib.h>
|
3
|
-
#include <ctype.h>
|
4
|
-
#include "ruby.h"
|
5
|
-
#include "signer.h"
|
6
|
-
#include "base64.h"
|
7
|
-
#include "cmdbase.h"
|
8
|
-
|
9
|
-
#define ASCII_SIZE 512
|
10
|
-
#define BUF_64_SIZE 220
|
11
|
-
|
12
|
-
// Defining a space for information and references about the module to be stored internally
|
13
|
-
VALUE cSigner;
|
14
|
-
|
15
|
-
typedef VALUE (ruby_method)(...);
|
16
|
-
|
17
|
-
// Prototype for the initialization method - Ruby calls this, not you
|
18
|
-
//extern "C" void Init_Wmutils();
|
19
|
-
|
20
|
-
// Prototype for our method 'test1' - methods are prefixed by 'method_' here
|
21
|
-
// typedef VALUE method_test1(VALUE self);
|
22
|
-
// typedef VALUE initialize(VALUE self, const char *szWMID, const char *szPwd, const char *szKeyData);
|
23
|
-
|
24
|
-
//Signer *pSign;
|
25
|
-
|
26
|
-
void signer_free(Signer *p)
|
27
|
-
{
|
28
|
-
if (p)
|
29
|
-
delete p;
|
30
|
-
}
|
31
|
-
|
32
|
-
bool IsWmid(const char* sz)
|
33
|
-
{
|
34
|
-
int len = strlen(sz);
|
35
|
-
if (len != 12) return false;
|
36
|
-
for(int i = 0; i < len; i++)
|
37
|
-
{
|
38
|
-
if (!isdigit(sz[i]))
|
39
|
-
return false;
|
40
|
-
}
|
41
|
-
return true;
|
42
|
-
}
|
43
|
-
|
44
|
-
extern "C" VALUE signer_new(VALUE self, VALUE szWMID, VALUE szPwd, VALUE szKeyData64)
|
45
|
-
{
|
46
|
-
Signer *pSign;
|
47
|
-
|
48
|
-
if(NIL_P(szWMID)) rb_raise(rb_eArgError, "nil wmid");
|
49
|
-
|
50
|
-
// check WMID
|
51
|
-
if (! IsWmid(RSTRING_PTR(szWMID))) rb_raise(rb_eArgError, "Incorrect WMID");
|
52
|
-
|
53
|
-
if(NIL_P(szPwd)) rb_raise(rb_eArgError, "nil password");
|
54
|
-
|
55
|
-
if(NIL_P(szKeyData64)) rb_raise(rb_eArgError, "nil key");
|
56
|
-
|
57
|
-
// check base64 data
|
58
|
-
if ( RSTRING_LEN(szKeyData64) != 220 ) rb_raise(rb_eArgError, "Illegal size for base64 keydata");
|
59
|
-
|
60
|
-
char KeyBuffer[ASCII_SIZE];
|
61
|
-
int bytes = code64( ENCODE, KeyBuffer, ASCII_SIZE, RSTRING_PTR(szKeyData64), BUF_64_SIZE );
|
62
|
-
|
63
|
-
// check encoded key
|
64
|
-
if ( bytes != 164) rb_raise(rb_eArgError, "Illegal size for keydata");
|
65
|
-
|
66
|
-
pSign = new Signer(RSTRING_PTR(szWMID), RSTRING_PTR(szPwd), "");
|
67
|
-
VALUE tdata = Data_Wrap_Struct(self, 0, signer_free, pSign);
|
68
|
-
|
69
|
-
pSign->isIgnoreKeyFile = TRUE;
|
70
|
-
pSign->Key64Flag = TRUE;
|
71
|
-
|
72
|
-
if (pSign) pSign->SetKeyFromCL( TRUE, KeyBuffer );
|
73
|
-
|
74
|
-
return tdata;
|
75
|
-
}
|
76
|
-
|
77
|
-
extern "C" VALUE signer_init(VALUE self)
|
78
|
-
{
|
79
|
-
return self;
|
80
|
-
}
|
81
|
-
|
82
|
-
extern "C" VALUE signer_sign(VALUE self, VALUE szIn)
|
83
|
-
{
|
84
|
-
VALUE ret;
|
85
|
-
ret = rb_str_new2("");
|
86
|
-
|
87
|
-
Signer *pSign;
|
88
|
-
|
89
|
-
Data_Get_Struct(self, Signer, pSign);
|
90
|
-
|
91
|
-
if(NIL_P(szIn)) rb_raise(rb_eArgError, "nil for sign");
|
92
|
-
|
93
|
-
if (pSign)
|
94
|
-
{
|
95
|
-
szptr szSign;
|
96
|
-
if (pSign->Sign(RSTRING_PTR(szIn), szSign))
|
97
|
-
{
|
98
|
-
ret = rb_str_new2((char *)(const char *)szSign);
|
99
|
-
}
|
100
|
-
}
|
101
|
-
|
102
|
-
int err_no = pSign->ErrorCode();
|
103
|
-
if (err_no){
|
104
|
-
rb_raise(rb_eStandardError, "Signer error: %d", err_no);
|
105
|
-
}
|
106
|
-
|
107
|
-
return ret;
|
108
|
-
}
|
109
|
-
|
110
|
-
// The initialization method for this module
|
111
|
-
extern "C" void Init_wmsigner()
|
112
|
-
{
|
113
|
-
cSigner = rb_define_class("Signer", rb_cObject);
|
114
|
-
rb_define_singleton_method(cSigner, "new", (ruby_method*) &signer_new, 3);
|
115
|
-
rb_define_method(cSigner, "initialize", (ruby_method*) &signer_init, 0);
|
116
|
-
rb_define_method(cSigner, "sign", (ruby_method*) &signer_sign, 1);
|
117
|
-
}
|