EldoS | Feel safer!

Software components for data protection, secure storage and transfer

About ElX509Certificate.LoadKeyFromStreamPVK Methods

Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages
Posted: 03/17/2008 04:34:06
by  xu cong
protected TElX509Certificate TELX509 = new TElX509Certificate();
protected void Button1_Click(object sender, EventArgs e)
string pwd="1234";
FileStream FS = File.OpenRead("C:\\abcd.pvk");
TELX509.LoadKeyFromStreamPVK(FS, pwd, 0);

FileStream FS2 = File.OpenRead("C:\\abcd.cer");

FileStream sFS = File.OpenWrite("C:\\test.pfx");
TELX509.SaveToStreamPFX(sFS, "1234");

The abcd.pvk password is "1234",When I not for the LoadKeyFromStreamPVK password, produces test.pfx does not have the private key; But after establishment password, run-time error.
Why don't I know?
Posted: 03/17/2008 04:40:43
by Ken Ivanov (Team)

Would you be so kind to specify the exact error message?
Posted: 03/17/2008 04:46:49
by  xu cong
Posted: 03/17/2008 21:51:58
by  xu cong
Execution Arrive:TELX509.LoadKeyFromStream­PVK(FS, pwd, 0);
Will appear NullReferenceException ;
Posted: 03/18/2008 02:17:29
by Ken Ivanov (Team)

You have to load a certificate prior to loading private key material. As you are trying to load the key into empty certificate object, there's no associated public key material and thus the exception is thrown.
Posted: 03/18/2008 02:38:11
by  xu cong
Thank you very much!
Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.



Topic viewed 2020 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!