Andrew Fan wrote:
I want to create a RSA public key ( SECKEYPublicKey ) from RSA moduls
and exponent. I can not find the functions. What can I do? Can you tell
me the process?
I also want to convert othe mechanism( such as DSA ) raw public
materials into SECKEYPublicKey. Hope you give me some advices.
Same process for both. The SECKEYPublicKey struct is public.
You construct your own. Before asking NSS to use it, you call
PK11_ImportPublicKey, which imports the key into a cryptographic device
(which may be hardware or software, you choose which one).
When constructing the SECKEYPublicKey, the struct itself
and all the buffers containing the components should be allocated from a
PLArenaPool, and the address of that pool is stored in the pubkey's
"arena" member. The entire struct should begin zeroed out.
When you're done using the imported struct, you call SECKEY_DestroyPublicKey
to disconnect your structure from the crypto device and free the PLArenaPool
that contains the struct and its related buffers.
There aren't any examples of this (that I can recall) because this is a
pretty unusual thing to do. Normally public keys are transported in
certs, not as bare keys.
Thanks in advance.
Andrew