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 class
ShamirSecretSplitter.Algorithm
static class
ShamirSecretSplitter.Mode
-
Constructor Summary
Constructors Constructor Description ShamirSecretSplitter(ShamirSecretSplitter.Algorithm algorithm, ShamirSecretSplitter.Mode mode, int l, java.security.SecureRandom random)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ShamirSplitSecret
resplit(byte[] secret, int m, int n)
Creates secret shares from a given secret.ShamirSplitSecret
split(int m, int n)
Creates secret shares.ShamirSplitSecret
splitAround(SecretShare s, int m, int n)
Creates secret shares from a given secret share.
-
-
-
Constructor Detail
-
ShamirSecretSplitter
public ShamirSecretSplitter(ShamirSecretSplitter.Algorithm algorithm, ShamirSecretSplitter.Mode mode, int l, java.security.SecureRandom random)
-
-
Method Detail
-
split
public ShamirSplitSecret split(int m, int n)
Description copied from interface:SecretSplitter
Creates secret shares. The secret will be divided into shares, where the secret has a length of L bytes.- Specified by:
split
in interfaceSecretSplitter
- Parameters:
m
- A threshold number of sharesn
- Total number of shares- Returns:
- An array of
byte[][]
representing the generated secret shares for m users with l bytes each.
-
splitAround
public ShamirSplitSecret splitAround(SecretShare s, int m, int n) throws java.io.IOException
Description copied from interface:SecretSplitter
Creates 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:
splitAround
in interfaceSecretSplitter
m
- A threshold number of sharesn
- Total number of shares- Returns:
- An array of
byte[][]
representing the generated secret shares for m users with l bytes each. - Throws:
java.io.IOException
-
resplit
public ShamirSplitSecret resplit(byte[] secret, int m, int n)
Description copied from interface:SecretSplitter
Creates secret shares from a given secret. The secret will be divided into shares, where the secret has a length of L bytes.- Specified by:
resplit
in interfaceSecretSplitter
m
- A threshold number of sharesn
- Total number of shares- Returns:
- An array of
byte[][]
representing the generated secret shares for m users with l bytes each.
-
-