Kaydet (Commit) 4234b099 authored tarafından Miklos Vajna's avatar Miklos Vajna

tdf#99327 vcl PDF mscrypto sign: fix SHA-256 OID

The previous OID only worked with NSS as NSS_CMSUtil_MapSignAlgs() has a
hack to accept it, saying Windows 2003 generates such OIDs. Don't depend
on readers of the signature accepting that incorrect OID.

Change-Id: I63e9a363e9e2ad233eeeacea1a354e3190da1ac1
üst 1ed86ee4
...@@ -7306,7 +7306,7 @@ bool PDFWriter::Sign(PDFSignContext& rContext) ...@@ -7306,7 +7306,7 @@ bool PDFWriter::Sign(PDFSignContext& rContext)
aPara.cbSize = sizeof(aPara); aPara.cbSize = sizeof(aPara);
aPara.dwMsgEncodingType = PKCS_7_ASN_ENCODING | X509_ASN_ENCODING; aPara.dwMsgEncodingType = PKCS_7_ASN_ENCODING | X509_ASN_ENCODING;
aPara.pSigningCert = pCertContext; aPara.pSigningCert = pCertContext;
aPara.HashAlgorithm.pszObjId = const_cast<LPSTR>(szOID_RSA_SHA256RSA); aPara.HashAlgorithm.pszObjId = const_cast<LPSTR>(szOID_NIST_sha256);
aPara.HashAlgorithm.Parameters.cbData = 0; aPara.HashAlgorithm.Parameters.cbData = 0;
aPara.cMsgCert = 1; aPara.cMsgCert = 1;
aPara.rgpMsgCert = &pCertContext; aPara.rgpMsgCert = &pCertContext;
...@@ -7335,7 +7335,7 @@ bool PDFWriter::Sign(PDFSignContext& rContext) ...@@ -7335,7 +7335,7 @@ bool PDFWriter::Sign(PDFSignContext& rContext)
aSignerInfo.pCertInfo = pCertContext->pCertInfo; aSignerInfo.pCertInfo = pCertContext->pCertInfo;
aSignerInfo.hCryptProv = hCryptProv; aSignerInfo.hCryptProv = hCryptProv;
aSignerInfo.dwKeySpec = nKeySpec; aSignerInfo.dwKeySpec = nKeySpec;
aSignerInfo.HashAlgorithm.pszObjId = const_cast<LPSTR>(szOID_RSA_SHA256RSA); aSignerInfo.HashAlgorithm.pszObjId = const_cast<LPSTR>(szOID_NIST_sha256);
aSignerInfo.HashAlgorithm.Parameters.cbData = 0; aSignerInfo.HashAlgorithm.Parameters.cbData = 0;
CMSG_SIGNED_ENCODE_INFO aSignedInfo; CMSG_SIGNED_ENCODE_INFO aSignedInfo;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment