title: Load stored RSA public/private key from disk?
body: <p>independent from the fact that the private key should be encrypted (which happens independently from this question): I'm generating RSA key pairs using this code:</p>
  
  <pre><code>KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA");
  
  kpg.initialize(2048);
  KeyPair keyPair = kpg.generateKeyPair();
  privKey = (RSAPrivateKey)keyPair.getPrivate();
  pubKey = (RSAPublicKey)keyPair.getPublic();     
  byte[] data=privKey.getEncoded();
  ...
  byte[] data=pupKey.getEncoded();
  </code></pre>
  
  <p>The contents of data are binary and not Base 64 encoded or something like that.</p>
  
  <p>When I store the contents of data somewhere and want to load them later - how can I do that? RSAPrivateKey and RSAPublicKey do not have any constructors/loader or something like that...</p>