public Main(NetworkClient sock) { initComponents(); this.sock = sock; initComboBox(); menu = new Menu(); int port = Integer.parseInt(EasyFile.getConfig("Configs_Serveur_Restaurants", "PORT_HEAD")); String host = EasyFile.getConfig("Configs_Serveur_Restaurants", "HOST"); }
public static void main(String args[]) { KeyStore ks = null; MyCertificate myCertificate = new MyCertificate(); int portVoyageurs = Integer.parseInt(EasyFile.getConfig("Configs_Serveur_Occupations", "PORT_VILLAGES_MOTELS")); String path = EasyFile.getConfig("Configs_Serveur_Occupations", "ADRESSE_KS_SERVEUR_NO_SSL"); File fichierKeyStore = new File(path); try { ks = KeyStore.getInstance("PKCS12", "BC"); String passKs = "lolilol"; ks.load(new FileInputStream(fichierKeyStore), passKs.toCharArray()); myCertificate.setCertificate((X509Certificate) ks.getCertificate("server")); myCertificate.getCertificate().checkValidity(); String passKeyStore = "lolilol"; myCertificate.setPrivateKey((PrivateKey) ks.getKey("server", passKeyStore.toCharArray())); } catch (KeyStoreException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (NoSuchAlgorithmException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (UnrecoverableKeyException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (CertificateExpiredException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (CertificateNotYetValidException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (NoSuchProviderException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (CertificateException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } Thread MyThread = new Thread(new ServeurPool(portVoyageurs, myCertificate)); MyThread.start(); }