简体   繁体   English

是否可以对机器密钥加密进行纯文本攻击?

[英]Is it possible, to make a plain-text attack on machine key encryption?

I protect some strings with the following function: 我使用以下功能保护一些字符串:

public static string ProtectString(string input)
{
    System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
    return enc.GetString(MachineKey.Protect(enc.GetBytes(input), null));
}

If i now encrypt a string, the attacker may now (ie an username), is he able to extract the machine key with the encrypted and decrypted values? 如果我现在对字符串进行加密,那么攻击者现在可以(即用户名)使用他的加密和解密值提取机器密钥吗?

I did some research and found out, that the used algorithm is one of those: DES, 3DES or AES . 我做了一些研究,发现所使用的算法是其中一种: DES,3DES或AES And that algorithms are very resistant to plain-text attacks. 而且该算法非常抗纯文本攻击。

Based on Chris' comment, DES is very weak, so choose AES if possible. 根据克里斯的评论,DES非常弱,因此请尽可能选择AES。

But that's not a reason, to gift plain text values to your attacker :) 但这不是给攻击者赠送纯文本值的原因:)

If you give a hacker the cipher text and the plain text, that is all he needs to brute force the crypto key. 如果您给黑客提供密文和纯文本,这就是他强行破解加密密钥所需要的。 That and a farm of high performance computers. 那是一个高性能计算机场。

Really there is rarely a reason to send the clear text and plain text at the same time. 实际上,几乎没有理由同时发送明文和纯文本。 Just don't do it. 只是不要这样做。 If you want to make the clear text tamper-resistant, pass the cleartext along with an HMAC instead. 如果要使纯文本具有防篡改功能,则应将纯文本与HMAC一起传递。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 加快将 rtf 转换为纯文本的速度 - Speeding up converting rtf to plain-text 纯文本加密问题 - Plain text encryption issues 使用正则表达式将纯文本转换为 HTML 的小错误 - Minor bug in plain-text to HTML conversion using Regular Expressions 单击按钮时,将纯文本中的值传递给方法 - Pass values from plain-text to a method on button click 将纯文本密码迁移到asp.net Identity 2.1 - Migrating plain-text password to asp.net Identity 2.1 当我知道纯文本和加密的文本时,能否导出DPAPI加密中使用的密钥? - Can I derive the key used in DPAPI encryption when I know the plain text and the encrypted text? C#在发送包含**纯文本**和** Html **内容的电子邮件时遇到问题 - C# having trouble in sending email with both **Plain-text** & **Html** content 在EWS中,如何获取消息的纯文本和HTML正文作为字符串,以保持原始字符编码 - In EWS, how to get message's both plain-text and HTML bodies as strings keeping the original character encoding 使用C#将超链接替换为纯文本,后跟括号中的URL - Replace Hyperlinks with Plain-Text followed by URL in Brackets using C# 如何在.docx文件中找到纯文本内容控件,并使用OpenXML SDK替换其中的文本? - How do I find plain-text content controls within a .docx file and replace the text within using the OpenXML SDK?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM