rsa 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/rsa/pkcs1.rb +12 -6
- data/lib/rsa/version.rb +1 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
data/lib/rsa/pkcs1.rb
CHANGED
@@ -23,13 +23,19 @@ module RSA
|
|
23
23
|
# @return [String] octet string of length `len`
|
24
24
|
# @see http://tools.ietf.org/html/rfc3447#section-4.1
|
25
25
|
# @raise [ArgumentError] if `n` is greater than 256^len
|
26
|
-
def self.i2osp(x, len =
|
27
|
-
raise ArgumentError, "integer too large" if x >= 256**len
|
26
|
+
def self.i2osp(x, len = nil)
|
27
|
+
raise ArgumentError, "integer too large" if len && x >= 256**len
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
StringIO.open do |buffer|
|
30
|
+
while x > 0
|
31
|
+
b = (x & 0xFF).chr
|
32
|
+
x >>= 8
|
33
|
+
buffer << b
|
34
|
+
end
|
35
|
+
s = buffer.string
|
36
|
+
s.force_encoding(Encoding::BINARY) if s.respond_to?(:force_encoding)
|
37
|
+
s.reverse!
|
38
|
+
s = len ? s.rjust(len, "\0") : s
|
33
39
|
end
|
34
40
|
end
|
35
41
|
|
data/lib/rsa/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 4
|
9
|
+
version: 0.1.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Arto Bendiken
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-10-17 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|