RSATest.java 12.1 KB
package com.thinkgem.jeesite.tools;

import com.inspur.uaccess.common.utils.RSASignature;
import com.thinkgem.jeesite.modules.reg.utils.RegUtils;

public class RSATest {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		try {
			// xml 内容
			String xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n" + 
					"\r\n" + 
					"<Message> \r\n" + 
					"  <Head> \r\n" + 
					"    <AreaCode>610726</AreaCode>  \r\n" + 
					"    <ASID>AS100</ASID>  \r\n" + 
					"    <BizMsgID>610726200626008999</BizMsgID>  \r\n" + 
					"    <DigitalSign></DigitalSign>  \r\n" + 
					"    <CertCount>0</CertCount>  \r\n" + 
					"    <CreateDate>2020-06-26T15:57:48.322+08:00</CreateDate>  \r\n" + 
					"    <EstateNum>610726109200JC00274F99990001</EstateNum>  \r\n" + 
					"    <ParcelID>610726109200JC00274</ParcelID>  \r\n" + 
					"    <PreCertID>陕2020宁强县不动产权第0007764号</PreCertID>  \r\n" + 
					"    <PreEstateNum>610726109200JC00274F99990001</PreEstateNum>  \r\n" + 
					"    <ProofCount>0</ProofCount>  \r\n" + 
					"    <RecFlowID>20201118002</RecFlowID>  \r\n" + 
					"    <RecType>3000402</RecType>  \r\n" + 
					"    <RegOrgID>陕西省汉中市宁强县不动产登记交易服务中心</RegOrgID>  \r\n" + 
					"    <RegType>300</RegType>  \r\n" + 
					"    <RightType>4</RightType> \r\n" + 
					"  </Head>  \r\n" + 
					"  <Data> \r\n" + 
					"    <ZTT_GY_QLR QLRMC=\"秦启荣\" YSDM=\"6003000000\" BDCDYH=\"610726109200JC00274F99990001\" SXH=\"1\" BDCQZH=\"陕2020宁强县不动产权第0007764号\" SFCZR=\"1\" ZJZL=\"1\" ZJH=\"612326197808016556\" GJ=\"142\" XB=\"1\" QLRLX=\"1\" GYFS=\"1\" GYQK=\"共同共有\" QXDM=\"610726\"/>\r\n" + 
					"    <KTT_FW_ZRZ BDCDYH=\"610726109200JC00274F00010000\" BSM=\"117852\" DSCS=\"1\" DXCS=\"0\" DXSD=\"0.0\" FWJG=\"5\" GHYT=\"10\" JGRQ=\"2016-07-01T00:00:00\" JZWGD=\"0.0\" QXDM=\"610726\" JZWMC=\"秦启荣1号楼\" SCJZMJ=\"76.61\" XMMC=\"秦启荣自建房\" YCJZMJ=\"0.0\" YSDM=\"6001030110\" ZCS=\"1\" ZDDM=\"610726109200JC00274\" ZRZH=\"1\" ZT=\"1\" ZTS=\"1\" ZYDMJ=\"76.61\" ZZDMJ=\"76.61\"/>\r\n" + 
					"    <KTT_FW_ZRZ BDCDYH=\"610726109200JC00274F00020000\" BSM=\"117853\" DSCS=\"3\" DXCS=\"0\" DXSD=\"0.0\" FWJG=\"4\" GHYT=\"10\" JGRQ=\"2016-07-01T00:00:00\" JZWGD=\"0.0\" QXDM=\"610726\" JZWMC=\"秦启荣2号楼\" SCJZMJ=\"350.29\" XMMC=\"秦启荣自建房\" YCJZMJ=\"0.0\" YSDM=\"6001030110\" ZCS=\"3\" ZDDM=\"610726109200JC00274\" ZRZH=\"2\" ZT=\"1\" ZTS=\"1\" ZYDMJ=\"115.52\" ZZDMJ=\"115.52\"/>\r\n" + 
					"    <KTT_FW_LJZ YSDM=\"6001030110\" LJZH=\"1\" ZRZH=\"1\" MPH=\"秦启荣1号楼\" YCJZMJ=\"0.0\" YCDXMJ=\"0\" YCQTMJ=\"0\" SCJZMJ=\"76.61\" SCDXMJ=\"0\" SCQTMJ=\"0\" JGRQ=\"2016-07-01T00:00:00\" FWYT1=\"10\" QXDM=\"610726\" DSCS=\"1\" DXCS=\"0\" ZCS=\"1\" JZWZT=\"3\"/>\r\n" + 
					"    <KTT_FW_LJZ YSDM=\"6001030110\" LJZH=\"2\" ZRZH=\"2\" MPH=\"秦启荣2号楼\" YCJZMJ=\"0.0\" YCDXMJ=\"0\" YCQTMJ=\"0\" SCJZMJ=\"350.29\" SCDXMJ=\"0\" SCQTMJ=\"0\" JGRQ=\"2016-07-01T00:00:00\" FWYT1=\"10\" QXDM=\"610726\" DSCS=\"3\" DXCS=\"0\" ZCS=\"3\" JZWZT=\"3\"/>\r\n" + 
					"    <KTT_FW_C YSDM=\"6001030130\" CBQMJ=\"0.0\" CFTJZMJ=\"0.0\" CG=\"0.0\" CGYJZMJ=\"0.0\" CH=\"1\" CJZMJ=\"0.0\" CTNJZMJ=\"0.0\" CYTMJ=\"0.0\" MYC=\"1\" QXDM=\"610726\" SJC=\"1\" SPTYMJ=\"0.0\" ZRZH=\"1\"/>\r\n" + 
					"    <KTT_FW_C YSDM=\"6001030130\" CBQMJ=\"0.0\" CFTJZMJ=\"0.0\" CG=\"0.0\" CGYJZMJ=\"0.0\" CH=\"3\" CJZMJ=\"0.0\" CTNJZMJ=\"0.0\" CYTMJ=\"0.0\" MYC=\"3\" QXDM=\"610726\" SJC=\"3\" SPTYMJ=\"0.0\" ZRZH=\"2\"/>\r\n" + 
					"    <KTT_FW_C YSDM=\"6001030130\" CBQMJ=\"0.0\" CFTJZMJ=\"0.0\" CG=\"0.0\" CGYJZMJ=\"0.0\" CH=\"2\" CJZMJ=\"0.0\" CTNJZMJ=\"0.0\" CYTMJ=\"0.0\" MYC=\"2\" QXDM=\"610726\" SJC=\"2\" SPTYMJ=\"0.0\" ZRZH=\"2\"/>\r\n" + 
					"    <KTT_FW_C YSDM=\"6001030130\" CBQMJ=\"0.0\" CFTJZMJ=\"0.0\" CG=\"0.0\" CGYJZMJ=\"0.0\" CH=\"1\" CJZMJ=\"0.0\" CTNJZMJ=\"0.0\" CYTMJ=\"0.0\" MYC=\"1\" QXDM=\"610726\" SJC=\"1\" SPTYMJ=\"0.0\" ZRZH=\"2\"/>\r\n" + 
					"    <KTT_FW_H YSDM=\"6001030140\" BDCDYH=\"610726109200JC00274F00010001\" FWBM=\"1047993\" ZRZH=\"1\" CH=\"1\" ZL=\"宁强县铁锁关镇周家坝村五组\" MJDW=\"1\" SJCS=\"1\" HH=\"0101\" SHBW=\"0101室\" HX=\"99\" FWYT1=\"10\" YCJZMJ=\"0.0\" YCTNJZMJ=\"0.0\" YCFTJZMJ=\"0.0\" YCDXBFJZMJ=\"0.0\" YCQTJZMJ=\"0.0\" YCFTXS=\"0.0\" SCJZMJ=\"76.61\" SCTNJZMJ=\"76.61\" SCFTJZMJ=\"0.0\" SCDXBFJZMJ=\"0.0\" SCQTJZMJ=\"0.0\" SCFTXS=\"0.0\" GYTDMJ=\"0.0\" FTTDMJ=\"0.0\" DYTDMJ=\"0.0\" ZT=\"1\" QXDM=\"610726\"/>\r\n" + 
					"    <KTT_FW_H YSDM=\"6001030140\" BDCDYH=\"610726109200JC00274F00020001\" FWBM=\"1047994\" ZRZH=\"2\" CH=\"1\" ZL=\"宁强县铁锁关镇周家坝村五组\" MJDW=\"1\" SJCS=\"3\" HH=\"0101\" SHBW=\"0101室\" HX=\"99\" FWYT1=\"10\" YCJZMJ=\"0.0\" YCTNJZMJ=\"0.0\" YCFTJZMJ=\"0.0\" YCDXBFJZMJ=\"0.0\" YCQTJZMJ=\"0.0\" YCFTXS=\"0.0\" SCJZMJ=\"350.29\" SCTNJZMJ=\"350.29\" SCFTJZMJ=\"0.0\" SCDXBFJZMJ=\"0.0\" SCQTJZMJ=\"0.0\" SCFTXS=\"0.0\" GYTDMJ=\"0.0\" FTTDMJ=\"0.0\" DYTDMJ=\"0.0\" ZT=\"1\" QXDM=\"610726\"/>\r\n" + 
					"    <ZD_K_103 BDCDYH=\"610726109200JC00274W00000000\" XH=\"1\" XZB=\"35625020.471\" YZB=\"3646071.532\" ZDX=\"1\"/>\r\n" + 
					"    <ZD_K_103 BDCDYH=\"610726109200JC00274W00000000\" XH=\"2\" XZB=\"35625019.852\" YZB=\"3646070.344\" ZDX=\"1\"/>\r\n" + 
					"    <ZD_K_103 BDCDYH=\"610726109200JC00274W00000000\" XH=\"3\" XZB=\"35625021.705\" YZB=\"3646069.437\" ZDX=\"1\"/>\r\n" + 
					"    <ZD_K_103 BDCDYH=\"610726109200JC00274W00000000\" XH=\"4\" XZB=\"35625021.360\" YZB=\"3646068.749\" ZDX=\"1\"/>\r\n" + 
					"    <ZD_K_103 BDCDYH=\"610726109200JC00274W00000000\" XH=\"5\" XZB=\"35625020.129\" YZB=\"3646066.291\" ZDX=\"1\"/>\r\n" + 
					"    <ZD_K_103 BDCDYH=\"610726109200JC00274W00000000\" XH=\"6\" XZB=\"35625019.580\" YZB=\"3646065.194\" ZDX=\"1\"/>\r\n" + 
					"    <ZD_K_103 BDCDYH=\"610726109200JC00274W00000000\" XH=\"7\" XZB=\"35625018.732\" YZB=\"3646063.501\" ZDX=\"1\"/>\r\n" + 
					"    <ZD_K_103 BDCDYH=\"610726109200JC00274W00000000\" XH=\"8\" XZB=\"35625018.429\" YZB=\"3646063.645\" ZDX=\"1\"/>\r\n" + 
					"    <ZD_K_103 BDCDYH=\"610726109200JC00274W00000000\" XH=\"9\" XZB=\"35625014.168\" YZB=\"3646054.658\" ZDX=\"1\"/>\r\n" + 
					"    <ZD_K_103 BDCDYH=\"610726109200JC00274W00000000\" XH=\"10\" XZB=\"35625013.842\" YZB=\"3646054.813\" ZDX=\"1\"/>\r\n" + 
					"    <ZD_K_103 BDCDYH=\"610726109200JC00274W00000000\" XH=\"11\" XZB=\"35625013.470\" YZB=\"3646053.590\" ZDX=\"1\"/>\r\n" + 
					"    <ZD_K_103 BDCDYH=\"610726109200JC00274W00000000\" XH=\"12\" XZB=\"35625013.118\" YZB=\"3646052.430\" ZDX=\"1\"/>\r\n" + 
					"    <ZD_K_103 BDCDYH=\"610726109200JC00274W00000000\" XH=\"13\" XZB=\"35625012.667\" YZB=\"3646050.947\" ZDX=\"1\"/>\r\n" + 
					"    <ZD_K_103 BDCDYH=\"610726109200JC00274W00000000\" XH=\"14\" XZB=\"35625002.099\" YZB=\"3646054.202\" ZDX=\"1\"/>\r\n" + 
					"    <ZD_K_103 BDCDYH=\"610726109200JC00274W00000000\" XH=\"15\" XZB=\"35625002.553\" YZB=\"3646055.684\" ZDX=\"1\"/>\r\n" + 
					"    <ZD_K_103 BDCDYH=\"610726109200JC00274W00000000\" XH=\"16\" XZB=\"35625002.908\" YZB=\"3646056.843\" ZDX=\"1\"/>\r\n" + 
					"    <ZD_K_103 BDCDYH=\"610726109200JC00274W00000000\" XH=\"17\" XZB=\"35625005.619\" YZB=\"3646065.686\" ZDX=\"1\"/>\r\n" + 
					"    <ZD_K_103 BDCDYH=\"610726109200JC00274W00000000\" XH=\"18\" XZB=\"35625007.587\" YZB=\"3646072.107\" ZDX=\"1\"/>\r\n" + 
					"    <ZD_K_103 BDCDYH=\"610726109200JC00274W00000000\" XH=\"19\" XZB=\"35625009.755\" YZB=\"3646071.354\" ZDX=\"1\"/>\r\n" + 
					"    <ZD_K_103 BDCDYH=\"610726109200JC00274W00000000\" XH=\"20\" XZB=\"35625011.217\" YZB=\"3646074.961\" ZDX=\"1\"/>\r\n" + 
					"    <ZD_K_103 BDCDYH=\"610726109200JC00274W00000000\" XH=\"21\" XZB=\"35625015.133\" YZB=\"3646074.008\" ZDX=\"1\"/>\r\n" + 
					"    <ZD_K_103 BDCDYH=\"610726109200JC00274W00000000\" XH=\"22\" XZB=\"35625014.813\" YZB=\"3646073.331\" ZDX=\"1\"/>\r\n" + 
					"    <ZD_K_103 BDCDYH=\"610726109200JC00274W00000000\" XH=\"23\" XZB=\"35625020.471\" YZB=\"3646071.532\" ZDX=\"1\"/>\r\n" + 
					"    <QLT_FW_FDCQ_DZ BDCDYH=\"610726109200JC00274F99990001\" BDCQZH=\"陕2020宁强县不动产权第0007764号\" DBR=\"宋林瑶\" DJJG=\"宁强县不动产登记局\" DJLX=\"100\" DJSJ=\"2020-06-26T15:57:48\" DJYY=\"首次登记\" DYTDMJ=\"426.9\" FDZL=\"宁强县铁锁关镇周家坝村五组\" FJ=\"宅基地实测268.08㎡,批准267㎡,超面积1.08㎡。\" QLLX=\"6\" QSZT=\"1\" QXDM=\"610726\" TDSYJSSJ=\"2999-12-31T00:00:00\" TDSYQR=\"秦启荣\" TDSYQSSJ=\"1949-10-01T00:00:00\" YSDM=\"6002010210\" YWH=\"20201118002\"/>\r\n" + 
					"    <QLF_FW_FDCQ_DZ_XM BDCDYH=\"610726109200JC00274F99990001\" FWJG=\"4\" GHYT=\"10\" JZMJ=\"350.29\" XMMC=\"秦启荣自建房\" ZCS=\"3\" ZH=\"2\" ZTS=\"3\" QXDM=\"610726\"/>\r\n" + 
					"    <QLF_FW_FDCQ_DZ_XM BDCDYH=\"610726109200JC00274F99990001\" FWJG=\"5\" GHYT=\"10\" JZMJ=\"76.61\" XMMC=\"秦启荣自建房\" ZCS=\"1\" ZH=\"1\" ZTS=\"1\" QXDM=\"610726\"/>\r\n" + 
					"    <DJT_DJ_SLSQ YWH=\"20201118002\" DJXL=\"220\" DJDL=\"100\" JSSJ=\"2020-06-26T10:40:51\" QXDM=\"610726\" SFWTAJ=\"0\" SLRY=\"李世豪\" SLSJ=\"2020-06-17T16:11:05\" SQFBCZ=\"1\" SQZSBS=\"0\" TZRXM=\"秦启荣 姜兴宇 \" YSDM=\"2004010000\"/>\r\n" + 
					"    <DJF_DJ_SJ YWH=\"20201118002\" SFBCSJ=\"0\" SFEWSJ=\"0\" SFSJSY=\"1\" SJLX=\"2\" SJMC=\"2\" SJSJ=\"2020-05-29T00:00:00\" SJSL=\"5\" YS=\"1\" YSDM=\"2004020000\" QXDM=\"610726\"/>\r\n" + 
					"    <DJF_DJ_SJ YWH=\"20201118002\" SFBCSJ=\"0\" SFEWSJ=\"0\" SFSJSY=\"1\" SJLX=\"1\" SJMC=\"1\" SJSJ=\"2020-05-29T00:00:00\" SJSL=\"5\" YS=\"1\" YSDM=\"2004020000\" QXDM=\"610726\"/>\r\n" + 
					"    <DJF_DJ_SJ YWH=\"20201118002\" SFBCSJ=\"0\" SFEWSJ=\"0\" SFSJSY=\"1\" SJLX=\"1\" SJMC=\"12\" SJSJ=\"2020-05-29T00:00:00\" SJSL=\"5\" YS=\"1\" YSDM=\"2004020000\" QXDM=\"610726\"/>\r\n" + 
					"    <DJF_DJ_SJ YWH=\"20201118002\" SFBCSJ=\"0\" SFEWSJ=\"0\" SFSJSY=\"1\" SJLX=\"1\" SJMC=\"7\" SJSJ=\"2020-05-29T00:00:00\" SJSL=\"5\" YS=\"1\" YSDM=\"2004020000\" QXDM=\"610726\"/>\r\n" + 
					"    <DJF_DJ_SJ YWH=\"20201118002\" SFBCSJ=\"0\" SFEWSJ=\"0\" SFSJSY=\"1\" SJLX=\"1\" SJMC=\"4\" SJSJ=\"2020-05-29T00:00:00\" SJSL=\"5\" YS=\"1\" YSDM=\"2004020000\" QXDM=\"610726\"/>\r\n" + 
					"    <DJF_DJ_SH YWH=\"20201118002\" JDMC=\"受理申请\" SHJSSJ=\"2020-06-17T16:11:05\" SHKSSJ=\"2020-05-29T11:02:00\" SHRYXM=\"李世豪\" SHYJ=\"房地产权(项目内多幢房屋)首次登记-同意受理\" SXH=\"1\" CZJG=\"1\" YSDM=\"2004010000\" QXDM=\"610726\"/>\r\n" + 
					"    <DJF_DJ_SH YWH=\"20201118002\" JDMC=\"初审(主办科室)\" SHJSSJ=\"2020-06-17T22:02:26\" SHKSSJ=\"2020-06-17T16:11:05\" SHRYXM=\"马攀(初审)\" SHYJ=\"初审合格\" SXH=\"2\" CZJG=\"1\" YSDM=\"2004010000\" QXDM=\"610726\"/>\r\n" + 
					"    <DJF_DJ_SH YWH=\"20201118002\" JDMC=\"复审(登记中心主任)\" SHJSSJ=\"2020-06-18T10:39:14\" SHKSSJ=\"2020-06-17T22:02:26\" SHRYXM=\"黄福春\" SHYJ=\"复审合格\" SXH=\"3\" CZJG=\"1\" YSDM=\"2004010000\" QXDM=\"610726\"/>\r\n" + 
					"    <DJF_DJ_SH YWH=\"20201118002\" JDMC=\"核定(登记局局长)\" SHJSSJ=\"2020-06-26T10:40:51\" SHKSSJ=\"2020-06-18T10:39:14\" SHRYXM=\"周建华\" SHYJ=\"核定通过\" SXH=\"4\" CZJG=\"1\" YSDM=\"2004010000\" QXDM=\"610726\"/>\r\n" + 
					"    <DJF_DJ_SH YWH=\"20201118002\" JDMC=\"登簿\" SHJSSJ=\"2020-06-26T15:57:48\" SHKSSJ=\"2020-06-26T10:40:51\" SHRYXM=\"宋林瑶\" SHYJ=\"无\" SXH=\"5\" CZJG=\"1\" YSDM=\"2004010000\" QXDM=\"610726\"/>\r\n" + 
					"    <DJF_DJ_SZ YWH=\"20201118002\" QXDM=\"610726\" YSDM=\"2002040100\" SZMC=\"1\" SZRY=\"宋林瑶\" SZZH=\"0007764\" YSXLH=\"0\" SZSJ=\"2020-06-26T00:00:00\"/>\r\n" + 
					"    <DJF_DJ_SQR YWH=\"20201118002\" QLRMC=\"秦启荣\" QLRTXDZ=\"宁强县铁锁关镇周家坝村五组\" QLRYB=\"724403\" QLRZJH=\"612326197808016556\" QLRZJZL=\"1\" YSDM=\"6003000000\" QXDM=\"610726\"/> \r\n" + 
					"  </Data> \r\n" + 
					"</Message>\r\n" + 
					"";
			String RSApara=RegUtils.SJHJPara();
			String abc = RSASignature.getNewMsgWithSignature(xml,RSApara);
			abc = RSASignature.getNewMsgWithSignature(xml,RSApara);
			//生成签名保存数据汇交表
			String Digitalsign = abc.substring(abc.indexOf("<DigitalSign>")+13,abc.indexOf("</DigitalSign>"));
			System.out.println("Digitalsign===="+Digitalsign);
		}catch (Exception e) {
			e.printStackTrace();
		}
	}

}