public class ShamirHandler
extends java.lang.Object
构造器和说明 |
---|
ShamirHandler() |
限定符和类型 | 方法和说明 |
---|---|
static byte[] |
join(java.util.Map<java.lang.Integer,byte[]> parts)
Joins the given parts to recover the original secret.
|
static java.util.Map<java.lang.Integer,byte[]> |
split(byte[] secret,
java.security.SecureRandom random,
int n,
int k)
Splits the given secret into n parts, of which any k or more can be combined to
recover the original secret.
|
public static java.util.Map<java.lang.Integer,byte[]> split(byte[] secret, java.security.SecureRandom random, int n, int k)
secret
- the secret to splitpublic static byte[] join(java.util.Map<java.lang.Integer,byte[]> parts)
N.B.: There is no way to determine whether or not the returned value is actually the original secret. If the parts are incorrect, or are under the threshold value used to split the secret, a random value will be returned.
parts
- a map of part IDs to part valuesjava.lang.IllegalArgumentException
- if parts is empty or contains values of varying lengths