class Rails::Auth::X509::Filter::Pem
Extract OpenSSL::X509::Certificates from Privacy Enhanced Mail (PEM) certificates
Public Instance Methods
call(pem)
click to toggle source
# File lib/rails/auth/x509/filter/pem.rb, line 9 def call(pem) # Normalize the whitespace in the certificate to the exact format # certificates are normally formatted in otherwise parsing with fail # with a 'nested asn1 error'. split(" ") handles sequential whitespace # characters like \t, \n, and space. OpenSSL::X509::Certificate.new(pem.split.instance_eval do [[self[0], self[1]].join(" "), self[2...-2], [self[-2], self[-1]].join(" ")] .flatten.join("\n") end).freeze end