Secret Sharing

Reconstructing the Secret

To reconstruct the secret, call B_DecryptUpdate for each share you are entering. You need at least threshold number of shares; if you enter fewer, B_DecryptFinal will return an error. Any combination of threshold shares will work.

Step 1: Creating An Algorithm Object

Declare a variable to be B_ALGORITHM_OBJ. As defined in the function prototype in Chapter 4 of the Reference Manual, its address is the argument for B_CreateAlgorithmObject:

B_ALGORITHM_OBJ secretReconstructer = (B_ALGORITHM_OBJ)NULL_PTR;

if ((status = B_CreateAlgorithmObject (&secretReconstructer)) != 0)

break;

Step 2: Setting The Algorithm Object

Use the same AI, AI_BSSecretSharing:

B_SECRET_SHARING_PARAMS secretSharingParams;

secretSharingParams.threshold = 2;

if ((status = B_SetAlgorithmInfo (secretReconstructer, AI_BSSecretSharing, (POINTER)&secretSharingParams)) != 0)

break;

Step 3: Init

Initialize the algorithm with B_DecryptInit. Once again no key or algorithm chooser is necessary. This function is very quick, so it is reasonable to pass a NULL_PTR for the surrender context:

C h a p t e r 8 S e c r e t S h a r i n g O p e r a t i o n s

3 0 9

Page 331
Image 331
RSA Security 5.2.2 manual Reconstructing the Secret, Use the same AI, AIBSSecretSharing