def files_for_domain(domain)
      crt = File.expand_path("#{domain}.crt", @dir)
      key = File.expand_path("#{domain}.key", @dir)
      return [crt, key] if File.exists?(crt) && File.exists?(key)

      # Might be a wildcard cert file.
      @@sources.each do |file, certs|
        certs.each do |cert|
          if OpenSSL::SSL.verify_certificate_identity(cert, domain)
            key = file.chomp(File.extname(file)) + '.key'
            return [file, key] if File.exists?(file) && File.exists?(key)
          end
        end
      end
      nil
    end
def files_for_domain(domain)
      crt = File.expand_path("#{domain}.crt", @dir)
      key = File.expand_path("#{domain}.key", @dir)
      return [crt, key] if File.exists?(crt) && File.exists?(key)

      # Might be a wildcard cert file.
      @@sources.each do |file, certs|
        certs.each do |cert|
          if OpenSSL::SSL.verify_certificate_identity(cert, domain)
            key = file.chomp(File.extname(file)) + '.key'
            return [file, key] if File.exists?(file) && File.exists?(key)
          end
        end
      end
      nil
    end
Returns a pair of file names containing the public key certificate
 and matching private key for the given domain. This supports using
 wildcard certificate files to serve several subdomains.

 Finding the certificate and private key file for a domain follows these steps:

 - Look for <domain>.crt and <domain>.key files in the conf/certs
   directory. If found, return those file names, otherwise . . .

 - Inspect all conf/certs/*.crt files for certificates that contain the
   domain name either as the subject common name (CN) or as a DNS
   subjectAltName. The corresponding private key must be in a file of the
   same name as the certificate's, but with a .key extension.

 So in the simplest configuration, the tea.wonderland.lit encryption files
 would be named:

 - conf/certs/tea.wonderland.lit.crt
 - conf/certs/tea.wonderland.lit.key

 However, in the case of a wildcard certificate for *.wonderland.lit,
 the files would be:

 - conf/certs/wonderland.lit.crt
 - conf/certs/wonderland.lit.key

 These same two files would be returned for the subdomains of:

 - tea.wonderland.lit
 - crumpets.wonderland.lit
 - etc.

 domain - The String domain name.

 Returns a two element String array for the certificate and private key
   file names or nil if not found.