1: // 서버에서는 private key를 가지고 MyClass를 암호화한다. 2: String jarFile = "./download/util.jar"; 3: byte[] loadFile = FileManager.getBytes(jarFile); 4: loadFile = encrypt(loadFile,privateKey); 5: // jarFile명으로 암호화된 파일을 생성한다. 6: FileManager.createFile(loadFile,jarFileName); 7: .... 8: // 클라이언트에서는 파일을 다운로드 받을 경우 public key로 복호화 한다. 9: URL[] classURLs= new URL[]{new URL("http://filesave.com/download/util.jar")}; 10: URLConnection conn=classURLs.openConnection(); 11: InputStream is = conn.getInputStream(); 12: // 입력 스트림을 읽어 서버의 jarFile명으로 파일을 출력한다. 13: FileOutputStream fos = new FileOutputStream(new File(jarFile)); 14: while ( is.read(buf) != -1 ) { 15: ... 16: } 17: byte[] loadFile = FileManager.getBytes(jarFile); 18: loadFile = decrypt(loadFile,publicKey); 19: // 복호화된 파일을 생성한다. 20: FileManager.createFile(loadFile,jarFile); 21: URLClassLoader loader = new URLClassLoader(classURLs); 22: Class loadedClass = Class.forName("MyClass", true, loader);