Sha256: a5eccf982766adb5ae826941101bd600fd867f6780e4caf0c65799afb85c4f55
Contents?: true
Size: 799 Bytes
Versions: 5
Compression:
Stored size: 799 Bytes
Contents
# frozen_string_literal: true module Rails module Auth module X509 module Filter # Extract OpenSSL::X509::Certificates from Privacy Enhanced Mail (PEM) certificates class Pem 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 end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems