title: OpenSSL verify certificate from own CA
body: <p>Hello all and thanks for your time reading this.</p>
  
  <p>I need to verify certificates issued by my own CA, for which I have a
  certificate. How can I do the equivalent to openssl's</p>
  
  <p>openssl verify -CAfile  </p>
  
  <p>in Ruby code? The RDoc for OpenSSL is not very helpful in this regard.
  I've tried:</p>
  
  <pre>
  require 'openssl'
  
  ca = OpenSSL::X509::Certificate.new(File.read('ca-cert.pem'))
  
  lic = OpenSSL::X509::Certificate.new(File.read('cert.pem'))
  
  puts lic.verify( ca )
  </pre>
  
  <p>but I get:</p>
  
  <pre>
  test.rb:7:in `verify': wrong argument (OpenSSL::X509::Certificate)!
  (Expected kind of OpenSSL::PKey::PKey) (TypeError)
    from test.rb:7
  </pre>
  
  <p>I can't even find "verify" in the OpenSSL Rdoc at
  <a href="http://www.ruby-doc.org/stdlib/libdoc/openssl/rdoc/index.html" rel="noreferrer">http://www.ruby-doc.org/stdlib/libdoc/openssl/rdoc/index.html</a>.</p>
  
  <p>Any help is appreciated. Thanks again!</p>