260: def verify(name)
261: unless cert = Puppet::SSL::Certificate.find(name)
262: raise ArgumentError, "Could not find a certificate for #{name}"
263: end
264: store = OpenSSL::X509::Store.new
265: store.add_file Puppet[:cacert]
266: store.add_crl crl.content if self.crl
267: store.purpose = OpenSSL::X509::PURPOSE_SSL_CLIENT
268: store.flags = OpenSSL::X509::V_FLAG_CRL_CHECK_ALL|OpenSSL::X509::V_FLAG_CRL_CHECK if Puppet.settings[:certificate_revocation]
269:
270: raise CertificateVerificationError.new(store.error), store.error_string unless store.verify(cert.content)
271: end