Class: Ccrypto::KeypairConfig
- Inherits:
-
Object
- Object
- Ccrypto::KeypairConfig
- Includes:
- AlgoConfig
- Defined in:
- lib/ccrypto/configs/keypair_config.rb
Direct Known Subclasses
CrystalDilithiumConfig, CrystalKyberConfig, ECCConfig, ED25519Config, RSAConfig, X25519Config
Constant Summary collapse
- Algo_Active =
:active
- Algo_NotRecommended =
:not_recommended
- Algo_Obsolete =
:obsolete
- Algo_Broken =
:broken
Instance Attribute Summary collapse
-
#algo ⇒ Object
Returns the value of attribute algo.
-
#algo_status ⇒ Object
readonly
Returns the value of attribute algo_status.
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#keypair ⇒ Object
Returns the value of attribute keypair.
-
#private_key ⇒ Object
Returns the value of attribute private_key.
-
#provider_config ⇒ Object
Returns the value of attribute provider_config.
-
#public_key ⇒ Object
Returns the value of attribute public_key.
Class Method Summary collapse
Instance Method Summary collapse
- #has_keypair? ⇒ Boolean
- #has_private_key? ⇒ Boolean
- #has_public_key? ⇒ Boolean
-
#initialize(status = Algo_Active, default = false) ⇒ KeypairConfig
constructor
A new instance of KeypairConfig.
- #is_default_algo? ⇒ Boolean
Methods included from AlgoConfig
Constructor Details
#initialize(status = Algo_Active, default = false) ⇒ KeypairConfig
Returns a new instance of KeypairConfig.
22 23 24 25 |
# File 'lib/ccrypto/configs/keypair_config.rb', line 22 def initialize(status = Algo_Active, default = false) @algo_status = status @default = default end |
Instance Attribute Details
#algo ⇒ Object
Returns the value of attribute algo.
8 9 10 |
# File 'lib/ccrypto/configs/keypair_config.rb', line 8 def algo @algo end |
#algo_status ⇒ Object (readonly)
Returns the value of attribute algo_status.
11 12 13 |
# File 'lib/ccrypto/configs/keypair_config.rb', line 11 def algo_status @algo_status end |
#default ⇒ Object (readonly)
Returns the value of attribute default.
18 19 20 |
# File 'lib/ccrypto/configs/keypair_config.rb', line 18 def default @default end |
#keypair ⇒ Object
Returns the value of attribute keypair.
9 10 11 |
# File 'lib/ccrypto/configs/keypair_config.rb', line 9 def keypair @keypair end |
#private_key ⇒ Object
Returns the value of attribute private_key.
9 10 11 |
# File 'lib/ccrypto/configs/keypair_config.rb', line 9 def private_key @private_key end |
#provider_config ⇒ Object
Returns the value of attribute provider_config.
20 21 22 |
# File 'lib/ccrypto/configs/keypair_config.rb', line 20 def provider_config @provider_config end |
#public_key ⇒ Object
Returns the value of attribute public_key.
9 10 11 |
# File 'lib/ccrypto/configs/keypair_config.rb', line 9 def public_key @public_key end |
Class Method Details
.keypair_purposes ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/ccrypto/configs/keypair_config.rb', line 51 def self.keypair_purposes { signing: "Keypair for signing and digital signature operation", cipher: "Keypair for data encryption operation", sign_and_encrypt: "Keypair for both signing and data encryption operation" } end |
.supported_keypair_config(purpose = :signing, &block) ⇒ Object
59 60 61 |
# File 'lib/ccrypto/configs/keypair_config.rb', line 59 def self.supported_keypair_config(purpose = :signing, &block) Provider.instance.provider.supported_keypair_config(purpose, &block) end |
Instance Method Details
#has_keypair? ⇒ Boolean
31 32 33 |
# File 'lib/ccrypto/configs/keypair_config.rb', line 31 def has_keypair? (not @keypair.nil?) or not (@privateKey.nil? and @publicKey.nil?) end |
#has_private_key? ⇒ Boolean
35 36 37 38 39 40 41 |
# File 'lib/ccrypto/configs/keypair_config.rb', line 35 def has_private_key? if has_keypair? not @keypair.private_key.nil? else not @private_key.nil? end end |
#has_public_key? ⇒ Boolean
43 44 45 46 47 48 49 |
# File 'lib/ccrypto/configs/keypair_config.rb', line 43 def has_public_key? if has_keypair? not @keypair.public_key.nil? else not @public_key.nil? end end |
#is_default_algo? ⇒ Boolean
27 28 29 |
# File 'lib/ccrypto/configs/keypair_config.rb', line 27 def is_default_algo? @default end |