Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
4a948fa9
Commit
4a948fa9
authored
Nov 16, 2009
by
Juan Lang
Committed by
Alexandre Julliard
Nov 17, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Add more tests for CertCompareCertificateName.
parent
459361d4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
0 deletions
+60
-0
cert.c
dlls/crypt32/tests/cert.c
+60
-0
No files found.
dlls/crypt32/tests/cert.c
View file @
4a948fa9
...
...
@@ -2541,6 +2541,29 @@ static void testGetValidUsages(void)
CertFreeCertificateContext
(
contexts
[
2
]);
}
static
BYTE
cn
[]
=
{
0x30
,
0x14
,
0x31
,
0x12
,
0x30
,
0x10
,
0x06
,
0x03
,
0x55
,
0x04
,
0x03
,
0x13
,
0x09
,
0x4a
,
0x75
,
0x61
,
0x6e
,
0x20
,
0x4c
,
0x61
,
0x6e
,
0x67
};
static
BYTE
cnWithLeadingSpace
[]
=
{
0x30
,
0x15
,
0x31
,
0x13
,
0x30
,
0x11
,
0x06
,
0x03
,
0x55
,
0x04
,
0x03
,
0x13
,
0x0a
,
0x20
,
0x4a
,
0x75
,
0x61
,
0x6e
,
0x20
,
0x4c
,
0x61
,
0x6e
,
0x67
};
static
BYTE
cnWithTrailingSpace
[]
=
{
0x30
,
0x15
,
0x31
,
0x13
,
0x30
,
0x11
,
0x06
,
0x03
,
0x55
,
0x04
,
0x03
,
0x13
,
0x0a
,
0x4a
,
0x75
,
0x61
,
0x6e
,
0x20
,
0x4c
,
0x61
,
0x6e
,
0x67
,
0x20
};
static
BYTE
cnWithIntermediateSpace
[]
=
{
0x30
,
0x15
,
0x31
,
0x13
,
0x30
,
0x11
,
0x06
,
0x03
,
0x55
,
0x04
,
0x03
,
0x13
,
0x0a
,
0x4a
,
0x75
,
0x61
,
0x6e
,
0x20
,
0x20
,
0x4c
,
0x61
,
0x6e
,
0x67
};
static
BYTE
cnThenO
[]
=
{
0x30
,
0x2d
,
0x31
,
0x2b
,
0x30
,
0x10
,
0x06
,
0x03
,
0x55
,
0x04
,
0x03
,
0x13
,
0x09
,
0x4a
,
0x75
,
0x61
,
0x6e
,
0x20
,
0x4c
,
0x61
,
0x6e
,
0x67
,
0x30
,
0x17
,
0x06
,
0x03
,
0x55
,
0x04
,
0x0a
,
0x13
,
0x10
,
0x54
,
0x68
,
0x65
,
0x20
,
0x57
,
0x69
,
0x6e
,
0x65
,
0x20
,
0x50
,
0x72
,
0x6f
,
0x6a
,
0x65
,
0x63
,
0x74
};
static
BYTE
oThenCN
[]
=
{
0x30
,
0x2d
,
0x31
,
0x2b
,
0x30
,
0x10
,
0x06
,
0x03
,
0x55
,
0x04
,
0x0a
,
0x13
,
0x09
,
0x4a
,
0x75
,
0x61
,
0x6e
,
0x20
,
0x4c
,
0x61
,
0x6e
,
0x67
,
0x30
,
0x17
,
0x06
,
0x03
,
0x55
,
0x04
,
0x03
,
0x13
,
0x10
,
0x54
,
0x68
,
0x65
,
0x20
,
0x57
,
0x69
,
0x6e
,
0x65
,
0x20
,
0x50
,
0x72
,
0x6f
,
0x6a
,
0x65
,
0x63
,
0x74
};
static
void
testCompareCertName
(
void
)
{
static
BYTE
bogus
[]
=
{
1
,
2
,
3
,
4
};
...
...
@@ -2572,6 +2595,43 @@ static void testCompareCertName(void)
blob2
.
cbData
=
sizeof
(
emptyPrime
);
ret
=
CertCompareCertificateName
(
0
,
&
blob1
,
&
blob2
);
ok
(
!
ret
,
"Expected failure
\n
"
);
/* Tests to show that CertCompareCertificateName doesn't decode the name
* to remove spaces, or to do an order-independent comparison.
*/
/* Compare CN="Juan Lang" with CN=" Juan Lang" */
blob1
.
pbData
=
cn
;
blob1
.
cbData
=
sizeof
(
cn
);
blob2
.
pbData
=
cnWithLeadingSpace
;
blob2
.
cbData
=
sizeof
(
cnWithLeadingSpace
);
ret
=
CertCompareCertificateName
(
0
,
&
blob1
,
&
blob2
);
ok
(
!
ret
,
"Expected failure
\n
"
);
ret
=
CertCompareCertificateName
(
X509_ASN_ENCODING
,
&
blob1
,
&
blob2
);
ok
(
!
ret
,
"Expected failure
\n
"
);
/* Compare CN="Juan Lang" with CN="Juan Lang " */
blob2
.
pbData
=
cnWithTrailingSpace
;
blob2
.
cbData
=
sizeof
(
cnWithTrailingSpace
);
ret
=
CertCompareCertificateName
(
0
,
&
blob1
,
&
blob2
);
ok
(
!
ret
,
"Expected failure
\n
"
);
ret
=
CertCompareCertificateName
(
X509_ASN_ENCODING
,
&
blob1
,
&
blob2
);
ok
(
!
ret
,
"Expected failure
\n
"
);
/* Compare CN="Juan Lang" with CN="Juan Lang" */
blob2
.
pbData
=
cnWithIntermediateSpace
;
blob2
.
cbData
=
sizeof
(
cnWithIntermediateSpace
);
ret
=
CertCompareCertificateName
(
0
,
&
blob1
,
&
blob2
);
ok
(
!
ret
,
"Expected failure
\n
"
);
ret
=
CertCompareCertificateName
(
X509_ASN_ENCODING
,
&
blob1
,
&
blob2
);
ok
(
!
ret
,
"Expected failure
\n
"
);
/* Compare 'CN="Juan Lang", O="The Wine Project"' with
* 'O="The Wine Project", CN="Juan Lang"'
*/
blob1
.
pbData
=
cnThenO
;
blob1
.
cbData
=
sizeof
(
cnThenO
);
blob2
.
pbData
=
oThenCN
;
blob2
.
cbData
=
sizeof
(
oThenCN
);
ret
=
CertCompareCertificateName
(
0
,
&
blob1
,
&
blob2
);
ok
(
!
ret
,
"Expected failure
\n
"
);
ret
=
CertCompareCertificateName
(
X509_ASN_ENCODING
,
&
blob1
,
&
blob2
);
ok
(
!
ret
,
"Expected failure
\n
"
);
}
static
BYTE
int1
[]
=
{
0x88
,
0xff
,
0xff
,
0xff
};
...
...
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