package com.allinpay.demo;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.security.MessageDigest;
import java.security.SecureRandom;
import java.util.Arrays;

import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;

import org.bouncycastle.jcajce.provider.symmetric.Threefish;

import com.allinpay.demo.util.DemoUtil;

import sun.misc.BASE64Encoder;
public class Test {
 public static void main(String args[]) throws UnsupportedEncodingException { 
	 boolean s = false;
	 String s1="内蒙古维力斯置业有限责任公司蔚丽斯云水湾A1-2号楼、C-7号楼、C-6号楼、C-3号楼、C-2号楼、C-1号楼、B2-2号楼、B1-1号楼、B1-15号楼客户交易结算资";	 
	
	String rrString="<?xml version=\"1.0\" encoding=\"GBK\"?><AIPG><INFO><TRX_CODE>310001</TRX_CODE><VERSION>04</VERSION><DATA_TYPE>2</DATA_TYPE><REQ_SN>ALLI2024030699902920000002318</REQ_SN><RET_CODE>0000</RET_CODE><ERR_MSG>提交成功</ERR_MSG><SIGNED_MSG>3045022071169cf249d2ab45f4cc4853f75671877ceeb7ed058d60b8c286c0fc923ca2b1022100a9e09f314cb829b8d91b7f052b3dd5b35907b61ab6d3e53c0276c24a1e216e31</SIGNED_MSG></INFO><FAGRARET><RET_CODE>0000</RET_CODE><ERR_MSG>请求成功</ERR_MSG></FAGRARET></AIPG>";
	/*
	 * try { String tString=rrString.getBytes("GBK").toString();
	 * System.out.print(tString);
	 * System.out.print("验证"+DemoUtil.verifyXml(tString)); } catch (AIPGException e)
	 * { // TODO Auto-generated catch block e.printStackTrace(); }
	 */
	System.out.print( s1.getBytes().length);
	}

	  
 public static  String getSha1Str(File file) {
     String str = "";
     try {
         MessageDigest md = MessageDigest.getInstance("SHA-1");
         FileInputStream fis = new FileInputStream(file);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         byte[] buf = new byte[2048];
         int c;
         while ((c = fis.read(buf)) > 0) {
             baos.write(buf, 0, c);
         }
         str = new BASE64Encoder().encode(md.digest(baos.toByteArray()));
         fis.close();
     } catch (Exception ex) {
         ex.printStackTrace();
     }
     return str;
 }
 
 
 }
