Skip to content
Merged
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
7 changes: 1 addition & 6 deletions spec/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def initialize(name, port: 23456, postgresql_conf: '')
def create_test_db
trace "Creating the test DB"
log_and_run @logfile, pg_bin_path('psql'), '-p', @port.to_s, '-e', '-c', 'DROP DATABASE IF EXISTS test', 'postgres'
log_and_run @logfile, pg_bin_path('createdb'), '-p', @port.to_s, '-e', 'test'
log_and_run @logfile, pg_bin_path('createdb'), '-p', @port.to_s, 'test'
end

def connect
Expand Down Expand Up @@ -355,7 +355,6 @@ def next_serial
end

def create_ca_cert(name, ca_key, x509_name, valid_years: 10)
ca_key = OpenSSL::PKey::RSA.new File.read "#{ca_key}" unless ca_key.kind_of?(OpenSSL::PKey::RSA)
ca_name = OpenSSL::X509::Name.parse x509_name

ca_cert = OpenSSL::X509::Certificate.new
Expand Down Expand Up @@ -396,7 +395,6 @@ def create_key(name, rsa_size: 2048)
end

def create_signing_request(name, x509_name, key)
key = OpenSSL::PKey::RSA.new File.read "#{key}" unless key.kind_of?(OpenSSL::PKey::RSA)
csr = OpenSSL::X509::Request.new
csr.version = 0
csr.subject = OpenSSL::X509::Name.parse x509_name
Expand All @@ -411,9 +409,6 @@ def create_signing_request(name, x509_name, key)
end

def create_cert_from_csr(name, csr, ca_cert, ca_key, valid_years: 10, dns_names: nil)
ca_key = OpenSSL::PKey::RSA.new File.read "#{ca_key}" unless ca_key.kind_of?(OpenSSL::PKey::RSA)
ca_cert = OpenSSL::X509::Certificate.new File.read "#{ca_cert}" unless ca_cert.kind_of?(OpenSSL::X509::Certificate)
csr = OpenSSL::X509::Request.new File.read "#{csr}" unless csr.kind_of?(OpenSSL::X509::Request)
raise 'CSR can not be verified' unless csr.verify csr.public_key

csr_cert = OpenSSL::X509::Certificate.new
Expand Down
Loading