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
546bfa2c
Commit
546bfa2c
authored
Sep 22, 2011
by
Juan Lang
Committed by
Alexandre Julliard
Sep 22, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Test CertCreateCertificateContext, and fix an error code in a failure case.
parent
5619b215
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
0 deletions
+52
-0
cert.c
dlls/crypt32/cert.c
+6
-0
cert.c
dlls/crypt32/tests/cert.c
+46
-0
No files found.
dlls/crypt32/cert.c
View file @
546bfa2c
...
...
@@ -141,6 +141,12 @@ PCCERT_CONTEXT WINAPI CertCreateCertificateContext(DWORD dwCertEncodingType,
TRACE
(
"(%08x, %p, %d)
\n
"
,
dwCertEncodingType
,
pbCertEncoded
,
cbCertEncoded
);
if
((
dwCertEncodingType
&
CERT_ENCODING_TYPE_MASK
)
!=
X509_ASN_ENCODING
)
{
SetLastError
(
E_INVALIDARG
);
return
NULL
;
}
ret
=
CryptDecodeObjectEx
(
dwCertEncodingType
,
X509_CERT_TO_BE_SIGNED
,
pbCertEncoded
,
cbCertEncoded
,
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
&
certInfo
,
&
size
);
...
...
dlls/crypt32/tests/cert.c
View file @
546bfa2c
...
...
@@ -634,6 +634,51 @@ static void testCertProperties(void)
CertFreeCertificateContext
(
context
);
}
static
void
testCreateCert
(
void
)
{
PCCERT_CONTEXT
cert
,
enumCert
;
DWORD
count
,
size
;
BOOL
ret
;
SetLastError
(
0xdeadbeef
);
cert
=
CertCreateCertificateContext
(
0
,
NULL
,
0
);
ok
(
!
cert
&&
GetLastError
()
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %08x
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
cert
=
CertCreateCertificateContext
(
0
,
selfSignedCert
,
sizeof
(
selfSignedCert
));
ok
(
!
cert
&&
GetLastError
()
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %08x
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
cert
=
CertCreateCertificateContext
(
X509_ASN_ENCODING
,
NULL
,
0
);
ok
(
!
cert
&&
(
GetLastError
()
==
CRYPT_E_ASN1_EOD
||
broken
(
GetLastError
()
==
OSS_MORE_INPUT
/* NT4 */
)),
"expected CRYPT_E_ASN1_EOD, got %08x
\n
"
,
GetLastError
());
cert
=
CertCreateCertificateContext
(
X509_ASN_ENCODING
,
selfSignedCert
,
sizeof
(
selfSignedCert
));
ok
(
cert
!=
NULL
,
"creating cert failed: %08x
\n
"
,
GetLastError
());
/* Even in-memory certs are expected to have a store associated with them */
todo_wine
ok
(
cert
->
hCertStore
!=
NULL
,
"expected created cert to have a store
\n
"
);
/* The cert doesn't have the archived property set (which would imply it
* doesn't show up in enumerations.)
*/
size
=
0
;
ret
=
CertGetCertificateContextProperty
(
cert
,
CERT_ARCHIVED_PROP_ID
,
NULL
,
&
size
);
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_NOT_FOUND
,
"expected CRYPT_E_NOT_FOUND, got %08x
\n
"
,
GetLastError
());
/* Strangely, enumerating the certs in the store finds none. */
enumCert
=
NULL
;
count
=
0
;
while
((
enumCert
=
CertEnumCertificatesInStore
(
cert
->
hCertStore
,
enumCert
)))
count
++
;
ok
(
!
count
,
"expected 0, got %d
\n
"
,
count
);
CertFreeCertificateContext
(
cert
);
}
static
void
testDupCert
(
void
)
{
HCERTSTORE
store
;
...
...
@@ -3634,6 +3679,7 @@ START_TEST(cert)
testAddCert
();
testCertProperties
();
testCreateCert
();
testDupCert
();
testFindCert
();
testGetSubjectCert
();
...
...
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