Docsity

Java Certificates: Understanding and Granting Permissions for Applets, Slides of Java Programming

Partial preview of the text

Download Java Certificates: Understanding and Granting Permissions for Applets and more Slides Java Programming in PDF only on Docsity!

Certificates

What is a Certificate

  • A certificate is basically a digitally signed statement from one

entity (person, company, etc.), saying that the public key of another entity has some particular value.

  • Some certificate related classes, included in java.security.cert

package, are certificate, certificateFactory, and X509certificate

Certificate

  • JDK 1.2 also introduces keytool, jarsigner, and policy tool.

These tools provide features such as creating a public-private pair, verify authority, and policy configuration.

  • This bring us to our next topic, using certificate and policy file

to gain permission between a client and an applet.

Certificate with Applets

  • The policy file must have an entry to grant permission.
  • The following examples shows you how to create a file. When

you try to run the file, you should get a security exception since the applet doesn’t have permission to access it. Type http://java.sun.com/docs/books/tutorial/security1.2/tour1/ex ample-1dot2/WriteFile.html to run the file.

Grant Permission

• So how do you grant the required permission

to a client? Well, here is what’s needed.

• First you must create a policy entry granting

this permission.

• To do so, choose the Add Policy Entry button

in the main Policy Tool window.

Grant Permission

  • You should see a Policy Entry dialog box.
  • A CodeBase value indicates the code source location.
  • A SignedBy value indicates the alias for a certificate stored in a keystore.

Grant Permission

  • Now you are ready to

grant permissions to that code.

  • Choose the Add

Permission button to bring up the Permissions dialog box.

Grant Permission

  • Choose File Permission from the Permission drop-down list. The complete permission type name (java.io.FilePermission) now appears in the text box to the right of the drop-down list.
  • Type the following in the text box to the right of the list labeled Target Name to specify the file name, whatever the client file name is.
  • Specify write access by choosing the write option from the Actions drop-down list.
  • Click the OK button.

Grant Permission

  • The following box should

appear when you select Done

Save Policy File

  • Choose the Save As

command from the File menu. This brings up the Save As dialog box.

Grant Permission

  • Choose add policy entry.

You should see this box pop up.

  • Type in location or the

URL in the codebase box. For example, file:/C:/Test/

  • Click add permission

Grant Permission

  • You should see this box.
  • Choose property

permission, target name, and read from the options.

  • Click ok and save this file.