Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.security

Class CodeSource

java.lang.Object
|
+--java.security.CodeSource

All Implemented Interfaces:

Serializable


public class CodeSource

extends Object

implements Serializable

This class represents a location from which code is loaded (as represented by a URL), and the list of certificates that are used to check the signatures of signed code loaded from this source.

Since:Authors:

Constructor Summary

CodeSource(java.net.URL location, java.security.Certificate[] certs)

This creates a new instance of CodeSource that loads code from the specified URL location and which uses the specified certificates for verifying signatures.

Method Summary

booleanequals(java.lang.Object obj)

This method tests the specified Object for equality with this object.
java.security.cert.Certificate[]getCertificates()

This method returns the list of digital certificates that can be used to verify the signatures of code loaded under this CodeSource.
java.net.URLgetLocation()

This method returns the URL specifying the location from which code will be loaded under this CodeSource.
inthashCode()

This method returns a hash value for this object.
booleanimplies(java.security.CodeSource cs)

This method tests to see if a specified CodeSource is implied by this object.
java.lang.StringtoString()

This method returns a String that represents this object.

Constructor Details

CodeSource

public CodeSource(java.net.URL location, java.security.Certificate[] certs)

This creates a new instance of CodeSource that loads code from the specified URL location and which uses the specified certificates for verifying signatures.

Parameters:


Method Details

equals

public boolean equals(java.lang.Object obj)

This method tests the specified Object for equality with this object. This will be true if and only if the locations are equal and the certificate sets are identical (ignoring order).

Parameters:

Returns:


getCertificates

public final Certificate[] getCertificates()

This method returns the list of digital certificates that can be used to verify the signatures of code loaded under this CodeSource.

Returns:


getLocation

public final URL getLocation()

This method returns the URL specifying the location from which code will be loaded under this CodeSource.

Returns:


hashCode

public int hashCode()

This method returns a hash value for this object.

Returns:


implies

public boolean implies(java.security.CodeSource cs)

This method tests to see if a specified CodeSource is implied by this object. Effectively, to meet this test, the specified object must have all the certifcates this object has (but may have more), and must have a location that is a subset of this object's. In order for this object to imply the specified object, the following must be true:
  1. codesource must not be null.
  2. If codesource has a certificate list, all of it's certificates must be present in the certificate list of this code source.
  3. If this object does not have a null location, then the following addtional tests must be passed.
    1. codesource must not have a null location.
    2. codesource's location must be equal to this object's location, or
      • codesource's location protocol, port, and ref (aka, anchor) must equal this objects
      • codesource's location host must imply this object's location host, as determined by contructing SocketPermission objects from each with no action list and using that classes's implies method
      • If this object's location file ends with a '/', then the specified object's location file must start with this object's location file. Otherwise, the specified object's location file must start with this object's location file with the '/' character appended to it.

For example, each of these locations imply the location "http://java.sun.com/classes/foo.jar":

Parameters:

Returns:


toString

public String toString()

This method returns a String that represents this object. The result is in the format "(" + getLocation() followed by a space separated list of certificates (or ""), followed by ")".

Returns: