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
bd41f77d
Commit
bd41f77d
authored
Jan 28, 2009
by
Juan Lang
Committed by
Alexandre Julliard
Jan 29, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rsaenh: Use key spec rather than char * to identify a key pair.
parent
fbc26f38
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
8 deletions
+45
-8
rsaenh.c
dlls/rsaenh/rsaenh.c
+45
-8
No files found.
dlls/rsaenh/rsaenh.c
View file @
bd41f77d
...
...
@@ -890,6 +890,37 @@ static HCRYPTKEY new_key(HCRYPTPROV hProv, ALG_ID aiAlgid, DWORD dwFlags, CRYPTK
}
/******************************************************************************
* map_key_spec_to_key_pair_name [Internal]
*
* Returns the name of the registry value associated with a key spec.
*
* PARAMS
* dwKeySpec [I] AT_KEYEXCHANGE or AT_SIGNATURE
*
* RETURNS
* Success: Name of registry value.
* Failure: NULL
*/
static
LPCSTR
map_key_spec_to_key_pair_name
(
DWORD
dwKeySpec
)
{
LPCSTR
szValueName
;
switch
(
dwKeySpec
)
{
case
AT_KEYEXCHANGE
:
szValueName
=
"KeyExchangeKeyPair"
;
break
;
case
AT_SIGNATURE
:
szValueName
=
"SignatureKeyPair"
;
break
;
default:
WARN
(
"invalid key spec %d
\n
"
,
dwKeySpec
);
szValueName
=
NULL
;
}
return
szValueName
;
}
/******************************************************************************
* store_key_pair [Internal]
*
* Stores a key pair to the registry
...
...
@@ -897,16 +928,19 @@ static HCRYPTKEY new_key(HCRYPTPROV hProv, ALG_ID aiAlgid, DWORD dwFlags, CRYPTK
* PARAMS
* hCryptKey [I] Handle to the key to be stored
* hKey [I] Registry key where the key pair is to be stored
*
szValueName [I] Registry value where key pair's value is to be stored
*
dwKeySpec [I] AT_KEYEXCHANGE or AT_SIGNATURE
* dwFlags [I] Flags for protecting the key
*/
static
void
store_key_pair
(
HCRYPTKEY
hCryptKey
,
HKEY
hKey
,
LPCSTR
szValueName
,
DWORD
dwFlags
)
static
void
store_key_pair
(
HCRYPTKEY
hCryptKey
,
HKEY
hKey
,
DWORD
dwKeySpec
,
DWORD
dwFlags
)
{
LPCSTR
szValueName
;
DATA_BLOB
blobIn
,
blobOut
;
CRYPTKEY
*
pKey
;
DWORD
dwLen
;
BYTE
*
pbKey
;
if
(
!
(
szValueName
=
map_key_spec_to_key_pair_name
(
dwKeySpec
)))
return
;
if
(
lookup_handle
(
&
handle_table
,
hCryptKey
,
RSAENH_MAGIC_KEY
,
(
OBJECTHDR
**
)
&
pKey
))
{
...
...
@@ -1051,9 +1085,9 @@ static void store_key_container_keys(KEYCONTAINER *pKeyContainer)
if
(
create_container_key
(
pKeyContainer
,
KEY_WRITE
,
&
hKey
))
{
store_key_pair
(
pKeyContainer
->
hKeyExchangeKeyPair
,
hKey
,
"KeyExchangeKeyPair"
,
dwFlags
);
AT_KEYEXCHANGE
,
dwFlags
);
store_key_pair
(
pKeyContainer
->
hSignatureKeyPair
,
hKey
,
"SignatureKeyPair"
,
dwFlags
);
AT_SIGNATURE
,
dwFlags
);
RegCloseKey
(
hKey
);
}
}
...
...
@@ -1158,17 +1192,20 @@ static HCRYPTPROV new_key_container(PCCH pszContainerName, DWORD dwFlags, const
* PARAMS
* hKeyContainer [I] Crypt provider to use to import the key
* hKey [I] Registry key from which to read the key pair
*
szValueName [I] Registry value from which to read the key pair's value
*
dwKeySpec [I] AT_KEYEXCHANGE or AT_SIGNATURE
* dwFlags [I] Flags for unprotecting the key
* phCryptKey [O] Returned key
*/
static
BOOL
read_key_value
(
HCRYPTPROV
hKeyContainer
,
HKEY
hKey
,
LPCSTR
szValueName
,
DWORD
dwFlags
,
HCRYPTKEY
*
phCryptKey
)
static
BOOL
read_key_value
(
HCRYPTPROV
hKeyContainer
,
HKEY
hKey
,
DWORD
dwKeySpec
,
DWORD
dwFlags
,
HCRYPTKEY
*
phCryptKey
)
{
LPCSTR
szValueName
;
DWORD
dwValueType
,
dwLen
;
BYTE
*
pbKey
;
DATA_BLOB
blobIn
,
blobOut
;
BOOL
ret
=
FALSE
;
if
(
!
(
szValueName
=
map_key_spec_to_key_pair_name
(
dwKeySpec
)))
return
FALSE
;
if
(
RegQueryValueExA
(
hKey
,
szValueName
,
0
,
&
dwValueType
,
NULL
,
&
dwLen
)
==
ERROR_SUCCESS
)
{
...
...
@@ -1232,10 +1269,10 @@ static HCRYPTPROV read_key_container(PCHAR pszContainerName, DWORD dwFlags, cons
(
OBJECTHDR
**
)
&
pKeyContainer
))
return
(
HCRYPTPROV
)
INVALID_HANDLE_VALUE
;
if
(
read_key_value
(
hKeyContainer
,
hKey
,
"KeyExchangeKeyPair"
,
if
(
read_key_value
(
hKeyContainer
,
hKey
,
AT_KEYEXCHANGE
,
dwProtectFlags
,
&
hCryptKey
))
pKeyContainer
->
hKeyExchangeKeyPair
=
hCryptKey
;
if
(
read_key_value
(
hKeyContainer
,
hKey
,
"SignatureKeyPair"
,
if
(
read_key_value
(
hKeyContainer
,
hKey
,
AT_SIGNATURE
,
dwProtectFlags
,
&
hCryptKey
))
pKeyContainer
->
hSignatureKeyPair
=
hCryptKey
;
}
...
...
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