首先RSA是一个非对称的加密算法,所以在使用该算法加密解密之前,必须先行生成密钥对,包括公钥和私钥
JDK中提供了生成密钥对的类KeyPairGenerator,实例如下:
public static Map genKeyPair() throws Exception {
// 获取公钥私钥密钥对的生成器
KeyPairGenerator kpg = KeyPairGenerator....
分类:
编程语言 时间:
2014-08-15 10:44:18
阅读次数:
261
import java.io.IOException;import java.util.Scanner;public class CommonDivisor { public static void main(String[] args)throws IOException{ t...
分类:
其他好文 时间:
2014-08-14 20:13:29
阅读次数:
174
import java.io.IOException;import java.util.Scanner;public class Sum { public static void main(String[] args) throws IOException { try { ...
分类:
其他好文 时间:
2014-08-14 20:11:09
阅读次数:
206
//读取内容public void read() throws Exception{SAXReader reader = new SAXReader();Document document = reader.read("src/book.xml");Element root = document.g...
分类:
其他好文 时间:
2014-08-14 15:53:58
阅读次数:
164
前些天看aop就看到了cglib,看cglib又看到了asm,模仿着做了个示例。利用asm修改字节码,能实现编译不通过执行通的过的效果,挺有意思。
一个简单的待修改类:
package com.asm.zjc;
public class C {
public void m() throws InterruptedException{
Thread.sleep(300);
}
}...
分类:
其他好文 时间:
2014-08-13 10:36:55
阅读次数:
255
SpringMVC的controller层:
/**
* 查询得到财务信息报表
* @author liupeng
* @param request
* @return
* @throws UnknownHostException
* @throws ParseException
*/
@RequestMapping(value="/innerChartOutFo...
分类:
Web程序 时间:
2014-08-12 19:07:24
阅读次数:
295
在某个线程中调用另一个线程的join方法,是将当前的cpu让给另一个线程,等到规定的时间到了或另一个线程执行结束后,自己再执行。
package test;
public class TestJoin1 {
public static void main(String[] args) throws InterruptedException {
TheOtherThread to...
分类:
编程语言 时间:
2014-08-12 19:03:34
阅读次数:
313
blob 转换为byte[]public byte[] blobToByte(Blob blob) throws Exception { byte[] bytes = null; try { InputStream in=blob.getBinaryStream(); ...
分类:
其他好文 时间:
2014-08-12 18:31:54
阅读次数:
261
1 @Override 2 public Image myWrite(Image image, String filePath) throws IOException { 3 if (image == null) { 4 throw new IOE...
分类:
编程语言 时间:
2014-08-12 03:07:23
阅读次数:
204
使用Java上传文件 从Apache Software Foundation下载HttpClient 4.3.4。 在工程中添加下面的jar包: 参考sample,写一个简单的上传: public?static?void?main(String[]?args)?throws?Exception?{
????...
分类:
移动开发 时间:
2014-08-11 15:26:54
阅读次数:
455