Making a java applet meet high security standards - java

I have a working applet and I am trying to add it to my website for my portfolio. My problem is I can't get the applet to run without adding the directory (I'm running it locally for now) to the site exception list. my applet code is as follows:
<applet code = "myTetris.TetrisApplet"
archive = "myTetris\jar.jar"
height = "400" width = "200">
I have created a jar file using IntelliJ IDEA. The manifest is as follows:
Manifest-Version: 1.0
Permissions: sandbox
Application-Name: Tetris
I have signed the jar file.

Since Java 7 update 51 Java Web Start applications and applets need to be signed and must have a permission set in the manifest. You have done both correctly. However, the certificate you used for code signing, was probably a so-called self signed certificate. As the identity of the signer cannot be verified, such certificates are not trusted by browsers, operating systems, and the Java Runtime. To fix this, you would either need to import your certificate into your system and trust it, or you would need to obtain (buy) a certificate that was issued by a trusted authority. Some organizations offer trusted certificates for open sources projects.

Related

Java blocks my (signed .jar) applet due to security reasons. How do i fix this?

First i would like to say that the .jar does not contain any malicious software or code. It's not harmfull, everything is fine. I signed my .jar and I'm trying to load it into my website using this code:
<applet width="765" height="503" code="Loader.java" archive="HolyDivinity718V1.1.jar" name="Holy Divinity"></applet></p>
But when i run it i get this error:
Application Blocked. Click for details. Your security settings have blocked a self-signed application from running.
The client is a webclient of a game that I'm running. What's the reason that it's getting blocked?
Since recently all self signed java applets are blocked. You can do one of the following things:
Buy and sign your applet with an official certificate
Decrease your security slider to medium
Use the exception site list
Sign your app with a self signed certificate and add your certificate to the java trust store

Signing Jars to resolve Uknown Publisher for Internal Apps

We develop several Java apps for internal use within our company (jnlp). With Java 1.7u40 we are seeing a nasty warning that unknown publishers will not be allowed to run in future java releases.
I understand your jars need to be signed by a trusted CA for code signing ... self signing will not suffice. I don't like the fact that we now will have to pay just to sign our apps for internal use only. I truly must be misunderstanding something. Is there a way to code sign the jars so that they will continue to run with future java releases without the need to pay a CA (Verisign, etc)?
If your company runs an internal CA, then you can issue a code signing certificate from that. Most companies that use Active Directory will also have a CA deployed.
Another approach would be to run a script on all company machines that installs the code signing certificate into the trusted certificates store.

Professionally sign an applet

I've made a Java applet and I self signed it before, but due to security changes in recent Java updates, self signing no longer gives the applet the necessary permissions.
I need the applet to be able to read the local file system to use images and to be able to connect to a MYSQL database.
The applet used to work with the database when I self signed it, but not anymore.
In addition, many unknown users will be using the applet, so I won't have control over their machines.
Where can I get my applet professionally signed and if possible, is there another way to self sign that will make the applet work?
Purchase a certificate from any reputable certificate authority. Use that to sign your code. List of CAs
Or, some companies also do this: Sign the jars themselves, but pre-populate the JDK trust store with your (self created) CA cert. If you have control over the JRE that is installed on all user machines, you can place your certificate in JRE/lib/security/cacerts so that is trusted ahead of time.
update: This page (Java Control Panel Documentation) describes what type of signature is required for various client side security level settings:
As long as the applet 'phones home' to the DB & this demo. of the JNLP API file services1 works for the problem machines you should be set to go for a Plug-In 2 JRE (1.6.0_10+) JRE. And if the client has less than that, they should seriously look to update. The Deployment Toolkit Script can assist with that.
It is relevant in that:
It uses a self signed certificate
It allows a sand-boxed app. to read/write to the local file system.
An applet launched using JWS has access to the API.
This should only be considered a work-around. The correct way to solve the problem is to heed the advice offered to get a certified code certificate. Oracle seems to be heading towards making it so that unsigned or self-signed code will not just be sand-boxed, but entirely forbidden (& that is for the best).
As an aside re. DB access: For the protection of the DB. The applet should be forced to go through a 'public interface' (via the site that hosts the applet). Do not give the applet direct access to the DB. Otherwise hackers also have direct DB access.

How do I sign an apk using .key file?

I created an application which is currently on Android market. The key used to sign the application was made using jarsigner. How do I sign using the .key file originally generated?
You will need the original private key that you used to sign the first version.
Full information is available here, but here is the excerpt it sounds like you need:
Application upgrade – As you release
updates to your application, you will
want to continue to sign the updates
with the same certificate or set of
certificates, if you want users to
upgrade seamlessly to the new version.
When the system is installing an
update to an application, it compares
the certificate(s) in the new version
with those in the existing version. If
the certificates match exactly,
including both the certificate data
and order, then the system allows the
update. If you sign the new version
without using matching certificates,
you will also need to assign a
different package name to the
application — in this case, the user
installs the new version as a
completely new application.
AFAIK, .key is not a standard (conventional) file ending. Most of the time you are working with a .keystore file. The keystore contains the key. The keystore and the key both have passwords and separate security measures for safety.
If you generated your ".key" file using jarsigner and one of the commands listed here, then you likely created a keystore file and happened to give it the ending ".key" If this is the case, then just compile your application into release mode, sign the application using the jarsigner tool, and use zipalign (not sure what this is for, compression perhaps?).
If you don't have the original keystore and key file, then you're boned. Sorry :/ Tons of other info can be found on the Signing Your Application page
HTH,
Hamy

java web start security warning

I have a web application that downloads a jar file from the web server using java web start. The jar is signed using J2SE security tool. However, I get the security warning "The application digital signature cannot be verified. Do you want to run the application?"
Am I missing something that is causing this??
If it is self-signed you also need to add the certificate into windows certificate store.
If you use a Certificate Authority such as Verisign then you will not have the problem.
See here for an explanation (from Verisign) on why to sign from them.

Categories