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
6ac16223
Commit
6ac16223
authored
Nov 03, 2009
by
Juan Lang
Committed by
Alexandre Julliard
Nov 04, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Add tests for CertGetIntendedKeyUsage.
parent
812fdca9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
cert.c
dlls/crypt32/tests/cert.c
+53
-0
No files found.
dlls/crypt32/tests/cert.c
View file @
6ac16223
...
@@ -2065,6 +2065,58 @@ static void testCreateSelfSignCert(void)
...
@@ -2065,6 +2065,58 @@ static void testCreateSelfSignCert(void)
CRYPT_DELETEKEYSET
);
CRYPT_DELETEKEYSET
);
}
}
static
void
testIntendedKeyUsage
(
void
)
{
BOOL
ret
;
CERT_INFO
info
=
{
0
};
static
char
oid_key_usage
[]
=
szOID_KEY_USAGE
;
/* A couple "key usages". Really they're just encoded bits which aren't
* necessarily restricted to the defined key usage values.
*/
static
BYTE
usage1
[]
=
{
0x03
,
0x03
,
0x00
,
0xff
,
0xff
};
static
BYTE
usage2
[]
=
{
0x03
,
0x03
,
0x01
,
0xff
,
0xfe
};
static
const
BYTE
expected_usage1
[]
=
{
0xff
,
0xff
,
0x00
,
0x00
};
static
const
BYTE
expected_usage2
[]
=
{
0xff
,
0xfe
,
0x00
,
0x00
};
CERT_EXTENSION
ext
=
{
oid_key_usage
,
TRUE
,
{
sizeof
(
usage1
),
usage1
}
};
BYTE
usage_bytes
[
4
];
if
(
0
)
{
/* Crash */
ret
=
CertGetIntendedKeyUsage
(
0
,
NULL
,
NULL
,
0
);
}
ret
=
CertGetIntendedKeyUsage
(
0
,
&
info
,
NULL
,
0
);
ok
(
!
ret
,
"expected failure
\n
"
);
ret
=
CertGetIntendedKeyUsage
(
0
,
&
info
,
usage_bytes
,
sizeof
(
usage_bytes
));
ok
(
!
ret
,
"expected failure
\n
"
);
ret
=
CertGetIntendedKeyUsage
(
X509_ASN_ENCODING
,
&
info
,
NULL
,
0
);
ok
(
!
ret
,
"expected failure
\n
"
);
ret
=
CertGetIntendedKeyUsage
(
X509_ASN_ENCODING
,
&
info
,
usage_bytes
,
sizeof
(
usage_bytes
));
info
.
cExtension
=
1
;
info
.
rgExtension
=
&
ext
;
ret
=
CertGetIntendedKeyUsage
(
X509_ASN_ENCODING
,
&
info
,
NULL
,
0
);
ok
(
!
ret
,
"expected failure
\n
"
);
/* The unused bytes are filled with 0. */
ret
=
CertGetIntendedKeyUsage
(
X509_ASN_ENCODING
,
&
info
,
usage_bytes
,
sizeof
(
usage_bytes
));
todo_wine
{
ok
(
ret
,
"CertGetIntendedKeyUsage failed: %08x
\n
"
,
GetLastError
());
ok
(
!
memcmp
(
usage_bytes
,
expected_usage1
,
sizeof
(
expected_usage1
)),
"unexpected value
\n
"
);
}
/* The usage bytes are copied in big-endian order. */
ext
.
Value
.
cbData
=
sizeof
(
usage2
);
ext
.
Value
.
pbData
=
usage2
;
ret
=
CertGetIntendedKeyUsage
(
X509_ASN_ENCODING
,
&
info
,
usage_bytes
,
sizeof
(
usage_bytes
));
todo_wine
{
ok
(
ret
,
"CertGetIntendedKeyUsage failed: %08x
\n
"
,
GetLastError
());
ok
(
!
memcmp
(
usage_bytes
,
expected_usage2
,
sizeof
(
expected_usage2
)),
"unexpected value
\n
"
);
}
}
static
const
LPCSTR
keyUsages
[]
=
{
szOID_PKIX_KP_CODE_SIGNING
,
static
const
LPCSTR
keyUsages
[]
=
{
szOID_PKIX_KP_CODE_SIGNING
,
szOID_PKIX_KP_CLIENT_AUTH
,
szOID_RSA_RSA
};
szOID_PKIX_KP_CLIENT_AUTH
,
szOID_RSA_RSA
};
...
@@ -3222,6 +3274,7 @@ START_TEST(cert)
...
@@ -3222,6 +3274,7 @@ START_TEST(cert)
testCertSigs
();
testCertSigs
();
testSignAndEncodeCert
();
testSignAndEncodeCert
();
testCreateSelfSignCert
();
testCreateSelfSignCert
();
testIntendedKeyUsage
();
testKeyUsage
();
testKeyUsage
();
testGetValidUsages
();
testGetValidUsages
();
testCompareCertName
();
testCompareCertName
();
...
...
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