# File common/lib/symbiosis/domain/ssl.rb, line 252 def ssl_find_matching_certificate_and_key # # Find the certificates and keys # certificate_files, key_files = self.ssl_available_files return nil if certificate_files.empty? or key_files.empty? # # Test each certificate... certificate_files.each do |cert_fn| cert = OpenSSL::X509::Certificate.new(File.read(cert_fn)) # # ...with each key key_files.each do |key_fn| key = OpenSSL::PKey::RSA.new(File.read(key_fn)) # # This tests the private key, and returns the current certificate and # key if they verify. return [cert_fn, key_fn] if cert.check_private_key(key) end end # # Return nil if no matching keys and certs are found return nil end