/// <summary> /// 验证设备CA证书 /// </summary> public CheckCertificateResponse CheckCertificate(CheckCertificateRequest checkCertificateRequest) { Dictionary <string, string> urlParam = new Dictionary <string, string>(); urlParam.Add("certificate_id", checkCertificateRequest.CertificateId.ToString()); string urlPath = HttpUtils.AddUrlPath("/v5/iot/{project_id}/certificates/{certificate_id}/action", urlParam); SdkRequest request = HttpUtils.InitSdkRequest(urlPath, "application/json", checkCertificateRequest); HttpResponseMessage response = DoHttpRequestSync("POST", request); CheckCertificateResponse checkCertificateResponse = JsonUtils.DeSerializeNull <CheckCertificateResponse>(response); return(checkCertificateResponse); }
//tundub vb imelik, et miks seda klassis välja ei kutsta //Makes response public virtual CertificationInfoDto MakeResponse(CheckCertificateResponse checkCertificateResponse) { var certificationInfoDto = new CertificationInfoDto(); if (checkCertificateResponse.Status == CertificateStatusConstants.CertificateStatusGood) { var authenticationDto = new AuthenticationDto { FirstName = checkCertificateResponse.UserGivenname, LastName = checkCertificateResponse.UserSurname, IdCode = checkCertificateResponse.UserIDCode, EnhancedKeyUsage = checkCertificateResponse.EnhancedKeyUsage, IssuerCN = checkCertificateResponse.IssuerCN, KeyUsage = checkCertificateResponse.KeyUsage, RevocationData = checkCertificateResponse.RevocationData, Status = checkCertificateResponse.Status, UserCN = checkCertificateResponse.UserCN, UserCountry = checkCertificateResponse.UserCountry, UserOrganisation = checkCertificateResponse.UserOrganisation, }; certificationInfoDto.IsCertificateValid = true; certificationInfoDto.AuthenticationDto = authenticationDto; certificationInfoDto.CertifikateChainStatus = CertificateChainStatusEnum.NotChecked; certificationInfoDto.CanRedirect = true; certificationInfoDto.CertificateStatus = checkCertificateResponse.Status; return(certificationInfoDto); } certificationInfoDto.CanRedirect = false; certificationInfoDto.IsCertificateValid = false; certificationInfoDto.AuthenticationDto = null; certificationInfoDto.CertifikateChainStatus = CertificateChainStatusEnum.NotChecked; certificationInfoDto.CertificateStatus = checkCertificateResponse.Status; return(certificationInfoDto); }