A SERVICE OF

logo

Secret Sharing
306 RSA BSAFE Crypto-C Developers Guide
The example in this section corresponds to the file scrtshar.c.
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:
Step 2: Setting The Algorithm Object
There is only one AI that implements the Bloom-Shamir secret sharing algorithm:
AI_BSSecretSharing. The Reference Manual Chapter 2 entry on this AI reports that the
format of
info
supplied to B_SetAlgorithmInfo is the following struct:
Because you want to set the threshold to two, set your algorithm object as follows:
Step 3: Init
Initialize the algorithm with B_EncryptInit. No key is necessary, so pass a properly
cast
NULL_PTR for the key object. This algorithm object does not need an algorithm
chooser, so pass a properly cast
NULL_PTR for that argument as well. This function is
very quick, so it is reasonable to pass a
NULL_PTR for the surrender context:
B_ALGORITHM_OBJ secretSplitter = (B_ALGORITHM_OBJ)NULL_PTR;
if ((status = B_CreateAlgorithmObject (&secretSplitter)) != 0)
break;
typedef struct {
unsigned int threshold; /* share threshold */
} B_SECRET_SHARING_PARAMS;
B_SECRET_SHARING_PARAMS secretSharingParams;
secretSharingParams.threshold = 2;
if ((status = B_SetAlgorithmInfo
(secretSplitter, AI_BSSecretSharing,
(POINTER)&secretSharingParams)) != 0)
break;