Class: Ktct::Baofu
Instance Attribute Summary
Attributes included from Cryptable
#key
Instance Method Summary
collapse
Methods included from Cryptable
#crypt, #max_decrypt_block_size, #max_encrypt_block_size, #modulus_byte_size, #reset_key, #stupid_decrypt, #stupid_decrypt_batch, #stupid_encrypt, #stupid_encrypt_batch
Methods included from Config
#config
Instance Method Details
#de_decrypt(digital_envelop, data = nil) ⇒ Object
55
56
57
58
|
# File 'lib/ktct/baofu.rb', line 55
def de_decrypt(digital_envelop, data = nil)
digital_envelop = decrypt_digital_envelop(digital_envelop)
puts DigitalEnvelop.new(digital_envelop).decrypt(data || STDIN.read)
end
|
#de_encrypt(digital_envelop, data = nil) ⇒ Object
50
51
52
|
# File 'lib/ktct/baofu.rb', line 50
def de_encrypt(digital_envelop, data = nil)
puts DigitalEnvelop.new(digital_envelop).encrypt(data || STDIN.read)
end
|
#de_gen ⇒ Object
61
62
63
64
65
66
|
# File 'lib/ktct/baofu.rb', line 61
def de_gen
original = DigitalEnvelop.get
puts "Original: #{original}"
print 'Encrypted: '
encrypted = encrypt(original.to_s)
end
|
#decrypt(data = nil) ⇒ Object
20
21
22
23
|
# File 'lib/ktct/baofu.rb', line 20
def decrypt(data = nil)
reset_key(config['payee-private-key-path'], config['payee-private-key-passphrase'])
puts super(data || STDIN.read)
end
|
#decrypt_de(digital_envelop) ⇒ Object
69
70
71
|
# File 'lib/ktct/baofu.rb', line 69
def decrypt_de(digital_envelop)
decrypt(digital_envelop)
end
|
#encrypt(data = nil) ⇒ Object
14
15
16
17
|
# File 'lib/ktct/baofu.rb', line 14
def encrypt(data = nil)
reset_key(config['platform-certificate-path'])
puts super(data || STDIN.read)
end
|
#sdecrypt(data = nil) ⇒ Object
32
33
34
35
|
# File 'lib/ktct/baofu.rb', line 32
def sdecrypt(data = nil)
reset_key(config['platform-certificate-path'])
puts stupid_decrypt(data || STDIN.read)
end
|
#sencrypt(data = nil) ⇒ Object
26
27
28
29
|
# File 'lib/ktct/baofu.rb', line 26
def sencrypt(data = nil)
reset_key(config['payee-private-key-path'], config['payee-private-key-passphrase'])
puts stupid_encrypt(data || STDIN.read)
end
|
#ssign(data = nil) ⇒ Object
38
39
40
41
|
# File 'lib/ktct/baofu.rb', line 38
def ssign(data = nil)
reset_key(config['payee-private-key-path'], config['payee-private-key-passphrase'])
puts super(data || STDIN)
end
|
#sverify(signature, data = nil) ⇒ Object
44
45
46
47
|
# File 'lib/ktct/baofu.rb', line 44
def sverify(signature, data = nil)
reset_key(config['platform-certificate-path'])
puts super(signature, data || STDIN.read)
end
|