title: How to encrypt/decrypt a password using StandardPBEStringEncryptor?
body: <p>I am trying to encrypt/decrypt password in my application using StandardPBEStringEncryptor. However I think the code I am using is resulting in a memory leak. Am I using this correctly?</p>
  
  <pre><code>public static String getPassword(String seed, String encryptedPwd) {
    StandardPBEStringEncryptor pes = new StandardPBEStringEncryptor();
    pes.setProvider(new BouncyCastleProvider());
    pes.setPassword(seed);
    String originalPwd = pes.decrypt(encryptedPwd);
    return originalPwd;
  </code></pre>
  
  <p>}</p>
  
  <pre><code>public static String getDecryptedString( String encryptedPwd) {
     return MyClass.getPassword( 'mypassword', encryptedPwd);
  }
  </code></pre>
  
  <p>I use the getDecryptedString() method everywhere in the application for decryption of passwords. 
  Does having 2 static methods like above cause a memory leak?</p>