You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

curve.rb 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. module CryptCheck
  2. module Tls
  3. class Curve
  4. attr_reader :name
  5. def initialize(name)
  6. @name = name
  7. end
  8. # SUPPORTED = %i(sect163k1 sect163r1 sect163r2 sect193r1
  9. # sect193r2 sect233k1 sect233r1 sect239k1 sect283k1 sect283r1
  10. # sect409k1 sect409r1 sect571k1 sect571r1 secp160k1 secp160r1
  11. # secp160r2 secp192k1 secp192r1 secp224k1 secp224r1 secp256k1
  12. # secp256r1 secp384r1 secp521r1
  13. # prime256v1
  14. # brainpoolP256r1 brainpoolP384r1 brainpoolP512r1)
  15. SUPPORTED = %i(secp256k1 sect283k1 sect283r1 secp384r1
  16. sect409k1 sect409r1 secp521r1 sect571k1 sect571r1
  17. prime192v1 prime256v1
  18. brainpoolP256r1 brainpoolP384r1 brainpoolP512r1).collect { |c| self.new c }.freeze
  19. extend Enumerable
  20. def self.each(&block)
  21. SUPPORTED.each &block
  22. end
  23. def to_s
  24. @name
  25. end
  26. def ==(other)
  27. case other
  28. when String
  29. @name == other.to_sym
  30. when Symbol
  31. @name == other
  32. else
  33. @name == other.name
  34. end
  35. end
  36. include State
  37. CHECKS = [].freeze
  38. def checks
  39. CHECKS
  40. end
  41. end
  42. end
  43. end