is new.
java.lang.Objectjava.security.CodeSource
This class extends the concept of a codebase to encapsulate not only the location (URL) but also the
certificate chains
certificate(s)
that were used to verify signed code originating from that location.
| Constructor Summary | |
|---|---|
|
CodeSource
(
URL
url,
Certificate
[] certs) Constructs a CodeSource and associates it with the specified location and set of certificates. |
|
CodeSource
(
URL
url,
CodeSigner
Constructs a CodeSource and associates it with the specified location and set of code signers.
|
|
| Method Summary | |
|---|---|
| boolean |
equals
(
Object
obj) Tests for equality between the specified object and this object. |
| Certificate [] |
getCertificates
() Returns the certificates associated with this CodeSource. |
CodeSigner
|
getCodeSigners
()
Returns the code signers associated with this CodeSource.
|
| URL |
getLocation
() Returns the location associated with this CodeSource. |
| int |
hashCode
() Returns the hash code value for this object. |
| boolean |
implies
(
CodeSource
codesource) Returns true if this CodeSource object "implies" the specified CodeSource. |
| String |
toString
() Returns a string describing this CodeSource, telling its URL and certificates. |
| Methods inherited from class java.lang. Object |
|---|
| clone , finalize , getClass , notify , notifyAll , wait , wait , wait |
| Constructor Detail |
|---|
public CodeSource(URL url,
Certificate[] certs)
It may be null. The contents of the array are copied to protect against subsequent modification.
CodeSource
public
CodeSource
(
URL
url,
CodeSigner
[] signers)
Constructs a CodeSource and associates it with the specified location and set of code signers.
Parameters:
url - the location (URL).
signers - the code signers. It may be null. The contents of the array are copied to protect against subsequent modification.
Since:
1.5
| Method Detail |
|---|
public int hashCode()
public boolean equals(Object obj)
their signer certificate chains
value.
certificate chains
public final URL getLocation()
public final Certificate[] getCertificates()
If this CodeSource object was created using the
CodeSource(URL url, CodeSigner[] signers)
constructor then its certificate chains are extracted and used to create an array of Certificate objects. Each signer certificate is followed by its supporting certificate chain (which may be empty). Each signer certificate and its supporting certificate chain is ordered bottom-to-top (i.e., with the signer certificate first and the (root) certificate authority last).
A copy of the certificates array, or null if there is none.
getCodeSigners
public final
CodeSigner
[]
getCodeSigners
()
Returns the code signers associated with this CodeSource.
If this CodeSource object was created using the
CodeSource(URL url, Certificate[] certs)
constructor then its certificate chains are extracted and used to create an array of CodeSigner objects. Note that only X.509 certificates are examined - all other certificate types are ignored.
Returns:
A copy of the code signer array, or null if there is none.
Since:
1.5
public boolean implies(CodeSource codesource)
More specifically, this method makes the following checks, in order. If any fail, it returns false. If they all succeed, it returns true.
For example, the codesource objects with the following locations and null certificates all imply the codesource with the location "http://java.sun.com/classes/foo.jar" and null certificates:
http:
http://*.sun.com/classes/*
http://java.sun.com/classes/-
http://java.sun.com/classes/foo.jar
Note that if this CodeSource has a null location and a null certificate chain, then it implies every other CodeSource.
public String toString()