license updating

This commit is contained in:
Yan
2017-12-08 12:06:21 +06:30
parent 0591e4449e
commit ffb829fbc3
2 changed files with 28 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
require 'openssl'
require 'base64'
require 'json'
class MyAesCrypt
@cipher = ""
@@ -26,6 +27,21 @@ class MyAesCrypt
return cipher_key, cipher_iv
end
def export_to_file(passphrase)
file_path = "config/shops.json"
aes_key, aes_iv = export_key(passphrase)
tmpHash = {
"lookup" => passphrase,
"key" => aes_key,
"iv" => aes_iv
}
File.open(file_path, "w") { |io|
io.write(tmpHash.to_json)
}
end
private
def encrypt(data)
cipher.encrypt