Advertisement
Tyluur

Untitled

Jul 12th, 2012
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.58 KB | None | 0 0
  1. package com.runescape;
  2.  
  3. import java.io.File;
  4. import java.io.FileReader;
  5. import java.security.interfaces.RSAPrivateKey;
  6. import java.security.interfaces.RSAPublicKey;
  7. import java.util.logging.Level;
  8. import java.util.logging.Logger;
  9.  
  10. import com.runescape.networking.SevadorHandler;
  11. import com.runescape.utility.Config;
  12. import com.runescape.utility.secure.RSA;
  13. import com.runescape.utility.secure.RSAKeygen;
  14.  
  15. /**
  16.  * The main execution class of the Sevador framework.
  17.  *
  18.  * @author Tyluur
  19.  */
  20. public class Server {  
  21.    
  22.     /**
  23.      * The configuration file used to initialize main server variables.
  24.      */
  25.     public static final String CONFIG_FILE = "./config.ini";
  26.  
  27.     /** The logger instance. */
  28.     private static Logger logger = Logger.getLogger(Server.class.getName());
  29.  
  30.     /**
  31.      * Starter method.
  32.      *
  33.      * @param args
  34.      *            The program arguments
  35.      */
  36.     public static void main(String[] args) {
  37.         logger.info("Starting Sevador framework, please wait...");
  38.         try {
  39.             loadConfig();
  40.             new SevadorHandler();
  41.             logger.info("Startup complete.");
  42.         } catch (Exception ex) {
  43.             logger.log(Level.SEVERE, "Unable to start.", ex);
  44.         }
  45.     }
  46.    
  47.     /**
  48.      * Loads configuration.
  49.      *
  50.      * @throws Exception
  51.      */
  52.     private static void loadConfig() throws Exception {
  53.         Config.getProperties().load(new FileReader(CONFIG_FILE));
  54.         File privateKey = new File(Config.getProperties().getProperty("rsa_private_key"));
  55.         RSA.setPrivateKey((RSAPrivateKey) RSAKeygen.loadPrivateKey(privateKey));
  56.         File publicKey = new File(Config.getProperties().getProperty("rsa_public_key"));
  57.         RSA.setPublicKey((RSAPublicKey) RSAKeygen.loadPublicKey(publicKey));
  58.     }
  59.    
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement