public class ShamirSecretSharing extends java.lang.Object implements LinearSecretSharing<Policy>
Assume s is the secret to be shared. Based on the threshold t of the given ThresholdPolicy a
PolynomialRing.Polynomial P(x) of degree t-1 is computed,
such that \(P(0)=s\).
The shares \((i, s_i = P(i))\) correspond to data points on the polynomial therefore any set \(S\) of shares with \(|S| \geq t\) can be used to uniquely determine the original polynomial using interpolation and therefore reconstruct the secret.
The secret is only shared among the direct children of the given ThresholdPolicy.
To share a secret among all ThresholdPolicy in a hierarchy of Policys use
ThresholdTreeSecretSharing.
| Constructor and Description |
|---|
ShamirSecretSharing(ThresholdPolicy policy,
org.cryptimeleon.math.structures.rings.zn.Zp field)
Create a new
ShamirSecretSharing instance |
| Modifier and Type | Method and Description |
|---|---|
boolean |
checkShareConsistency(org.cryptimeleon.math.structures.rings.zn.Zp.ZpElement secret,
java.util.Map<java.lang.Integer,org.cryptimeleon.math.structures.rings.zn.Zp.ZpElement> shares)
Outputs true if the given (full) set of shares is consistent with the given secret, meaning that all qualified
subsets of the shares will recreate the given secret.
|
java.util.Map<java.lang.Integer,org.cryptimeleon.math.structures.rings.zn.Zp.ZpElement> |
completeShares(org.cryptimeleon.math.structures.rings.zn.Zp.ZpElement secret,
java.util.Map<java.lang.Integer,org.cryptimeleon.math.structures.rings.zn.Zp.ZpElement> partialShares)
Takes a partial set of shares and completes it to a full set of shares for the given secret.
|
boolean |
equals(java.lang.Object o) |
org.cryptimeleon.math.structures.rings.zn.Zp |
getSharedRing()
Returns the ring over which the secret is being shared.
|
java.util.Map<java.lang.Integer,Policy> |
getShareReceiverMap()
Returns the map that assigns each index i of a share \(s_i\) to its share receiver.
|
java.util.Map<java.lang.Integer,org.cryptimeleon.math.structures.rings.zn.Zp.ZpElement> |
getShares(org.cryptimeleon.math.structures.rings.zn.Zp.ZpElement secret)
Randomly generates shares \(s_i\) for the given secret.
|
java.util.Map<java.lang.Integer,org.cryptimeleon.math.structures.rings.zn.Zp.ZpElement> |
getSolvingVector(java.util.Set<? extends Policy> setOfShareReceivers)
Instructs how to reconstruct a shared secret using the shares of a given set of share receivers
setOfShareReceivers. |
int |
hashCode() |
boolean |
isQualified(java.util.Set<? extends Policy> setOfShareReceivers)
Checks whether or not the given set of share receivers will be able to recreate the secret
by pooling their shares \(\{s_i \; | \; \text{getShareReceiver}(i) \in \text{setOfShareReceivers}\}\).
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitgetShareReceiver, getSharesOfReceiver, getSharesOfReceivers, isQualified, reconstructpublic ShamirSecretSharing(ThresholdPolicy policy, org.cryptimeleon.math.structures.rings.zn.Zp field)
ShamirSecretSharing instancepolicy - ThresholdPolicy among which children a secret shall be sharedfield - Zp over which the secret shall be sharedpublic java.util.Map<java.lang.Integer,org.cryptimeleon.math.structures.rings.zn.Zp.ZpElement> getShares(org.cryptimeleon.math.structures.rings.zn.Zp.ZpElement secret)
throws WrongAccessStructureException
LinearSecretSharinggetShareReceiver(i) to determine which share belongs to which share receiver.getShares in interface LinearSecretSharing<Policy>WrongAccessStructureExceptionpublic java.util.Map<java.lang.Integer,org.cryptimeleon.math.structures.rings.zn.Zp.ZpElement> getSolvingVector(java.util.Set<? extends Policy> setOfShareReceivers) throws NoSatisfyingSet, WrongAccessStructureException
LinearSecretSharingsetOfShareReceivers.
More specifically, computes a vector of coefficients \(a_i\) such that
\(\sum a_i \cdot s_i = \text{secret}\) for the \(s_i\) output by getShares(secret).
Only shares \(s_i\) with getShareReceiver(i) contained in setOfShareReceivers
appear in this sum (one can imagine that all other \(a_i\) are 0).getSolvingVector in interface LinearSecretSharing<Policy>setOfShareReceivers - the set of share receivers to calculate the solving vector forgetShareReceiver(i) is contained in setOfShareReceivers.NoSatisfyingSet - if the given set of share receivers cannot reconstruct the secret,
i.e. isQualified(setOfShareReceivers) == falseWrongAccessStructureExceptionpublic java.util.Map<java.lang.Integer,Policy> getShareReceiverMap()
LinearSecretSharinggetShareReceiverMap in interface LinearSecretSharing<Policy>public boolean isQualified(java.util.Set<? extends Policy> setOfShareReceivers) throws WrongAccessStructureException
LinearSecretSharingisQualified in interface LinearSecretSharing<Policy>setOfShareReceivers - the set of share receivers to checkWrongAccessStructureExceptionpublic org.cryptimeleon.math.structures.rings.zn.Zp getSharedRing()
LinearSecretSharinggetSharedRing in interface LinearSecretSharing<Policy>public java.util.Map<java.lang.Integer,org.cryptimeleon.math.structures.rings.zn.Zp.ZpElement> completeShares(org.cryptimeleon.math.structures.rings.zn.Zp.ZpElement secret,
java.util.Map<java.lang.Integer,org.cryptimeleon.math.structures.rings.zn.Zp.ZpElement> partialShares)
LinearSecretSharingisQualified(S) == true this method will simply recreate the full set of shares.
The contract is that the two S in the following are distributed identically:
completeShares in interface LinearSecretSharing<Policy>secret - the desired secret for the completed sharespartialShares - the set of partial shares \(\{s_i \; | \; i \in \text{getSharesOfReceivers}(X)\}\)getShares(secret)
(if the given partial shares are distributed as in getShares())public boolean checkShareConsistency(org.cryptimeleon.math.structures.rings.zn.Zp.ZpElement secret,
java.util.Map<java.lang.Integer,org.cryptimeleon.math.structures.rings.zn.Zp.ZpElement> shares)
LinearSecretSharingcheckShareConsistency in interface LinearSecretSharing<Policy>public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object