全功能逆变/假负载61850通信程序
Administrator
2023-11-03 a4930c805846244e1f5febfb3698b691ca1d747e
修复计算验签时bug,当前设备暂时不用使用ukey
2个文件已修改
41 ■■■■■ 已修改文件
iec61852_forQGN/bin/com/dec/fbs9100/BTS_61851_SocketClient.class 补丁 | 查看 | 原始文档 | blame | 历史
iec61852_forQGN/src/com/dec/fbs9100/BTS_61851_SocketClient.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iec61852_forQGN/bin/com/dec/fbs9100/BTS_61851_SocketClient.class
Binary files differ
iec61852_forQGN/src/com/dec/fbs9100/BTS_61851_SocketClient.java
@@ -1240,23 +1240,23 @@
                sleep(1500);
                 **************************************************************************/
                if (true == write_res_t) {
                    if(!setBTSPublicKeyY(getUKEYRootDomStr(FBSDeviceName)+"/ncdGGIO1.Para1.setMag.f"))
                    if(!setBTSPublicKeyY(getUKEYRootDomStr(FBSDeviceName)+"/ncdGGIO1.Para1.setMag.f"));
                    writeNodeData(FBSDeviceName + "/ncdGGIO1.Para1.setMag.f", "SP",(float) m_StatAndParam.m_FBS_DiscParam.DisCurr);
                    float dis_hour_t = m_StatAndParam.m_FBS_DiscParam.DisTime;
                    dis_hour_t = dis_hour_t / 60;
                    if(!setBTSPublicKeyY(getUKEYRootDomStr(FBSDeviceName)+"/ncdGGIO1.Para2.setMag.f"))
                    if(!setBTSPublicKeyY(getUKEYRootDomStr(FBSDeviceName)+"/ncdGGIO1.Para2.setMag.f"));
                    writeNodeData(FBSDeviceName + "/ncdGGIO1.Para2.setMag.f", "SP", (float) dis_hour_t);
                    if(!setBTSPublicKeyY(getUKEYRootDomStr(FBSDeviceName)+"/ncdGGIO1.Para3.setMag.f"))
                    if(!setBTSPublicKeyY(getUKEYRootDomStr(FBSDeviceName)+"/ncdGGIO1.Para3.setMag.f"));
                    writeNodeData(FBSDeviceName + "/ncdGGIO1.Para3.setMag.f", "SP",    (float) m_StatAndParam.m_FBS_DiscParam.DisCap);
                    if(!setBTSPublicKeyY(getUKEYRootDomStr(FBSDeviceName)+"/ncdGGIO1.Para4.setMag.f"))
                    if(!setBTSPublicKeyY(getUKEYRootDomStr(FBSDeviceName)+"/ncdGGIO1.Para4.setMag.f"));
                    writeNodeData(FBSDeviceName + "/ncdGGIO1.Para4.setMag.f", "SP",    (float) m_StatAndParam.m_FBS_DiscParam.getMonomerLowCount());
                    if(!setBTSPublicKeyY(getUKEYRootDomStr(FBSDeviceName)+"/ncdGGIO1.Para5.setMag.f"))
                    if(!setBTSPublicKeyY(getUKEYRootDomStr(FBSDeviceName)+"/ncdGGIO1.Para5.setMag.f"));
                    writeNodeData(FBSDeviceName + "/ncdGGIO1.Para5.setMag.f", "SP",    (float) m_StatAndParam.m_FBS_DiscParam.GroupVol_LOW);
                    if(!setBTSPublicKeyY(getUKEYRootDomStr(FBSDeviceName)+"/ncdGGIO1.Para6.setMag.f"))
                    if(!setBTSPublicKeyY(getUKEYRootDomStr(FBSDeviceName)+"/ncdGGIO1.Para6.setMag.f"));
                    writeNodeData(FBSDeviceName + "/ncdGGIO1.Para6.setMag.f", "SP",    (float) m_StatAndParam.m_FBS_DiscParam.MonomerVol_LOW);
                    if(!setBTSPublicKeyY(getUKEYRootDomStr(FBSDeviceName)+"/ncdGGIO1.Para7.setMag.f"));
                    writeNodeData(FBSDeviceName + "/ncdGGIO1.Para7.setMag.f", "SP",    (float) m_StatAndParam.m_FBS_DiscParam.MonomerTmp_High);
                    if(!setBTSPublicKeyY(getUKEYRootDomStr(FBSDeviceName)+"/btgGGIO1.Para1.setMag.f"))
                    if(!setBTSPublicKeyY(getUKEYRootDomStr(FBSDeviceName)+"/btgGGIO1.Para1.setMag.f"));
                    writeNodeData(FBSDeviceName + "/btgGGIO1.Para1.setMag.f", "SP",    (float) m_StatAndParam.m_FBS_DiscParam.ChargeCurrSet);
                    //if(!setBTSPublicKeyY(getUKEYRootDomStr(FBSDeviceName)+"/btgGGIO1.Para2.setMag.f")) return false;
                    //writeNodeData(FBSDeviceName + "/btgGGIO1.Para2.setMag.f", "SP",    (float) m_StatAndParam.m_FBS_DiscParam.DCVolHighLimit);
@@ -1835,9 +1835,9 @@
        try {
            //System.out.println("YKey:"+m_StatAndParam.Crc32publicKeyY);
            //writeNodeDataString(FBSDeviceName+"/ncdGGIO1.key.setMag.i", "SP",m_StatAndParam.publicKeyY);
            //System.err.println("BTSID:"+m_StatAndParam.serialNumber+moderoot);
            logger.error("BTSID:"+m_StatAndParam.serialNumber+moderoot);
            //System.err.println(m_StatAndParam.serialNumber);
            //System.err.println("UKYID:"+m_StatAndParam.keyID);
            logger.error("UKYID:"+m_StatAndParam.keyID);
            //System.err.println("签名:"+signature);            
            if(m_StatAndParam.serialNumber.trim().length() > 0 && m_StatAndParam.keyID.trim().length() > 0) {
                String signature = createSignature(m_StatAndParam.serialNumber+moderoot, m_StatAndParam.keyID);            //生成签名
@@ -1850,11 +1850,12 @@
                Thread.sleep(900);
                return true;
            }
            Thread.sleep(900);
            //writeNodeDataString(FBSDeviceName+"/ncdGGIO1.sign.setVal", "SP",m_StatAndParam.publicKeyY);
        } catch (Exception e) {
            e.printStackTrace();
            logger.error(e.toString(), e);
        }
        return false;
        return true;
    }
    
    
