Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion evil-proxy.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@ Gem::Specification.new do |spec|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]

spec.add_development_dependency "bundler", "~> 1.6"
spec.add_development_dependency "rake"
end
12 changes: 6 additions & 6 deletions lib/evil-proxy/quickcert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class QuickCert

VERSION = "1.0.2"
CERT_DIR = File.join(Dir.pwd, "certs")
Dir.mkdir(CERT_DIR) unless File.exists?(CERT_DIR)
Dir.mkdir(CERT_DIR) unless File.exist?(CERT_DIR)

##
# Creates a new QuickCert instance using the Certificate
Expand All @@ -79,7 +79,7 @@ def create_cert(cert_config)
dest = cert_config[:hostname] || cert_config[:user]
key_file = "#{CERT_DIR}/#{dest}/#{dest}_keypair.pem"
cert_file = "#{CERT_DIR}/#{dest}/cert_#{dest}.pem"
if File.exists?(cert_file) && File.exists?(key_file)
if File.exist?(cert_file) && File.exist?(key_file)
key = OpenSSL::PKey::RSA.new(File.read(key_file))
cert = OpenSSL::X509::Certificate.new(File.read(cert_file))
else
Expand All @@ -95,7 +95,7 @@ def create_cert(cert_config)
# does not already exist at ca_config[:CA_dir].

def create_ca
return if File.exists? @ca_config[:CA_dir]
return if File.exist? @ca_config[:CA_dir]

Dir.mkdir @ca_config[:CA_dir]

Expand Down Expand Up @@ -151,12 +151,12 @@ def create_ca
def create_key(cert_config)
dest = cert_config[:hostname] || cert_config[:user]
keypair_file = "#{CERT_DIR}/#{dest}/#{dest}_keypair.pem"
if File.exists?(keypair_file)
if File.exist?(keypair_file)
keypair = OpenSSL::PKey::RSA.new(File.read(keypair_file),
cert_config[:password])
return keypair_file, keypair
end
Dir.mkdir("#{CERT_DIR}/#{dest}", 0700) unless File.exists?("#{CERT_DIR}/#{dest}")
Dir.mkdir("#{CERT_DIR}/#{dest}", 0700) unless File.exist?("#{CERT_DIR}/#{dest}")

puts "Generating RSA keypair" if $DEBUG
keypair = OpenSSL::PKey::RSA.new 1024
Expand Down Expand Up @@ -198,7 +198,7 @@ def create_csr(cert_config, keypair_file = nil)
end
name = OpenSSL::X509::Name.new name

if File.exists? keypair_file then
if File.exist? keypair_file then
keypair = OpenSSL::PKey::RSA.new(File.read(keypair_file),
cert_config[:password])
else
Expand Down