class Object
Constants
- ASSETS
- Handy
- SCR
Public Instance Methods
append_message(message)
click to toggle source
Calls superclass method
# File lib/eco/api/common/version_patches/exception.rb, line 29 def append_message(message) mod = Module.new do define_method :to_s do super() + String(message) end end self.extend mod end
prepend_message(message)
click to toggle source
Calls superclass method
# File lib/eco/api/common/version_patches/exception.rb, line 20 def prepend_message(message) mod = Module.new do define_method :to_s do String(message) + super() end end self.extend mod end
run!()
click to toggle source
see some ramblings here: distributed-frostbite.blogspot.com/2010/06/file-encryption-in-ruby-with-openssl.html
# File lib/eco/data/crypto/encryption.rb, line 11 def run! # this will run only if called from command line (not when require'd nor load'd) include Eco::CLI::Scripting include Eco::Data::Crypto # script arguments keygen = get_arg("-keygen") filename = get_arg("-keygen", with_param: true) ssh = get_arg("-ssh") length = get_arg("-length", with_param: true) check_rsa_pairs = get_arg("-keypairs") key_filename = get_arg("-keypairs", with_param: true) # methods case true when keygen puts "++ keygen RSA ++" #pp ::OpenSSL.constants.sort cr = Eco::Data::Crypto::OpenSSL.new case true when ssh puts "think about installing this library: https://rubygems.org/gems/sshkey" puts "GitHub: https://github.com/bensie/sshkey" puts "or add this Ruby solution to convert to ssh-rsa: https://stackoverflow.com/a/3162593/4352306" exit(1) cr.rsa_keygen_ssh(filename: filename) else cr.rsa_keygen(filename: filename) end when check_rsa_pairs puts "++ checking file pairs ++" begin key_filename = "rsa" if !key_filename priv = File.read(key_filename + '.pem') pub = File.read(key_filename + '.pub') rescue puts "could not find files with basename: #{key_filename}" exit(1) end cr = Eco::Data::Crypto::OpenSSL.new equals = cr.rsa_keypairs?(priv, pub) if equals puts "the pair #{key_filename} seem to be for one to another!" else puts "those files with base name #{key_filename} are not a rsa pair" end end end