pindo 4.7.4 → 4.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pindo/base/aeshelper.rb +9 -29
- data/lib/pindo/version.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8159df0872fa738e51e47c58871fd774599288933ad5b0abb06a1f75d034576
|
4
|
+
data.tar.gz: 7092870505178a36f55cc54d5eaa8248314a0f5c0af5188f446dab6e42bb65d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb1cf7c60caf44e8d92ee0d0cab2118c63fd842c4d0a27a3d4e0a0b33ac03d01a3a4b59b29c7589f30476f957dcd5011c4b0753bb155aa1efe2762fa19730ee3
|
7
|
+
data.tar.gz: b734c08d987650edd74d00b63a1c7bd9eec5dd7ba5ba947691f5a82a539b04e09fb3d96d76d5fde205f6fbca1bab6ec23137afc5503ad0cd42a9d8edc6b0a8d7
|
data/lib/pindo/base/aeshelper.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'openssl'
|
2
2
|
|
3
3
|
module Pindo
|
4
|
-
|
4
|
+
|
5
5
|
|
6
6
|
module AESHelper
|
7
7
|
|
@@ -17,7 +17,7 @@ module Pindo
|
|
17
17
|
|
18
18
|
unless password
|
19
19
|
password = FastlaneCore::Helper.ask_password(message: "请输入证书仓库的加密密码: ", confirm: true)
|
20
|
-
Security::InternetPassword.add(server_name, "", password)
|
20
|
+
Security::InternetPassword.add(server_name, "", password)
|
21
21
|
end
|
22
22
|
return password
|
23
23
|
end
|
@@ -54,17 +54,9 @@ module Pindo
|
|
54
54
|
def self.encrypt_specific_file(src_file: nil, password: nil, output_dir: nil)
|
55
55
|
UI.user_error!("No password supplied") if password.to_s.strip.length == 0
|
56
56
|
|
57
|
-
data_to_encrypt = File.binread(path)
|
58
|
-
salt = SecureRandom.random_bytes(8)
|
59
|
-
|
60
|
-
# The :: is important, as there is a name clash
|
61
|
-
cipher = ::OpenSSL::Cipher.new('AES-256-CBC')
|
62
|
-
cipher.encrypt
|
63
|
-
cipher.pkcs5_keyivgen(password, salt, 1, "MD5")
|
64
|
-
encrypted_data = "Salted__" + salt + cipher.update(data_to_encrypt) + cipher.final
|
65
|
-
|
66
57
|
destfile = File.join(output_dir, File.basename(src_file))
|
67
|
-
|
58
|
+
e = Match::Encryption::MatchFileEncryption.new
|
59
|
+
e.encrypt(file_path: src_file, password: password, output_path:destfile)
|
68
60
|
return destfile
|
69
61
|
rescue error
|
70
62
|
puts path
|
@@ -74,32 +66,20 @@ module Pindo
|
|
74
66
|
# The encryption parameters in this implementations reflect the old behavior which depended on the users' local OpenSSL version
|
75
67
|
# 1.0.x OpenSSL and earlier versions use MD5, 1.1.0c and newer uses SHA256, we try both before giving an error
|
76
68
|
def self.decrypt_specific_file(src_file: nil, password: nil, output_dir: nil, hash_algorithm: "MD5")
|
77
|
-
|
78
|
-
begin
|
79
|
-
stored_data = Base64.decode64(File.read(src_file))
|
80
|
-
salt = stored_data[8..15]
|
81
|
-
data_to_decrypt = stored_data[16..-1]
|
82
69
|
|
83
|
-
|
84
|
-
decipher.decrypt
|
85
|
-
decipher.pkcs5_keyivgen(password, salt, 1, hash_algorithm)
|
86
|
-
|
87
|
-
decrypted_data = decipher.update(data_to_decrypt) + decipher.final
|
70
|
+
begin
|
88
71
|
destfile = File.join(output_dir, File.basename(src_file))
|
89
|
-
|
72
|
+
e = Match::Encryption::MatchFileEncryption.new
|
73
|
+
e.decrypt(file_path: src_file, password: password, output_path:destfile)
|
90
74
|
return destfile
|
91
75
|
rescue => error
|
92
|
-
fallback_hash_algorithm = "SHA256"
|
93
|
-
if hash_algorithm != fallback_hash_algorithm
|
94
|
-
decrypt_specific_file(src_file: src_file, password: password, hash_algorithm: fallback_hash_algorithm)
|
95
|
-
else
|
96
76
|
Funlog.instance.fancyinfo_error("解析文件失败: #{src_file}")
|
77
|
+
raise Informative, error
|
97
78
|
return nil
|
98
|
-
end
|
99
79
|
end
|
100
80
|
end
|
101
81
|
|
102
|
-
end
|
103
82
|
|
104
83
|
|
84
|
+
end
|
105
85
|
end
|
data/lib/pindo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pindo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.7.
|
4
|
+
version: 4.7.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- wade
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: claide
|