zoukankan      html  css  js  c++  java
  • 跨境通申报助手V1.0

    一、跨境通申报助手 介绍

    经过多年的开发与修改对接了一部分口岸海关的申报对接,为了帮助进出口跨境电商企业,跨境通申报助手解决订单,支付,运单申报的问题,专注来做业务,推出跨境通申报助手V1.0

    帮助进出口跨境电商对接各地申报海关对接的一个申报助手。免费提供学习,提供有偿服务,申报按票数计费,减轻企业成本.

    下载地址:

     http://sdkjt.kjtcn.net/Downloadlist/downloadKJTHelp

    二、加签方法如下

           /// <summary>
            /// 签名报文
            /// </summary>
            /// <param name="strMsgXml"></param>
            /// <returns></returns>
            private string EncryptToSHA1(string strMsgXml)
            {
                string result;
                try
                {
                    SHA1CryptoServiceProvider sha1CryptoServiceProvider = new SHA1CryptoServiceProvider();
                    byte[] bytes = Encoding.UTF8.GetBytes(strMsgXml);
                    byte[] inArray = sha1CryptoServiceProvider.ComputeHash(bytes);
                    sha1CryptoServiceProvider.Clear();
                    ((IDisposable)sha1CryptoServiceProvider).Dispose();
                    result = Convert.ToBase64String(inArray);
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
                return result;
            }

     

     /// <summary>
            /// 读取设备
            /// </summary>
            /// <param name="centiNoOut"></param>
            /// <returns></returns>
            public bool IsICOrUKeyOk(out string centiNoOut)
            {
                centiNoOut = "";
                bool result;
                try
                {
                    byte[] array = new byte[100];
                    int num = array.Length;
                    byte[] array2 = new byte[10000];
                    int num2 = array2.Length;
                    int cardID = ICHepler.GetCardID(array, out num);
                    if (cardID == 0)
                    {
                        int certNo = ICHepler.GetCertNo(array2, out num2);
                        if (certNo == 0)
                        {
                            byte[] array3 = new byte[num2];
                            Array.Copy(array2, array3, num2);
                            centiNoOut = Encoding.UTF8.GetString(array3);
                            return true;
                        }
                        if (certNo == -1)
                        {
                            throw new Exception("卡初始化出错");
                        }
                        if (certNo == -2)
                        {
                            throw new Exception("读取证书号失败");
                        }
                    }
                    else
                    {
                        if (cardID == -1)
                        {
                            throw new Exception("卡初始化出错");
                        }
                        if (cardID == -2)
                        {
                            throw new Exception("读取卡号失败");
                        }
                    }
                    result = false;
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
                return result;
            }

     

     

      /// <summary>
            /// 组织签各后的报文
            /// </summary>
            /// <param name="strMsgXml"></param>
            /// <param name="digestMsg"></param>
            /// <param name="signResult"></param>
            /// <param name="centiNo"></param>
            /// <param name="signInfo"></param>
            /// <returns></returns>
            private string RebuildXmlMsg(string strMsgXml, string digestMsg, string signResult, string centiNo, string signInfo)
            {
                string result;
                try
                {
                    string str = string.Format("<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"><ds:SignedInfo><ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/><ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/><ds:Reference URI=""><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/><ds:DigestValue>{0}</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>{1}</ds:SignatureValue><ds:KeyInfo><ds:KeyName>{2}</ds:KeyName><ds:X509Data><ds:X509Certificate>{3}</ds:X509Certificate></ds:X509Data></ds:KeyInfo></ds:Signature>", new object[]
                    {
                        digestMsg,
                        signResult,
                        centiNo,
                        signInfo
                    });
                    string text = strMsgXml.Substring(strMsgXml.LastIndexOf('<'));
                    strMsgXml = strMsgXml.Replace(text, str + text);
                    result = strMsgXml;
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
                return result;
            }

     

    /// <summary>
            /// 签名报文
            /// </summary>
            /// <param name="digestMsg"></param>
            /// <returns></returns>
            private string OnlySignXml(string digestMsg)
            {
                string result;
                try
                {
                    byte[] bytes = Encoding.UTF8.GetBytes(digestMsg);
                    IntPtr intPtr = Marshal.AllocHGlobal(bytes.Length);
                    Marshal.Copy(bytes, 0, intPtr, bytes.Length);
                    byte[] array = new byte[200];
                    IntPtr intPtr2 = Marshal.AllocHGlobal(array.Length);
                    Marshal.Copy(array, 0, intPtr2, array.Length);
                    int num = array.Length;
                    string password = this.Password;
                    int num2 = ICHepler.Sign(intPtr, bytes.Length, intPtr2, ref num, password);
                    array = new byte[num];
                    Marshal.Copy(intPtr2, array, 0, num);
                    Marshal.FreeHGlobal(intPtr);
                    Marshal.FreeHGlobal(intPtr2);
                    if (num2 == 0)
                    {
                        result = Encoding.UTF8.GetString(array);
                    }
                    else
                    {
                        if (num2 == -1)
                        {
                            throw new Exception("卡初始化出错");
                        }
                        if (num2 == -2)
                        {
                            throw new Exception("卡口令不正确");
                        }
                        if (num2 == -3)
                        {
                            throw new Exception("签名失败");
                        }
                        if (num2 == -4)
                        {
                            throw new Exception("编码失败");
                        }
                        result = "";
                    }
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
                return result;
            }

     下载地址:

        链接:https://pan.baidu.com/s/1813-eDsw3NiuUINH4wbEaQ

        提取码:pbrm

  • 相关阅读:
    php入门变量
    php入门引言
    帝国cms7.0修改默认搜索模版中的分页[!--show.page--]
    帝国cms 列表页分页样式修改美化【2】
    划词翻译
    MySQL几种常见的排序方式
    你的眼界决定了你的格局
    Easy Window Switcher支持Windows 10虚拟桌面
    鬼谷子的人生智慧
    接口设计的八大黄金规则
  • 原文地址:https://www.cnblogs.com/kuangood2018/p/15374899.html
Copyright © 2011-2022 走看看