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
da3eeb4b
Commit
da3eeb4b
authored
Jul 28, 2006
by
Juan Lang
Committed by
Alexandre Julliard
Jul 29, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Implement CryptHashPublicKeyInfo.
parent
669b0a52
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
1 deletion
+76
-1
cert.c
dlls/crypt32/cert.c
+38
-0
crypt32.spec
dlls/crypt32/crypt32.spec
+1
-1
cert.c
dlls/crypt32/tests/cert.c
+33
-0
wincrypt.h
include/wincrypt.h
+4
-0
No files found.
dlls/crypt32/cert.c
View file @
da3eeb4b
...
...
@@ -1115,6 +1115,44 @@ BOOL WINAPI CryptHashCertificate(HCRYPTPROV hCryptProv, ALG_ID Algid,
return
ret
;
}
BOOL
WINAPI
CryptHashPublicKeyInfo
(
HCRYPTPROV
hCryptProv
,
ALG_ID
Algid
,
DWORD
dwFlags
,
DWORD
dwCertEncodingType
,
PCERT_PUBLIC_KEY_INFO
pInfo
,
BYTE
*
pbComputedHash
,
DWORD
*
pcbComputedHash
)
{
BOOL
ret
=
TRUE
;
HCRYPTHASH
hHash
=
0
;
TRACE
(
"(%ld, %d, %08lx, %ld, %p, %p, %p)
\n
"
,
hCryptProv
,
Algid
,
dwFlags
,
dwCertEncodingType
,
pInfo
,
pbComputedHash
,
pcbComputedHash
);
if
(
!
hCryptProv
)
hCryptProv
=
CRYPT_GetDefaultProvider
();
if
(
!
Algid
)
Algid
=
CALG_MD5
;
if
(
ret
)
{
BYTE
*
buf
;
DWORD
size
=
0
;
ret
=
CryptEncodeObjectEx
(
dwCertEncodingType
,
X509_PUBLIC_KEY_INFO
,
pInfo
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
if
(
ret
)
{
ret
=
CryptCreateHash
(
hCryptProv
,
Algid
,
0
,
0
,
&
hHash
);
if
(
ret
)
{
ret
=
CryptHashData
(
hHash
,
buf
,
size
,
0
);
if
(
ret
)
ret
=
CryptGetHashParam
(
hHash
,
HP_HASHVAL
,
pbComputedHash
,
pcbComputedHash
,
0
);
CryptDestroyHash
(
hHash
);
}
LocalFree
(
buf
);
}
}
return
ret
;
}
BOOL
WINAPI
CryptSignCertificate
(
HCRYPTPROV
hCryptProv
,
DWORD
dwKeySpec
,
DWORD
dwCertEncodingType
,
const
BYTE
*
pbEncodedToBeSigned
,
DWORD
cbEncodedToBeSigned
,
PCRYPT_ALGORITHM_IDENTIFIER
pSignatureAlgorithm
,
...
...
dlls/crypt32/crypt32.spec
View file @
da3eeb4b
...
...
@@ -124,7 +124,7 @@
@ stdcall CryptGetOIDFunctionValue(long str str wstr ptr ptr ptr)
@ stdcall CryptHashCertificate(long long long ptr long ptr ptr)
@ stub CryptHashMessage
@ st
ub CryptHashPublicKeyInfo
@ st
dcall CryptHashPublicKeyInfo(long long long long ptr ptr ptr)
@ stub CryptHashToBeSigned
@ stub CryptImportPKCS8
@ stdcall CryptImportPublicKeyInfo(long long ptr ptr)
...
...
dlls/crypt32/tests/cert.c
View file @
da3eeb4b
...
...
@@ -1544,6 +1544,38 @@ static void testComparePublicKeyInfo(void)
ok
(
!
ret
,
"Expected keys not to compare
\n
"
);
}
static
void
testHashPublicKeyInfo
(
void
)
{
BOOL
ret
;
CERT_PUBLIC_KEY_INFO
info
=
{
{
0
}
};
DWORD
len
;
/* Crash
ret = CryptHashPublicKeyInfo(0, 0, 0, 0, NULL, NULL, NULL);
ret = CryptHashPublicKeyInfo(0, 0, 0, 0, &info, NULL, NULL);
*/
ret
=
CryptHashPublicKeyInfo
(
0
,
0
,
0
,
0
,
NULL
,
NULL
,
&
len
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"Expected ERROR_FILE_NOT_FOUND, got %08lx
\n
"
,
GetLastError
());
ret
=
CryptHashPublicKeyInfo
(
0
,
0
,
0
,
X509_ASN_ENCODING
,
NULL
,
NULL
,
&
len
);
ok
(
!
ret
&&
GetLastError
()
==
STATUS_ACCESS_VIOLATION
,
"Expected STATUS_ACCESS_VIOLATION, got %08lx
\n
"
,
GetLastError
());
ret
=
CryptHashPublicKeyInfo
(
0
,
0
,
0
,
X509_ASN_ENCODING
,
&
info
,
NULL
,
&
len
);
ok
(
ret
,
"CryptHashPublicKeyInfo failed: %08lx
\n
"
,
GetLastError
());
ok
(
len
==
16
,
"Expected hash size 16, got %ld
\n
"
,
len
);
if
(
len
==
16
)
{
static
const
BYTE
emptyHash
[]
=
{
0xb8
,
0x51
,
0x3a
,
0x31
,
0x0e
,
0x9f
,
0x40
,
0x36
,
0x9c
,
0x92
,
0x45
,
0x1b
,
0x9d
,
0xc8
,
0xf9
,
0xf6
};
BYTE
buf
[
16
];
ret
=
CryptHashPublicKeyInfo
(
0
,
0
,
0
,
X509_ASN_ENCODING
,
&
info
,
buf
,
&
len
);
ok
(
ret
,
"CryptHashPublicKeyInfo failed: %08lx
\n
"
,
GetLastError
());
ok
(
!
memcmp
(
buf
,
emptyHash
,
len
),
"Unexpected hash
\n
"
);
}
}
void
testCompareCert
(
void
)
{
CERT_INFO
info1
=
{
0
},
info2
=
{
0
};
...
...
@@ -1827,6 +1859,7 @@ START_TEST(cert)
testCompareCertName
();
testCompareIntegerBlob
();
testComparePublicKeyInfo
();
testHashPublicKeyInfo
();
testCompareCert
();
testVerifySubjectCert
();
testAcquireCertPrivateKey
();
...
...
include/wincrypt.h
View file @
da3eeb4b
...
...
@@ -2936,6 +2936,10 @@ BOOL WINAPI CryptHashCertificate(HCRYPTPROV hCryptProv, ALG_ID Algid,
DWORD
dwFlags
,
const
BYTE
*
pbEncoded
,
DWORD
cbEncoded
,
BYTE
*
pbComputedHash
,
DWORD
*
pcbComputedHash
);
BOOL
WINAPI
CryptHashPublicKeyInfo
(
HCRYPTPROV
hCryptProv
,
ALG_ID
Algid
,
DWORD
dwFlags
,
DWORD
dwCertEncodingType
,
PCERT_PUBLIC_KEY_INFO
pInfo
,
BYTE
*
pbComputedHash
,
DWORD
*
pcbComputedHash
);
BOOL
WINAPI
CryptHashToBeSigned
(
HCRYPTPROV
hCryptProv
,
DWORD
dwCertEncodingType
,
const
BYTE
*
pbEncoded
,
DWORD
cbEncoded
,
BYTE
*
pbComputedHash
,
DWORD
*
pcbComputedHash
);
...
...
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