如何生成包含加密数据的密钥代码?
情况:
我想提供一个网站服务,用户可以输入一些数据,例如 15 字节长的名称“namedata”并获取密钥代码。 然后,该代码可用于解锁游戏中的某些功能(由我提供),同时还可以利用名称数据(想象一个名为“Lazgun of Peter”的自定义 Lazgun,其中“Peter”是名称数据)。
我的计划是使用非对称加密(使用私钥)将名称数据以及一些短签名(例如 5 字节“hello”)加密到密钥代码中(例如 AsdF-STaCK-0VEr-FL0W-13Abbx)。
然后,用户在游戏中输入密钥代码,然后游戏使用公钥将数据解码为名称数据和签名,瞧,用户得到了“Lazgun of Peter”。
问题:
问题(或者我的误解?)是典型的RSA加密只能用于加密密钥长度的数据,例如1024位,这对于我的密钥代码来说太长了 - 没有用户愿意输入代码包含 150 多个字符(假设每个输入的字符大约有 6 位数据)。
问题:
我应该使用什么样的加密来获得良好的安全性,以便只有我的网站服务可以生成“正确”的代码,但用户只需输入大约名称数据+签名+一些小开销的代码?
注意:游戏可执行文件显然是公开可用的,并且可以从中读取其中存储的任何加密密钥,但可执行文件本身无法更改(复制保护)。
Situation:
I want to provide a website service where users can enter some data e.g. 15 bytes long name "namedata" and get a key code.
That code can then be used to unlock some feature in a game (provided by me), also utilizing the namedata (think of a custom Lazgun named "Lazgun of Peter", where "Peter" is the namedata).
My plan is to encrypt the namedata along with some short signature (e.g. 5 Bytes "hello") with asymmetric encrytion (using the private key) into the key code (something like AsdF-STaCK-0VEr-FL0W-13Abbx).
The user then enters the key code in the game and the game then decodes the data with a public key into the namedata and the signature and voila the user gets its "Lazgun of Peter".
Problem:
The problem (or my misunderstanding?) is that the typical RSA encryption can only be used to encrypt data of the length of the key, e.g. 1024 bit, which would be too long for my key code - no user wants to enter codes with 150+ characters (assuming about 6 bit data per entered character).
Question:
What kind of encryption should I use to get decent security, so that only my website service can generate "correct" codes, but the user only has to enter codes about the size of the namedata + signature + some small overhead?
Note: The game executable is obviously publically available and any encryption key stored in it could be read from it, but the executable itself cannot be altered (copy protection).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为将所有项目数据存储在实际的键代码中是错误的想法。
创建独特的下载代码更有意义。 输入后,客户端将连接到服务器,并通过安全连接下载实际的项目数据。
这有意义吗?
I think it is the wrong idea to store all item data inside the actual key code.
It makes more sense to create a unique download code. When entered, the client will connect to a server, and download the actual item data through a secure connection.
Does this make any sense?