Additive Secret Sharing and Share Proactivization ñ Using Python


Additive Secret Sharing is a method of sharing a secret among a group of participants in such a way that the secret can only be reconstructed if a certain number of participants come together and provide their shares. This technique is widely used in cryptography and secure multiparty computation. In this article, we will discuss the concept of Additive Secret Sharing and Share Proactivization and how they can be implemented using Python.

Introduction to Additive Secret Sharing

Additive Secret Sharing is a technique that allows a group of participants to share a secret among themselves without revealing the secret to any individual participant. The secret is divided into a number of shares, and each participant receives one share. The secret can only be reconstructed if a certain number of participants come together and provide their shares. This technique is also known as threshold secret sharing.

The basic idea behind Additive Secret Sharing is that the secret is represented as a polynomial of degree (t-1) where t is the threshold. The polynomial is chosen such that its coefficients are random integers. Each participant is then given a point on the polynomial, which represents their share. The secret can be reconstructed by interpolating the polynomial using the points provided by the participants.

For example, let's say that we have a secret S that we want to share among three participants, A, B, and C. We choose a polynomial of degree 2 with random coefficients. The polynomial is represented as S(x) = a0 + a1x + a2x^2. Each participant is then given a point on the polynomial (x, S(x)), where x is a unique value chosen for each participant.

Participant A receives the point (1, S(1))
Participant B receives the point (2, S(2))
Participant C receives the point (3, S(3))

Now, if any two participants come together and provide their points, they can reconstruct the polynomial and hence the secret. However, if an individual participant comes with their point, they cannot reconstruct the secret.

Implementing Additive Secret Sharing in Python

To implement Additive Secret Sharing in Python, we can use the Python library called "secretsharing" which provides an easy-to-use API for implementing threshold secret sharing. The library provides a function called "split_secret" that takes the secret, the number of shares, and the threshold as inputs and returns a list of shares.

Here is an example of how to use the "split_secret" function to share a secret among three participants −

from secretsharing import SecretSharer

# Secret to be shared secret = "mysecret" # Number of shares to be generated n = 3 # Threshold value t = 2 # Generate shares shares = SecretSharer.split_secret(secret, n, t) # Print the shares for share in shares: print(share)

In the above example, we have a secret "mysecret" that we want to share among three participants. We have set the threshold value to 2, which means that any two participants can reconstruct the secret. The "split_secret" function generates three shares and prints them.

Reconstructing the Secret

To reconstruct the secret, we can use the "recover_secret" function provided by the "secretsharing" library. The function takes a list of shares as input and returns the secret. Here is an example of how to use the "recover_secret" function to reconstruct the secret −

from secretsharing import SecretSharer # List of shares shares = ["1-mysecret", "2-mysecret", "3-mysecret"] # Reconstruct the secret secret = SecretSharer.recover_secret(shares) print(secret)

In the above example, we have a list of shares that we want to use to reconstruct the secret. The "recover_secret" function takes the list of shares as input and returns the secret. In this example, the secret is "mysecret".

Introduction to Share Proactivization

Share Proactivization is a technique that allows a group of participants to proactively refresh their shares without revealing the secret. This technique is used in situations where the secret may need to be changed frequently, such as in the case of a shared password.

The basic idea behind Share Proactivization is that each participant generates a new share for the new secret and sends it to the others. The new shares are then combined to reconstruct the new secret. The old shares are discarded, and the new shares are used to reconstruct the new secret.

Implementing Share Proactivization in Python

To implement Share Proactivization in Python, we can use the same "secretsharing" library that we used for Additive Secret Sharing. The library provides a function called "create_share" that takes the secret and a unique share ID as inputs and returns a new share for the secret.

Here is an example of how to use the "create_share" function to proactively refresh a share −

from secretsharing import SecretSharer # New secret new_secret = "mynewsecret" # Share ID share_id = "1" # Create a new share new_share = SecretSharer.create_share(new_secret, share_id) print(new_share)

In the above example, we have a new secret "mynewsecret" that we want to share among three participants. We also have a share ID "1" which represents the participant who will generate a new share. The "create_share" function takes the new secret and share ID as inputs and returns a new share for the secret.

To reconstruct the new secret, we can use the same "recover_secret" function as before. However, this time, we will use the new shares generated by each participant.

from secretsharing import SecretSharer # List of new shares new_shares = ["1-mynewsecret", "2-mysecret", "3-mysecret"] # Reconstruct the new secret new_secret = SecretSharer.recover_secret(new_shares) print(new_secret)

In the above example, we have a list of new shares that we want to use to reconstruct the new secret. The "recover_secret" function takes the list of new shares as input and returns the new secret, which in this case is "mynewsecret".

Conclusion

Additive Secret Sharing and Share Proactivization are powerful techniques that can be used to secure the sharing of sensitive information among a group of participants. The "secretsharing" library in Python provides an easy-to-use API for implementing these techniques. By using the "split_secret" and "create_share" functions, we can easily implement Additive Secret Sharing and Share Proactivization respectively. And, by using the "recover_secret" function, we can easily reconstruct the secret or the new secret.

Updated on: 31-Jan-2023

353 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements