public string CheckTRK(StringBuilder source) { StringBuilder result = new StringBuilder(); F10.SUNSON_ActiveKey(0x00, 0x02, result); F10.SUNSON_SetAlgorithmParameter(0x01, 0x30, result); F10.SUNSON_SetAlgorithmParameter(0x07, 0x20, result); F10.SUNSON_DataEncrypt((byte)(source.ToString().Length / 2), source, result); return(result.ToString().Substring(0, 16)); }
/// <summary> /// 计算PIN码 /// </summary> /// <param name="source"></param> /// <returns></returns> public string CalculatePIN(StringBuilder source) { File.AppendAllText("pin.txt", source.ToString()); StringBuilder result = new StringBuilder(); F10.SUNSON_ActiveKey(0x00, 0x00, result); F10.SUNSON_SetAlgorithmParameter(0x01, 0x30, result); F10.SUNSON_DataEncrypt((byte)(source.ToString().Length / 2), source, result); return(result.ToString().Substring(0, 16)); }
/// <summary> /// 核对MAC码 /// </summary> /// <param name="source"></param> /// <returns></returns> public string CheckMAK(StringBuilder source) { StringBuilder sbMac = new StringBuilder(); StringBuilder sbReturn = new StringBuilder(); F10.SUNSON_ActiveKey(0x00, 0x01, sbReturn); F10.SUNSON_SetAlgorithmParameter(0x01, 0x20, sbReturn); F10.SUNSON_SetAlgorithmParameter(0x07, 0x10, sbReturn); F10.SUNSON_DataEncrypt(8, source, sbMac); return(sbMac.ToString().Substring(0, 16)); }