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", ...

Get PURE Java™ 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.