public ActionResult certkeymatcher(FormCollection collection) { KeyMatcherRequest req = new KeyMatcherRequest(); KeyMatcherresponse objRestResponse = null; bool iscsr = Convert.ToString(Request.Form["hdnType"]).Equals("CSR", StringComparison.OrdinalIgnoreCase); if (iscsr && (string.IsNullOrEmpty(Request.Form["txtsslcert"]) || string.IsNullOrEmpty(Request.Form["txtprivatekey"]))) { objRestResponse = new KeyMatcherresponse(); objRestResponse.AuthResponse = new AuthResponse(); objRestResponse.AuthResponse.isError = true; objRestResponse.AuthResponse.Message = new string[1] { iscsr ? "Please insert SSL certificate and CSR!" : "Please insert SSL certificate and Private key!" }; return(View(objRestResponse)); } req.AuthRequest = GetAuthrequest(); req.Certificate = Request.Form["txtsslcert"].Trim(); req.CSR = iscsr ? Request.Form["txtprivatekey"].Trim() : ""; req.PrivateKey = !iscsr?Convert.ToString(Request.Form["txtprivatekey"]).Trim() : ""; objRestResponse = FreeSSLToolsService.KeyMatcher(req); return(View(objRestResponse)); }
public static KeyMatcherresponse KeyMatcher(KeyMatcherRequest csrdetails) { KeyMatcherresponse Response = new KeyMatcherresponse(); var json = JsonConvert.SerializeObject(csrdetails); string strResponse = ApiHelper.GetResponseFromAPI(json, "ssltools/certkeymatcher/"); Response = JsonConvert.DeserializeObject <KeyMatcherresponse>(strResponse); return(Response); }