title: How to store and reuse keypair in Java?
body: <p>I am wanting generate a keypair once and reuse it.</p>
  
  <pre><code>public static KeyPair generateKeyPair() throws Exception {
          KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA");
          generator.initialize(2048, new SecureRandom());
          KeyPair pair = generator.generateKeyPair();
  
          return pair;
  }
  </code></pre>
  
  <p>How do I go about this?</p>