cyberplat_pki_patched 1.0.1
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.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/.travis.yml +7 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +47 -0
- data/Rakefile +1 -0
- data/cyberplat_pki.gemspec +25 -0
- data/ext/libipriv-linux32.so +0 -0
- data/ext/libipriv.dylib +0 -0
- data/ext/libipriv32.dll +0 -0
- data/ext/mock_the_clock/.gitignore +1 -0
- data/ext/mock_the_clock/Makefile +2 -0
- data/ext/mock_the_clock/extconf.rb +1 -0
- data/ext/mock_the_clock/mock_the_clock.c +53 -0
- data/lib/cyberplat_pki.rb +10 -0
- data/lib/cyberplat_pki/key.rb +78 -0
- data/lib/cyberplat_pki/library.rb +104 -0
- data/spec/key_spec.rb +77 -0
- data/spec/keys/pubkeys.key +28 -0
- data/spec/keys/secret.key +15 -0
- data/spec/spec_helper.rb +39 -0
- data/vendor/linux.zip +0 -0
- data/vendor/win32.zip +0 -0
- metadata +100 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a40e40d759da85dce828aa8094e4834c11b5f8c0efebc60a8126658e4820372b
|
4
|
+
data.tar.gz: c73ebbf61202f3b10c5c6a18d44f983b002310b18eb87ca6bf0a2a850b2581d1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a805cc089c2729dee89d66f209ef79e01ef2af9f7ff4476e44777e3ea3e62f1312dd7a796e3584c3ab8034203ea29b5d8e0861426758119fb07d7b56341f7a5b
|
7
|
+
data.tar.gz: 33a1f5db5fa6d6f6b2754d7b84c1a29f217fc7e5962bad4173aa1acb7959bd25ceed783aa44a074d24e8a7672b12484eff2c5c028fc303e904cd82d7a3ffd336
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Peter Zotov <whitequark@whitequark.org>
|
2
|
+
|
3
|
+
MIT License
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# CyberplatPKI
|
2
|
+
|
3
|
+
CyberplatPKI is an FFI binding for signing Cyberplat requests. It includes both Linux and Windows versions of Cyberplat-provided library as well as the necessary wrapping code.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'cyberplat_pki'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install cyberplat_pki
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
To sign:
|
22
|
+
|
23
|
+
``` ruby
|
24
|
+
privkey_serialized = File.read("private.key")
|
25
|
+
privkey = CyberplatPKI::Key.new_private(privkey_serialized, 'passphrase')
|
26
|
+
|
27
|
+
signed_data = privkey.sign(data)
|
28
|
+
```
|
29
|
+
|
30
|
+
To verify:
|
31
|
+
|
32
|
+
``` ruby
|
33
|
+
pubkey_serialized = File.read("public.key")
|
34
|
+
pubkey = CyberplatPKI::Key.new_public(pubkey_serialized, 12345) # serial = 12345
|
35
|
+
|
36
|
+
pubkey.verify(signed_data) # => true
|
37
|
+
```
|
38
|
+
|
39
|
+
Note that the library uses Windows line endings (`\r\n`) internally. You must not touch those, or the library will fail. Treat the signed data as binary, or make sure to restore the expected line endings.
|
40
|
+
|
41
|
+
## Contributing
|
42
|
+
|
43
|
+
1. Fork it
|
44
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
45
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
46
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
47
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.name = "cyberplat_pki_patched"
|
7
|
+
gem.version = "1.0.1"
|
8
|
+
gem.authors = ["Evgeniy Burdaev"]
|
9
|
+
gem.email = ["inqify@gmail.com"]
|
10
|
+
gem.description = %q{CyberplatPKI is an FFI binding for signing Cyberplat requests. Patched fork.}
|
11
|
+
gem.summary = gem.description
|
12
|
+
gem.homepage = "http://github.com/whitequark/cyberplat_pki"
|
13
|
+
|
14
|
+
gem.files = `git ls-files`.split($/)
|
15
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
16
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
17
|
+
gem.require_paths = ["lib"]
|
18
|
+
|
19
|
+
if RUBY_PLATFORM =~ /linux/
|
20
|
+
gem.extensions = ["ext/mock_the_clock/extconf.rb"]
|
21
|
+
end
|
22
|
+
|
23
|
+
gem.add_dependency "ffi"
|
24
|
+
gem.add_development_dependency "rspec"
|
25
|
+
end
|
Binary file
|
data/ext/libipriv.dylib
ADDED
Binary file
|
data/ext/libipriv32.dll
ADDED
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
*.so
|
@@ -0,0 +1 @@
|
|
1
|
+
system "make"
|
@@ -0,0 +1,53 @@
|
|
1
|
+
#include <string.h>
|
2
|
+
#include <assert.h>
|
3
|
+
#include <sys/time.h>
|
4
|
+
#include <time.h>
|
5
|
+
#include <dlfcn.h>
|
6
|
+
|
7
|
+
/* Remember, remember the fifth of November! 2005-11-05 00:00 UTC. */
|
8
|
+
#define TIMESTAMP 1131148800
|
9
|
+
|
10
|
+
int gettimeofday(struct timeval *tv, struct timezone *tz)
|
11
|
+
{
|
12
|
+
if(tv) {
|
13
|
+
tv->tv_sec = TIMESTAMP;
|
14
|
+
tv->tv_usec = 0;
|
15
|
+
}
|
16
|
+
|
17
|
+
if(tz) {
|
18
|
+
tz->tz_minuteswest = 0;
|
19
|
+
tz->tz_dsttime = 0;
|
20
|
+
}
|
21
|
+
|
22
|
+
return 0;
|
23
|
+
}
|
24
|
+
|
25
|
+
time_t time(time_t *t)
|
26
|
+
{
|
27
|
+
if(t) {
|
28
|
+
*t = TIMESTAMP;
|
29
|
+
}
|
30
|
+
|
31
|
+
return TIMESTAMP;
|
32
|
+
}
|
33
|
+
|
34
|
+
int clock_gettime(clockid_t clk_id, struct timespec *tp) {
|
35
|
+
static int (*original)(clockid_t clk_id, struct timespec *tp);
|
36
|
+
|
37
|
+
if(original == NULL) {
|
38
|
+
void *hndl = dlopen("librt.so.1", RTLD_LAZY);
|
39
|
+
assert(hndl);
|
40
|
+
original = dlsym(hndl, "clock_gettime");
|
41
|
+
}
|
42
|
+
|
43
|
+
switch(clk_id) {
|
44
|
+
case CLOCK_REALTIME:
|
45
|
+
tp->tv_sec = TIMESTAMP;
|
46
|
+
tp->tv_nsec = 0;
|
47
|
+
|
48
|
+
return 0;
|
49
|
+
|
50
|
+
default:
|
51
|
+
return original(clk_id, tp);
|
52
|
+
}
|
53
|
+
}
|
@@ -0,0 +1,78 @@
|
|
1
|
+
module CyberplatPKI
|
2
|
+
class Key
|
3
|
+
attr_reader :internal
|
4
|
+
|
5
|
+
class << self
|
6
|
+
def new_private(source, password, engine=Library::DEFAULT_ENGINE)
|
7
|
+
internal = Library::Key.new
|
8
|
+
|
9
|
+
Library.invoke :OpenSecretKey,
|
10
|
+
engine,
|
11
|
+
source, source.length,
|
12
|
+
password,
|
13
|
+
internal
|
14
|
+
|
15
|
+
new(internal)
|
16
|
+
end
|
17
|
+
|
18
|
+
def new_public(source, serial, ca_key=nil, engine=Library::DEFAULT_ENGINE)
|
19
|
+
internal = Library::Key.new
|
20
|
+
|
21
|
+
if ca_key
|
22
|
+
ca_key = ca_key.internal
|
23
|
+
end
|
24
|
+
|
25
|
+
Library.invoke :OpenPublicKey,
|
26
|
+
engine,
|
27
|
+
source, source.length,
|
28
|
+
serial,
|
29
|
+
internal,
|
30
|
+
ca_key
|
31
|
+
|
32
|
+
new(internal)
|
33
|
+
end
|
34
|
+
|
35
|
+
private :new
|
36
|
+
end
|
37
|
+
|
38
|
+
def initialize(internal)
|
39
|
+
@internal = internal
|
40
|
+
if defined?(ObjectSpace) &&
|
41
|
+
ObjectSpace.respond_to?(:define_finalizer)
|
42
|
+
ObjectSpace.define_finalizer(self, lambda {
|
43
|
+
Library.invoke :CloseKey, internal
|
44
|
+
})
|
45
|
+
else
|
46
|
+
warn "No ObjectSpace.define_finalizer; Crypt_CloseKey will not be called."
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def sign(data)
|
51
|
+
# Be fucking optimistic. Someone, please teach the morons from
|
52
|
+
# cyberplat how to design APIs and document them.
|
53
|
+
# I sincerely hope this does not segfault in production.
|
54
|
+
result = FFI::MemoryPointer.new(:char, data.length + 1024)
|
55
|
+
|
56
|
+
result_length = Library.invoke :Sign,
|
57
|
+
data, data.size,
|
58
|
+
result, result.total,
|
59
|
+
@internal
|
60
|
+
|
61
|
+
result.read_string(result_length)
|
62
|
+
end
|
63
|
+
|
64
|
+
def verify(data_with_signature)
|
65
|
+
retval = Library.Crypt_Verify \
|
66
|
+
data_with_signature, data_with_signature.size,
|
67
|
+
nil, nil,
|
68
|
+
@internal
|
69
|
+
|
70
|
+
if retval == -20 # VERIFY
|
71
|
+
false
|
72
|
+
else
|
73
|
+
Library.handle_error("Crypt_Verify", retval)
|
74
|
+
true
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
require 'ffi'
|
2
|
+
|
3
|
+
module CyberplatPKI::Library
|
4
|
+
extend FFI::Library
|
5
|
+
|
6
|
+
ffi_lib File.expand_path('../../../ext/libipriv.dylib', __FILE__)
|
7
|
+
|
8
|
+
Errors = {
|
9
|
+
-1 => "BAD_ARGS",
|
10
|
+
-2 => "OUT_OF_MEMORY",
|
11
|
+
-3 => "INVALID_FORMAT",
|
12
|
+
-4 => "NO_DATA_FOUND",
|
13
|
+
-5 => "INVALID_PACKET_FORMAT",
|
14
|
+
-6 => "UNKNOWN_ALG",
|
15
|
+
-7 => "INVALID_KEYLEN",
|
16
|
+
-8 => "INVALID_PASSWD",
|
17
|
+
-9 => "DOCTYPE",
|
18
|
+
-10 => "RADIX_DECODE",
|
19
|
+
-11 => "RADIX_ENCODE",
|
20
|
+
-12 => "INVALID_ENG",
|
21
|
+
-13 => "ENG_NOT_READY",
|
22
|
+
-14 => "NOT_SUPPORT",
|
23
|
+
-15 => "FILE_NOT_FOUND",
|
24
|
+
-16 => "CANT_READ_FILE",
|
25
|
+
-17 => "INVALID_KEY",
|
26
|
+
-18 => "SEC_ENC",
|
27
|
+
-19 => "PUB_KEY_NOT_FOUND",
|
28
|
+
-20 => "VERIFY",
|
29
|
+
-21 => "CREATE_FILE",
|
30
|
+
-22 => "CANT_WRITE_FILE",
|
31
|
+
-23 => "INVALID_KEYCARD",
|
32
|
+
-24 => "GENKEY",
|
33
|
+
-25 => "PUB_ENC",
|
34
|
+
-26 => "SEC_DEC",
|
35
|
+
}
|
36
|
+
|
37
|
+
ENGINE_RSAREF = 0
|
38
|
+
ENGINE_OPENSSL = 1
|
39
|
+
ENGINE_PKCS11 = 2
|
40
|
+
ENGINE_WINCRYPT = 3
|
41
|
+
|
42
|
+
DEFAULT_ENGINE = ENGINE_RSAREF
|
43
|
+
|
44
|
+
ENGCMD_IS_READY = 0
|
45
|
+
ENGCMD_GET_ERROR = 1
|
46
|
+
ENGCMD_SET_PIN = 2
|
47
|
+
ENGCMD_SET_PKCS11_LIB = 3
|
48
|
+
ENGCMD_GET_PKCS11_SLOTS_NUM = 4
|
49
|
+
ENGCMD_GET_PKCS11_SLOT_NAME = 5
|
50
|
+
ENGCMD_SET_PKCS11_SLOT = 6
|
51
|
+
ENGCMD_ENUM_PKCS11_KEYS = 7
|
52
|
+
ENGCMD_ENUM_PKCS11_PUBKEYS = 8
|
53
|
+
|
54
|
+
KEY_TYPE_RSA_SECRET = 1
|
55
|
+
KEY_TYPE_RSA_PUBLIC = 2
|
56
|
+
|
57
|
+
MAX_USERID_LENGTH = 20
|
58
|
+
|
59
|
+
class Key < FFI::Struct
|
60
|
+
layout :eng, :short,
|
61
|
+
:type, :short,
|
62
|
+
:keyserial, :ulong,
|
63
|
+
:userid, [:char, 24],
|
64
|
+
:key, :pointer
|
65
|
+
end
|
66
|
+
|
67
|
+
# Only required functions are defined.
|
68
|
+
# For all functions, zero return code is success, nonzero is error.
|
69
|
+
|
70
|
+
# int Crypt_Initialize(void)
|
71
|
+
attach_function :Crypt_Initialize, [], :int
|
72
|
+
|
73
|
+
# int Crypt_OpenSecretKey(int eng, const char* src, int src_len, const char* password, IPRIV_KEY* key)
|
74
|
+
attach_function :Crypt_OpenSecretKey, [:int, :string, :int, :string, :pointer], :int
|
75
|
+
|
76
|
+
# int Crypt_OpenPublicKey(int eng, const char* src, int src_len, int keyserial, IPRIV_KEY* key, IPRIV_KEY* cakey)
|
77
|
+
attach_function :Crypt_OpenPublicKey, [:int, :string, :int, :int, :pointer, :pointer], :int
|
78
|
+
|
79
|
+
# int Crypt_Sign(const char* src, int src_len, char* dst, int dst_len, IPRIV_KEY* key);
|
80
|
+
attach_function :Crypt_Sign, [:string, :int, :pointer, :int, :pointer], :int
|
81
|
+
|
82
|
+
# int Crypt_Verify(const char* src, int src_len, const char** pdst, int* pndst,IPRIV_KEY* key);
|
83
|
+
attach_function :Crypt_Verify, [:string, :int, :pointer, :pointer, :pointer], :int
|
84
|
+
|
85
|
+
# int Crypt_CloseKey(IPRIV_KEY* key)
|
86
|
+
attach_function :Crypt_CloseKey, [:pointer], :int
|
87
|
+
|
88
|
+
# int Crypt_Done(void)
|
89
|
+
attach_function :Crypt_Done, [], :int
|
90
|
+
|
91
|
+
def self.handle_error(function, retval)
|
92
|
+
if retval < 0
|
93
|
+
error = Errors[retval] || "UNKNOWN"
|
94
|
+
raise "CyberplatPKI: Cannot invoke #{function}: #{error} (#{retval})"
|
95
|
+
end
|
96
|
+
|
97
|
+
retval
|
98
|
+
end
|
99
|
+
|
100
|
+
def self.invoke(function, *args)
|
101
|
+
function = :"Crypt_#{function}"
|
102
|
+
handle_error(function, send(function, *args))
|
103
|
+
end
|
104
|
+
end
|
data/spec/key_spec.rb
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CyberplatPKI::Key do
|
4
|
+
before do
|
5
|
+
@pubkey = File.read(File.expand_path('../keys/pubkeys.key', __FILE__))
|
6
|
+
@seckey = File.read(File.expand_path('../keys/secret.key', __FILE__))
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should load public keys" do
|
10
|
+
lambda {
|
11
|
+
CyberplatPKI::Key.new_public(@pubkey, 17033)
|
12
|
+
}.should_not raise_error
|
13
|
+
end
|
14
|
+
|
15
|
+
it "fails loading public key from invalid source" do
|
16
|
+
lambda {
|
17
|
+
CyberplatPKI::Key.new_public(@pubkey, 12345)
|
18
|
+
}.should raise_error(/PUB_KEY_NOT_FOUND/)
|
19
|
+
|
20
|
+
lambda {
|
21
|
+
CyberplatPKI::Key.new_public("foo", 17033)
|
22
|
+
}.should raise_error(/PUB_KEY_NOT_FOUND/)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should load private keys" do
|
26
|
+
lambda {
|
27
|
+
CyberplatPKI::Key.new_private(@seckey, '1111111111')
|
28
|
+
}.should_not raise_error
|
29
|
+
end
|
30
|
+
|
31
|
+
it "fails loading private key from invalid source" do
|
32
|
+
lambda {
|
33
|
+
CyberplatPKI::Key.new_private("foo", '1111111111')
|
34
|
+
}.should raise_error(/INVALID_FORMAT/)
|
35
|
+
end
|
36
|
+
|
37
|
+
it "fails loading private key with invalid password" do
|
38
|
+
lambda {
|
39
|
+
CyberplatPKI::Key.new_private(@seckey, 'foo')
|
40
|
+
}.should raise_error(/INVALID_PASSWD/)
|
41
|
+
end
|
42
|
+
|
43
|
+
SIGNED = <<-SIGNED.gsub("\n", "\r\n").freeze
|
44
|
+
0000027201SM000000110000001100000125
|
45
|
+
api17032 00017033
|
46
|
+
00000000
|
47
|
+
BEGIN
|
48
|
+
Hello world
|
49
|
+
END
|
50
|
+
BEGIN SIGNATURE
|
51
|
+
iQBRAwkBAABCiVCdMQoBAcf2AfwOYzgQxyj1jwRv/6JdjCFh+lguLENscUFfaNXu
|
52
|
+
OIi4jaGbW8jFrxnUj5AaoeA/WJtFuBayNdBmyiQpeisngU6XsAHH
|
53
|
+
=z1vE
|
54
|
+
END SIGNATURE
|
55
|
+
SIGNED
|
56
|
+
|
57
|
+
it "can sign and then verify block" do
|
58
|
+
privkey = CyberplatPKI::Key.new_private(@seckey, '1111111111')
|
59
|
+
pubkey = CyberplatPKI::Key.new_public(@pubkey, 17033)
|
60
|
+
|
61
|
+
signed = privkey.sign("Hello world")
|
62
|
+
pubkey.verify(signed).should be_true
|
63
|
+
end
|
64
|
+
|
65
|
+
it "can verify a block" do
|
66
|
+
pubkey = CyberplatPKI::Key.new_public(@pubkey, 17033)
|
67
|
+
|
68
|
+
pubkey.verify(SIGNED).should be_true
|
69
|
+
end
|
70
|
+
|
71
|
+
it "fails verifying an invalid block" do
|
72
|
+
pubkey = CyberplatPKI::Key.new_public(@pubkey, 17033)
|
73
|
+
|
74
|
+
fail_signed = SIGNED.sub('world', 'wor1d')
|
75
|
+
pubkey.verify(fail_signed).should be_false
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
0000040801NS000001470000010000000125
|
2
|
+
api17032 00017033
|
3
|
+
api17032 00017033
|
4
|
+
BEGIN
|
5
|
+
mQBRAwAAQok95z4+AAABAgDrzoyI24MItz/UdYrV7as4xrjhjpYqBG3Owb7dP1pE
|
6
|
+
p6Dz4MLJkdWzm+ccjy3pTmjgvqfnaAnRyID4nrwQ9+p9AAURsAGHtAhhcGkxNzAz
|
7
|
+
MrABAw==
|
8
|
+
=5jFd
|
9
|
+
END
|
10
|
+
BEGIN SIGNATURE
|
11
|
+
iQBRAwkQAABCiT3nPj4BAaxXAgDT6bfpnp513156n2O4H5nyp7LyH6jaR6NrOi1/
|
12
|
+
x3Bm+/rzl0mfBFMC8LTVF2ukQ4gX6meCwK+ZaFFdT8UJXVVUsAHH
|
13
|
+
=fOzH
|
14
|
+
END SIGNATURE
|
15
|
+
0000040401NS000001430000009800000125
|
16
|
+
0J0005 00064182
|
17
|
+
api17032 00017033
|
18
|
+
BEGIN
|
19
|
+
mQBRAwAA+rY8quyyAAABAgDb8iYDU760T8phaS1KFW4wj0cSROQ2dJzkJN5X64y0
|
20
|
+
azNAmCCyM9KzGU3M400isSEU+LddQG+HE/hbRsntAURTAAURsAGHtAYwSjAwMDWw
|
21
|
+
AQM=
|
22
|
+
=HcgR
|
23
|
+
END
|
24
|
+
BEGIN SIGNATURE
|
25
|
+
iQBRAwkQAABCiT3nPnEBAeYFAgCJWP1AnPJ46UrJny81UCv5EVMyaocqBRCbQW9S
|
26
|
+
8bxvV/uixVcWwimyrGv8/aNc9bTeX9TacEELashrOTfXTUSIsAHH
|
27
|
+
=S9Y8
|
28
|
+
END SIGNATURE
|
@@ -0,0 +1,15 @@
|
|
1
|
+
0000051701NM000003810000027300000000
|
2
|
+
api17032 00017033
|
3
|
+
00000000
|
4
|
+
BEGIN
|
5
|
+
lQEEAwAAQok95z4+AAABAgDrzoyI24MItz/UdYrV7as4xrjhjpYqBG3Owb7dP1pE
|
6
|
+
p6Dz4MLJkdWzm+ccjy3pTmjgvqfnaAnRyID4nrwQ9+p9AAURATXU8D817k6vAfqv
|
7
|
+
qaNX3nRlR6EMHSyDSoMzeMYZ64D5OgHqIt+rnqRLqApwk5tP5ewscxfr6coACuF5
|
8
|
+
qLJAKmAtwHRZnY8cWgKzAQBMyV0nshDFbN7+biMSPGobWjhhQ8GlVfi1636/FZqe
|
9
|
+
TQEApdjYa7cCBMKNdJojykQ977wVZpcYzDZ0zIWBRhfLez0BAPTvT/ipmFxcjtGG
|
10
|
+
z0sFSYk7QVaXIoCIdugQbd4Z+iq8TPK0CGFwaTE3MDMy
|
11
|
+
=Uxun
|
12
|
+
END
|
13
|
+
BEGIN SIGNATURE
|
14
|
+
|
15
|
+
END SIGNATURE
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
4
|
+
# loaded once.
|
5
|
+
#
|
6
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
|
+
RSpec.configure do |config|
|
8
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
9
|
+
config.run_all_when_everything_filtered = true
|
10
|
+
config.filter_run :focus
|
11
|
+
|
12
|
+
# Run specs in random order to surface order dependencies. If you find an
|
13
|
+
# order dependency and want to debug it, you can fix the order by providing
|
14
|
+
# the seed, which is printed after each run.
|
15
|
+
# --seed 1234
|
16
|
+
config.order = 'random'
|
17
|
+
end
|
18
|
+
|
19
|
+
if RUBY_ENGINE == 'ruby' &&
|
20
|
+
RUBY_PLATFORM =~ /i.86/
|
21
|
+
require 'time'
|
22
|
+
|
23
|
+
if Time.now != Time.parse('5th November 2005 00:00 UTC')
|
24
|
+
if ENV['TIME_TRAVEL'] != '1'
|
25
|
+
puts "Travelling back in time..."
|
26
|
+
|
27
|
+
ENV['TIME_TRAVEL'] = '1'
|
28
|
+
|
29
|
+
mock_path = File.expand_path('../../ext/mock_the_clock/mock_the_clock.so', __FILE__)
|
30
|
+
exec "sh", "-c", "LD_PRELOAD=#{mock_path} #{$0}"
|
31
|
+
else
|
32
|
+
puts "Time machine failure, continuing."
|
33
|
+
end
|
34
|
+
else
|
35
|
+
puts "Time.now: #{Time.now}"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
require 'cyberplat_pki'
|
data/vendor/linux.zip
ADDED
Binary file
|
data/vendor/win32.zip
ADDED
Binary file
|
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cyberplat_pki_patched
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Evgeniy Burdaev
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-05-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: ffi
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: CyberplatPKI is an FFI binding for signing Cyberplat requests. Patched
|
42
|
+
fork.
|
43
|
+
email:
|
44
|
+
- inqify@gmail.com
|
45
|
+
executables: []
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- ".rspec"
|
51
|
+
- ".travis.yml"
|
52
|
+
- Gemfile
|
53
|
+
- LICENSE.txt
|
54
|
+
- README.md
|
55
|
+
- Rakefile
|
56
|
+
- cyberplat_pki.gemspec
|
57
|
+
- ext/libipriv-linux32.so
|
58
|
+
- ext/libipriv.dylib
|
59
|
+
- ext/libipriv32.dll
|
60
|
+
- ext/mock_the_clock/.gitignore
|
61
|
+
- ext/mock_the_clock/Makefile
|
62
|
+
- ext/mock_the_clock/extconf.rb
|
63
|
+
- ext/mock_the_clock/mock_the_clock.c
|
64
|
+
- lib/cyberplat_pki.rb
|
65
|
+
- lib/cyberplat_pki/key.rb
|
66
|
+
- lib/cyberplat_pki/library.rb
|
67
|
+
- spec/key_spec.rb
|
68
|
+
- spec/keys/pubkeys.key
|
69
|
+
- spec/keys/secret.key
|
70
|
+
- spec/spec_helper.rb
|
71
|
+
- vendor/linux.zip
|
72
|
+
- vendor/win32.zip
|
73
|
+
homepage: http://github.com/whitequark/cyberplat_pki
|
74
|
+
licenses: []
|
75
|
+
metadata: {}
|
76
|
+
post_install_message:
|
77
|
+
rdoc_options: []
|
78
|
+
require_paths:
|
79
|
+
- lib
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
requirements: []
|
91
|
+
rubyforge_project:
|
92
|
+
rubygems_version: 2.7.6
|
93
|
+
signing_key:
|
94
|
+
specification_version: 4
|
95
|
+
summary: CyberplatPKI is an FFI binding for signing Cyberplat requests. Patched fork.
|
96
|
+
test_files:
|
97
|
+
- spec/key_spec.rb
|
98
|
+
- spec/keys/pubkeys.key
|
99
|
+
- spec/keys/secret.key
|
100
|
+
- spec/spec_helper.rb
|