@@ -1862,25 +1863,33 @@
     *     生成SM2数据签名
     * @return
     */
    public static String createSignature(String BTSID,String UkeyID) {
    public String createSignature(String BTSID,String UkeyID) {
        String str = "";
        BufferedReader stdout = null;
        try {
            Process proc=Runtime.getRuntime().exec("sign_test.exe "+BTSID+" "+UkeyID);
            String OS = System.getProperty("os.name").toLowerCase();
            String cmd = "";
            if(OS.contains("window")) {
                cmd = "sign_test.exe";
            }else {
                cmd = "./sign_test.exe";
            }
            Process proc=Runtime.getRuntime().exec(cmd + " "+BTSID+" "+UkeyID);
            //Process proc=Runtime.getRuntime().exec("sign_calukey_x64.exe "+BTSID+" "+UkeyID);
             stdout = new BufferedReader(new InputStreamReader(proc.getInputStream()));
             str = stdout.readLine();
             System.out.println("内部验签计算签名:"+str);
             logger.info("内部验签计算签名:"+str);
             //System.out.println("调试----:"+stdout.readLine());
             
        } catch (Exception e) {
            e.printStackTrace();
            logger.error(e.toString(), e);
        } finally {
            if(null != stdout) {
                try {
                    stdout.close();
                } catch (IOException e) {
                    e.printStackTrace();
                    logger.error(e.toString(), e);
                }
            }
        }