Security settings block signed applet running via Javascript

Question:

There is a signed applet. Runs in this way via HTML and works:

<!DOCTYPE html>
<html>
<head>
<title>Applet-Test</title>

</head>
<body>
    <h1> Hi html works </h1>
    <applet code="Applet.class" archive="applet.jar" width=320 height=320>
    <param name="locale" value="de"/>
    </applet>
</body>

</html>

Now I'm trying to do the same via javascript using jnlp:

<?xml version="1.0" encoding="utf-8"?>

<jnlp spec="1.0+" codebase="" href="">
    <information>
        <title>OTC-Applet</title>
        <vendor>BBraun</vendor>
    </information>
    <resources>
        <!-- Application Resources -->
        <j2se version="1.7+"
              href="http://java.sun.com/products/autodl/j2se"/>
        <jar href="applet.jar" main="true" />

    </resources>
    <applet-desc 
         name="Applet"
         main-class="Applet" 
         width="1"
         height="1">
         <param name="locale" value="de"/>
    </applet-desc>
     <update check="background"/>
</jnlp>

And the script itself inside HTML:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en-US">
  <head>
    <title>OTC-Applet Page</title>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <script language="javascript">
    </script>

  </head>
  <body>
    <noscript>A browser with JavaScript enabled is required for this page to operate properly.</noscript>
    <!-- script src="https://www.java.com/js/deployJava.js"></script -->
    <script src="otc.js"></script>
    <script>
        <!-- applet id can be used to get a reference to the applet object -->
        var attributes = { id:'applet', code:'Applet', width:400, height:300} ;
        var parameters = {jnlp_href: 'applet.jnlp', locale: 'de'} ;
        deployJava.runApplet(attributes, parameters, '1.6');
    </script>


    <h1>OTC Applet</h1>
  </body>
</html>

In this case, it is blocked by the java. What's wrong here? What is the difference from the first option?
Java version 1.7.0_67.

Answer:

To run, applets must be signed. There are test and free certificates, but for use on the site you should buy a certificate, for example, verysign (there are different ones, at different prices).

Here's an example of how to sign an applet: https://docs.oracle.com/javase/7/docs/technotes/guides/jweb/security/rsa_signing.html

And more links, can help in difficulty:

https://habrahabr.ru/post/201210/

http://www.codejava.net/java-se/applet/how-to-sign-a-java-applet?showall=1

https://habrahabr.ru/post/204984/

Scroll to Top