none
Problem in porting the code using XEnroll to CertEnroll in Certificate Enrollment RRS feed

  • Question

  • Hi folks,

     

    Now i have some problem in converting code using XEnroll to CertEnroll for creating certificate request.

     

    The following is the previously written code in javascript using XEnroll,

    function CertRequest()

    {

       XEnrollObj.ProviderName = providername;
         XEnrollObj.KeySpec = 1;
         XEnrollObj.ContainerName = containername;
         XEnrollObj.UseExistingKeySet = true;
         certreq = XEnrollObj.createPKCS10(Dnstring, OIDstring);

    }

     

    Now i want to port the code to Vista using CertEnroll. Can anybody please give the corresponding piece of code using CertEnroll for the above code?

     

    Regards,

    Mukil

    Saturday, April 21, 2007 1:20 PM

All replies

  • I have the same problem, so if you found the solution, please post it here.

     

    Thanks,

    Marcus

    Wednesday, June 6, 2007 7:56 AM
    • Proposed as answer by Rizwan Afsar Wednesday, August 15, 2012 4:33 PM
    Friday, August 17, 2007 7:50 AM
  • Hi All

    please check this link...

    http://jasper-net.blogspot.in/2010/05/how-to-create-certificate-request-with.html

    Wednesday, August 15, 2012 4:36 PM
  • Hi All,

    I'm using following code to generate CSR and send to CA once i get response from CA i wanted to make it password protected before sending

    // XENROLLLib.CEnroll certEnroll = new XENROLLLib.CEnroll();
               // certEnroll.GenKeyFlags = 1024 * (256*256); //KEY
               // certEnroll.GenKeyFlags = CRYPT_EXPORTABLE;
               // certEnroll.UseExistingKeySet = 0;
               // certEnroll.EnableSMIMECapabilities=1;
               // certEnroll.addCertTypeToRequest (CertificateTemplate);
               // certEnroll.ProviderName =ProviderName;
               // //certEnroll.PVKFileName = @"C:\pvk1.pvk"; //if you need to export the private key (not req. because you generate

               // string dn = "CN="+ CommonName +",E="+ Email +",O="+ Organisation +",L="+ City +",S="+ State +",C="+Countrycode+"";
               // string req = certEnroll.createPKCS10(dn, EmailCertOID); //create the Request

               // int CR_IN_BASE64 = 0x1;
               // int CR_IN_PKCS10 = 0x100;

               // CERTCLIENTLib.CCertRequest certRequest = new CERTCLIENTLib.CCertRequest();
               //// creationState = certRequest.Submit(CR_IN_BASE64 | CR_IN_PKCS10, req, "", mCaServer+@"\"+mCaName);

               // if ( 3 == creationState)
               // {
               // string Cert =(string)certRequest.GetFullResponseProperty(FR_PRO P_FULLRESPONSE,0,PROPTYPE_BINARY,CR_OUT_BASE64);
               // certEnroll.acceptResponse(Cert);
               // //generate pfx
               //// certEnroll.createFilePFX(currentPfxPass,PFXFileName);

           certEnroll.createFilePFX(currentPfxPass,PFXFileName);

    when createFilePFX method is executed i get COM error Catastrophic failure

    Please help..

    Thanks

    Rizwan

    Wednesday, August 15, 2012 4:41 PM