ktct 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/Gemfile.lock +1 -1
- data/lib/ktct/version.rb +1 -1
- data/lib/ktct/wangjinshe.rb +3 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3768f0c109ba4cf491753cf513c6462961af507efe1db93967b5d6c4945120d3
|
4
|
+
data.tar.gz: b93266dfee9d2c5c7f2c6618569b2c8443eb56fb7335417c112748b956919135
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76dbfc9743b61c862f1f9b74a4fe80d181972ff4151494737e72969d864daac8c7c7c213a2704086a5b947b581fcc09c42214805ef6db31f839692e12f4fece3
|
7
|
+
data.tar.gz: 296505cce41edf7b1e17c95c09ef5d9cf0ef838a586b8e2ae1a88d39b9fc219563b7f824ef8ea9983eaacd0e493a45896fca804bb6885d54fb6e5c1bcaa53d44
|
data/Gemfile.lock
CHANGED
data/lib/ktct/version.rb
CHANGED
data/lib/ktct/wangjinshe.rb
CHANGED
@@ -13,19 +13,19 @@ module Ktct
|
|
13
13
|
desc 'encrypt [DATA]', "Encrypt data using Wangjinshe's public key, DATA can also be read from STDIN"
|
14
14
|
def encrypt(data = nil)
|
15
15
|
reset_key(config['server_public_key_path'])
|
16
|
-
puts URI::encode_www_form_component(Base64.strict_encode64(public_encrypt(data || STDIN.read)))
|
16
|
+
puts URI::encode_www_form_component(Base64.strict_encode64(public_encrypt(data || STDIN.read)).scan(/.{1,76}/).join("\n"))
|
17
17
|
end
|
18
18
|
|
19
19
|
desc 'decrypt [DATA]', "Decrypt data using client's private key, DATA can also be read from STDIN"
|
20
20
|
def decrypt(data = nil)
|
21
21
|
reset_key(config['client_private_key_path'])
|
22
|
-
puts private_decrypt(Base64.strict_decode64(data || STDIN.read))
|
22
|
+
puts private_decrypt(Base64.strict_decode64((data || STDIN.read).gsub(/\n/, '')))
|
23
23
|
end
|
24
24
|
|
25
25
|
desc 'sign [DATA]', "Sign data using client's private key, DATA can also be read from STDIN"
|
26
26
|
def sign(data = nil)
|
27
27
|
reset_key(config['client_private_key_path'])
|
28
|
-
puts URI::encode_www_form_component(Base64.strict_encode64(key.sign('sha1', data || STDIN.read)))
|
28
|
+
puts URI::encode_www_form_component(Base64.strict_encode64(key.sign('sha1', data || STDIN.read)).scan(/.{1,76}/).join("\n"))
|
29
29
|
end
|
30
30
|
|
31
31
|
# desc 'verify <SIGNATURE> [DATA]', "Verify signature using Wangjinshe's public key, DATA can also be read from STDIN"
|