ssbx 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/ssbx/box.rb +7 -4
- data/lib/ssbx/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb3f97e7f7bcd6aced71f70fca0c43ebec72d0e4251b003e447a87d49eacb039
|
4
|
+
data.tar.gz: ecc265a10d0045c6f07944b7379432b7bf2452a77b2ca9893b1d6acb5f0d4424
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df6183075ea93db79bd41942085cfd45b18a807cf17f198d0c7071d92a79f7098288d5e08c9a2c2fed48f73ae995e986b85acecf6850a49b22fe7426b37b4022
|
7
|
+
data.tar.gz: 3e68060e935524cc38184c5e63c6e48ef19b909e86ba0fd2314d43e52e6c34b8dbaaebaf8c5cde76f1cd3c630f25394f4931d25079da365a33625c41a46426b5
|
data/README.md
CHANGED
data/lib/ssbx/box.rb
CHANGED
@@ -8,6 +8,9 @@ module Ssbx
|
|
8
8
|
# This uses File to read and write data, but the actual encryption logic is in here.
|
9
9
|
class Box
|
10
10
|
|
11
|
+
# The symetric cipher name used for the symetric parts of this algorithm.
|
12
|
+
SYMETRIC_CIPHER_NAME = 'AES-256-CBC'
|
13
|
+
|
11
14
|
# Create a new box.
|
12
15
|
def initialize(file)
|
13
16
|
if file.is_a? IO
|
@@ -30,7 +33,7 @@ module Ssbx
|
|
30
33
|
privkey = OpenSSL::PKey::RSA.new(2048)
|
31
34
|
|
32
35
|
userrecord = [ userid ]
|
33
|
-
userrecord << privkey.to_pem(OpenSSL::Cipher
|
36
|
+
userrecord << privkey.to_pem(OpenSSL::Cipher.new(SYMETRIC_CIPHER_NAME), password)
|
34
37
|
userrecord << privkey.public_key.to_pem
|
35
38
|
userrecord << '' # Private Key
|
36
39
|
userrecord << '' # Initialization Vector.
|
@@ -42,14 +45,14 @@ module Ssbx
|
|
42
45
|
privkey = OpenSSL::PKey::RSA.new(2048)
|
43
46
|
|
44
47
|
# Rotate user record entries.
|
45
|
-
userrecord[1] = privkey.to_pem(OpenSSL::Cipher
|
48
|
+
userrecord[1] = privkey.to_pem(OpenSSL::Cipher.new(SYMETRIC_CIPHER_NAME), password)
|
46
49
|
userrecord[2] = privkey.public_key.to_pem
|
47
50
|
userrecord[3] = '' # Private Key
|
48
51
|
userrecord[4] = '' # Initialization Vector.
|
49
52
|
end
|
50
53
|
|
51
54
|
# Make semetric cipher.
|
52
|
-
cipher = OpenSSL::Cipher.new(
|
55
|
+
cipher = OpenSSL::Cipher.new(SYMETRIC_CIPHER_NAME)
|
53
56
|
cipher.encrypt
|
54
57
|
|
55
58
|
key = cipher.random_key
|
@@ -85,7 +88,7 @@ module Ssbx
|
|
85
88
|
|
86
89
|
privkey = OpenSSL::PKey::RSA.new(userrecord[1], password)
|
87
90
|
|
88
|
-
cipher = OpenSSL::Cipher.new(
|
91
|
+
cipher = OpenSSL::Cipher.new(SYMETRIC_CIPHER_NAME)
|
89
92
|
cipher.decrypt
|
90
93
|
|
91
94
|
cipher.key = privkey.private_decrypt(userrecord[3])
|
data/lib/ssbx/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ssbx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam
|
@@ -83,8 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: '0'
|
85
85
|
requirements: []
|
86
|
-
|
87
|
-
rubygems_version: 2.7.6
|
86
|
+
rubygems_version: 3.0.1
|
88
87
|
signing_key:
|
89
88
|
specification_version: 4
|
90
89
|
summary: Shared encrypted file.
|