Class: FROST::SecretShare
- Inherits:
-
Object
- Object
- FROST::SecretShare
- Defined in:
- lib/frost/secret_share.rb
Overview
A secret share generated by performing a (t-out-of-n) secret sharing scheme.
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#share ⇒ Object
readonly
Returns the value of attribute share.
Instance Method Summary collapse
-
#group ⇒ ECDSA::Group
Get group.
-
#initialize(context, identifier, share) ⇒ SecretShare
constructor
Generate secret share.
-
#to_key ⇒ FROST::SigningKey
Generate signing share key.
-
#to_point ⇒ ECDSA::Point
Compute public key.
Constructor Details
#initialize(context, identifier, share) ⇒ SecretShare
Generate secret share.
12 13 14 15 16 17 18 19 20 |
# File 'lib/frost/secret_share.rb', line 12 def initialize(context, identifier, share) raise ArgumentError, "identifier must be Integer." unless identifier.is_a?(Integer) raise ArgumentError, "share must be Integer." unless share.is_a?(Integer) raise ArgumentError "context must be FROST::Context." unless context.is_a?(FROST::Context) @identifier = identifier @share = share @context = context end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
6 7 8 |
# File 'lib/frost/secret_share.rb', line 6 def context @context end |
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
4 5 6 |
# File 'lib/frost/secret_share.rb', line 4 def identifier @identifier end |
#share ⇒ Object (readonly)
Returns the value of attribute share.
5 6 7 |
# File 'lib/frost/secret_share.rb', line 5 def share @share end |
Instance Method Details
#group ⇒ ECDSA::Group
Get group
24 25 26 |
# File 'lib/frost/secret_share.rb', line 24 def group context.group end |
#to_key ⇒ FROST::SigningKey
Generate signing share key.
36 37 38 |
# File 'lib/frost/secret_share.rb', line 36 def to_key FROST::SigningKey.new(context, share) end |
#to_point ⇒ ECDSA::Point
Compute public key.
30 31 32 |
# File 'lib/frost/secret_share.rb', line 30 def to_point group.generator * share end |