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
962aed51
Commit
962aed51
authored
Feb 01, 2019
by
Hans Leidekker
Committed by
Alexandre Julliard
Feb 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Add support for PFX objects in CryptQueryObject.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
4782b283
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
2 deletions
+85
-2
object.c
dlls/crypt32/object.c
+51
-2
store.c
dlls/crypt32/tests/store.c
+34
-0
No files found.
dlls/crypt32/object.c
View file @
962aed51
...
@@ -696,6 +696,48 @@ static BOOL CRYPT_QueryEmbeddedMessageObject(DWORD dwObjectType,
...
@@ -696,6 +696,48 @@ static BOOL CRYPT_QueryEmbeddedMessageObject(DWORD dwObjectType,
return
ret
;
return
ret
;
}
}
static
BOOL
CRYPT_QueryPFXObject
(
DWORD
dwObjectType
,
const
void
*
pvObject
,
DWORD
dwExpectedContentTypeFlags
,
DWORD
dwExpectedFormatTypeFlags
,
DWORD
*
pdwMsgAndCertEncodingType
,
DWORD
*
pdwContentType
,
DWORD
*
pdwFormatType
,
HCERTSTORE
*
phCertStore
,
HCRYPTMSG
*
phMsg
)
{
CRYPT_DATA_BLOB
blob
=
{
0
},
*
ptr
;
BOOL
ret
;
TRACE
(
"(%d, %p, %08x, %08x, %p, %p, %p, %p, %p)
\n
"
,
dwObjectType
,
pvObject
,
dwExpectedContentTypeFlags
,
dwExpectedFormatTypeFlags
,
pdwMsgAndCertEncodingType
,
pdwContentType
,
pdwFormatType
,
phCertStore
,
phMsg
);
switch
(
dwObjectType
)
{
case
CERT_QUERY_OBJECT_FILE
:
if
(
!
CRYPT_ReadBlobFromFile
(
pvObject
,
&
blob
))
return
FALSE
;
ptr
=
&
blob
;
break
;
case
CERT_QUERY_OBJECT_BLOB
:
ptr
=
(
CRYPT_DATA_BLOB
*
)
pvObject
;
break
;
default:
return
FALSE
;
}
ret
=
PFXIsPFXBlob
(
ptr
);
if
(
ret
)
{
if
(
pdwMsgAndCertEncodingType
)
*
pdwMsgAndCertEncodingType
=
X509_ASN_ENCODING
;
if
(
pdwContentType
)
*
pdwContentType
=
CERT_QUERY_CONTENT_PFX
;
if
(
pdwFormatType
)
*
pdwFormatType
=
CERT_QUERY_FORMAT_BINARY
;
if
(
phCertStore
)
*
phCertStore
=
NULL
;
if
(
phMsg
)
*
phMsg
=
NULL
;
}
CryptMemFree
(
blob
.
pbData
);
return
ret
;
}
BOOL
WINAPI
CryptQueryObject
(
DWORD
dwObjectType
,
const
void
*
pvObject
,
BOOL
WINAPI
CryptQueryObject
(
DWORD
dwObjectType
,
const
void
*
pvObject
,
DWORD
dwExpectedContentTypeFlags
,
DWORD
dwExpectedFormatTypeFlags
,
DWORD
dwExpectedContentTypeFlags
,
DWORD
dwExpectedFormatTypeFlags
,
DWORD
dwFlags
,
DWORD
*
pdwMsgAndCertEncodingType
,
DWORD
*
pdwContentType
,
DWORD
dwFlags
,
DWORD
*
pdwMsgAndCertEncodingType
,
DWORD
*
pdwContentType
,
...
@@ -703,8 +745,7 @@ BOOL WINAPI CryptQueryObject(DWORD dwObjectType, const void *pvObject,
...
@@ -703,8 +745,7 @@ BOOL WINAPI CryptQueryObject(DWORD dwObjectType, const void *pvObject,
const
void
**
ppvContext
)
const
void
**
ppvContext
)
{
{
static
const
DWORD
unimplementedTypes
=
static
const
DWORD
unimplementedTypes
=
CERT_QUERY_CONTENT_FLAG_PKCS10
|
CERT_QUERY_CONTENT_FLAG_PFX
|
CERT_QUERY_CONTENT_FLAG_PKCS10
|
CERT_QUERY_CONTENT_FLAG_CERT_PAIR
;
CERT_QUERY_CONTENT_FLAG_CERT_PAIR
;
BOOL
ret
=
TRUE
;
BOOL
ret
=
TRUE
;
TRACE
(
"(%08x, %p, %08x, %08x, %08x, %p, %p, %p, %p, %p, %p)
\n
"
,
TRACE
(
"(%08x, %p, %08x, %08x, %08x, %p, %p, %p, %p, %p, %p)
\n
"
,
...
@@ -779,6 +820,14 @@ BOOL WINAPI CryptQueryObject(DWORD dwObjectType, const void *pvObject,
...
@@ -779,6 +820,14 @@ BOOL WINAPI CryptQueryObject(DWORD dwObjectType, const void *pvObject,
dwExpectedContentTypeFlags
,
pdwMsgAndCertEncodingType
,
pdwContentType
,
dwExpectedContentTypeFlags
,
pdwMsgAndCertEncodingType
,
pdwContentType
,
phCertStore
,
phMsg
);
phCertStore
,
phMsg
);
}
}
if
(
!
ret
&&
(
dwExpectedContentTypeFlags
&
CERT_QUERY_CONTENT_FLAG_PFX
))
{
ret
=
CRYPT_QueryPFXObject
(
dwObjectType
,
pvObject
,
dwExpectedContentTypeFlags
,
dwExpectedFormatTypeFlags
,
pdwMsgAndCertEncodingType
,
pdwContentType
,
pdwFormatType
,
phCertStore
,
phMsg
);
}
if
(
!
ret
)
if
(
!
ret
)
SetLastError
(
CRYPT_E_NO_MATCH
);
SetLastError
(
CRYPT_E_NO_MATCH
);
TRACE
(
"returning %d
\n
"
,
ret
);
TRACE
(
"returning %d
\n
"
,
ret
);
...
...
dlls/crypt32/tests/store.c
View file @
962aed51
...
@@ -3326,6 +3326,39 @@ static void test_PFXImportCertStore(void)
...
@@ -3326,6 +3326,39 @@ static void test_PFXImportCertStore(void)
CertCloseStore
(
store
,
0
);
CertCloseStore
(
store
,
0
);
}
}
static
void
test_CryptQueryObject
(
void
)
{
CRYPT_DATA_BLOB
pfx
;
DWORD
encoding_type
,
content_type
,
format_type
;
HCERTSTORE
store
;
HCRYPTMSG
msg
;
const
void
*
ctx
;
BOOL
ret
;
SetLastError
(
0xdeadbeef
);
ret
=
CryptQueryObject
(
CERT_QUERY_OBJECT_BLOB
,
NULL
,
CERT_QUERY_CONTENT_FLAG_ALL
,
CERT_QUERY_FORMAT_FLAG_BINARY
,
0
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
!
ret
,
"success
\n
"
);
ok
(
GetLastError
()
==
E_INVALIDARG
,
"got %u
\n
"
,
GetLastError
()
);
pfx
.
pbData
=
(
BYTE
*
)
pfxdata
;
pfx
.
cbData
=
sizeof
(
pfxdata
);
encoding_type
=
content_type
=
format_type
=
0xdeadbeef
;
store
=
(
HCERTSTORE
*
)
0xdeadbeef
;
msg
=
(
HCRYPTMSG
*
)
0xdeadbeef
;
ctx
=
(
void
*
)
0xdeadbeef
;
ret
=
CryptQueryObject
(
CERT_QUERY_OBJECT_BLOB
,
&
pfx
,
CERT_QUERY_CONTENT_FLAG_ALL
,
CERT_QUERY_FORMAT_FLAG_BINARY
,
0
,
&
encoding_type
,
&
content_type
,
&
format_type
,
&
store
,
&
msg
,
&
ctx
);
ok
(
ret
,
"got %u
\n
"
,
GetLastError
()
);
ok
(
encoding_type
==
X509_ASN_ENCODING
,
"got %08x
\n
"
,
encoding_type
);
ok
(
content_type
==
CERT_QUERY_CONTENT_PFX
,
"got %08x
\n
"
,
content_type
);
ok
(
format_type
==
CERT_QUERY_FORMAT_BINARY
,
"got %08x
\n
"
,
format_type
);
ok
(
store
==
NULL
,
"got %p
\n
"
,
store
);
ok
(
msg
==
NULL
,
"got %p
\n
"
,
msg
);
ok
(
ctx
==
NULL
,
"got %p
\n
"
,
ctx
);
}
START_TEST
(
store
)
START_TEST
(
store
)
{
{
/* various combinations of CertOpenStore */
/* various combinations of CertOpenStore */
...
@@ -3357,4 +3390,5 @@ START_TEST(store)
...
@@ -3357,4 +3390,5 @@ START_TEST(store)
test_I_UpdateStore
();
test_I_UpdateStore
();
test_PFXImportCertStore
();
test_PFXImportCertStore
();
test_CryptQueryObject
();
}
}
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