java如何使用StandardPBEStringEncryptor加密/解密密码?
我正在尝试使用StandardPBEStringEncryptor对应用程序中的密码进行加密/解密。然而,我认为我使用的代码导致了内存泄漏。我用得对吗
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;
}
public static String getDecryptedString( String encryptedPwd) {
return MyClass.getPassword( 'mypassword', encryptedPwd);
}
我在应用程序中的任何地方都使用getDecryptedString()方法来解密密码。 使用上述两种静态方法是否会导致内存泄漏
共 (0) 个答案