public bool USKeyRem_SendRemoveRequest(String userID, String email, String macValue) { ActionLog_Write(email + ": USKeyRem_SendPublicKey"); Console.WriteLine(beginProtocol); Console.WriteLine(email + ": USKeyRem_SendPublicKey"); if (SendQuery(userID, email, "I want to remove my current public key", macValue)) { DatabaseConnection connection = new DatabaseConnection(); connection.removePublicKey(userID, email); connection.close(); ActionLog_Write(email + ": Public key is removed."); Console.WriteLine(email + ": Public key is removed."); return(true); } return(false); }
public bool KeyRem(String userID, String email, Message signedMessage) { ActionLog_Write(email + ": KeyRem"); Console.WriteLine(beginProtocol); Console.WriteLine(email + ": KeyRem"); DatabaseConnection connection = new DatabaseConnection(); String publicKey = connection.getPublicKey(email); if (signedMessage.Verify(publicKey)) { if (DateTime.Compare(signedMessage.Time, DateTime.Now.AddHours(-1)) >= 0) { bool result = connection.removePublicKey(userID, email); connection.close(); return(result); } } connection.close(); throw new Exception("Incorrect message"); }
public bool USKeyRem_SendRemoveRequest(String userID, String email, String macValue) { ActionLog_Write(email + ": USKeyRem_SendPublicKey"); Console.WriteLine(beginProtocol); Console.WriteLine(email + ": USKeyRem_SendPublicKey"); if (SendQuery(userID, email, "I want to remove my current public key", macValue)) { DatabaseConnection connection = new DatabaseConnection(); connection.removePublicKey(userID, email); connection.close(); ActionLog_Write(email + ": Public key is removed."); Console.WriteLine(email + ": Public key is removed."); return true; } return false; }
public bool KeyRem(String userID, String email, Message signedMessage) { ActionLog_Write(email + ": KeyRem"); Console.WriteLine(beginProtocol); Console.WriteLine(email + ": KeyRem"); DatabaseConnection connection = new DatabaseConnection(); String publicKey = connection.getPublicKey(email); if (signedMessage.Verify(publicKey)) { if (DateTime.Compare(signedMessage.Time, DateTime.Now.AddHours(-1)) >= 0) { bool result = connection.removePublicKey(userID, email); connection.close(); return result; } } connection.close(); throw new Exception("Incorrect message"); }