cyberplat_pki 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = "cyberplat_pki"
7
- gem.version = "2.0.1"
7
+ gem.version = "2.0.2"
8
8
  gem.authors = ["Peter Zotov"]
9
9
  gem.email = ["whitequark@whitequark.org"]
10
10
  gem.description = %q{CyberplatPKI is a library for signing Cyberplat requests.}
@@ -45,7 +45,10 @@ module CyberplatPKI
45
45
  end
46
46
 
47
47
  def self.encode64(data)
48
- encoded = Base64.encode64(data).gsub /\n/, "\r\n"
48
+ encoded = Base64.encode64(data)
49
+ encoded.gsub!(/\n/, "")
50
+
51
+ encoded = encoded.scan(/.{1,64}/).join("\r\n") + "\r\n"
49
52
 
50
53
  crc = Digest::CRC24.checksum data
51
54
 
@@ -35,8 +35,9 @@ module CyberplatPKI
35
35
  io.write metadata
36
36
  io.write [ 1, 1 ].pack "CC"
37
37
  io.write hash_msw
38
- io.write [ signature.length * 8 ].pack "n"
39
- io.write signature
38
+
39
+ bn = OpenSSL::BN.new signature, 2
40
+ io.write_mpi bn
40
41
  end
41
42
  end
42
43
  end
data/spec/spec_helper.rb CHANGED
@@ -16,15 +16,24 @@ RSpec.configure do |config|
16
16
  config.order = 'random'
17
17
  end
18
18
 
19
- require 'time'
19
+ if RUBY_ENGINE == 'ruby' &&
20
+ RUBY_PLATFORM =~ /i.86/
21
+ require 'time'
20
22
 
21
- if Time.now != Time.parse('5th November 2005 00:00 UTC')
22
- puts "Travelling back in time..."
23
+ if Time.now != Time.parse('5th November 2005 00:00 UTC')
24
+ if ENV['TIME_TRAVEL'] != '1'
25
+ puts "Travelling back in time..."
23
26
 
24
- mock_path = File.expand_path('../../ext/mock_the_clock/mock_the_clock.so', __FILE__)
25
- exec "sh", "-c", "LD_PRELOAD=#{mock_path} #{$0}"
26
- else
27
- puts "Time.now: #{Time.now}"
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
28
37
  end
29
38
 
30
39
  require 'cyberplat_pki'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cyberplat_pki
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: