/// <summary> /// /// </summary> /// <param name="strContent">原文</param> /// <param name="strCerId">印章标识</param> public void SignOrderItem(string strContent, string strCerId, out string strmsg) { strmsg = ""; if (!InitCa(out strmsg)) { return; } string sealResultId = ""; //证书标示 cerlst[0] if (cerlst.Count > 0) { sealResultId = _seal.SOF_SignSealData(strCerId, cerlst[0], strContent, 0); if (sealResultId == "") { strmsg = "产生签名值失败"; } string strResult = _seal.SOF_GetSealInfo(sealResultId, 0); try { //验证签名值 InitCaConnection(out strmsg); //string strbase64=medicalTK.SOF_ExportUserCert(cerlst[0]); int iRet = vstkClientPro.SOF_VerifySignedData(_seal.SOF_GetSealInfo(sealResultId, 2), strContent, _seal.SOF_GetSealInfo(sealResultId, 1)); //int iRet = _seal.SOF_VerifySealData(_seal.SOF_GetSealInfo(sealResultId, 2), // strContent, // _seal.SOF_GetSealInfo(sealResultId, 1), // _seal.SOF_GetSealInfo(sealResultId, 4), 0); if (iRet == 0) { MessageBox.Show("验签成功!"); } else { strmsg = "验失败!"; } } catch (Exception err) { strmsg = err.Message + ";CA错误代码:" + vstkClientPro.SOF_GetLastError(); } } }
/// <summary> /// 原文签章 /// </summary> /// <param name="sealId">印章标识</param> /// <param name="certId">证书标识</param> /// <param name="flatData">原文</param> /// <param name="flag">签章模式 0</param> /// <returns>签章结果标识</returns> public string SignSealData(string sealId, string certId, string flatData, int flag) { return(seal.SOF_SignSealData(sealId, certId, flatData, flag)); }