Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
441f7b6d
Commit
441f7b6d
authored
Feb 01, 2012
by
Juan Lang
Committed by
Alexandre Julliard
Feb 02, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Test and correct CryptVerifyCertificateSignature.
parent
17cd9d33
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
1 deletion
+71
-1
cert.c
dlls/crypt32/cert.c
+3
-1
cert.c
dlls/crypt32/tests/cert.c
+68
-0
No files found.
dlls/crypt32/cert.c
View file @
441f7b6d
...
...
@@ -2239,8 +2239,10 @@ BOOL WINAPI CryptVerifyCertificateSignature(HCRYPTPROV_LEGACY hCryptProv,
DWORD
dwCertEncodingType
,
const
BYTE
*
pbEncoded
,
DWORD
cbEncoded
,
PCERT_PUBLIC_KEY_INFO
pPublicKey
)
{
CRYPT_DATA_BLOB
blob
=
{
cbEncoded
,
(
BYTE
*
)
pbEncoded
};
return
CryptVerifyCertificateSignatureEx
(
hCryptProv
,
dwCertEncodingType
,
CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB
,
(
void
*
)
pbEncoded
,
CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB
,
&
blob
,
CRYPT_VERIFY_CERT_SIGN_ISSUER_PUBKEY
,
pPublicKey
,
0
,
NULL
);
}
...
...
dlls/crypt32/tests/cert.c
View file @
441f7b6d
...
...
@@ -1765,6 +1765,73 @@ static void testVerifyCertSig(HCRYPTPROV csp, const CRYPT_DATA_BLOB *toBeSigned,
DWORD
size
=
0
;
BOOL
ret
;
if
(
!
pCryptEncodeObjectEx
)
{
win_skip
(
"no CryptEncodeObjectEx support
\n
"
);
return
;
}
ret
=
CryptVerifyCertificateSignature
(
0
,
0
,
NULL
,
0
,
NULL
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"Expected ERROR_FILE_NOT_FOUND, got %08x
\n
"
,
GetLastError
());
ret
=
CryptVerifyCertificateSignature
(
csp
,
0
,
NULL
,
0
,
NULL
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"Expected ERROR_FILE_NOT_FOUND, got %08x
\n
"
,
GetLastError
());
ret
=
CryptVerifyCertificateSignature
(
csp
,
X509_ASN_ENCODING
,
NULL
,
0
,
NULL
);
ok
(
!
ret
&&
(
GetLastError
()
==
CRYPT_E_ASN1_EOD
||
GetLastError
()
==
OSS_BAD_ARG
),
"Expected CRYPT_E_ASN1_EOD or OSS_BAD_ARG, got %08x
\n
"
,
GetLastError
());
info
.
ToBeSigned
.
cbData
=
toBeSigned
->
cbData
;
info
.
ToBeSigned
.
pbData
=
toBeSigned
->
pbData
;
info
.
SignatureAlgorithm
.
pszObjId
=
(
LPSTR
)
sigOID
;
info
.
SignatureAlgorithm
.
Parameters
.
cbData
=
0
;
info
.
Signature
.
cbData
=
sigLen
;
info
.
Signature
.
pbData
=
(
BYTE
*
)
sig
;
info
.
Signature
.
cUnusedBits
=
0
;
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
X509_CERT
,
&
info
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
cert
,
&
size
);
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
if
(
cert
)
{
PCERT_PUBLIC_KEY_INFO
pubKeyInfo
=
NULL
;
DWORD
pubKeySize
;
if
(
0
)
{
/* Crashes prior to Vista */
ret
=
CryptVerifyCertificateSignature
(
csp
,
X509_ASN_ENCODING
,
cert
,
size
,
NULL
);
}
CryptExportPublicKeyInfoEx
(
csp
,
AT_SIGNATURE
,
X509_ASN_ENCODING
,
(
LPSTR
)
sigOID
,
0
,
NULL
,
NULL
,
&
pubKeySize
);
pubKeyInfo
=
HeapAlloc
(
GetProcessHeap
(),
0
,
pubKeySize
);
if
(
pubKeyInfo
)
{
ret
=
CryptExportPublicKeyInfoEx
(
csp
,
AT_SIGNATURE
,
X509_ASN_ENCODING
,
(
LPSTR
)
sigOID
,
0
,
NULL
,
pubKeyInfo
,
&
pubKeySize
);
ok
(
ret
,
"CryptExportKey failed: %08x
\n
"
,
GetLastError
());
if
(
ret
)
{
ret
=
CryptVerifyCertificateSignature
(
csp
,
X509_ASN_ENCODING
,
cert
,
size
,
pubKeyInfo
);
ok
(
ret
,
"CryptVerifyCertificateSignature failed: %08x
\n
"
,
GetLastError
());
}
HeapFree
(
GetProcessHeap
(),
0
,
pubKeyInfo
);
}
LocalFree
(
cert
);
}
}
static
void
testVerifyCertSigEx
(
HCRYPTPROV
csp
,
const
CRYPT_DATA_BLOB
*
toBeSigned
,
LPCSTR
sigOID
,
const
BYTE
*
sig
,
DWORD
sigLen
)
{
CERT_SIGNED_CONTENT_INFO
info
;
LPBYTE
cert
=
NULL
;
DWORD
size
=
0
;
BOOL
ret
;
if
(
!
pCryptVerifyCertificateSignatureEx
)
{
win_skip
(
"no CryptVerifyCertificateSignatureEx support
\n
"
);
...
...
@@ -1875,6 +1942,7 @@ static void testCertSigs(void)
testSignCert
(
csp
,
&
toBeSigned
,
szOID_RSA_SHA1RSA
,
sig
,
&
sigSize
);
testVerifyCertSig
(
csp
,
&
toBeSigned
,
szOID_RSA_SHA1RSA
,
sig
,
sigSize
);
testVerifyCertSigEx
(
csp
,
&
toBeSigned
,
szOID_RSA_SHA1RSA
,
sig
,
sigSize
);
CryptReleaseContext
(
csp
,
0
);
ret
=
pCryptAcquireContextA
(
&
csp
,
cspNameA
,
MS_DEF_PROV_A
,
PROV_RSA_FULL
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment