Hello,
Marchena wrote:
> This problem you have is due to permissions you need to specify.
> Add this line to the .java.policy file by hand or using the
> policytool.exe.
>
> permission java.security.AllPermission;
>
> You can do this just for testing objetives. You need to find the exact
> permission you have to specify in order to gaing acces to library
> loading when you begin to deploy your applet or you'll be leaving
> clues to a security hole. If you find it let me know
>
> If anybody knows wich permission have to be specified please let us
> know
In order to finely specify the permissions, you need to step
by step grant them when a layer of software is requesting an access
to such a file or port. That's how I did and so I think my policy
file is quite minimum for my platform (please find it attached).
BUT note that it will *not* work "out-of-the-box" for any platform
because the security settings you need to grant are different from
one platform to another (e.g., name of the ports to access, location
of the different properties files: Java, Comm, and even our
CardTerminal, locations of the dynamic libraries: depending on the JDK
-there are three JDKs under Linux!-, and of course name of these
libraries: .so under Linux or Solaris, .DLL under Win$ etc.).
So mine works under:
- Linux
- JDK from Blackdown (1.2.2) and IBM (1.3)
- Comm API from RXTX (there is one from IBM too!)
- GemplusCardTerminal
Sorry about this.. In fact, it's quite a nightmare if you are
thinking about deployment.. except if you have uniform platforms.
In this case, it's important to understand what is needed, usually
accesses from Comm or sometimes from OCF (opencard.properties) and
then to specify them.
This way you will limit security holes. Note that there are
sometimes bugs in some software layers, for example it's enough
to grant "read" access for opencard.properties but not for the Java
or Comm API properties (you need "read,write") which seems strange
and ... dangerous to me. But we would need the sources of comm.jar
to understand the reason, and maybe patch it.
Note that Xavier Lorphelin <mailto:[EMAIL PROTECTED]> has written
a nice article about the subject (SmartCards & Internet) where he
explains the three different security models, how to sign (I guess
you already know that by now but some people might not) and how to
grant permissions in IE, Netscape, and Java. The examples, as
I remember, are more for JDK 1.1 and will need to be adapted but the
article is a good overview:
http://www.smartcardcentral.com/technical/articles/jsource/jsource_080999.asp
Hope it'll help to clarify the subject. I'm still in the process of
writing a FAQ on the use of OCF in applets, and I hope to have it
ready for beginning of next year.. stay tuned :-).
Cheers,
Christophe.
= When you trade freedom for security you get neither =
= -- Thomas Jefferson =
--
-------------------------------------------------------------
[EMAIL PROTECTED] - Gemplus Research Lab
Phone: +33 4-42-36-57-83 | Disclaimer: I don't speak for Gemplus
Gemplus doesn't speak for me... it is better that way!
-------------------------------------------------------------
// this keystore is to store our certificates
keystore ".keystore";
// a grant entry suitable for the OCF applets
// allows ALL applets that were signed by "cm" to carry out the following actions
grant signedBy "cm" {
/* TEST with AllPermission */
/*permission java.security.AllPermission;*/
// read and write arbitrary (including sensitive) system properties
permission java.util.PropertyPermission "*", "read,write";
// read the 'opencard.properties' file in the standard locations
permission java.io.FilePermission "${java.home}/lib/opencard.properties", "read";
permission java.io.FilePermission "${user.home}/.opencard.properties", "read";
permission java.io.FilePermission "${user.dir}/opencard.properties", "read";
permission java.io.FilePermission "${user.dir}/.opencard.properties", "read";
// read the 'javax.comm.properties' file in the standard location
permission java.io.FilePermission "${java.home}/lib/javax.comm.properties",
"read,write,delete";
permission java.io.FilePermission
"${java.home}/lib/Gempluscardterminal.properties", "read,write,delete";
// read the Comm API driver implementation in the standard locations (e.g.,
Blackdown & IBM)
permission java.io.FilePermission "${java.home}/lib/ext/libSerial.so", "read";
permission java.io.FilePermission "${java.home}/lib/ext/i386/libSerial.so", "read";
permission java.io.FilePermission "${java.home}/bin/libibmcomm.so", "read";
permission java.io.FilePermission "${java.home}/lib/ext/libibmcomm.so", "read";
permission java.io.FilePermission "${java.home}/lib/ext/x86/libibmcomm.so", "read";
// access the serial port devices
permission java.io.FilePermission "/dev", "read,write";
permission java.io.FilePermission "/dev/lp0", "read,write";
permission java.io.FilePermission "/dev/lp1", "read,write";
permission java.io.FilePermission "/dev/lp2", "read,write";
permission java.io.FilePermission "/dev/ttyS0", "read,write";
permission java.io.FilePermission "/dev/ttyS1", "read,write";
permission java.io.FilePermission "/dev/ttyS2", "read,write";
permission java.io.FilePermission "/dev/ttyS3", "read,write";
// dynamically load native libraries
permission java.lang.RuntimePermission "loadLibrary.*";
// get access to declared constructors/methods/fields via reflection API
permission java.lang.RuntimePermission "reflect.declared.*";
};