|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.fikin.classmarshaling.util.CertificateBasedClassSelector
public class CertificateBasedClassSelector
Class selector based on certificates
It selects all classes except:
This class is useful when you have an environment where each "system" class
is signed with some certificate, while all "other" (external) classes are not.
This class will check if the signature of the class has been signed by
the given certificate and select only those which have not been signed.
The certificate will be loaded from a given keystore (password-less read access) or it should be given explicitly.
Example:
Create a private-public keys pair and signed with it the application jars.
Pass the same certificate to this selector and then all classes which has
not been signed (and not being JDK) will be selected.
created on Aug 2, 2005
Selector selector = new CertificateBasedClassSelector();
selector.setCertificate( myBuildCert );
MarshaledObject mo = new MarshaledObject( myObj, selector );
// not serialize the "mo" instead of "myObj"
Constructor Summary | |
---|---|
CertificateBasedClassSelector()
|
Method Summary | |
---|---|
void |
init()
Before calling this methof one has to set one of these two options: setKeystoreUrl(URL) and setCertificateName(String)
setCertificate(Certificate)
If it has been provided keystore URL and certificate name, this method
will read the certificate. |
boolean |
isClassToBeMarshaled(java.lang.Class cl)
looks to find if the given class: is system (no code source object) it has been signed with cluster's build certificate In either if these two cases it will return "false". |
void |
setCertificate(java.security.cert.Certificate cert)
set the certificate One has to set one of these two options: setKeystoreUrl(URL) and setCertificateName(String)
this property
|
void |
setCertificateName(java.lang.String name)
set the certificate's name One has to set one of these two options: this and setKeystoreUrl(URL)
setCertificate(Certificate)
|
void |
setKeystoreUrl(java.net.URL ks)
set certificate's keystore location One has to set one of these two options: this and setCertificateName(String)
setCertificate(Certificate)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CertificateBasedClassSelector()
Method Detail |
---|
public void setKeystoreUrl(java.net.URL ks)
One has to set one of these two options:
ks
- url of the keystorepublic void setCertificateName(java.lang.String name)
One has to set one of these two options:
name
- of the certificatepublic void setCertificate(java.security.cert.Certificate cert)
One has to set one of these two options:
setKeystoreUrl(URL)
and setCertificateName(String)
cert
- is the certificate to be usedpublic void init() throws java.security.KeyStoreException, java.io.IOException, java.security.NoSuchAlgorithmException, java.security.cert.CertificateException
Before calling this methof one has to set one of these two options:
If it has been provided keystore URL and certificate name, this method will read the certificate. Keystore access must be password-less.
If certificate itself has been given, this method will do nothing.
java.security.KeyStoreException
java.io.IOException
java.security.NoSuchAlgorithmException
java.security.cert.CertificateException
public boolean isClassToBeMarshaled(java.lang.Class cl)
In all other cases it will return "true".
isClassToBeMarshaled
in interface ClassSelector
cl
- is the class to check
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |