Commit bebc397d authored by O'Reilly Media, Inc.'s avatar O'Reilly Media, Inc.
Browse files

Initial commit

parents
Loading
Loading
Loading
Loading

9780596001575

0 → 120000
+1 −0
Changes for 9780596001575: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
9780596001575
 No newline at end of file

META-INF/MANIFEST.MF

0 → 100644
+3 −0
Changes for META-INF/MANIFEST.MF: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
Manifest-Version: 1.0
Created-By: 1.3.0 (Sun Microsystems Inc.)

README.md

0 → 100644
+15 −0
Changes for README.md: 15 added lines, 0 removed lines.
Original line number Diff line number Diff line
## Example files for the title:  
  
# Java Security 2nd Edition, by Scott Oaks
  
[![Java Security 2nd Edition, by Scott Oaks](http://akamaicovers.oreilly.com/images/9780596001575/cat.gif)](https://www.safaribooksonline.com/library/view/title/0596001576//)
  
The following applies to example files from material published by O’Reilly Media, Inc. Content from other publishers may include different rules of usage. Please refer to any additional usage rights explained in the actual example files or refer to the publisher’s website.
  
O'Reilly books are here to help you get your job done. In general, you may use the code in O'Reilly books in your programs and documentation. You do not need to contact us for permission unless you're reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from our books does not require permission. Answering a question by citing our books and quoting example code does not require permission. On the other hand, selling or distributing a CD-ROM of examples from O'Reilly books does require permission. Incorporating a significant amount of example code from our books into your product's documentation does require permission.
  
We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN.
  
If you think your use of code examples falls outside fair use or the permission given here, feel free to contact us at <permissions@oreilly.com>.
  
Please note that the examples are not production code and have not been carefully testing. They are provided "as-is" and come with no warranty of any kind.
+18 −0
Changes for javasec/samples/appc/ListIdentityScope.java: 18 added lines, 0 removed lines.
Original line number Diff line number Diff line
package javasec.samples.appc;

import java.security.*;
import java.util.*;

public class ListIdentityScope {
    public static void main(String args[]) {
        try {
            IdentityScope is = IdentityScope.getSystemScope();
            System.out.println(is);
            Enumeration e = is.identities();
            while (e.hasMoreElements()) {
                Identity id = (Identity) e.nextElement();
                System.out.println(id);
            }
        } catch (Exception ex) {}
    }
}
+42 −0
Changes for javasec/samples/appc/NewEmployee.java: 42 added lines, 0 removed lines.
Original line number Diff line number Diff line
package javasec.samples.appc;

import java.security.*;

public class NewEmployee {
    public static void main(String args[]) {
        try {
            IdentityScope is = IdentityScope.getSystemScope();
            Signer origSigner = (Signer) is.getIdentity(args[0]);

            System.out.println(
                        "Please insert the floppy for " + args[0]);
            System.out.print("Press enter when ready:  ");
            System.in.read();
            XYZFileScope privateScope =
                        new XYZFileScope("/floppy/floppy0/private");
            XYZSigner newSigner = new XYZSigner(args[0], privateScope);
            KeyPair kp = new KeyPair(origSigner.getPublicKey(),
                                      origSigner.getPrivateKey());
            newSigner.setKeyPair(kp);
            newSigner.setInfo(origSigner.getInfo());
            Certificate certs[] = origSigner.certificates();
            for (int i = 0; i < certs.length; i++)
                newSigner.addCertificate(certs[i]);
            newSigner.setTrust(Integer.parseInt(args[1]));
            privateScope.save();

            XYZFileScope sharedScope =
                        new XYZFileScope("/auto/shared/sharedScope");
            XYZIdentity newId = new XYZIdentity(args[0], sharedScope);
            newId.setPublicKey(origSigner.getPublicKey());
            newId.setInfo(origSigner.getInfo());
            certs = origSigner.certificates();
            for (int i = 0; i < certs.length; i++)
                newId.addCertificate(certs[i]);
            newId.setTrust(Integer.parseInt(args[1]));
            sharedScope.save();
        } catch (Exception e) {
            System.out.println(e);
        }
    }
}
Loading