use of sun.misc.BASE64Decoder in project portal by ixinportal.
the class ReceiptTest method test.
@Test
public void test() {
// 正式系统地址
String url = "https://www.fapiao.com:53087/fpt-dsqz/services/DZFPService";
// String appId = "0d94a610c6e9a4260201b003bd78bdf8981af7906e4da43b96435bfaee4a089f"; //appid
String appId = "2550ac3d539f7db6f859485af99e63de9882514145fbc2199d3f65f3bfece980";
// String url = "https://dev.fapiao.com:19443/fpt-dsqz-spbm/services/DZFPService"; //测试地址
// String appId = "6d29f136114544bcc73edcce960c430231183cc192c433e2b9ebcad56e8ceb08"; //appid
// 执行命令后,会生成该testclient.truststore
String ssl_store = getClass().getClassLoader().getResource("").getPath() + File.separator + "fapiao.truststore";
// 证书的存取密码,即执行命令时填写的密码
String ssl_pwd = "ixin21060921";
System.setProperty("javax.net.ssl.trustStore", ssl_store);
System.setProperty("javax.net.ssl.keyStorePassword", ssl_pwd);
HostnameVerifier hv = new HostnameVerifier() {
public boolean verify(String urlHostName, SSLSession session) {
System.out.println("Warning: URL Host: " + urlHostName + " vs. " + session.getPeerHost());
return true;
}
};
HttpsURLConnection.setDefaultHostnameVerifier(hv);
try {
org.apache.axis.client.Service s = new org.apache.axis.client.Service();
Call call = (Call) s.createCall();
call.setTargetEndpointAddress(new URL(url));
call.setOperation("doService");
String content;
String xml;
String val;
Map<String, String> temp;
Long count = 0L;
// 循环开票数量
for (int i = 0; i < 0; i++) {
count++;
content = getContent(count);
log.error("[input0]{}", content);
xml = getCommonXml("DFXJ1001", new BASE64Encoder().encodeBuffer(content.getBytes("UTF-8")), appId);
log.error("[input1]{}", xml);
Object[] fn01 = { xml };
val = (String) call.invoke(fn01);
log.error("[output]{}", val);
temp = parseXml(val);
if (!temp.get("returnCode").equals("0000")) {
log.error("ERRORLOG电子发票 {}", "开票推送失败,错误:" + temp.get("returnMessage"));
}
temp = parseXml(new String(new BASE64Decoder().decodeBuffer(temp.get("content")), "UTF-8"));
log.error("pefurl=" + temp.get("PDF_URL"));
}
} catch (Exception e) {
log.error("ERRORLOG电子发票 {}", "开票推送失败,错误:" + e.toString());
e.printStackTrace();
}
}
use of sun.misc.BASE64Decoder in project javautils by jiadongpo.
the class RSAUtil method fileDecrypt.
/**
* 使用keystore对密文进行解密
* @param privateKeystore 私钥路径
* @param enStr 密文
* @return
*/
public static String fileDecrypt(String privateKeystore, String enStr) {
try {
FileReader fr = new FileReader(privateKeystore);
BufferedReader br = new BufferedReader(fr);
String privateKeyString = "";
String str;
while ((str = br.readLine()) != null) {
privateKeyString += str;
}
br.close();
fr.close();
cipher.init(Cipher.DECRYPT_MODE, getPrivateKey(privateKeyString));
byte[] deBytes = cipher.doFinal((new BASE64Decoder()).decodeBuffer(enStr));
return new String(deBytes);
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (IllegalBlockSizeException e) {
e.printStackTrace();
} catch (BadPaddingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
use of sun.misc.BASE64Decoder in project javautils by jiadongpo.
the class RSAUtil method decrypt.
/**
* 使用私钥对密文进行解密
* @param privateKey 私钥
* @param enStr 密文
* @return
*/
public static String decrypt(String privateKey, String enStr) {
try {
cipher.init(Cipher.DECRYPT_MODE, getPrivateKey(privateKey));
byte[] deBytes = cipher.doFinal((new BASE64Decoder()).decodeBuffer(enStr));
return new String(deBytes);
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (IllegalBlockSizeException e) {
e.printStackTrace();
} catch (BadPaddingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
use of sun.misc.BASE64Decoder in project vip by guangdada.
the class MD5 method t.
public static void t() {
String sql = "OezXcEiiBSKSxW0eoylIeP0vrZKNUFaiKCV7NbFjnJu6goFepR6kzZc5NTN--2I-fHckWCS03u4Zs8uy-xtwLp0gh53Zd_Lp3gyFGr0Yh_QucXrs8PsCxFBtFyPyWhmyGHtLK6BcnKXkRVRPmBq0oA";
getTI(sql);
BASE64Decoder dc = new BASE64Decoder();
try {
byte[] bt = dc.decodeBuffer(sql);
System.out.println(new String(bt, "gbk"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
use of sun.misc.BASE64Decoder in project archi-modelrepository-plugin by archi-contribs.
the class SimpleCredentialsStorage method decrypt.
public static String decrypt(String encstr) throws IOException {
if (encstr.length() > 12) {
String cipher = encstr.substring(12);
BASE64Decoder decoder = new BASE64Decoder();
return new String(decoder.decodeBuffer(cipher));
}
return null;
}
Aggregations