コード例 #1
0
        public string receiveMessage(string cipherText)
        {
            turnDiffieHellmanRatchet();
            turnReceivingRatchet();
            var plainText = CryptUtils.SimpleAESDecryption(outputChain.latest.value, cipherText, outputChain.latest.nonce);

            receiveDiffieHellmanParameters();
            sendDiffieHellmanParameters();
            return plainText
        }
コード例 #2
0
        public void sendMessage(string message)
        {
            turnDiffieHellmanRatchet();
            turnSendingRatchet();
            var cipherText = CryptUtils.SimpleAESEncryption(outputChain.latest.value, message, outputChain.latest.nonce);

            Post(server, HttpContentTypes.TextPlain, new { message = cipherText });
            sendDiffieHellmanParameters();
            receiveDiffieHellmanParameters();
        }
コード例 #3
0
ファイル: KeyChain.cs プロジェクト: Noirdemort/Bodark.NET
        public Dictionary <string, string> findKey(string website)
        {
            var credentials = new Dictionary <string, string>();
            var document    = collection.Find(new BsonDocument {
                { "website", website }
            }).FirstOrDefault();
            var decryptedData        = CryptUtils.SimpleAESDecryption(secretKey, document["credentials"].ToString(), Encoding.UTF8.GetBytes(document["nonce"].ToString()));
            var decryptedCredentials = decryptedData.Split(new[] { separator }, StringSplitOptions.None);

            credentials["username"] = decryptedCredentials[0];
            credentials["password"] = decryptedCredentials[1];
            return(credentials);
        }