title: Easy way to store/restore encryption key for decrypting string in java
body: <p>For encryption I use something like this:</p>
  
  <pre><code>SecretKey aesKey = KeyGenerator.getInstance("AES").generateKey();
  StringEncrypter aesEncrypt = new StringEncrypter(aesKey, aesKey.getAlgorithm());
  String aesEncrypted= aesEncrypt.encrypt(StringContent);
  </code></pre>
  
  <p>If I print out aesKey I get: "javax.crypto.spec.SecretKeySpec@1708d".</p>
  
  <p>So for encryption I would like to ask user for key but dont know how and what format should it be.
  My plan was something like this:</p>
  
  <pre><code>SecretKey aesKey = javax.crypto.spec.SecretKeySpec@1708d;
  StringEncrypter aesEncrypt = new StringEncrypter(aesKey, aesKey.getAlgorithm());
  String aesDecrypt = aesEncrypt.decrypt(aesEncrypted);
  </code></pre>
  
  <p>But seems its not working. Is there some easy way to print out the key after encryption to console so user can save it(or remember it) and then Use for Decryption ?</p>
  
  <p>Whole code is here:<a href="https://stackoverflow.com/questions/1918542/symmetric-key-encryption-in-java-reading-from-file-problem">Cannot decrypt cyphertext from text file, symmetric key implement. in java</a> 
  So Im sorry for posting again but Im not sure If the code is even readable(I'm newbie).</p>