public static void KeyChangePassphrase(PgpSecretKey key, char[] originalPhrase, char[] newPhrase, KeyStoreDB keyDb, string keyExportName) { string fileData = string.Empty; bool useTemp = false; if (key == null) { throw new ArgumentNullException("key"); } if (keyDb == null) { throw new ArgumentNullException("keyDb"); } if (originalPhrase == null || originalPhrase.Count() <= 0) { throw new ArgumentNullException("originalPhrase"); } if (newPhrase == null || newPhrase.Count() <= 0) { throw new ArgumentNullException("newPhrase"); } PgpSecretKey newKey = ChangePassprase(key, originalPhrase, newPhrase); Debug.Assert(key.GetHashCode() != newKey.GetHashCode()); if (newKey != null) { if (string.IsNullOrEmpty(keyExportName)) { useTemp = true; string tempPath = Path.GetTempPath(); keyExportName = Path.Combine(tempPath, Guid.NewGuid().ToString() + ".tmppgp"); } ExportKey expKey = new ExportKey(keyDb); expKey.UpdateDbSecretKey(newKey, keyExportName); if (useTemp) { //File.Delete(keyExportName); } } }