EldoS | Feel safer!

Software components for data protection, secure storage and transfer

About ElX509Certificate.LoadKeyFromStreamPVK Methods

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
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 (EldoS Corp.)

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 (EldoS Corp.)

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: Callback File System
Create virtual file systems and disks, expose and manage remote data as if they were files on the local disk.



Topic viewed 1936 times

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


Back to top

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

Got it!