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
b15ee459
Commit
b15ee459
authored
Aug 29, 2008
by
Juan Lang
Committed by
Alexandre Julliard
Sep 02, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Add tests for CertGetCTLContextProperty.
parent
429b1e1b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
81 additions
and
0 deletions
+81
-0
ctl.c
dlls/crypt32/tests/ctl.c
+81
-0
No files found.
dlls/crypt32/tests/ctl.c
View file @
b15ee459
...
...
@@ -173,7 +173,88 @@ static void testCreateCTL(void)
CertFreeCTLContext
(
ctl
);
}
static
void
checkHash
(
const
BYTE
*
data
,
DWORD
dataLen
,
ALG_ID
algID
,
PCCTL_CONTEXT
context
,
DWORD
propID
)
{
BYTE
hash
[
20
]
=
{
0
},
hashProperty
[
20
];
BOOL
ret
;
DWORD
size
;
memset
(
hash
,
0
,
sizeof
(
hash
));
memset
(
hashProperty
,
0
,
sizeof
(
hashProperty
));
size
=
sizeof
(
hash
);
ret
=
CryptHashCertificate
(
0
,
algID
,
0
,
data
,
dataLen
,
hash
,
&
size
);
ret
=
CertGetCTLContextProperty
(
context
,
propID
,
hashProperty
,
&
size
);
ok
(
ret
,
"CertGetCTLContextProperty failed: %08x
\n
"
,
GetLastError
());
if
(
ret
)
ok
(
!
memcmp
(
hash
,
hashProperty
,
size
),
"Unexpected hash for property %d
\n
"
,
propID
);
}
static
void
testCTLProperties
(
void
)
{
PCCTL_CONTEXT
ctl
;
BOOL
ret
;
DWORD
propID
,
numProps
,
access
,
size
;
ctl
=
CertCreateCTLContext
(
X509_ASN_ENCODING
,
signedCTLWithCTLInnerContent
,
sizeof
(
signedCTLWithCTLInnerContent
));
if
(
!
ctl
)
{
skip
(
"CertCreateCTLContext failed: %08x
\n
"
,
GetLastError
());
return
;
}
/* No properties as yet */
propID
=
0
;
numProps
=
0
;
do
{
propID
=
CertEnumCTLContextProperties
(
ctl
,
propID
);
if
(
propID
)
numProps
++
;
}
while
(
propID
!=
0
);
ok
(
numProps
==
0
,
"Expected 0 properties, got %d
\n
"
,
numProps
);
/* An implicit property */
ret
=
CertGetCTLContextProperty
(
ctl
,
CERT_ACCESS_STATE_PROP_ID
,
NULL
,
&
size
);
todo_wine
ok
(
ret
,
"CertGetCTLContextProperty failed: %08x
\n
"
,
GetLastError
());
ret
=
CertGetCTLContextProperty
(
ctl
,
CERT_ACCESS_STATE_PROP_ID
,
&
access
,
&
size
);
todo_wine
ok
(
ret
,
"CertGetCTLContextProperty failed: %08x"
,
GetLastError
());
todo_wine
ok
(
!
(
access
&
CERT_ACCESS_STATE_WRITE_PERSIST_FLAG
),
"Didn't expect a persisted cert
\n
"
);
todo_wine
checkHash
(
signedCTLWithCTLInnerContent
,
sizeof
(
signedCTLWithCTLInnerContent
),
CALG_SHA1
,
ctl
,
CERT_HASH_PROP_ID
);
/* Now that the hash property is set, we should get one property when
* enumerating.
*/
propID
=
0
;
numProps
=
0
;
do
{
propID
=
CertEnumCTLContextProperties
(
ctl
,
propID
);
if
(
propID
)
numProps
++
;
}
while
(
propID
!=
0
);
todo_wine
ok
(
numProps
==
1
,
"Expected 1 properties, got %d
\n
"
,
numProps
);
todo_wine
checkHash
(
signedCTLWithCTLInnerContent
,
sizeof
(
signedCTLWithCTLInnerContent
),
CALG_MD5
,
ctl
,
CERT_MD5_HASH_PROP_ID
);
CertFreeCTLContext
(
ctl
);
}
START_TEST
(
ctl
)
{
testCreateCTL
();
testCTLProperties
();
}
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