Module: Rsa::Tools
- Defined in:
- lib/rsa/tools/version.rb,
lib/rsa/tools/generator.rb,
lib/rsa/tools/utility.rb,
lib/rsa/tools.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
"0.3.0"
Class Method Summary collapse
- .decrypt(public_key, encrypted) ⇒ Object
-
.encrypt(private_key, data) ⇒ Object
TO C的业务 & 私钥加密 公钥解密.
- .key_pairs ⇒ Object
- .pem_pairs(pri_path = nil, pub_path = nil) ⇒ Object
- .pri_decrypt(private_key, encrypted) ⇒ Object
-
.pub_encrypt(public_key, data) ⇒ Object
TO B的业务 & 公钥加密 私钥解密.
-
.sign(private_key, data) ⇒ Object
签名 & 用自己私钥签名 & RSAWithSha256 的签名.
-
.verify(public_key, data, original_data) ⇒ Object
验签 & 用对方的公钥验签.
Class Method Details
.decrypt(public_key, encrypted) ⇒ Object
21 22 23 |
# File 'lib/rsa/tools.rb', line 21 def self.decrypt(public_key, encrypted) Utility.decrypt(public_key, encrypted) end |
.encrypt(private_key, data) ⇒ Object
TO C的业务 & 私钥加密 公钥解密
17 18 19 |
# File 'lib/rsa/tools.rb', line 17 def self.encrypt(private_key, data) Utility.encrypt(private_key, data) end |
.key_pairs ⇒ Object
34 35 36 |
# File 'lib/rsa/tools.rb', line 34 def self.key_pairs return Generator.key_pairs end |
.pem_pairs(pri_path = nil, pub_path = nil) ⇒ Object
38 39 40 |
# File 'lib/rsa/tools.rb', line 38 def self.pem_pairs(pri_path = nil, pub_path = nil) return Generator.pem_pairs(pri_path, pub_path) end |
.pri_decrypt(private_key, encrypted) ⇒ Object
30 31 32 |
# File 'lib/rsa/tools.rb', line 30 def self.pri_decrypt(private_key, encrypted) Utility.pri_decrypt(private_key, encrypted) end |
.pub_encrypt(public_key, data) ⇒ Object
TO B的业务 & 公钥加密 私钥解密
26 27 28 |
# File 'lib/rsa/tools.rb', line 26 def self.pub_encrypt(public_key, data) Utility.pub_encrypt(public_key, data) end |