MultiPrime
224 RSA BSAFE Crypto-C Developers Guide
Crypto-C Format
publicKey
is a key object that was set by the Crypto-C function B_GenerateKeypair. Its
key info type (KI) is KI_RSAPublic. In the Reference Manual Chapter 3 entry on
KI_RSAPublic, the section titled Format of
info
returned by B_GetKeyInfo tells you
that the function returns a pointer to an A_RSA_KEY struct:
So you need to declare a variable to be a pointer to such a struct and pass this
variables address as the argument.
Using the prototype in Chapter 4 of the Reference Manual for B_GetKeyInfo as a guide,
write the following:
If you looked at the elements of the struct:
getPublicKey
->modulus.data
getPublicKey
->modulus.len
getPublicKey
->exponent.data
getPublicKey
->exponent.len
You could see the public key that Crypto-C generated. This is the information you
would make public.
Note: If you want to e-mail the information, you will not be able to send the
information over most e-mail systems because the data is in binary form, not
ASCII. Crypto-C offers encoding and decoding functions to convert between
binary and ASCII. See Converting Data Between Binary and ASCII on
page 172 for more information.
BER/DER Encoding
There is a problem with distributing the key in the above struct: it is not standard; it
typedef struct {
ITEM modulus; /* modulus */
ITEM exponent; /* exponent */
} A_RSA_KEY;
A_RSA_KEY *getPublicKey = (A_RSA_KEY *)NULL_PTR;
if ((status = B_GetKeyInfo
((POINTER *)&getPublicKey, publicKey, KI_RSAPublic)) != 0)
break;