public class ShamirSecretSplitterTest
extends junit.framework.TestCase
| Modifier and Type | Field and Description |
|---|---|
static byte[][] |
TV011D_TV1_1_2_SPLITS |
static byte[] |
TV011D_TV1_SECRET |
static byte[][] |
TV011D_TV1_SPLITS |
static byte[][] |
TV011D_TV1_SR |
static byte[][] |
TV011D_TV2_1_2_SPLITS |
static byte[][] |
TV011D_TV2_1_4_SPLITS |
static byte[][] |
TV011D_TV2_3_4_SPLITS |
static byte[] |
TV011D_TV2_SECRET |
static byte[][] |
TV011D_TV2_SPLITS |
static byte[][] |
TV011D_TV2_SR |
static byte[][] |
TV011D_TV3_1_2_3_SPLITS |
static byte[][] |
TV011D_TV3_1_2_4_SPLITS |
static byte[][] |
TV011D_TV3_1_3_4_SPLITS |
static byte[] |
TV011D_TV3_SECRET |
static byte[][] |
TV011D_TV3_SPLITS |
static byte[][] |
TV011D_TV3_SR |
static byte[][] |
TV011D_TV4_1_2_3_4_SPLITS |
static byte[] |
TV011D_TV4_SECRET |
static byte[][] |
TV011D_TV4_SPLITS |
static byte[][] |
TV011D_TV4_SR |
static byte[][] |
TV011D_TV5_1_2_SPLITS |
static byte[][] |
TV011D_TV5_8_9_SPLITS |
static byte[] |
TV011D_TV5_SECRET |
static byte[][] |
TV011D_TV5_SPLITS |
static byte[][] |
TV011D_TV5_SR |
| Constructor and Description |
|---|
ShamirSecretSplitterTest() |
| Modifier and Type | Method and Description |
|---|---|
static void |
main(java.lang.String[] args) |
void |
performTest() |
void |
testLargeShareSetRecovery()
Recovery has to work for any share count the splitter will produce. getSecret counted the
Lagrange products into a byte, so from 130 shares up the index wrapped negative and threw an
ArrayIndexOutOfBoundsException.
|
void |
testMultipleDivideRejectFieldZero()
divide() and multiple() rewrite every share in place, so a zero divisor or multiplier would
silently overwrite the whole set with zeroes and irreversibly destroy the secret. gfMul reduces
its operand modulo 256, so the field's zero element is any value with (v & 0xFF) == 0 - not just
an exact 0 - and both methods reject it up front.
|
void |
testPolynomial() |
void |
testPolynomialModeEquivalence()
The mode-free getInstance and both deprecated Mode values have to be interchangeable, since all
three now run the same GF(256) arithmetic.
|
void |
testRecombine(ShamirSplitSecret splitSecret,
byte[] secret) |
void |
testRecoveryRejectsEmptyShareSet()
Nothing can be recovered from no shares at all. getSecret used to size its Lagrange product
array at one less than the share count, so an empty set threw a NegativeArraySizeException.
|
void |
testResplitRejectsWrongLengthSecret()
resplit sizes its coefficient rows by l but took the replacement secret at whatever length it
came in at, so a short secret silently produced shares shorter than l and a long one threw an
ArrayIndexOutOfBoundsException.
|
void |
testShamirSecretMultipleDivide() |
void |
testShamirSecretResplit() |
void |
testShamirSecretSplitter() |
void |
testShamirSecretSplitterSplitAround() |
void |
testShareCountIndependentOfSecretLength()
The generated share array is sized by the requested number of shares n, not by the length l
of the secret.
|
void |
testSplitAroundRejectsWrongLengthShare()
splitAround folds the supplied share over the secret length l, so a share of any other length
used to fail with an ArrayIndexOutOfBoundsException (short), or be carried into the result at
its own length while every other share was l bytes (long).
|
void |
testSplitAroundThresholdOfOne()
A threshold of one is a degenerate but legal split - every share is the secret. splitAround
read the second coefficient row unconditionally, so it threw an ArrayIndexOutOfBoundsException
before producing any share.
|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, setUp, tearDown, toStringpublic static final byte[][] TV011D_TV1_SR
public static final byte[][] TV011D_TV1_SPLITS
public static final byte[][] TV011D_TV1_1_2_SPLITS
public static final byte[] TV011D_TV1_SECRET
public static final byte[][] TV011D_TV2_SR
public static final byte[][] TV011D_TV2_SPLITS
public static final byte[][] TV011D_TV2_1_2_SPLITS
public static final byte[][] TV011D_TV2_1_4_SPLITS
public static final byte[][] TV011D_TV2_3_4_SPLITS
public static final byte[] TV011D_TV2_SECRET
public static final byte[][] TV011D_TV3_SR
public static final byte[][] TV011D_TV3_SPLITS
public static final byte[][] TV011D_TV3_1_2_3_SPLITS
public static final byte[][] TV011D_TV3_1_2_4_SPLITS
public static final byte[][] TV011D_TV3_1_3_4_SPLITS
public static final byte[] TV011D_TV3_SECRET
public static final byte[][] TV011D_TV4_SR
public static final byte[][] TV011D_TV4_SPLITS
public static final byte[][] TV011D_TV4_1_2_3_4_SPLITS
public static final byte[] TV011D_TV4_SECRET
public static final byte[][] TV011D_TV5_SR
public static final byte[][] TV011D_TV5_SPLITS
public static final byte[][] TV011D_TV5_1_2_SPLITS
public static final byte[][] TV011D_TV5_8_9_SPLITS
public static final byte[] TV011D_TV5_SECRET
public static void main(java.lang.String[] args)
throws java.io.IOException
java.io.IOExceptionpublic void performTest()
throws java.io.IOException
java.io.IOExceptionpublic void testResplitRejectsWrongLengthSecret()
throws java.io.IOException
java.io.IOExceptionpublic void testRecoveryRejectsEmptyShareSet()
throws java.io.IOException
java.io.IOExceptionpublic void testLargeShareSetRecovery()
throws java.io.IOException
java.io.IOExceptionpublic void testSplitAroundThresholdOfOne()
throws java.io.IOException
java.io.IOExceptionpublic void testSplitAroundRejectsWrongLengthShare()
throws java.io.IOException
java.io.IOExceptionpublic void testShareCountIndependentOfSecretLength()
throws java.io.IOException
java.io.IOExceptionpublic void testPolynomialModeEquivalence()
throws java.io.IOException
java.io.IOExceptionpublic void testShamirSecretResplit()
throws java.io.IOException
java.io.IOExceptionpublic void testShamirSecretMultipleDivide()
throws java.io.IOException
java.io.IOExceptionpublic void testMultipleDivideRejectFieldZero()
throws java.io.IOException
java.io.IOExceptionpublic void testShamirSecretSplitterSplitAround()
throws java.io.IOException
java.io.IOExceptionpublic void testShamirSecretSplitter()
throws java.io.IOException
java.io.IOExceptionpublic void testPolynomial()
throws java.io.IOException
java.io.IOExceptionpublic void testRecombine(ShamirSplitSecret splitSecret, byte[] secret) throws java.io.IOException
java.io.IOException