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
a1352035
Commit
a1352035
authored
Oct 19, 2010
by
Juan Lang
Committed by
Alexandre Julliard
Oct 20, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Implement CertRDNValueToStr for UTF8 strings.
parent
8f2821ac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
0 deletions
+31
-0
str.c
dlls/crypt32/str.c
+2
-0
str.c
dlls/crypt32/tests/str.c
+29
-0
No files found.
dlls/crypt32/str.c
View file @
a1352035
...
...
@@ -102,6 +102,7 @@ DWORD WINAPI CertRDNValueToStrA(DWORD dwValueType, PCERT_RDN_VALUE_BLOB pValue,
}
break
;
case
CERT_RDN_BMP_STRING
:
case
CERT_RDN_UTF8_STRING
:
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
(
LPCWSTR
)
pValue
->
pbData
,
pValue
->
cbData
/
sizeof
(
WCHAR
),
NULL
,
0
,
NULL
,
NULL
);
if
(
pValue
->
cbData
&&
isspaceW
(((
LPCWSTR
)
pValue
->
pbData
)[
0
]))
...
...
@@ -210,6 +211,7 @@ DWORD WINAPI CertRDNValueToStrW(DWORD dwValueType, PCERT_RDN_VALUE_BLOB pValue,
}
break
;
case
CERT_RDN_BMP_STRING
:
case
CERT_RDN_UTF8_STRING
:
strLen
=
len
=
pValue
->
cbData
/
sizeof
(
WCHAR
);
if
(
pValue
->
cbData
&&
isspace
(
pValue
->
pbData
[
0
]))
needsQuotes
=
TRUE
;
...
...
dlls/crypt32/tests/str.c
View file @
a1352035
...
...
@@ -53,6 +53,12 @@ static BYTE bin6[] = { 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73,
0x74
};
static
BYTE
bin7
[]
=
{
0x61
,
0x72
,
0x69
,
0x63
,
0x40
,
0x63
,
0x6f
,
0x64
,
0x65
,
0x77
,
0x65
,
0x61
,
0x76
,
0x65
,
0x72
,
0x73
,
0x2e
,
0x63
,
0x6f
,
0x6d
};
static
BYTE
bin8
[]
=
{
0x65
,
0x00
,
0x50
,
0x00
,
0x4b
,
0x00
,
0x49
,
0x00
,
0x20
,
0x00
,
0x52
,
0x00
,
0x6f
,
0x00
,
0x6f
,
0x00
,
0x74
,
0x00
,
0x20
,
0x00
,
0x43
,
0x00
,
0x65
,
0x00
,
0x72
,
0x00
,
0x74
,
0x00
,
0x69
,
0x00
,
0x66
,
0x00
,
0x69
,
0x00
,
0x63
,
0x00
,
0x61
,
0x00
,
0x74
,
0x00
,
0x69
,
0x00
,
0x6f
,
0x00
,
0x6e
,
0x00
,
0x20
,
0x00
,
0x41
,
0x00
,
0x75
,
0x00
,
0x74
,
0x00
,
0x68
,
0x00
,
0x6f
,
0x00
,
0x72
,
0x00
,
0x69
,
0x00
,
0x74
,
0x00
,
0x79
,
0x00
};
static
const
BYTE
cert
[]
=
{
0x30
,
0x82
,
0x2
,
0xbb
,
0x30
,
0x82
,
0x2
,
0x24
,
0x2
,
0x9
,
0x0
,
0xe3
,
0x5a
,
0x10
,
0xf1
,
0xfc
,
...
...
@@ -216,6 +222,7 @@ static void test_CertRDNValueToStrA(void)
DWORD
i
,
ret
;
char
buffer
[
2000
];
CERT_RDN_VALUE_BLOB
blob
=
{
0
,
NULL
};
static
const
char
ePKI
[]
=
"ePKI Root Certification Authority"
;
if
(
!
pCertRDNValueToStrA
)
return
;
...
...
@@ -239,6 +246,14 @@ static void test_CertRDNValueToStrA(void)
ok
(
!
strcmp
(
buffer
,
attrs
[
i
].
str
),
"Expected %s, got %s
\n
"
,
attrs
[
i
].
str
,
buffer
);
}
blob
.
pbData
=
bin8
;
blob
.
cbData
=
sizeof
(
bin8
);
ret
=
pCertRDNValueToStrA
(
CERT_RDN_UTF8_STRING
,
&
blob
,
buffer
,
sizeof
(
buffer
));
ok
(
ret
==
strlen
(
ePKI
)
+
1
||
broken
(
ret
!=
strlen
(
ePKI
)
+
1
),
"Expected length %d, got %d
\n
"
,
lstrlenA
(
ePKI
),
ret
);
if
(
ret
==
strlen
(
ePKI
)
+
1
)
ok
(
!
strcmp
(
buffer
,
ePKI
),
"Expected %s, got %s
\n
"
,
ePKI
,
buffer
);
}
static
void
test_CertRDNValueToStrW
(
void
)
...
...
@@ -254,6 +269,9 @@ static void test_CertRDNValueToStrW(void)
static
const
WCHAR
localhostW
[]
=
{
'l'
,
'o'
,
'c'
,
'a'
,
'l'
,
'h'
,
'o'
,
's'
,
't'
,
0
};
static
const
WCHAR
aricW
[]
=
{
'a'
,
'r'
,
'i'
,
'c'
,
'@'
,
'c'
,
'o'
,
'd'
,
'e'
,
'w'
,
'e'
,
'a'
,
'v'
,
'e'
,
'r'
,
's'
,
'.'
,
'c'
,
'o'
,
'm'
,
0
};
static
const
WCHAR
ePKIW
[]
=
{
'e'
,
'P'
,
'K'
,
'I'
,
' '
,
'R'
,
'o'
,
'o'
,
't'
,
' '
,
'C'
,
'e'
,
'r'
,
't'
,
'i'
,
'f'
,
'i'
,
'c'
,
'a'
,
't'
,
'i'
,
'o'
,
'n'
,
' '
,
'A'
,
'u'
,
't'
,
'h'
,
'o'
,
'r'
,
'i'
,
't'
,
'y'
,
0
};
CertRDNAttrEncodingW
attrs
[]
=
{
{
"2.5.4.6"
,
CERT_RDN_PRINTABLE_STRING
,
{
sizeof
(
bin1
),
bin1
},
usW
},
...
...
@@ -269,6 +287,8 @@ static void test_CertRDNValueToStrW(void)
{
sizeof
(
bin6
),
bin6
},
localhostW
},
{
"1.2.840.113549.1.9.1"
,
CERT_RDN_IA5_STRING
,
{
sizeof
(
bin7
),
bin7
},
aricW
},
{
"2.5.4.3"
,
CERT_RDN_UTF8_STRING
,
{
sizeof
(
bin8
),
bin8
},
ePKIW
},
};
DWORD
i
,
ret
;
WCHAR
buffer
[
2000
];
...
...
@@ -301,6 +321,15 @@ static void test_CertRDNValueToStrW(void)
ok
(
!
lstrcmpW
(
buffer
,
attrs
[
i
].
str
),
"Expected %s, got %s
\n
"
,
wine_dbgstr_w
(
attrs
[
i
].
str
),
wine_dbgstr_w
(
buffer
));
}
blob
.
pbData
=
bin8
;
blob
.
cbData
=
sizeof
(
bin8
);
ret
=
pCertRDNValueToStrW
(
CERT_RDN_UTF8_STRING
,
&
blob
,
buffer
,
sizeof
(
buffer
));
ok
(
ret
==
lstrlenW
(
ePKIW
)
+
1
||
broken
(
ret
!=
lstrlenW
(
ePKIW
)
+
1
),
"Expected length %d, got %d
\n
"
,
lstrlenW
(
ePKIW
),
ret
);
if
(
ret
==
lstrlenW
(
ePKIW
)
+
1
)
ok
(
!
lstrcmpW
(
buffer
,
ePKIW
),
"Expected %s, got %s
\n
"
,
wine_dbgstr_w
(
ePKIW
),
wine_dbgstr_w
(
buffer
));
}
static
void
test_NameToStrConversionA
(
PCERT_NAME_BLOB
pName
,
DWORD
dwStrType
,
...
...
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