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
ff6328ef
Commit
ff6328ef
authored
Aug 07, 2009
by
Juan Lang
Committed by
Alexandre Julliard
Aug 10, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rsaenh: Implement importing PLAINTEXTKEYBLOBs.
parent
64b320b7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
+51
-0
rsaenh.c
dlls/rsaenh/rsaenh.c
+51
-0
No files found.
dlls/rsaenh/rsaenh.c
View file @
ff6328ef
...
...
@@ -2834,6 +2834,53 @@ static BOOL import_symmetric_key(HCRYPTPROV hProv, CONST BYTE *pbData,
}
/******************************************************************************
* import_plaintext_key [Internal]
*
* Import a plaintext key into a key container.
*
* PARAMS
* hProv [I] Key container into which the symmetric key is to be imported.
* pbData [I] Pointer to a buffer which holds the plaintext key BLOB.
* dwDataLen [I] Length of data in buffer at pbData.
* dwFlags [I] One of:
* CRYPT_EXPORTABLE: the imported key is marked exportable
* phKey [O] Handle to the imported key.
*
*
* NOTES
* Assumes the caller has already checked the BLOBHEADER at pbData to ensure
* it's a PLAINTEXTKEYBLOB.
*
* RETURNS
* Success: TRUE.
* Failure: FALSE.
*/
static
BOOL
import_plaintext_key
(
HCRYPTPROV
hProv
,
CONST
BYTE
*
pbData
,
DWORD
dwDataLen
,
DWORD
dwFlags
,
HCRYPTKEY
*
phKey
)
{
CRYPTKEY
*
pCryptKey
;
CONST
BLOBHEADER
*
pBlobHeader
=
(
CONST
BLOBHEADER
*
)
pbData
;
CONST
DWORD
*
pKeyLen
=
(
CONST
DWORD
*
)(
pBlobHeader
+
1
);
CONST
BYTE
*
pbKeyStream
=
(
CONST
BYTE
*
)(
pKeyLen
+
1
);
if
(
dwDataLen
<
sizeof
(
BLOBHEADER
)
+
sizeof
(
DWORD
)
+*
pKeyLen
)
{
SetLastError
(
NTE_BAD_DATA
);
/* FIXME: error code */
return
FALSE
;
}
*
phKey
=
new_key
(
hProv
,
pBlobHeader
->
aiKeyAlg
,
*
pKeyLen
<<
19
,
&
pCryptKey
);
if
(
*
phKey
==
(
HCRYPTKEY
)
INVALID_HANDLE_VALUE
)
return
FALSE
;
memcpy
(
pCryptKey
->
abKeyValue
,
pbKeyStream
,
*
pKeyLen
);
setup_key
(
pCryptKey
);
if
(
dwFlags
&
CRYPT_EXPORTABLE
)
pCryptKey
->
dwPermissions
|=
CRYPT_EXPORT
;
return
TRUE
;
}
/******************************************************************************
* import_key [Internal]
*
* Import a BLOB'ed key into a key container, optionally storing the key's
...
...
@@ -2893,6 +2940,10 @@ static BOOL import_key(HCRYPTPROV hProv, CONST BYTE *pbData, DWORD dwDataLen,
return
import_symmetric_key
(
hProv
,
pbData
,
dwDataLen
,
hPubKey
,
dwFlags
,
phKey
);
case
PLAINTEXTKEYBLOB
:
return
import_plaintext_key
(
hProv
,
pbData
,
dwDataLen
,
dwFlags
,
phKey
);
default:
SetLastError
(
NTE_BAD_TYPE
);
/* FIXME: error code? */
return
FALSE
;
...
...
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