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
9928e2e1
Commit
9928e2e1
authored
Oct 29, 2009
by
Juan Lang
Committed by
Alexandre Julliard
Nov 03, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Support reading a serialized store object from memory in CryptQueryObject.
parent
51a1f5a6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
83 additions
and
9 deletions
+83
-9
crypt32_private.h
dlls/crypt32/crypt32_private.h
+6
-0
object.c
dlls/crypt32/object.c
+46
-9
serialize.c
dlls/crypt32/serialize.c
+31
-0
No files found.
dlls/crypt32/crypt32_private.h
View file @
9928e2e1
...
...
@@ -282,6 +282,12 @@ const void *CRYPT_ReadSerializedElement(const BYTE *pbElement,
*/
BOOL
CRYPT_ReadSerializedStoreFromFile
(
HANDLE
file
,
HCERTSTORE
store
);
/* Reads contexts serialized in the blob into the memory store. Returns FALSE
* if the file is not of the expected format.
*/
BOOL
CRYPT_ReadSerializedStoreFromBlob
(
const
CRYPT_DATA_BLOB
*
blob
,
HCERTSTORE
store
);
/* Fixes up the pointers in info, where info is assumed to be a
* CRYPT_KEY_PROV_INFO, followed by its container name, provider name, and any
* provider parameters, in a contiguous buffer, but where info's pointers are
...
...
dlls/crypt32/object.c
View file @
9928e2e1
...
...
@@ -283,20 +283,13 @@ end:
return
ret
;
}
static
BOOL
CRYPT_QuerySerializedStore
Object
(
DWORD
dwObjectTyp
e
,
const
void
*
pvObject
,
DWORD
*
pdwMsgAndCertEncodingType
,
DWORD
*
pdwContentType
,
static
BOOL
CRYPT_QuerySerializedStore
FromFile
(
LPCWSTR
fileNam
e
,
DWORD
*
pdwMsgAndCertEncodingType
,
DWORD
*
pdwContentType
,
HCERTSTORE
*
phCertStore
,
HCRYPTMSG
*
phMsg
)
{
LPCWSTR
fileName
=
pvObject
;
HANDLE
file
;
BOOL
ret
=
FALSE
;
if
(
dwObjectType
!=
CERT_QUERY_OBJECT_FILE
)
{
FIXME
(
"unimplemented for non-file type %d
\n
"
,
dwObjectType
);
SetLastError
(
E_INVALIDARG
);
/* FIXME: is this the correct error? */
return
FALSE
;
}
TRACE
(
"%s
\n
"
,
debugstr_w
(
fileName
));
file
=
CreateFileW
(
fileName
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
0
,
NULL
);
...
...
@@ -322,6 +315,50 @@ static BOOL CRYPT_QuerySerializedStoreObject(DWORD dwObjectType,
return
ret
;
}
static
BOOL
CRYPT_QuerySerializedStoreFromBlob
(
const
CRYPT_DATA_BLOB
*
blob
,
DWORD
*
pdwMsgAndCertEncodingType
,
DWORD
*
pdwContentType
,
HCERTSTORE
*
phCertStore
,
HCRYPTMSG
*
phMsg
)
{
HCERTSTORE
store
=
CertOpenStore
(
CERT_STORE_PROV_MEMORY
,
0
,
0
,
CERT_STORE_CREATE_NEW_FLAG
,
NULL
);
BOOL
ret
;
TRACE
(
"(%d, %p)
\n
"
,
blob
->
cbData
,
blob
->
pbData
);
ret
=
CRYPT_ReadSerializedStoreFromBlob
(
blob
,
store
);
if
(
ret
)
{
if
(
pdwMsgAndCertEncodingType
)
*
pdwMsgAndCertEncodingType
=
X509_ASN_ENCODING
;
if
(
pdwContentType
)
*
pdwContentType
=
CERT_QUERY_CONTENT_SERIALIZED_STORE
;
if
(
phCertStore
)
*
phCertStore
=
CertDuplicateStore
(
store
);
}
CertCloseStore
(
store
,
0
);
TRACE
(
"returning %d
\n
"
,
ret
);
return
ret
;
}
static
BOOL
CRYPT_QuerySerializedStoreObject
(
DWORD
dwObjectType
,
const
void
*
pvObject
,
DWORD
*
pdwMsgAndCertEncodingType
,
DWORD
*
pdwContentType
,
HCERTSTORE
*
phCertStore
,
HCRYPTMSG
*
phMsg
)
{
switch
(
dwObjectType
)
{
case
CERT_QUERY_OBJECT_FILE
:
return
CRYPT_QuerySerializedStoreFromFile
(
pvObject
,
pdwMsgAndCertEncodingType
,
pdwContentType
,
phCertStore
,
phMsg
);
case
CERT_QUERY_OBJECT_BLOB
:
return
CRYPT_QuerySerializedStoreFromBlob
(
pvObject
,
pdwMsgAndCertEncodingType
,
pdwContentType
,
phCertStore
,
phMsg
);
default:
FIXME
(
"unimplemented for type %d
\n
"
,
dwObjectType
);
SetLastError
(
E_INVALIDARG
);
/* FIXME: is this the correct error? */
return
FALSE
;
}
}
static
BOOL
CRYPT_QuerySignedMessage
(
const
CRYPT_DATA_BLOB
*
blob
,
DWORD
*
pdwMsgAndCertEncodingType
,
DWORD
*
pdwContentType
,
HCRYPTMSG
*
phMsg
)
{
...
...
dlls/crypt32/serialize.c
View file @
9928e2e1
...
...
@@ -534,6 +534,37 @@ BOOL CRYPT_ReadSerializedStoreFromFile(HANDLE file, HCERTSTORE store)
return
CRYPT_ReadSerializedStore
(
file
,
read_file_wrapper
,
store
);
}
struct
BlobReader
{
const
CRYPT_DATA_BLOB
*
blob
;
DWORD
current
;
};
static
BOOL
read_blob_wrapper
(
void
*
handle
,
void
*
buffer
,
DWORD
bytesToRead
,
DWORD
*
bytesRead
)
{
struct
BlobReader
*
reader
=
handle
;
BOOL
ret
;
if
(
reader
->
current
<
reader
->
blob
->
cbData
)
{
*
bytesRead
=
min
(
bytesToRead
,
reader
->
blob
->
cbData
-
reader
->
current
);
memcpy
(
buffer
,
reader
->
blob
->
pbData
+
reader
->
current
,
*
bytesRead
);
ret
=
TRUE
;
}
else
ret
=
FALSE
;
return
ret
;
}
BOOL
CRYPT_ReadSerializedStoreFromBlob
(
const
CRYPT_DATA_BLOB
*
blob
,
HCERTSTORE
store
)
{
struct
BlobReader
reader
=
{
blob
,
0
};
return
CRYPT_ReadSerializedStore
(
&
reader
,
read_blob_wrapper
,
store
);
}
static
BOOL
WINAPI
CRYPT_SerializeCertNoHash
(
PCCERT_CONTEXT
pCertContext
,
DWORD
dwFlags
,
BYTE
*
pbElement
,
DWORD
*
pcbElement
)
{
...
...
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