RE: How to extract the public key
"Colestock, Robert" <[email protected]> Thu, 7 Jun 2001 11:32:38 -0400
| Newsgroups | gmane.ietf.sfl |
|---|---|
| Message-ID | <[email protected]> |
Tuzi:
I assume you are using the RSA algorithm, since none other allows signing
and encrypting operations on the same public key (barring the obscure DH
signing alg).
We do not allow RSA public keys as raw input for Encryption operations, they
must be in a certificate. You would need to extract the certificate from
the SignedData (which must be present, since it also cannot store a raw
public key) and specify this certificate (from a file perhaps?) as a
recipient for the encryption operation.
As to how to do this, the SignedData certificate must be extracted from the
CSM_MsgCertCrls member variable and stored as a file (you can extract as a
CSM_Buffer, then save to file with the convert to file method). To load
into the CSM_MsgToEncrypt class, call the AddRecipient method specifying the
above extracted CSM_Buffer certificate (see the
./SMIME/testutil/util/CL_MsgToEncrypt.cpp file for an example). You can
create a CSM_Buffer directly from a file ("CSM_Buffer
A("./ExampleFileWithCertificate.cer"). If you need the actual specific
details, please e-mail back and I will lookup the necessary example logic to
perform these operations.
Bob Colestock
VDA
-----Original Message-----
From: tuzi
To: [email protected]
Sent: 6/7/2001 3:55 AM
Subject: How to extract the public key
imc-sfl,
hi all, my question comes from the following case:
When one send a signed message to me, his
public key is included in the signed data. With
this public key, I can send some encrypted message
to him.
My question is how to use the SFL API to :
1.extract the public key from the signed data
2.store the public key for later use
3.use this public key to generate a encrypted message
Thank you very much.
sincerely
tuzi
[email protected]