/// <summary> /// 生成SAFENET证书 /// </summary> /// <param name="productKey"></param> /// <returns></returns> internal bool installSafeNet(string productKey, out string slId, out string msg) { msg = null; slId = null; try { string v2c = getV2C(productKey, out msg); string refXml = null; if (!string.IsNullOrEmpty(v2c)) { xmlBiz bll = new xmlBiz(); XmlDocument xml = bll.getXmlDocument(v2c.ToString()); XmlNode haspInfo = bll.getXmlSingleNode(xml, "hasp_info"); XmlNode haspscope = bll.getXmlSingleNode(haspInfo, "haspscope"); XmlNode vendor = bll.getXmlSingleNode(haspscope, "vendor"); XmlNode hasp = bll.getXmlSingleNode(vendor, "hasp"); slId = bll.getXmlAttribute(hasp, "id"); } HaspStatus status = Hasp.Update(v2c, ref refXml); return(status == HaspStatus.StatusOk); } catch (Exception ex) { msg += ex.Message + ex.StackTrace; return(false); } }
private string exctractV2CFromResponseXml(String responseXml) { xmlBiz bll = new xmlBiz(); XmlDocument xmlDoc = bll.getXmlDocument(responseXml); XmlNode root = bll.getXmlSingleNode(xmlDoc, "activation"); XmlNode node = bll.getXmlSingleNode(root, "activationOutput"); XmlNode v2c = bll.getXmlSingleNode(node, "activationString"); return(v2c.InnerText); }
/// <summary> /// 获取密锁锁号 /// </summary> /// <returns></returns> public List <string> getSlCode() { List <string> rtn = new List <string>(); safeNetBiz sb = new safeNetBiz(); string xmlString = sb.getSL(); if (!string.IsNullOrEmpty(xmlString)) { string id; xmlBiz biz = new xmlBiz(); XmlDocument doc = biz.getXmlDocument(xmlString); XmlDocument infoDoc = biz.getXmlDocument(xmlString); XmlNode root = biz.getXmlSingleNode(doc, "hasp_info"); if (root != null) { XmlNodeList nodeList = biz.getXmlNode(root, "hasp"); foreach (XmlNode node in nodeList) { id = biz.getXmlAttribute(node, "id"); //if (sb.login(id)) //{ infoDoc.LoadXml(sb.getSLInfo(id)); XmlNode infoRoot = infoDoc.SelectSingleNode("hasp_info"); if (infoRoot != null) { XmlNodeList infoNodeList = infoRoot.SelectNodes("feature"); bool mark = true; foreach (XmlNode infoNode in infoNodeList) { if ("false" == infoNode.Attributes["locked"].Value || "true" == infoNode.Attributes["disabled"].Value || "false" == infoNode.Attributes["usable"].Value) { mark = false; } } if (mark) { rtn.Add(id); } } // sb.logout(); //} } } } return(rtn); }
private string[] extractJsessionIdFromResponese(string xml) { String[] loginRes = new String[3]; if (xml.ToLower().Contains("<html>")) { return(null); } xmlBiz bll = new xmlBiz(); XmlDocument xmlDoc = bll.getXmlDocument(xml); XmlNode root = bll.getXmlSingleNode(xmlDoc, "EMSResponse"); XmlNode sessionId = bll.getXmlSingleNode(root, "sessionId"); loginRes[0] = sessionId.InnerText; XmlNode regRequired = bll.getXmlSingleNode(root, "regRequired"); loginRes[1] = regRequired.InnerText; XmlNode redirectToUserReg = bll.getXmlSingleNode(root, "redirectToUserReg"); loginRes[2] = redirectToUserReg.InnerText; return(loginRes); }