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
bcbf5dce
Commit
bcbf5dce
authored
Aug 07, 2007
by
Juan Lang
Committed by
Alexandre Julliard
Aug 08, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Test and correct finding a subject certificate.
parent
d89528b0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletion
+29
-1
cert.c
dlls/crypt32/cert.c
+7
-1
cert.c
dlls/crypt32/tests/cert.c
+22
-0
No files found.
dlls/crypt32/cert.c
View file @
bcbf5dce
...
...
@@ -906,9 +906,15 @@ static BOOL compare_cert_by_subject_cert(PCCERT_CONTEXT pCertContext,
DWORD
dwType
,
DWORD
dwFlags
,
const
void
*
pvPara
)
{
CERT_INFO
*
pCertInfo
=
(
CERT_INFO
*
)
pvPara
;
BOOL
ret
;
ret
urn
CertCompareCertificateName
(
pCertContext
->
dwCertEncodingType
,
ret
=
CertCompareCertificateName
(
pCertContext
->
dwCertEncodingType
,
&
pCertInfo
->
Issuer
,
&
pCertContext
->
pCertInfo
->
Subject
);
if
(
ret
&&
pCertInfo
->
SerialNumber
.
cbData
)
ret
=
CertCompareIntegerBlob
(
&
pCertContext
->
pCertInfo
->
SerialNumber
,
&
pCertInfo
->
SerialNumber
);
TRACE
(
"returning %d
\n
"
,
ret
);
return
ret
;
}
static
BOOL
compare_cert_by_cert_id
(
PCCERT_CONTEXT
pCertContext
,
DWORD
dwType
,
...
...
dlls/crypt32/tests/cert.c
View file @
bcbf5dce
...
...
@@ -604,6 +604,7 @@ static void testFindCert(void)
BOOL
ret
;
CERT_INFO
certInfo
=
{
0
};
CRYPT_HASH_BLOB
blob
;
BYTE
otherSerialNumber
[]
=
{
2
};
store
=
CertOpenStore
(
CERT_STORE_PROV_MEMORY
,
0
,
0
,
CERT_STORE_CREATE_NEW_FLAG
,
NULL
);
...
...
@@ -685,6 +686,27 @@ static void testFindCert(void)
CERT_FIND_SUBJECT_CERT
,
&
certInfo
.
Subject
,
context
);
ok
(
context
==
NULL
,
"Expected one cert only
\n
"
);
}
/* The above search matched even though no serial number is set. A
* non-matching serial number will not match.
*/
certInfo
.
SerialNumber
.
pbData
=
otherSerialNumber
;
certInfo
.
SerialNumber
.
cbData
=
sizeof
(
otherSerialNumber
);
context
=
CertFindCertificateInStore
(
store
,
X509_ASN_ENCODING
,
0
,
CERT_FIND_SUBJECT_CERT
,
&
certInfo
,
NULL
);
ok
(
context
==
NULL
,
"Expected no match
\n
"
);
/* A matching serial number will match. */
certInfo
.
SerialNumber
.
pbData
=
serialNum
;
certInfo
.
SerialNumber
.
cbData
=
sizeof
(
serialNum
);
context
=
CertFindCertificateInStore
(
store
,
X509_ASN_ENCODING
,
0
,
CERT_FIND_SUBJECT_CERT
,
&
certInfo
,
NULL
);
ok
(
context
!=
NULL
,
"CertFindCertificateInStore failed: %08x
\n
"
,
GetLastError
());
if
(
context
)
{
context
=
CertFindCertificateInStore
(
store
,
X509_ASN_ENCODING
,
0
,
CERT_FIND_SUBJECT_CERT
,
&
certInfo
.
Subject
,
context
);
ok
(
context
==
NULL
,
"Expected one cert only
\n
"
);
}
/* The nice thing about hashes, they're unique */
blob
.
pbData
=
bigCertHash
;
...
...
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