lib/sepa/utilities.rb
def extract_cert(doc, node, namespace)
      cert_raw = doc.at("xmlns|#{node}", 'xmlns' => namespace)

      return nil unless cert_raw

      cert_raw = cert_raw.content.gsub(/\s+/, "")

      cert = process_cert_value(cert_raw)

      begin
        x509_certificate(cert)
      rescue => e
        raise OpenSSL::X509::CertificateError,
              "The certificate could not be processed. It's most likely corrupted. " \
              "OpenSSL had this to say: #{e}."
      end
    end
# Extracts a certificate from a document and returns it as an OpenSSL X509 certificate. Returns
# nil if the node cannot be found
#
# @param doc [Nokogiri::XML::Document] the document that contains the certificate node
# @param node [String] the name of the node that contains the certificate
# @param namespace [String] the namespace of the certificate node
# @return [OpenSSL::X509::Certificate] the extracted certificate if it is extracted successfully
# @return [nil] if the certificate cannot be found
# @raise [OpenSSL::X509::CertificateError] if there is a problem with the certificate
# @todo refactor not to fail
Extracts a certificate from a document and returns it as an OpenSSL X509 certificate. Returns
nil if the node cannot be found
Extracts a certificate from a document and returns it as an OpenSSL X509 certificate . Returns nil if the node cannot be found
def extract_cert(doc, node, namespace)
      cert_raw = doc.at("xmlns|#{node}", 'xmlns' => namespace)
      return nil unless cert_raw
      cert_raw = cert_raw.content.gsub(/\s+/, "")
      cert = process_cert_value(cert_raw)
      begin
        x509_certificate(cert)
      rescue => e
        raise OpenSSL::X509::CertificateError,
              "The certificate could not be processed. It's most likely corrupted. " \
              "OpenSSL had this to say: #{e}."
      end
    end
def extract_cert ( doc , node , namespace ) cert_raw = doc . at ( "xmlns|#{node}" , 'xmlns' => namespace ) return nil unless cert_raw cert_raw = cert_raw . content . gsub ( / \s + / , "" ) cert = process_cert_value ( cert_raw ) begin x509_certificate ( cert ) rescue => e raise OpenSSL :: X509 :: CertificateError , "The certificate could not be processed. It's most likely corrupted. " "OpenSSL had this to say: #{e}." end end
Extracts a certificate from a document and returns it as an OpenSSL X509 certificate.
Extracts a certificate from a document and returns it as an OpenSSL X509 certificate .
the extracted certificate if it is extracted successfully
the extracted certificate if it is extracted successfully
OpenSSL::X509::Certificate
if the certificate cannot be found
if the certificate cannot be found
nil
[OpenSSL::X509::CertificateError] if there is a problem with the certificate
[ OpenSSL :: X509 :: CertificateError ] if there is a problem with the certificate
doc
the document that contains the certificate node
the document that contains the certificate node
node
the name of the node that contains the certificate
the name of the node that contains the certificate
namespace
the namespace of the certificate node
the namespace of the certificate node
todo
refactor not to fail
refactor not to fail