Class ShamirSecretSplitter
- java.lang.Object
-
- org.bouncycastle.crypto.threshold.ShamirSecretSplitter
-
- All Implemented Interfaces:
SecretSplitter
public class ShamirSecretSplitter extends java.lang.Object implements SecretSplitter
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classShamirSecretSplitter.Algorithmstatic classShamirSecretSplitter.ModeDeprecated.no longer selects anything.
-
Constructor Summary
Constructors Constructor Description ShamirSecretSplitter(ShamirSecretSplitter.Algorithm algorithm, ShamirSecretSplitter.Mode mode, int l, java.security.SecureRandom random)Deprecated.the mode is ignored - seeShamirSecretSplitter.Mode.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ShamirSecretSplittergetInstance(ShamirSecretSplitter.Algorithm algorithm, int l, java.security.SecureRandom random)Create a splitter using constant-time GF(256) arithmetic.ShamirSplitSecretresplit(byte[] secret, int m, int n)Creates secret shares from a given secret.ShamirSplitSecretsplit(int m, int n)Creates secret shares.ShamirSplitSecretsplitAround(SecretShare s, int m, int n)Creates secret shares from a given secret share.
-
-
-
Constructor Detail
-
ShamirSecretSplitter
@Deprecated public ShamirSecretSplitter(ShamirSecretSplitter.Algorithm algorithm, ShamirSecretSplitter.Mode mode, int l, java.security.SecureRandom random)
Deprecated.the mode is ignored - seeShamirSecretSplitter.Mode. UsegetInstance(Algorithm, int, SecureRandom).
-
-
Method Detail
-
getInstance
public static ShamirSecretSplitter getInstance(ShamirSecretSplitter.Algorithm algorithm, int l, java.security.SecureRandom random)
Create a splitter using constant-time GF(256) arithmetic.- Parameters:
algorithm- the reduction polynomial to work over.l- length in bytes of the secret to be split.random- source of randomness for the polynomial coefficients.
-
split
public ShamirSplitSecret split(int m, int n)
Description copied from interface:SecretSplitterCreates secret shares. The secret will be divided into shares, where the secret has a length of L bytes.- Specified by:
splitin interfaceSecretSplitter- Parameters:
m- A threshold number of sharesn- Total number of shares- Returns:
- the n generated secret shares, each L bytes long, any m of which recover the secret.
-
splitAround
public ShamirSplitSecret splitAround(SecretShare s, int m, int n) throws java.io.IOException
Description copied from interface:SecretSplitterCreates secret shares from a given secret share. The secret will be divided into shares, where the secret has a length of L bytes.- Specified by:
splitAroundin interfaceSecretSplitterm- A threshold number of sharesn- Total number of shares- Returns:
- the n generated secret shares, each L bytes long, any m of which recover the secret. The first of them is s.
- Throws:
java.io.IOException
-
resplit
public ShamirSplitSecret resplit(byte[] secret, int m, int n)
Description copied from interface:SecretSplitterCreates secret shares from a given secret. The secret will be divided into shares, where the secret has a length of L bytes.- Specified by:
resplitin interfaceSecretSplitterm- A threshold number of sharesn- Total number of shares- Returns:
- the n generated secret shares, each L bytes long, any m of which recover the secret.
-
-