Class: NamedEcdsaKeyValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
app/validators/named_ecdsa_key_validator.rb

Overview

NamedEcdsaKeyValidator

Custom validator for ecdsa private keys. Golang currently doesn’t support explicit curves for ECDSA certificates This validator checks if curve is set by name, not by parameters

class Project < ActiveRecord::Base
  validates :certificate_key, named_ecdsa_key: true
end

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



14
15
16
17
18
# File 'app/validators/named_ecdsa_key_validator.rb', line 14

def validate_each(record, attribute, value)
  if explicit_ec?(value)
    record.errors.add(attribute, "ECDSA keys with explicit curves are not supported")
  end
end