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
be370380
Commit
be370380
authored
Jul 20, 2010
by
Hans Leidekker
Committed by
Alexandre Julliard
Jul 22, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Add a partial implementation of WINHTTP_OPTION_SECURITY_CERTIFICATE_STRUCT.
parent
a610fc17
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
0 deletions
+52
-0
session.c
dlls/winhttp/session.c
+40
-0
winhttp.c
dlls/winhttp/tests/winhttp.c
+12
-0
No files found.
dlls/winhttp/session.c
View file @
be370380
...
...
@@ -559,6 +559,18 @@ static void str_to_buffer( WCHAR *buffer, const WCHAR *str, LPDWORD buflen )
*
buflen
=
len
*
sizeof
(
WCHAR
);
}
static
WCHAR
*
blob_to_str
(
DWORD
encoding
,
CERT_NAME_BLOB
*
blob
)
{
WCHAR
*
ret
;
DWORD
size
,
format
=
CERT_SIMPLE_NAME_STR
|
CERT_NAME_STR_CRLF_FLAG
;
size
=
CertNameToStrW
(
encoding
,
blob
,
format
,
NULL
,
0
);
if
((
ret
=
LocalAlloc
(
0
,
size
*
sizeof
(
WCHAR
)
)))
CertNameToStrW
(
encoding
,
blob
,
format
,
ret
,
size
);
return
ret
;
}
static
BOOL
request_query_option
(
object_header_t
*
hdr
,
DWORD
option
,
LPVOID
buffer
,
LPDWORD
buflen
)
{
request_t
*
request
=
(
request_t
*
)
hdr
;
...
...
@@ -598,6 +610,34 @@ static BOOL request_query_option( object_header_t *hdr, DWORD option, LPVOID buf
*
buflen
=
sizeof
(
cert
);
return
TRUE
;
}
case
WINHTTP_OPTION_SECURITY_CERTIFICATE_STRUCT
:
{
const
CERT_CONTEXT
*
cert
;
WINHTTP_CERTIFICATE_INFO
*
ci
=
buffer
;
FIXME
(
"partial stub
\n
"
);
if
(
!
buffer
||
*
buflen
<
sizeof
(
*
ci
))
{
*
buflen
=
sizeof
(
*
ci
);
set_last_error
(
ERROR_INSUFFICIENT_BUFFER
);
return
FALSE
;
}
if
(
!
(
cert
=
netconn_get_certificate
(
&
request
->
netconn
)))
return
FALSE
;
ci
->
ftExpiry
=
cert
->
pCertInfo
->
NotAfter
;
ci
->
ftStart
=
cert
->
pCertInfo
->
NotBefore
;
ci
->
lpszSubjectInfo
=
blob_to_str
(
cert
->
dwCertEncodingType
,
&
cert
->
pCertInfo
->
Subject
);
ci
->
lpszIssuerInfo
=
blob_to_str
(
cert
->
dwCertEncodingType
,
&
cert
->
pCertInfo
->
Issuer
);
ci
->
lpszProtocolName
=
NULL
;
ci
->
lpszSignatureAlgName
=
NULL
;
ci
->
lpszEncryptionAlgName
=
NULL
;
ci
->
dwKeySize
=
128
;
CertFreeCertificateContext
(
cert
);
*
buflen
=
sizeof
(
*
ci
);
return
TRUE
;
}
case
WINHTTP_OPTION_SECURITY_KEY_BITNESS
:
{
if
(
!
buffer
||
*
buflen
<
sizeof
(
DWORD
))
...
...
dlls/winhttp/tests/winhttp.c
View file @
be370380
...
...
@@ -770,6 +770,7 @@ static void test_secure_connection(void)
DWORD
size
,
status
,
policy
,
bitness
;
BOOL
ret
;
CERT_CONTEXT
*
cert
;
WINHTTP_CERTIFICATE_INFO
info
;
ses
=
WinHttpOpen
(
test_useragent
,
0
,
NULL
,
NULL
,
0
);
ok
(
ses
!=
NULL
,
"failed to open session %u
\n
"
,
GetLastError
());
...
...
@@ -823,6 +824,17 @@ static void test_secure_connection(void)
ret
=
WinHttpQueryOption
(
req
,
WINHTTP_OPTION_SECURITY_KEY_BITNESS
,
&
bitness
,
&
size
);
ok
(
ret
,
"failed to retrieve key bitness %u
\n
"
,
GetLastError
());
size
=
sizeof
(
info
);
ret
=
WinHttpQueryOption
(
req
,
WINHTTP_OPTION_SECURITY_CERTIFICATE_STRUCT
,
&
info
,
&
size
);
ok
(
ret
,
"failed to retrieve certificate info %u
\n
"
,
GetLastError
());
trace
(
"lpszSubjectInfo %s
\n
"
,
wine_dbgstr_w
(
info
.
lpszSubjectInfo
));
trace
(
"lpszIssuerInfo %s
\n
"
,
wine_dbgstr_w
(
info
.
lpszIssuerInfo
));
trace
(
"lpszProtocolName %s
\n
"
,
wine_dbgstr_w
(
info
.
lpszProtocolName
));
trace
(
"lpszSignatureAlgName %s
\n
"
,
wine_dbgstr_w
(
info
.
lpszSignatureAlgName
));
trace
(
"lpszEncryptionAlgName %s
\n
"
,
wine_dbgstr_w
(
info
.
lpszEncryptionAlgName
));
trace
(
"dwKeySize %u
\n
"
,
info
.
dwKeySize
);
ret
=
WinHttpReceiveResponse
(
req
,
NULL
);
ok
(
ret
,
"failed to receive response %u
\n
"
,
GetLastError
());
...
...
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