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
e7eeef49
Commit
e7eeef49
authored
Oct 17, 2013
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 17, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Added more cert duplicate and link tests.
parent
2601f58a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
2 deletions
+75
-2
cert.c
dlls/crypt32/tests/cert.c
+75
-2
No files found.
dlls/crypt32/tests/cert.c
View file @
e7eeef49
...
...
@@ -680,8 +680,8 @@ static void testCreateCert(void)
static
void
testDupCert
(
void
)
{
HCERTSTORE
store
;
PCCERT_CONTEXT
context
,
dupContext
;
PCCERT_CONTEXT
context
,
dupContext
,
storeContext
,
storeContext2
,
context2
;
HCERTSTORE
store
,
store2
;
BOOL
ret
;
store
=
CertOpenStore
(
CERT_STORE_PROV_MEMORY
,
0
,
0
,
...
...
@@ -719,11 +719,83 @@ static void testDupCert(void)
}
CertCloseStore
(
store
,
0
);
context
=
CertCreateCertificateContext
(
X509_ASN_ENCODING
,
bigCert
,
sizeof
(
bigCert
));
ok
(
context
!=
NULL
,
"CertCreateCertificateContext failed
\n
"
);
dupContext
=
CertDuplicateCertificateContext
(
context
);
ok
(
dupContext
==
context
,
"context != dupContext
\n
"
);
CertFreeCertificateContext
(
dupContext
);
store
=
CertOpenStore
(
CERT_STORE_PROV_MEMORY
,
0
,
0
,
CERT_STORE_CREATE_NEW_FLAG
,
NULL
);
ok
(
store
!=
NULL
,
"CertOpenStore failed: %d
\n
"
,
GetLastError
());
ret
=
CertAddCertificateContextToStore
(
store
,
context
,
CERT_STORE_ADD_NEW
,
&
storeContext
);
ok
(
ret
,
"CertAddCertificateContextToStore failed
\n
"
);
ok
(
storeContext
!=
NULL
&&
storeContext
!=
context
,
"unexpected storeContext
\n
"
);
ok
(
storeContext
->
hCertStore
==
store
,
"unexpected hCertStore
\n
"
);
ok
(
storeContext
->
pbCertEncoded
!=
context
->
pbCertEncoded
,
"unexpected pbCertEncoded
\n
"
);
ok
(
storeContext
->
cbCertEncoded
==
context
->
cbCertEncoded
,
"unexpected cbCertEncoded
\n
"
);
ok
(
storeContext
->
pCertInfo
!=
context
->
pCertInfo
,
"unexpected pCertInfo
\n
"
);
store2
=
CertOpenStore
(
CERT_STORE_PROV_MEMORY
,
0
,
0
,
CERT_STORE_CREATE_NEW_FLAG
,
NULL
);
ok
(
store2
!=
NULL
,
"CertOpenStore failed: %d
\n
"
,
GetLastError
());
ret
=
CertAddCertificateContextToStore
(
store2
,
storeContext
,
CERT_STORE_ADD_NEW
,
&
storeContext2
);
ok
(
ret
,
"CertAddCertificateContextToStore failed
\n
"
);
ok
(
storeContext2
!=
NULL
&&
storeContext2
!=
storeContext
,
"unexpected storeContext
\n
"
);
ok
(
storeContext2
->
hCertStore
==
store2
,
"unexpected hCertStore
\n
"
);
ok
(
storeContext2
->
pbCertEncoded
!=
storeContext
->
pbCertEncoded
,
"unexpected pbCertEncoded
\n
"
);
ok
(
storeContext2
->
cbCertEncoded
==
storeContext
->
cbCertEncoded
,
"unexpected cbCertEncoded
\n
"
);
ok
(
storeContext2
->
pCertInfo
!=
storeContext
->
pCertInfo
,
"unexpected pCertInfo
\n
"
);
CertFreeCertificateContext
(
storeContext2
);
CertFreeCertificateContext
(
storeContext
);
context2
=
CertCreateCertificateContext
(
X509_ASN_ENCODING
,
certWithUsage
,
sizeof
(
certWithUsage
));
ok
(
context2
!=
NULL
,
"CertCreateCertificateContext failed
\n
"
);
ok
(
context2
->
hCertStore
==
context
->
hCertStore
,
"Unexpected hCertStore
\n
"
);
CertFreeCertificateContext
(
context2
);
CertFreeCertificateContext
(
context
);
CertCloseStore
(
store
,
0
);
CertCloseStore
(
store2
,
0
);
SetLastError
(
0xdeadbeef
);
context
=
CertDuplicateCertificateContext
(
NULL
);
ok
(
context
==
NULL
,
"Expected context to be NULL
\n
"
);
}
static
void
testLinkCert
(
void
)
{
const
CERT_CONTEXT
*
context
,
*
link
;
HCERTSTORE
store
;
BOOL
ret
;
context
=
CertCreateCertificateContext
(
X509_ASN_ENCODING
,
bigCert
,
sizeof
(
bigCert
));
ok
(
context
!=
NULL
,
"CertCreateCertificateContext failed
\n
"
);
store
=
CertOpenStore
(
CERT_STORE_PROV_MEMORY
,
0
,
0
,
CERT_STORE_CREATE_NEW_FLAG
,
NULL
);
ok
(
store
!=
NULL
,
"CertOpenStore failed: %d
\n
"
,
GetLastError
());
ret
=
CertAddCertificateLinkToStore
(
store
,
context
,
CERT_STORE_ADD_NEW
,
&
link
);
ok
(
ret
,
"CertAddCertificateContextToStore failed
\n
"
);
ok
(
link
!=
NULL
&&
link
!=
context
,
"unexpected storeContext
\n
"
);
ok
(
link
->
hCertStore
==
store
,
"unexpected hCertStore
\n
"
);
ok
(
link
->
pbCertEncoded
==
context
->
pbCertEncoded
,
"unexpected pbCertEncoded
\n
"
);
ok
(
link
->
cbCertEncoded
==
context
->
cbCertEncoded
,
"unexpected cbCertEncoded
\n
"
);
ok
(
link
->
pCertInfo
==
context
->
pCertInfo
,
"unexpected pCertInfo
\n
"
);
CertFreeCertificateContext
(
link
);
CertCloseStore
(
store
,
0
);
}
static
BYTE
subjectName3
[]
=
{
0x30
,
0x15
,
0x31
,
0x13
,
0x30
,
0x11
,
0x06
,
0x03
,
0x55
,
0x04
,
0x03
,
0x13
,
0x0a
,
0x52
,
0x6f
,
0x62
,
0x20
,
0x20
,
0x4c
,
0x61
,
0x6e
,
0x67
,
0x00
};
...
...
@@ -3902,6 +3974,7 @@ START_TEST(cert)
testFindCert
();
testGetSubjectCert
();
testGetIssuerCert
();
testLinkCert
();
testCryptHashCert
();
testCertSigs
();
...
...
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