key_type.go 377 B

123456789101112131415
  1. package validation
  2. import (
  3. "github.com/go-acme/lego/v4/certcrypto"
  4. val "github.com/go-playground/validator/v10"
  5. )
  6. func autoCertKeyType(fl val.FieldLevel) bool {
  7. switch certcrypto.KeyType(fl.Field().String()) {
  8. case "", certcrypto.RSA2048, certcrypto.RSA3072, certcrypto.RSA4096, certcrypto.RSA8192,
  9. certcrypto.EC256, certcrypto.EC384:
  10. return true
  11. }
  12. return false
  13. }