I'm loading a certificate (pfx) into a telfilecertstorage using copyprivatekey=true; when it's loaded, it says that the privatekey is present; but when i unmount the filestorage and remount it, it doesn't have the privatekey!! (and also, the filesize of the file is 1400 when it should be 2500 +-) so it isn't saving the privatekeys.

TElFileCertStorage uses PKCS#7-compliant files for storing certificates. PKCS#7 format is usually used for storing a set of *public* certificates (e.g., root CA's) and is not intended for storing private keys. Please consider using LoadFromStreamPFX/SaveToStreamPFX methods of certificate storage objects for storing certificates along with the private keys.

And can I use SaveToStreamPFX/LoadFromStreamPFX method over a PKCS#7 file? or should i make another file for storing private keys?. Can you provide me some pseudocode or code to handle this two files (or the pkcs#7 file). Which is the better way to do this?

Actually, TElFileCertStorage is a bit obsolete. We recommend you to use TElMemoryCertStorage component along with its SaveToStreamPFX/LoadFromStreamPFX methods. This will allow you to store a set of certificates along with the corresponding private keys in a single file.

We use cookies to help provide you with the best possible online experience. By using this site, you agree that we may store and access cookies on your device. You can find out more about and set your own preferences here.