SignerTimeStampEx2函数声明不正确 [英] SignerTimeStampEx2 function declared incorrectly

查看:107
本文介绍了SignerTimeStampEx2函数声明不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不确定发布此论坛的论坛,​​因为我没有看到与WIN32API特别相关的论坛。

Not sure what forum to post this in since I don't seen one specifically related to the WIN32API.

我是一个长期的Windows开发人员(20多岁)拥有丰富的WinAPI经验。 在以下页面:https://msdn.microsoft.com/en-us/library/windows/desktop/dd418879%28v=vs.85%29.aspx


$ b SignerTimeStampEx2函数$ b,文档中存在重大错误,这让我发疯。 它显示的是ALG_ID,它是一个DWORD。 这不起作用(无效的内存访问)和SignerTimeStampEX3和SignerSignEx2
的相同信息的格式表明它应该是一个OWS(pszAlgorithmOid)的PCWSTR。 问题是传递OID也不起作用。我正在使用C#并且当dwFlags设置为2(SIGNER_TIMESTAMP_RFC3161)时,将算法OID作为字符串传递,例如szOID_RSA_SHA256RSA
("1.2.840.113549.1.1.11"),例如总是返回HRESULT为-2146893816(无效的算法)。 我给它的OID并不重要(在Win7和Win10上验证)。



所以第一个问题是,有谁知道,CORRECT的定义是什么对于SignerTimeStampEX2? 这让我疯狂,因为我在黑暗中操作 - 该功能期望的数据/格式是什么?



他们还需要更新他们的SignerTimeStampEX3信息这说它适用于Win7。 就我所见,SignerTimeStampEX3(如SignerSignEX2)仅对Win8 +有用。



谢谢!

I am a longtime Windows dev here (20+ yrs) with lots of experience with WinAPI.  On the following page: https://msdn.microsoft.com/en-us/library/windows/desktop/dd418879%28v=vs.85%29.aspx

for the SignerTimeStampEx2 function, there is a major error in documentation and it's driving me crazy.  It shows an ALG_ID that's a DWORD.  That does not work (invalid memory access) and the format for the same info for SignerTimeStampEX3 and SignerSignEx2 shows that it is supposed to be a PCWSTR that's an OID (pszAlgorithmOid).  The problem is that passing an OID doesn't work either. I'm using C# and when dwFlags is set to 2 (SIGNER_TIMESTAMP_RFC3161), passing the Algorithm OID as a string like szOID_RSA_SHA256RSA ("1.2.840.113549.1.1.11") for instance always returns HRESULT of -2146893816 (invalid algorithm).  It doesn't matter what OID I give it (verified on both Win7 and Win10).

So the first question is, does anyone know, what is the CORRECT definition for SignerTimeStampEX2?  This has been driving me nuts because I'm operating in the dark - what data/format is that function expecting??

They also need to also update their SignerTimeStampEX3 info that says it works on Win7.  SignerTimeStampEX3 (like SignerSignEX2) only is avail on Win8+ as far as I can see.

Thanks!

推荐答案

你好chrislong98,

Hi chrislong98,

感谢您的发帖。我发现了一个讨论相同主题的类似线程。以下是此主题的解决方案。

Thank you for your post. I found a similar thread which discuss the same topic. Here is the solution from this thread.

dwFlags需要为SIGNER_TIMESTAMP_RFC3161(2)。 您获得访问冲突的原因是SignerTimeStampEx2()是
记录 错误。 它希望算法为PCSTR而不是DWORD。 如果你传递0x800C,它会尝试取消引用
作为指针,导致AV。 所以用PCSTR pszTimeStampAlgorithmOid替换函数声明中的ALG_ID dwAlgId。 将szOID_NIST_sha256传递给它,应该定义为"2.16.840.1.101.3.4.2.1"。

线程链接:
http://stackoverflow.com/questions/19293651/cryptoapis-signertimestampex2-using-pinvoke

最好的问候,

李旺

Best Regards,
Li Wang

注意:此回复包含对第三方万维网站点的引用。 Microsoft提供此信息是为了方便您。 Microsoft不控制这些网站,也未测试在这些网站上找到的任何软件或信息;因此,
Microsoft不能就其中发现的任何软件或信息的质量,安全性或适用性做出任何陈述。使用互联网上的任何软件都存在固有的危险,微软提醒您在从互联网上检索任何软件之前,确保您完全了解风险。

Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.


这篇关于SignerTimeStampEx2函数声明不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