public string SendRequest(string request, string caserver) { var objCertRequest = new CCertRequest(); var iDisposition = objCertRequest.Submit( (int)Encoding.CR_IN_BASE64 | (int)Format.CR_IN_FORMATANY, //http://msdn.microsoft.com/en-us/library/windows/desktop/aa385054(v=vs.85).aspx request, string.Empty, caserver); return objCertRequest.GetRequestId().ToString(); }
//submit the request that created in the createCertifcate to the CA public int SubmitRequest(string certrequest, string hostname) { CCertConfig objCertConfig = new CCertConfig(); CCertRequest objCertRequest = new CCertRequest(); // CCertAdmin objCertAdmin = new CCertAdmin(); string strCAConfig; int iDisposition; int requestID; string errorStatus; try { strCAConfig = objCertConfig.GetConfig(CC_DEFAULTCONFIG); //connect to the ca iDisposition = objCertRequest.Submit(CR_IN_BASE64, certrequest, null, strCAConfig); //submit the certiface request to the ca requestID = objCertRequest.GetRequestId(); //get the requestid that was created -the certifacte is in pending status Database db = new Database(); db.InsertToCertificateTable(hostname, iDisposition, requestID); //insert first certificate information // objCertAdmin.ResubmitRequest(strCAConfig, requestID); return(requestID); //return the reqid that was created for the certificate request in the pending queue } catch (Exception ex) { errorStatus = ex.Message; Database db = new Database(); db.InsertToErrorMessageTable(hostname, 0, ex.Message, "SubmitRequest");//insert Error Message into The Error Table Log In The DataBase return(0); } }