public async Task <String> GetPublicKey() { String readString = await ActivitySocket.read(); ReadObj = JsonParse.ReadObject(readString); return(ReadObj.getRSAPublicKey()); }
public async Task <String> ReceiveDHEncryptedMessage(String PublicKey) { ReadObj = JsonParse.ReadObject(await ActivitySocket.read()); if (FingerPrint.Verification(ReadObj.getEncryptedMessage(), PublicKey, ReadObj.getFingerPrint())) { if (MacAlgProvider.VerifyHMAC(ReadObj.getEncryptedMessage(), sessionKey.SessionKey, ReadObj.getHmacHash())) { return(AesEncryption.AES_Decrypt(ReadObj.getEncryptedMessage(), sessionKey.SessionKey)); } else { throw new Exception("Integrity of SymmetricKey canot verified"); } } else { throw new Exception("Integrity of RSA canot verified"); } }