C#MACTripleDES和ANSI 9.19 [英] C# MACTripleDES and ANSI 9.19
问题描述
我正在尝试实现ANSI 9.19消息身份验证代码,以将数据传输到另一家公司.这是一种银行标准,用于在消息的字节上创建MAC.目标食谱int指定了用于执行此操作的"2DES"机制,并描述了该算法.
我正在使用MACTripleDES类和AFAIK,它正在实现相同的算法,但答案并非我所期望的.将类类型设置为TripleDES,将填充模式设置为正确的零填充并使用正确的键,我仍然得到错误的答案.
I'm trying to implement ANSI 9.19 message authentication code for transmitting data to another company. This is a banking standard to create a MAC over the bytes of your message. The target recipeint specifies a '2DES' mechanism for doing so, and describes the algorithm.
I'm using the MACTripleDES class and AFAIK it is implementing the same algorithm, but the answer out is not what I expect. Having set the class type as TripleDES, the padding mode to the correct Zero padding and with the correct Key, I still get the wrong answer.
有人用这个标准来实现这个标准吗?这和零售MAC一样吗?该算法的简要提要是:
Has anyone used this calss to implement this standard? Is this the same as Retail MAC? A brief synopsis of the algorithm is:
1. 将数据填充为零以确保其长度为64位的倍数.
2. 将组成消息的身份验证代码部分的4个字节设置为空格( 0x20)
3. 将LeftKey设置为要使用的MAC密钥的左64位.字体>
4. 将RightKey设置为要使用的MAC密钥的右64位.字体>
5. 将Result设置为最初设置为全零的64位缓冲区.
6. 对于源数据中的每个64位块(块):
a. Xor Result with Block(Result ^ = Block)
b. 加密使用LeftKey
b. Encrypt Result using LeftKey
7. 解密使用RightKey
7. Decrypt Result using RightKey
8. 加密使用LeftKey
8. Encrypt Result using LeftKey
此处的MAC被指定为4字节,但这只是8字节MAC密钥的前4个字节.
The MAC here is specfied as 4 bytes, however this is just the first 4 bytes of the 8 byte MAC key.
推荐答案
您是否已解决此问题.如果您完成此项目,我需要您的帮助.
did you finish this issue.if you finish this project, I need your help.
我需要这个项目.
请给我发送电子邮件.我的电子邮件地址是batorgil2b@yahoo.com
Please send me email. my email address is batorgil2b@yahoo.com
这篇关于C#MACTripleDES和ANSI 9.19的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!