/**
* Loads the stores.
*/
public void loadStores(VariableBundle sourceBundle, String key) {
ResourceManager rm = Pooka.getPookaManager().getResourceManager();
String pgpPublicFilename = sourceBundle.getProperty(key + ".pgp.keyStore.public.filename", "");
if(!pgpPublicFilename.equals(""))
pgpPublicFilename = rm.translateName(pgpPublicFilename);
String pgpPrivateFilename = sourceBundle.getProperty(key + ".pgp.keyStore.private.filename", "");
if(!pgpPrivateFilename.equals(""))
pgpPrivateFilename = rm.translateName(pgpPrivateFilename);
String pgpPrivatePwString = sourceBundle.getProperty(key + ".pgp.keyStore.private.password", "");
if (!pgpPrivatePwString.equals("")){
pgpPrivatePwString = net.suberic.util.gui.propedit.PasswordEditorPane.descrambleString(pgpPrivatePwString);
pgpPassphrase = pgpPrivatePwString.toCharArray();
}
// if either store is configured, try loading.
if (! (pgpPrivateFilename.equals("") && pgpPublicFilename.equals(""))) {
try {
EncryptionUtils pgpUtils = EncryptionManager.getEncryptionUtils(EncryptionManager.PGP);
if (pgpUtils != null) {
pgpKeyMgr = pgpUtils.createKeyManager();
try {
pgpKeyMgr.loadPrivateKeystore(new FileInputStream(new File(pgpPrivateFilename)), null);
} catch (java.io.IOException fnfe) {
System.out.println("Error loading PGP private keystore from file " + pgpPrivateFilename + ": " + fnfe.getMessage());
} catch (java.security.GeneralSecurityException gse) {
System.out.println("Error loading PGP private keystore from file " + pgpPrivateFilename + ": " + gse.getMessage());
}
try {
pgpKeyMgr.loadPublicKeystore(new FileInputStream(new File(pgpPublicFilename)), null);
} catch (java.io.IOException fnfe) {
System.out.println("Error loading PGP public keystore from file " + pgpPublicFilename + ": " + fnfe.getMessage());
} catch (java.security.GeneralSecurityException gse) {
System.out.println("Error loading PGP public keystore from file " + pgpPublicFilename + ": " + gse.getMessage());
}
}
} catch (java.security.NoSuchProviderException nspe) {
System.out.println("Error loading PGP key store: " + nspe.getMessage());
} catch (Exception e) {
System.out.println("Error loading PGP key store: " + e.getMessage());
}
}
String smimePublicFilename = sourceBundle.getProperty(key + ".smime.keyStore.public.filename", "");
if(!smimePublicFilename.equals(""))
smimePublicFilename = rm.translateName(smimePublicFilename);
String smimePrivateFilename = sourceBundle.getProperty(key + ".smime.keyStore.private.filename", "");
if(!smimePrivateFilename.equals(""))
smimePrivateFilename = rm.translateName(smimePrivateFilename);
String smimePrivatePwString = sourceBundle.getProperty(key + ".smime.keyStore.private.password", "");
if (!smimePrivatePwString.equals("")){
smimePrivatePwString = net.suberic.util.gui.propedit.PasswordEditorPane.descrambleString(smimePrivatePwString);
smimePassphrase = smimePrivatePwString.toCharArray();