Bouncy Castle Cryptography Library 1.86

org.bouncycastle.crypto.threshold
Class ShamirSecretSplitter

java.lang.Object
  extended byorg.bouncycastle.crypto.threshold.ShamirSecretSplitter
All Implemented Interfaces:
SecretSplitter

public class ShamirSecretSplitter
extends java.lang.Object
implements SecretSplitter


Nested Class Summary
static class ShamirSecretSplitter.Algorithm
           
static class ShamirSecretSplitter.Mode
          Deprecated. no longer selects anything. Mode.Table indexed log/exp tables with the secret being split and with the share bytes, so which cache line it touched revealed them; both values now use the same constant-time arithmetic. Use #getInstance(Algorithm, int, SecureRandom), which takes no mode.
 
Field Summary
protected  int l
          Length of the secret
protected  java.security.SecureRandom random
           
 
Constructor Summary
ShamirSecretSplitter(ShamirSecretSplitter.Algorithm algorithm, ShamirSecretSplitter.Mode mode, int l, java.security.SecureRandom random)
          Deprecated. the mode is ignored - see ShamirSecretSplitter.Mode. Use #getInstance(Algorithm, int, SecureRandom).
 
Method Summary
static ShamirSecretSplitter getInstance(ShamirSecretSplitter.Algorithm algorithm, int l, java.security.SecureRandom random)
          Create a splitter using constant-time GF(256) arithmetic.
 SplitSecret resplit(byte[] secret, int m, int n)
          Creates secret shares from a given secret.
 SplitSecret split(int m, int n)
          Creates secret shares.
 SplitSecret splitAround(SecretShare s, int m, int n)
          Creates secret shares from a given secret share.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

l

protected int l
Length of the secret


random

protected java.security.SecureRandom random
Constructor Detail

ShamirSecretSplitter

public ShamirSecretSplitter(ShamirSecretSplitter.Algorithm algorithm,
                            ShamirSecretSplitter.Mode mode,
                            int l,
                            java.security.SecureRandom random)
Deprecated. the mode is ignored - see ShamirSecretSplitter.Mode. Use #getInstance(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 SplitSecret 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 interface SecretSplitter
Parameters:
m - A threshold number of shares
n - Total number of shares
Returns:
the n generated secret shares, each L bytes long, any m of which recover the secret.

splitAround

public SplitSecret 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 interface SecretSplitter
Parameters:
m - A threshold number of shares
n - 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 SplitSecret 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 interface SecretSplitter
Parameters:
m - A threshold number of shares
n - Total number of shares
Returns:
the n generated secret shares, each L bytes long, any m of which recover the secret.

Bouncy Castle Cryptography Library 1.86