}
// 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();
}
// if either store is configured, try loading.
if (! (smimePrivateFilename.equals("") && smimePublicFilename.equals(""))) {
try {
EncryptionUtils smimeUtils = EncryptionManager.getEncryptionUtils(EncryptionManager.SMIME);
if (smimeUtils != null) {
smimeKeyMgr = smimeUtils.createKeyManager();
try {
smimeKeyMgr.loadPrivateKeystore(new FileInputStream(new File(smimePrivateFilename)), smimePrivatePwString.toCharArray());
} catch (java.security.GeneralSecurityException gse) {
System.out.println("Error loading S/MIME private keystore from file " + smimePrivateFilename + ": " + gse.getMessage());
} catch (java.io.IOException fnfe) {