javatools/javasecuritycustomization/javasecuritycustomizationtool.pl
changeset 26 dc7c549001d5
parent 21 2a9601315dfc
equal deleted inserted replaced
23:98ccebc37403 26:dc7c549001d5
    62 my $iby_name;
    62 my $iby_name;
    63 my $sis_file_name;
    63 my $sis_file_name;
    64 my $pkg_file_name;
    64 my $pkg_file_name;
    65 my $pkg_name;
    65 my $pkg_name;
    66 my $package_type;
    66 my $package_type;
       
    67 my $s60_version;
    67 my $signed_sis                                     = "false";
    68 my $signed_sis                                     = "false";
    68 my $ROM                                            = "rom";
    69 my $ROM                                            = "rom";
    69 my $SIS                                            = "sis";
    70 my $SIS                                            = "sis";
    70 my $openssl                                        = "openssl.exe";
    71 my $openssl                                        = "openssl.exe";
    71 my $METADATA_EXT                                   = ".metadata";
    72 my $METADATA_EXT                                   = ".metadata";
    85 my $JAVA_CUSTOM_SECURITY_SIS_FILENAME              = "java_custom_security.sis";
    86 my $JAVA_CUSTOM_SECURITY_SIS_FILENAME              = "java_custom_security.sis";
    86 my $NON_REMOVABLE_PACKAGE_TYPE                     = ",(0x2001FD68), 1,0,0, TYPE=PU,RU\n%{\"Nokia\"}\n:\"Nokia\"\n[0x1028315F], 0, 0, 0, {\"Series60ProductID\"}\n";
    87 my $NON_REMOVABLE_PACKAGE_TYPE                     = ",(0x2001FD68), 1,0,0, TYPE=PU,RU\n%{\"Nokia\"}\n:\"Nokia\"\n[0x1028315F], 0, 0, 0, {\"Series60ProductID\"}\n";
    87 my $REMOVABLE_PACKAGE_TYPE                         = ",(0x2001FD68), 1,0,0, TYPE=SP,RU\n%{\"Nokia\"}\n:\"Nokia\"\n[0x1028315F], 0, 0, 0, {\"Series60ProductID\"}\n";
    88 my $REMOVABLE_PACKAGE_TYPE                         = ",(0x2001FD68), 1,0,0, TYPE=SP,RU\n%{\"Nokia\"}\n:\"Nokia\"\n[0x1028315F], 0, 0, 0, {\"Series60ProductID\"}\n";
    88 # IBY and PKG data
    89 # IBY and PKG data
    89 my $CERTS_DATACAGE                                 = "\\private\\200211dc\\security\\trustroots\\device\\certificates\\";
    90 my $CERTS_DATACAGE                                 = "\\private\\200211dc\\security\\trustroots\\device\\certificates\\";
       
    91 my $CERTS_DEST                                     = "\\resource\\java\\security\\trustroots\\";
    90 my $CERTS_STATE_DATACAGE                           = "\\private\\200211dc\\security\\trustroots\\device\\state\\";
    92 my $CERTS_STATE_DATACAGE                           = "\\private\\200211dc\\security\\trustroots\\device\\state\\";
    91 my $POLICIES_DATACAGE_SRC                          = "\\resource\\java\\security\\policies\\";
    93 my $POLICIES_DATACAGE_SRC                          = "\\resource\\java\\security\\policies\\";
    92 my $POLICIES_DATACAGE_SRC_5_0                      = "\\private\\102033E6\\resource\\security\\policies\\";
    94 my $POLICIES_DATACAGE_SRC_5_0                      = "\\private\\102033E6\\resource\\security\\policies\\";
    93 my $POLICIES_DATACAGE_DEST                         = "RESOURCE_FILES_DIR\\java\\security\\policies\\";
    95 my $POLICIES_DATACAGE_DEST                         = "RESOURCE_FILES_DIR\\java\\security\\policies\\";
    94 
    96 
   416     open (PKG_FILE, "+>tmp/$pkg_file_name") or die "Cannot create tmp file (tmp/$pkg_file_name)\n";
   418     open (PKG_FILE, "+>tmp/$pkg_file_name") or die "Cannot create tmp file (tmp/$pkg_file_name)\n";
   417     print PKG_FILE   "&EN\n#{\"$pkg_name\"}" ."$package_type";
   419     print PKG_FILE   "&EN\n#{\"$pkg_name\"}" ."$package_type";
   418     open (POLICY_FILE, "+>tmp/update_certs") or die "Cannot create tmp file (tmp/update_certs)\n";
   420     open (POLICY_FILE, "+>tmp/update_certs") or die "Cannot create tmp file (tmp/update_certs)\n";
   419     close POLICY_FILE;
   421     close POLICY_FILE;
   420   }
   422   }
   421 
   423   
       
   424   open (MIDPROOTSLIST_FILE, "+>tmp/midprootslist") or die "Cannot create temp file (tmp/certs/midprootslist)\n";
   422   foreach my $root (@{$xmldata->{root}}) {
   425   foreach my $root (@{$xmldata->{root}}) {
   423     
   426     
   424       # read the xml node
   427       # read the xml node
   425       $root_file = $root->{file}->[0];
   428       $root_file = $root->{file}->[0];
   426       $root_domain = $root->{domain}->[0];
   429       $root_domain = $root->{domain}->[0];
   582           print IBY_FILE $root_file_without_ext;
   585           print IBY_FILE $root_file_without_ext;
   583           print IBY_FILE "$METADATA_EXT\n";
   586           print IBY_FILE "$METADATA_EXT\n";
   584       }
   587       }
   585       else
   588       else
   586       {
   589       {
       
   590           print MIDPROOTSLIST_FILE $root_file_with_ext;       
       
   591           print MIDPROOTSLIST_FILE "\n";       
   587           print PKG_FILE   "\"./tmp/certs/";
   592           print PKG_FILE   "\"./tmp/certs/";
   588           print PKG_FILE   $root_file_with_ext;
   593           print PKG_FILE   $root_file_with_ext;
   589           print PKG_FILE   "\"-\"c:" . "$CERTS_DATACAGE";
   594           if ($s60_version eq "5.0")
       
   595           {
       
   596               print PKG_FILE   "\"-\"c:" . "$CERTS_DATACAGE";
       
   597           }
       
   598           else
       
   599           {
       
   600               print PKG_FILE   "\"-\"c:" . "$CERTS_DEST";
       
   601           }
   590           print PKG_FILE   $root_file_with_ext;
   602           print PKG_FILE   $root_file_with_ext;
   591           print PKG_FILE   "\"\n\"./tmp/certs/";
   603           print PKG_FILE   "\"\n\"./tmp/certs/";
   592           print PKG_FILE   $root_file_without_ext;
   604           print PKG_FILE   $root_file_without_ext;
   593           print PKG_FILE   "$METADATA_EXT\"-\"c:" ."$CERTS_DATACAGE";
   605           if ($s60_version eq "5.0")
       
   606           {
       
   607               print PKG_FILE   "$METADATA_EXT\"-\"c:" ."$CERTS_DATACAGE";
       
   608           }
       
   609           else
       
   610           {
       
   611               print PKG_FILE   "$METADATA_EXT\"-\"c:" ."$CERTS_DEST";
       
   612           }
   594           print PKG_FILE   $root_file_without_ext;
   613           print PKG_FILE   $root_file_without_ext;
   595           print PKG_FILE   "$METADATA_EXT\"\n";
   614           print PKG_FILE   "$METADATA_EXT\"\n";
   596           if ($root_state ne "")
   615           open (STATE_FILE, "+>tmp/certs/$root_file_without_ext$STATE_EXT") or die "Cannot create temp file (tmp/certs/$root_file_without_ext$STATE_EXT)\n";
       
   616           binmode STATE_FILE;
       
   617           my $state;
       
   618           if ($root_state eq "enabled" || $root_state eq "")
   597           {
   619           {
   598               open (STATE_FILE, "+>tmp/certs/$root_file_without_ext$STATE_EXT") or die "Cannot create temp file (tmp/certs/$root_file_without_ext$STATE_EXT)\n";
   620             $state = pack("h8", "3000");
   599               binmode STATE_FILE;
   621           }
   600               my $state;
   622           else
   601               if ($root_state eq "enabled")
   623           {
       
   624               if ($root_state eq "disabled")
   602               {
   625               {
   603                 $state = pack("h8", "3000");
   626                 $state = pack("h8", "2000");
   604               }
   627               }
   605               else
   628               else
   606               {
   629               {
   607                   if ($root_state eq "disabled")
   630                  if ($root_state eq "removed")
   608                   {
   631                  {
   609                     $state = pack("h8", "2000");
   632                     $state = pack("h8", "1000");
   610                   }
       
   611                   else
       
   612                   {
       
   613                      if ($root_state eq "removed")
       
   614                      {
       
   615                         $state = pack("h8", "1000");
       
   616                      }
       
   617                   }
   633                   }
   618               }
   634               }
   619               print STATE_FILE $state;
       
   620               close STATE_FILE;
       
   621               print PKG_FILE   "\"./tmp/certs/";
       
   622               print PKG_FILE   $root_file_without_ext;
       
   623               print PKG_FILE   "$STATE_EXT\"-\"c:" ."$CERTS_STATE_DATACAGE";
       
   624               print PKG_FILE   $root_file_without_ext;
       
   625               print PKG_FILE   "$STATE_EXT\"\n";
       
   626           }
   635           }
   627       }
   636           print STATE_FILE $state;
   628   }
   637           close STATE_FILE;
       
   638           print PKG_FILE   "\"./tmp/certs/";
       
   639           print PKG_FILE   $root_file_without_ext;
       
   640           print PKG_FILE   "$STATE_EXT\"-\"c:" ."$CERTS_STATE_DATACAGE";
       
   641           print PKG_FILE   $root_file_without_ext;
       
   642           print PKG_FILE   "$STATE_EXT\"\n";
       
   643       }
       
   644   }
       
   645   close MIDPROOTSLIST_FILE;
   629  	if ($deployment_destination eq $SIS)
   646  	if ($deployment_destination eq $SIS)
   630  	{
   647  	{
   631     print PKG_FILE   "\"./tmp/update_certs\"-\"c:\\private\\102033E6\\security\\tmp\\update_certs\"\n";
   648     print PKG_FILE   "\"./tmp/update_certs\"-\"c:\\private\\102033E6\\security\\tmp\\update_certs\"\n";
       
   649     if ($s60_version ne "5.0")
       
   650     {
       
   651         print PKG_FILE   "\"./tmp/midprootslist\"-\"c:\\resource\\java\\security\\trustroots\\midprootslist\"\n";
       
   652     }
   632   }
   653   }
   633   if ($deploy == 1)
   654   if ($deploy == 1)
   634   {
   655   {
   635     print PKG_FILE   "\"\\epoc32\\release\\armv5\\urel\\javasecuritycustomization.exe\"-\"c:\\sys\\bin\\javasecuritycustomization.exe\", FR, RB, RW\n";
   656     print PKG_FILE   "\"\\epoc32\\release\\armv5\\urel\\javasecuritycustomization.exe\"-\"c:\\sys\\bin\\javasecuritycustomization.exe\", FR, RB, RW\n";
   636   }
   657   }
   712  	mkdir "tmp/policies/external/";
   733  	mkdir "tmp/policies/external/";
   713  	mkdir "tmp/policies/internal/";
   734  	mkdir "tmp/policies/internal/";
   714  	
   735  	
   715   # read the xml node
   736   # read the xml node
   716   $policy_name = $xmldata->{policy}->{name};
   737   $policy_name = $xmldata->{policy}->{name};
   717   $s60_version = $xmldata->{s60_version};
       
   718   $utp_policy_path = $xmldata->{policy}->{unidentifiedthirdparty};
   738   $utp_policy_path = $xmldata->{policy}->{unidentifiedthirdparty};
   719   $ttp_policy_path = $xmldata->{policy}->{identifiedthirdparty};
   739   $ttp_policy_path = $xmldata->{policy}->{identifiedthirdparty};
   720   $operator_policy_path = $xmldata->{policy}->{operator};
   740   $operator_policy_path = $xmldata->{policy}->{operator};
   721   $manufacturer_policy_path = $xmldata->{policy}->{manufacturer};
   741   $manufacturer_policy_path = $xmldata->{policy}->{manufacturer};
   722   
   742   
  1169     
  1189     
  1170     $signing_cert = $xmldata->{signing}->{cert};
  1190     $signing_cert = $xmldata->{signing}->{cert};
  1171     $signing_key = $xmldata->{signing}->{key};
  1191     $signing_key = $xmldata->{signing}->{key};
  1172  
  1192  
  1173     $package_type = $xmldata->{deploytype};
  1193     $package_type = $xmldata->{deploytype};
       
  1194     $s60_version = $xmldata->{s60_version};
  1174     if (($package_type ne "") && ($package_type ne "removable") && ($package_type ne "non-removable"))
  1195     if (($package_type ne "") && ($package_type ne "removable") && ($package_type ne "non-removable"))
  1175     {
  1196     {
  1176         print "\nERROR: when specified, the type of the deployment package can have one of the two values: 'removable' or 'non-removable'. Please check the configuration file $config_file\n";
  1197         print "\nERROR: when specified, the type of the deployment package can have one of the two values: 'removable' or 'non-removable'. Please check the configuration file $config_file\n";
  1177         exit;
  1198         exit;
  1178     }
  1199     }