Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vba System.Security.Cryptography.HMACSHA1是Com可见的。我应该如何调用ComputeHash?_Vba_Ms Access - Fatal编程技术网

Vba System.Security.Cryptography.HMACSHA1是Com可见的。我应该如何调用ComputeHash?

Vba System.Security.Cryptography.HMACSHA1是Com可见的。我应该如何调用ComputeHash?,vba,ms-access,Vba,Ms Access,我想在Microsoft Access中创建一些文本的HMAC SHA1签名 .net对象System.Security.Cryptography.HMACSHA1是com可见的,所以我想我可以使用它 我可以创建对象并设置键,但是当我调用compute函数来获取散列时,我得到了错误运行时错误5“无效的过程调用或参数” 我从web复制了编码位,我注意到GetBytes已经转换为GetBytes_4。这个名字有问题吗?我需要做类似于ComputeHash的事情吗?如果是的话,那是什么(我试过了,其中

我想在Microsoft Access中创建一些文本的HMAC SHA1签名

.net对象System.Security.Cryptography.HMACSHA1是com可见的,所以我想我可以使用它

我可以创建对象并设置键,但是当我调用compute函数来获取散列时,我得到了错误运行时错误5“无效的过程调用或参数”

我从web复制了编码位,我注意到GetBytes已经转换为GetBytes_4。这个名字有问题吗?我需要做类似于ComputeHash的事情吗?如果是的话,那是什么(我试过了,其中n=1到6都没有用)


如果不是,我做错了什么?

我在这个问题中找到了我问题的答案


我想我已经试过enc.ComputeHash_2了,但可能我没有,因为它似乎有效

我找到了答案,见下文,但我还没有找到任何关于如何使用名称扭曲的好解释。知道这一点还是很有用的。你有没有找到一个好方法来查找正确的数字来作为后缀?@ncovox-不,对不起。我不记得为什么我问这个问题,它是为哪一位代码
Public Function sign(Key As String, Message As String)
    Dim asc, enc
    Dim MessageBytes() As bytes, HashBytes() As bytes
    Set asc = CreateObject("System.Text.UTF8Encoding")
    Set enc = CreateObject("System.Security.Cryptography.HMACSHA1")
    enc.Key = asc.GetBytes_4(Key)
    MessageBytes = asc.GetBytes_4(Message)
    HashBytes = enc.ComputeHash(MessageBytes)
    sign = EncodeBase64(HashBytes)
    Set asc = Nothing
    Set enc = Nothing
End Function