Class: Ccrypto::KeypairConfig
- Inherits:
-
Object
- Object
- Ccrypto::KeypairConfig
- Includes:
- AlgoConfig
- Defined in:
- lib/ccrypto/configs/keypair_config.rb
Direct Known Subclasses
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.
-
#public_key ⇒ Object
Returns the value of attribute public_key.
Attributes included from AlgoConfig
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.
20 21 22 23 |
# File 'lib/ccrypto/configs/keypair_config.rb', line 20 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 |
#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
49 50 51 52 53 54 55 |
# File 'lib/ccrypto/configs/keypair_config.rb', line 49 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
57 58 59 |
# File 'lib/ccrypto/configs/keypair_config.rb', line 57 def self.supported_keypair_config(purpose = :signing, &block) Provider.instance.provider.supported_keypair_config(purpose, &block) end |
Instance Method Details
#has_keypair? ⇒ Boolean
29 30 31 |
# File 'lib/ccrypto/configs/keypair_config.rb', line 29 def has_keypair? (not @keypair.nil?) or not (@privateKey.nil? and @publicKey.nil?) end |
#has_private_key? ⇒ Boolean
33 34 35 36 37 38 39 |
# File 'lib/ccrypto/configs/keypair_config.rb', line 33 def has_private_key? if has_keypair? not @keypair.private_key.nil? else not @private_key.nil? end end |
#has_public_key? ⇒ Boolean
41 42 43 44 45 46 47 |
# File 'lib/ccrypto/configs/keypair_config.rb', line 41 def has_public_key? if has_keypair? not @keypair.public_key.nil? else not @public_key.nil? end end |
#is_default_algo? ⇒ Boolean
25 26 27 |
# File 'lib/ccrypto/configs/keypair_config.rb', line 25 def is_default_algo? @default end |