예제 #1
0
        public async Task SendDHEncryptedMessage(String Message)
        {
            String encryptedMessage = (AesEncryption.AES_Encrypt(Message, sessionKey.SessionKey));
            String HmacHash         = MacAlgProvider.CreateHMAC(encryptedMessage, sessionKey.SessionKey);

            WriteObj.setEncryptedMessage(encryptedMessage);
            WriteObj.setHmacHash(HmacHash);

            await ActivitySocket.send(JsonParse.WriteObject(WriteObj));
        }
예제 #2
0
        public async Task StartDHSession()
        {
            String EncryptedClientNumber = AesEncryption.AES_Encrypt(GeneratoreMachine.GetClientPublicNumber(),
                                                                     SymmetricKey.StrKeyBase64);

            String HmacHash = MacAlgProvider.CreateHMAC(EncryptedClientNumber, SymmetricKey.StrKeyBase64);

            WriteObj.setClientEncryptedPrimeNumber(EncryptedClientNumber);
            WriteObj.setHmacHash(HmacHash);



            WriteObj.setEncryptedSymetricClientKey(RsaEncryption.RsaEncrypt(
                                                       SymmetricKey.StrKeyBase64,
                                                       ReadObj.getRSAPublicKey())
                                                   );


            String StringTOsentWithRsa = JsonParse.WriteObject(WriteObj);

            await ActivitySocket.send(StringTOsentWithRsa);
        }