Java调用dll实现des加密解密

package com.srcb.common;

public class Despass
{
	static 
	{
	    System.loadLibrary("despass");
	}
	
	public native static String despass(String pass);
	
}



package com.srcb.common;

public class UnDespass
{
	static 
	{
	    System.loadLibrary("undespass");
	}
	
	public native static String unDespass(String pass);
	
}


package com.srcb.common;

import junit.framework.TestCase;

public class DesTest extends TestCase {

	/*
	 * 将dll放入C:\WINDOWS
	 * */
	public void testDespass() {
		String pass = "006865";
		System.out.println(Despass.despass(pass));
	}
	
	public void testUnDespass() {
		String enpass = "E0F67852DD055967";
		System.out.println(UnDespass.unDespass(enpass));
	}
}

你可能感兴趣的:(java,C++,c,windows,JUnit)