|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
|
+--org.logi.crypto.Crypto
|
+--org.logi.crypto.secretshare.SecretShare
|
+--org.logi.crypto.secretshare.XorSecretShare
This class stores a share of a secret.
The xor method can only be used for n/n sharing, where n shares are created and all are needed to retrieve the secret. The shares s[0..n-2] are simply random numbers, while s[n] is the exclusive or of all the other shares along with the secret.
| Fields inherited from class org.logi.crypto.Crypto |
BIT, cdsPath, EMPTY_ARRAY, FOUR, keySource, NIBBLE, ONE, primeCertainty, random, TWO, ZERO |
| Constructor Summary | |
XorSecretShare(int n,
byte[] share)
Create an object for an n/n xor-share. |
|
XorSecretShare(int n,
byte[] share,
boolean copy)
Create an object for an n/n xor-share. |
|
| Method Summary | |
boolean |
equals(java.lang.Object obj)
|
byte[] |
getShare()
Get the actual bytes of the share. |
int |
hashCode()
|
static XorSecretShare |
parseCDS(java.lang.String[] param)
Used by Crypto.fromString when parsing a CDS. |
static byte[] |
retrieve(SecretShare[] shares)
retrieve the secret from an array of shares. |
static XorSecretShare[] |
share(int n,
byte[] secret)
Split the secret in n parts. |
java.lang.String |
toString()
Return a CDS for this object. |
| Methods inherited from class org.logi.crypto.secretshare.SecretShare |
getM, getN |
| Methods inherited from class org.logi.crypto.Crypto |
binString, binString, ensureArrayLength, ensureArrayLength, equal, equalRelaxed, equalSub, fromHexNibble, fromHexString, fromString, fromString, hexString, hexString, hexString, hexString, hexString, initRandom, initRandom, makeClass, makeInt, makeLong, makeSessionKey, pastSpace, pickBits, pickBits, prettyPrint, prettyPrint, readBlock, readInt, trimArrayLength, trimArrayLength, trimLeadingZeroes, writeBytes, writeBytes, writeInt |
| Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public XorSecretShare(int n,
byte[] share)
public XorSecretShare(int n,
byte[] share,
boolean copy)
| Method Detail |
public static XorSecretShare[] share(int n,
byte[] secret)
public static byte[] retrieve(SecretShare[] shares)
throws SecretSharingException
SecretSharingException - if the secret can't be retrieved.public byte[] getShare()
public static XorSecretShare parseCDS(java.lang.String[] param)
throws InvalidCDSException
A valid CDS can be created by calling the toString() method.
InvalidCDSException - if the CDS is malformed.Crypto.fromString(String)public java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Object
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
Copyright (c) 1997-2001 Logi Ragnarsson - Distributed under the GPL