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
e647719e
Commit
e647719e
authored
Jun 26, 2023
by
Paul Gofman
Committed by
Alexandre Julliard
Jun 27, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32/tests: Test CertCreateSelfSignCertificate() without provider info.
parent
7861b1e8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
9 deletions
+36
-9
cert.c
dlls/crypt32/tests/cert.c
+36
-9
No files found.
dlls/crypt32/tests/cert.c
View file @
e647719e
...
...
@@ -2167,17 +2167,44 @@ static void testCreateSelfSignCert(void)
HCRYPTPROV
csp
;
BOOL
ret
;
HCRYPTKEY
key
;
CRYPT_KEY_PROV_INFO
info
;
CRYPT_KEY_PROV_INFO
info
,
*
ret_info
;
DWORD
size
;
/* This crashes:
context = CertCreateSelfSignCertificate(0, NULL, 0, NULL, NULL, NULL, NULL,
NULL);
* Calling this with no first parameter creates a new key container, which
* lasts beyond the test, so I don't test that. Nb: the generated key
* name is a GUID.
context = CertCreateSelfSignCertificate(0, &name, 0, NULL, NULL, NULL, NULL,
NULL);
*/
context = CertCreateSelfSignCertificate(0, NULL, 0, NULL, NULL, NULL, NULL, NULL); */
/* Test CSP created by implementation without CSP or CSP parameters provided. */
context
=
CertCreateSelfSignCertificate
(
0
,
&
name
,
0
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
!!
context
,
"failed, error %#lx.
\n
"
,
GetLastError
());
size
=
0
;
ret
=
CertGetCertificateContextProperty
(
context
,
CERT_KEY_PROV_INFO_PROP_ID
,
NULL
,
&
size
);
ok
(
ret
,
"failed, error %#lx.
\n
"
,
GetLastError
());
ret_info
=
malloc
(
size
);
ok
(
!!
ret_info
,
"memory allocation failed.
\n
"
);
ret
=
CertGetCertificateContextProperty
(
context
,
CERT_KEY_PROV_INFO_PROP_ID
,
ret_info
,
&
size
);
ok
(
ret
,
"failed, error %#lx.
\n
"
,
GetLastError
());
CertFreeCertificateContext
(
context
);
ok
(
ret_info
->
dwKeySpec
==
AT_SIGNATURE
,
"got %#lx.
\n
"
,
ret_info
->
dwKeySpec
);
ok
(
!
ret_info
->
dwFlags
,
"got %#lx.
\n
"
,
ret_info
->
dwFlags
);
ok
(
ret_info
->
pwszContainerName
&&
*
ret_info
->
pwszContainerName
,
"got %s.
\n
"
,
debugstr_w
(
ret_info
->
pwszContainerName
));
ret
=
CryptAcquireContextW
(
&
csp
,
ret_info
->
pwszContainerName
,
ret_info
->
pwszProvName
,
ret_info
->
dwProvType
,
0
);
ok
(
ret
,
"failed, error %#lx.
\n
"
,
GetLastError
());
ret
=
CryptGetUserKey
(
csp
,
AT_SIGNATURE
,
&
key
);
ok
(
ret
,
"failed, error %#lx.
\n
"
,
GetLastError
());
ret
=
CryptDestroyKey
(
key
);
ok
(
ret
,
"failed, error %#lx.
\n
"
,
GetLastError
());
ret
=
CryptGetUserKey
(
csp
,
AT_KEYEXCHANGE
,
&
key
);
ok
(
!
ret
&&
GetLastError
()
==
NTE_NO_KEY
,
"got ret %d, error %#lx.
\n
"
,
ret
,
GetLastError
());
CryptReleaseContext
(
csp
,
0
);
csp
=
0xdeadbeef
;
ret
=
CryptAcquireContextW
(
&
csp
,
ret_info
->
pwszContainerName
,
ret_info
->
pwszProvName
,
ret_info
->
dwProvType
,
CRYPT_DELETEKEYSET
);
ok
(
ret
,
"failed, error %#lx.
\n
"
,
GetLastError
());
ok
(
!
csp
,
"got %p.
\n
"
,
(
void
*
)
csp
);
ret
=
CryptAcquireContextW
(
&
csp
,
ret_info
->
pwszContainerName
,
ret_info
->
pwszProvName
,
ret_info
->
dwProvType
,
0
);
ok
(
!
ret
&&
GetLastError
()
==
NTE_BAD_KEYSET
,
"got ret %d, error %#lx.
\n
"
,
ret
,
GetLastError
());
free
(
ret_info
);
/* Acquire a CSP */
CryptAcquireContextA
(
&
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