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

Classes: Generator, Utility

Constant Summary collapse

VERSION =
"0.3.0"

Class Method Summary collapse

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_pairsObject



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

.sign(private_key, data) ⇒ Object

签名 & 用自己私钥签名 & RSAWithSha256 的签名



12
13
14
# File 'lib/rsa/tools.rb', line 12

def self.sign(private_key, data)
  Utility.sign(private_key, data)
end

.verify(public_key, data, original_data) ⇒ Object

验签 & 用对方的公钥验签



7
8
9
# File 'lib/rsa/tools.rb', line 7

def self.verify(public_key, data, original_data)
  Utility.verify(public_key, data, original_data)
end