Commit 63eb4156 authored by Kamil Trzcinski's avatar Kamil Trzcinski Committed by James Edwards-Jones

Fix certificate validators

parent 8f09ec28
......@@ -16,7 +16,7 @@ class CertificateKeyValidator < ActiveModel::EachValidator
private
def valid_private_key_pem?(value)
return unless value
return false unless value
pkey = OpenSSL::PKey::RSA.new(value)
pkey.private?
rescue OpenSSL::PKey::PKeyError
......
......@@ -16,9 +16,9 @@ class CertificateValidator < ActiveModel::EachValidator
private
def valid_certificate_pem?(value)
return unless value
OpenSSL::X509::Certificate.new(value)
return false unless value
OpenSSL::X509::Certificate.new(value).present?
rescue OpenSSL::X509::CertificateError
nil
false
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment