Class: Ccrypto::ECCConfig

Inherits:
KeypairConfig show all
Defined in:
lib/ccrypto/configs/keypair_config.rb

Overview

KeypairConfig

Constant Summary

Constants inherited from KeypairConfig

KeypairConfig::Algo_Active, KeypairConfig::Algo_Broken, KeypairConfig::Algo_NotRecommended, KeypairConfig::Algo_Obsolete

Instance Attribute Summary collapse

Attributes inherited from KeypairConfig

#algo, #algo_status, #default, #keypair, #private_key, #provider_config, #public_key

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from KeypairConfig

#has_keypair?, #has_private_key?, #has_public_key?, #is_default_algo?, keypair_purposes, supported_keypair_config

Methods included from AlgoConfig

include

Constructor Details

#initialize(curve = nil, status = Algo_Active, default = false) ⇒ ECCConfig

Returns a new instance of ECCConfig.



76
77
78
79
80
81
# File 'lib/ccrypto/configs/keypair_config.rb', line 76

def initialize(curve = nil, status = Algo_Active, default = false)
  @algo = self.class.algo_key
  @curve = curve || :prime256v1
  @curve = @curve.to_sym if not @curve.is_a?(Symbol)
  super(status, default)
end

Instance Attribute Details

#curveObject (readonly)

Returns the value of attribute curve.



75
76
77
# File 'lib/ccrypto/configs/keypair_config.rb', line 75

def curve
  @curve
end

Class Method Details

.algo_keyObject



71
72
73
# File 'lib/ccrypto/configs/keypair_config.rb', line 71

def self.algo_key
  :ecc
end

.algo_nameObject



67
68
69
# File 'lib/ccrypto/configs/keypair_config.rb', line 67

def self.algo_name
  "Elliptic Curve (ECC) (Classical - Signing and Encryption)"
end

.supported_curves(&block) ⇒ Object



91
92
93
# File 'lib/ccrypto/configs/keypair_config.rb', line 91

def self.supported_curves(&block)
  Provider.instance.provider.algo_instance(*[ECCConfig], &block).supported_curves
end

Instance Method Details

#paramObject



83
84
85
# File 'lib/ccrypto/configs/keypair_config.rb', line 83

def param
  @curve
end

#to_sObject



87
88
89
# File 'lib/ccrypto/configs/keypair_config.rb', line 87

def to_s
  "ECC - #{@curve}"
end