public class SecretSharingGenerator
extends java.lang.Object
Constructor and Description |
---|
SecretSharingGenerator() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
combine(java.lang.String[] encodedSecretPhrasePieces)
Given minPieces pieces out of totalPieces of a secretPhrase, combine the pieces into the original phrase.*
Pieces are formatted as [version]:[split id]:[total pieces]:[minimum pieces]:[prime field size or zero]:[piece number]:[piece content]
|
static byte[] |
combinePrivateKey(java.lang.String[] encodedSecretPhrasePieces)
Given minPieces pieces out of totalPieces of a privateKey, combine the pieces into the original.
|
static java.math.BigInteger |
getModPrime(byte[] privateKey)
Given a private key calculate the modulo prime finite field size which is sufficiently large to split the key.
|
static java.math.BigInteger |
getModPrime(java.lang.String secretPhrase)
Given a secret phrase calculate the modulo prime finite field size which is sufficiently large to split the
shared secrets.
|
static boolean |
isPrivateKeySecret(java.lang.String[] encodedSecretPhrasePieces) |
static java.lang.String[] |
split(byte[] privateKey,
int totalPieces,
int minPieces,
java.math.BigInteger declaredModePrime)
Given a secret byte array split it into totalPieces pieces where each minPieces of them are enough to reproduce the secret.
|
static java.lang.String[] |
split(java.lang.String secretPhrase,
int totalPieces,
int minPieces,
java.math.BigInteger declaredModePrime)
Given a secretPhrase split it into totalPieces pieces where each minPieces of them are enough to reproduce the secret.
|
public static java.lang.String[] split(java.lang.String secretPhrase, int totalPieces, int minPieces, java.math.BigInteger declaredModePrime)
secretPhrase
- the secret phrasetotalPieces
- the number of generated piecesminPieces
- the number of pieces needed to reproduce the secret phrasedeclaredModePrime
- the modulo prime used for secret sharing calculations. Specify BigInteger.ZERO to calculate automaticallypublic static java.lang.String[] split(byte[] privateKey, int totalPieces, int minPieces, java.math.BigInteger declaredModePrime)
privateKey
- the secret byte arraytotalPieces
- the number of generated piecesminPieces
- the number of pieces needed to reproduce the secret phrasedeclaredModePrime
- the modulo prime used for secret sharing calculations. Specify BigInteger.ZERO to calculate automaticallypublic static byte[] combinePrivateKey(java.lang.String[] encodedSecretPhrasePieces)
encodedSecretPhrasePieces
- the pieces of the private key formatted as specified abovepublic static java.lang.String combine(java.lang.String[] encodedSecretPhrasePieces)
encodedSecretPhrasePieces
- the pieces of the secret phrase formatted as specified abovepublic static boolean isPrivateKeySecret(java.lang.String[] encodedSecretPhrasePieces)
public static java.math.BigInteger getModPrime(java.lang.String secretPhrase)
secretPhrase
- the secret phrasepublic static java.math.BigInteger getModPrime(byte[] privateKey)
privateKey
- the private key