activation form
This commit is contained in:
@@ -5,11 +5,27 @@ require 'uri'
|
||||
class AESEncDec {
|
||||
cipher = OpenSSL::Cipher::Cipher.new("aes-256-cbc")
|
||||
|
||||
def encrypt
|
||||
def export_key
|
||||
ENV['aes_key'] = cipher.key = cipher.random_key # stores the key in key, and also sets the generated key on the cipher
|
||||
ENV['aes_iv'] = cipher.iv = cipher.random_iv # stores the iv in iv, and also sets the generated iv on the cipher
|
||||
end
|
||||
|
||||
def encrypt(data)
|
||||
cipher.encrypt
|
||||
cipher.key = ENV["aes_key"]
|
||||
cipher.iv = ENV["aes_iv"]
|
||||
encrypted = cipher.update(data) + cipher.final
|
||||
encrypted = Base64.urlsafe_encode64(encrypted)
|
||||
return encrypted
|
||||
end
|
||||
|
||||
def decrypt
|
||||
cipher.decrypt
|
||||
cipher.key = ENV["aes_key"]
|
||||
cipher.iv = ENV["aes_iv"]
|
||||
|
||||
# Start the decryption
|
||||
decoded = Base64.urlsafe_decode64(encrypted)
|
||||
decrypted = cipher.update(decoded) + cipher.final
|
||||
end
|
||||
}
|
||||
@@ -50,7 +50,7 @@ class License
|
||||
if cache_license.nil?
|
||||
##change the d/e key
|
||||
# @options = { query: {device: "SXlite", lookup: lookup, skey: @secret, token: SECRETS_CONFIG['provision_key']} }
|
||||
@params = { query: { device: "SXlite", token: SECRETS_CONFIG['provision_key']} }
|
||||
@params = { query: { device: "SXlite", token: SECRETS_CONFIG['license_key']} }
|
||||
|
||||
response = self.class.get("/request_license", @params)
|
||||
@license = response.parsed_response
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
class Shop < ApplicationRecord
|
||||
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user