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
8fa3b687
Commit
8fa3b687
authored
May 25, 2008
by
Michael Karcher
Committed by
Alexandre Julliard
May 26, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Pass on aiKeyAlg on RSA key import.
parent
a3223df8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
0 deletions
+34
-0
encode.c
dlls/crypt32/encode.c
+4
-0
encode.c
dlls/crypt32/tests/encode.c
+30
-0
No files found.
dlls/crypt32/encode.c
View file @
8fa3b687
...
@@ -3918,8 +3918,12 @@ static BOOL WINAPI CRYPT_ImportRsaPublicKeyInfoEx(HCRYPTPROV hCryptProv,
...
@@ -3918,8 +3918,12 @@ static BOOL WINAPI CRYPT_ImportRsaPublicKeyInfoEx(HCRYPTPROV hCryptProv,
pInfo
->
PublicKey
.
pbData
,
pInfo
->
PublicKey
.
cbData
,
0
,
pubKey
,
pInfo
->
PublicKey
.
pbData
,
pInfo
->
PublicKey
.
cbData
,
0
,
pubKey
,
&
pubKeySize
);
&
pubKeySize
);
if
(
ret
)
if
(
ret
)
{
if
(
aiKeyAlg
)
((
BLOBHEADER
*
)
pubKey
)
->
aiKeyAlg
=
aiKeyAlg
;
ret
=
CryptImportKey
(
hCryptProv
,
pubKey
,
pubKeySize
,
0
,
0
,
ret
=
CryptImportKey
(
hCryptProv
,
pubKey
,
pubKeySize
,
0
,
0
,
phKey
);
phKey
);
}
CryptMemFree
(
pubKey
);
CryptMemFree
(
pubKey
);
}
}
else
else
...
...
dlls/crypt32/tests/encode.c
View file @
8fa3b687
...
@@ -5802,6 +5802,8 @@ static void testImportPublicKey(HCRYPTPROV csp, PCERT_PUBLIC_KEY_INFO info)
...
@@ -5802,6 +5802,8 @@ static void testImportPublicKey(HCRYPTPROV csp, PCERT_PUBLIC_KEY_INFO info)
BOOL
ret
;
BOOL
ret
;
HCRYPTKEY
key
;
HCRYPTKEY
key
;
PCCERT_CONTEXT
context
;
PCCERT_CONTEXT
context
;
DWORD
dwSize
;
ALG_ID
ai
;
/* These crash
/* These crash
ret = CryptImportPublicKeyInfoEx(0, 0, NULL, 0, 0, NULL, NULL);
ret = CryptImportPublicKeyInfoEx(0, 0, NULL, 0, 0, NULL, NULL);
...
@@ -5820,9 +5822,37 @@ static void testImportPublicKey(HCRYPTPROV csp, PCERT_PUBLIC_KEY_INFO info)
...
@@ -5820,9 +5822,37 @@ static void testImportPublicKey(HCRYPTPROV csp, PCERT_PUBLIC_KEY_INFO info)
&
key
);
&
key
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %08x
\n
"
,
GetLastError
());
"Expected ERROR_INVALID_PARAMETER, got %08x
\n
"
,
GetLastError
());
/* Export key with standard algorithm (CALG_RSA_KEYX) */
ret
=
CryptImportPublicKeyInfoEx
(
csp
,
X509_ASN_ENCODING
,
info
,
0
,
0
,
NULL
,
ret
=
CryptImportPublicKeyInfoEx
(
csp
,
X509_ASN_ENCODING
,
info
,
0
,
0
,
NULL
,
&
key
);
&
key
);
ok
(
ret
,
"CryptImportPublicKeyInfoEx failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptImportPublicKeyInfoEx failed: %08x
\n
"
,
GetLastError
());
dwSize
=
sizeof
(
ai
);
CryptGetKeyParam
(
key
,
KP_ALGID
,
(
LPVOID
)
&
ai
,
&
dwSize
,
0
);
ok
(
ret
,
"CryptGetKeyParam failed: %08x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
dwSize
==
sizeof
(
ai
),
"CryptGetKeyParam returned size %d
\n
"
,
dwSize
);
ok
(
ai
==
CALG_RSA_KEYX
,
"Default ALG_ID is %04x (expected CALG_RSA_KEYX)
\n
"
,
ai
);
}
CryptDestroyKey
(
key
);
/* Repeat with forced algorithm */
ret
=
CryptImportPublicKeyInfoEx
(
csp
,
X509_ASN_ENCODING
,
info
,
CALG_RSA_SIGN
,
0
,
NULL
,
&
key
);
ok
(
ret
,
"CryptImportPublicKeyInfoEx failed: %08x
\n
"
,
GetLastError
());
dwSize
=
sizeof
(
ai
);
CryptGetKeyParam
(
key
,
KP_ALGID
,
(
LPVOID
)
&
ai
,
&
dwSize
,
0
);
ok
(
ret
,
"CryptGetKeyParam failed: %08x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
dwSize
==
sizeof
(
ai
),
"CryptGetKeyParam returned size %d
\n
"
,
dwSize
);
ok
(
ai
==
CALG_RSA_SIGN
,
"ALG_ID is %04x (expected CALG_RSA_SIGN)
\n
"
,
ai
);
}
CryptDestroyKey
(
key
);
CryptDestroyKey
(
key
);
/* Test importing a public key from a certificate context */
/* Test importing a public key from a certificate context */
...
...
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