EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Client Certificate using Asp.net web application

Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.
Posted: 03/12/2013 01:37:51
by sandeep krishna (Basic support level)
Joined: 03/12/2013
Posts: 1

Can you please let me know if I can install the X509 Client Certificate programatically in web applicaton (ASP.Net)

I am using below code to generate client certificate.

TElX509CertificateEx CACert = new TElX509CertificateEx();

// Binary certificate
FileStream FS = File.OpenRead(Server.MapPath("../../Resources/Certificate") + "\\RajPersonalCA.cer");
CACert.LoadFromStream(FS, 0);

FileStream FS1 = File.OpenRead(Server.MapPath("../../Resources/Certificate") +"\\RajPersonalCA.pvk");
CACert.LoadKeyFromStreamPVK(FS1, certPassword, 0);

TElX509CertificateEx Cert = new TElX509CertificateEx();

Cert.Extensions.ExtendedKeyUsage.ClientAuthentication = true;

Cert.SubjectRDN.Count = 1;
for (int i = 0; i <= 0; i++) Cert.SubjectRDN.set_Tags(i, SBASN1Tree.Unit.SB_ASN1_PRINTABLESTRING);
Cert.SubjectRDN.set_OIDs(0, SBUtils.Unit.SB_CERT_OID_COMMON_NAME);
Cert.SubjectRDN.set_Values(0, SBUtils.Unit.BytesOfString(secureQueryString.DecryptURL(Request.QueryString["id"])));

Cert.ValidFrom = DateTime.Now;
Cert.ValidTo = DateTime.Now.AddYears(5);
int SignatureAlgorithm = 3;
CertificateGenerator cgen1 = new CertificateGenerator(CACert, Cert, SignatureAlgorithm, 64);

MemoryStream ms1 = new MemoryStream();
cgen1.Cert.SaveToStreamPFX(ms1, string.Empty);
Posted: 03/12/2013 02:07:53
by Vsevolod Ievgiienko (EldoS Corp.)

Thank you for contacting us.

You can use TElWinCertStorage to install generated certificate to Windows store. Please refer to this article for details: http://www.eldos.com/security/articles/7116.php



Topic viewed 376 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!