enigma_decrypter 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/lib/enigma_decrypter.rb +3 -2
- data/lib/enigma_decrypter/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77f3c871116600322b869c36190215db89698b10
|
4
|
+
data.tar.gz: 0d50c530c3e67e4b210a3574a80b390424f98d78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22a178d671484b9aabdef80d122d7eddbdeb034db5d5023a09fe37ecd11e4c77c0ec83c9674e0d61acff36d09ac4c87f631f4d6e144c6991548c2a43a899dc05
|
7
|
+
data.tar.gz: b760a8b542783b531e8834cce08d12cb8461860d81c9ab272c5f9991fe2d5f732ffb5b5bab5a733c27d3ba057c5ada09c6989c0630129d815462abeeb8f19d92
|
data/lib/enigma_decrypter.rb
CHANGED
@@ -3,8 +3,9 @@ require 'openssl'
|
|
3
3
|
require 'base64'
|
4
4
|
|
5
5
|
module EnigmaDecrypter
|
6
|
-
def self.decrypt(encrypted_key,
|
7
|
-
return nil if encrypted_key.to_s.empty? ||
|
6
|
+
def self.decrypt(encrypted_key, private_key_path)
|
7
|
+
return nil if encrypted_key.to_s.empty? || private_key_path.to_s.empty?
|
8
|
+
private_key = File.read(private_key_path)
|
8
9
|
rsa_private_key = OpenSSL::PKey::RSA.new(private_key)
|
9
10
|
rsa_private_key.private_decrypt(Base64.decode64(encrypted_key))
|
10
11
|
end
|