O'Reilly logo

PURE Java™ 2 by Kenneth Litwak

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sample Code for Digital Signing

First you need code to sign. Listing 16.1 shows a short program that I am going to sign with a digital signature.

Code Listing 16.1. Basic Application to Sign Digitally (PrivilegeDriver.java)
 // This program has little in the way of security-related code. // The program's purpose is to provide code that will need more permissions // than the default java.policy file grants so that you can't run this // program successfully without granting it additional permissions. import java.io.*; class PrivilegedFileAccessor { private FileWriter fw; private PrintWriter pw; private File textFile; private FileReader fr; private BufferedReader br; private String[] books = { "Rhetorica by Aristotle", "Against Apion by Josephus", ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required