public static void sign(File jadFile,File jarFile,RSAPrivateKey privateKey,X509Certificate[] certificateChain,int certificateNumber) throws IOException, CryptoException {
  File tmpFile=File.createTempFile("kse","tmp");
  tmpFile.deleteOnExit();
  sign(jadFile,tmpFile,jarFile,privateKey,certificateChain,certificateNumber);
  CopyUtil.copyClose(new FileInputStream(tmpFile),new FileOutputStream(jadFile));
  tmpFile.delete();
}

public static void sign ( File jadFile , File jarFile , RSAPrivateKey privateKey , X509Certificate [ ] certificateChain , int certificateNumber ) throws IOException , CryptoException { File tmpFile = File . createTempFile ( "kse" , "tmp" ) ; tmpFile . deleteOnExit ( ) ; sign ( jadFile , tmpFile , jarFile , privateKey , certificateChain , certificateNumber ) ; CopyUtil . copyClose ( new FileInputStream ( tmpFile ) , new FileOutputStream ( jadFile ) ) ; tmpFile . delete ( ) ; }
sign a midlet overwriting the supplied jad file .
