public void CryptPasswords(bool bEncrypt) { DebugHelper.WriteLine((bEncrypt ? "Encrypting " : "Decrypting") + " passwords."); CryptKeys crypt = new CryptKeys() { KeySize = this.PasswordsEncryptionStrength2 }; this.TinyPicPassword = bEncrypt ? crypt.Encrypt(this.TinyPicPassword) : crypt.Decrypt(this.TinyPicPassword); this.RapidSharePassword = bEncrypt ? crypt.Encrypt(this.RapidSharePassword) : crypt.Decrypt(this.RapidSharePassword); this.SendSpacePassword = bEncrypt ? crypt.Encrypt(this.SendSpacePassword) : crypt.Decrypt(this.SendSpacePassword); foreach (FTPAccount acc in this.FTPAccountList2) { acc.Password = bEncrypt ? crypt.Encrypt(acc.Password) : crypt.Decrypt(acc.Password); acc.Passphrase = bEncrypt ? crypt.Encrypt(acc.Passphrase) : crypt.Decrypt(acc.Passphrase); } foreach (LocalhostAccount acc in this.LocalhostAccountList) { acc.Password = bEncrypt ? crypt.Encrypt(acc.Password) : crypt.Decrypt(acc.Password); } this.TwitPicPassword = bEncrypt ? crypt.Encrypt(this.TwitPicPassword) : crypt.Decrypt(this.TwitPicPassword); this.EmailPassword = bEncrypt ? crypt.Encrypt(this.EmailPassword) : crypt.Decrypt(this.EmailPassword); }
public void Load(Func <string, byte[]> readbytes) { if (AuthKeys == null) { AuthKeys = new AuthKeyPair(); } if (CryptKeys == null) { CryptKeys = new CryptKeyPair(); } AuthKeys.Load(readbytes("BankAuthKeys.pubkey")); CryptKeys.Load(readbytes("BankCryptKeys.pubkey")); }
public void Save(Action <string, byte[]> writebytes) { AuthKeys.Save(bytes => writebytes("BankAuthKeys.pubkey", bytes)); CryptKeys.Save(bytes => writebytes("BankCryptKeys.pubkey", bytes)); }