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
ae5823db
Commit
ae5823db
authored
Mar 16, 2006
by
Juan Lang
Committed by
Alexandre Julliard
Mar 17, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Implement CertGetSubjectCertificateFromStore.
parent
7870a5a6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
82 additions
and
3 deletions
+82
-3
crypt32.spec
dlls/crypt32/crypt32.spec
+1
-1
store.c
dlls/crypt32/store.c
+17
-2
store.c
dlls/crypt32/tests/store.c
+61
-0
wincrypt.h
include/wincrypt.h
+3
-0
No files found.
dlls/crypt32/crypt32.spec
View file @
ae5823db
...
...
@@ -55,7 +55,7 @@
@ stdcall CertGetNameStringA(ptr long long ptr ptr long)
@ stdcall CertGetNameStringW(ptr long long ptr ptr long)
@ stub CertGetPublicKeyLength
@ st
ub CertGetSubjectCertificateFromStore
@ st
dcall CertGetSubjectCertificateFromStore(ptr long ptr)
@ stdcall CertGetValidUsages(long ptr ptr ptr ptr)
@ stub CertIsRDNAttrsInCertificateName
@ stdcall CertNameToStrA(long ptr long ptr long)
...
...
dlls/crypt32/store.c
View file @
ae5823db
...
...
@@ -866,9 +866,10 @@ static PWINECRYPT_CERTSTORE CRYPT_ProvOpenStore(LPCSTR lpszStoreProvider,
dwFlags
,
pvPara
,
NULL
,
&
provInfo
);
else
{
PWINECRYPT_
CERTSTORE
memStore
;
H
CERTSTORE
memStore
;
memStore
=
CRYPT_MemOpenStore
(
hCryptProv
,
dwFlags
,
NULL
);
memStore
=
CertOpenStore
(
CERT_STORE_PROV_MEMORY
,
0
,
0
,
CERT_STORE_CREATE_NEW_FLAG
,
NULL
);
if
(
memStore
)
{
if
(
provOpenFunc
(
lpszStoreProvider
,
dwEncodingType
,
hCryptProv
,
...
...
@@ -2559,6 +2560,20 @@ PCCERT_CONTEXT WINAPI CertFindCertificateInStore(HCERTSTORE hCertStore,
return
ret
;
}
PCCERT_CONTEXT
WINAPI
CertGetSubjectCertificateFromStore
(
HCERTSTORE
hCertStore
,
DWORD
dwCertEncodingType
,
PCERT_INFO
pCertId
)
{
TRACE
(
"(%p, %08lx, %p)
\n
"
,
hCertStore
,
dwCertEncodingType
,
pCertId
);
if
(
!
pCertId
)
{
SetLastError
(
HRESULT_FROM_WIN32
(
ERROR_INVALID_PARAMETER
));
return
NULL
;
}
return
CertFindCertificateInStore
(
hCertStore
,
dwCertEncodingType
,
0
,
CERT_FIND_SUBJECT_CERT
,
pCertId
,
NULL
);
}
BOOL
WINAPI
CertAddStoreToCollection
(
HCERTSTORE
hCollectionStore
,
HCERTSTORE
hSiblingStore
,
DWORD
dwUpdateFlags
,
DWORD
dwPriority
)
{
...
...
dlls/crypt32/tests/store.c
View file @
ae5823db
...
...
@@ -261,6 +261,66 @@ static void testFindCert(void)
}
}
static
void
testGetSubjectCert
(
void
)
{
HCERTSTORE
store
;
store
=
CertOpenStore
(
CERT_STORE_PROV_MEMORY
,
0
,
0
,
CERT_STORE_CREATE_NEW_FLAG
,
NULL
);
ok
(
store
,
"CertOpenStore failed: %ld
\n
"
,
GetLastError
());
if
(
store
!=
NULL
)
{
PCCERT_CONTEXT
context1
,
context2
;
CERT_INFO
info
=
{
0
};
BOOL
ret
;
ret
=
CertAddEncodedCertificateToStore
(
store
,
X509_ASN_ENCODING
,
bigCert
,
sizeof
(
bigCert
),
CERT_STORE_ADD_ALWAYS
,
NULL
);
ok
(
ret
,
"CertAddEncodedCertificateToStore failed: %08lx
\n
"
,
GetLastError
());
ret
=
CertAddEncodedCertificateToStore
(
store
,
X509_ASN_ENCODING
,
bigCert2
,
sizeof
(
bigCert2
),
CERT_STORE_ADD_NEW
,
&
context1
);
ok
(
ret
,
"CertAddEncodedCertificateToStore failed: %08lx
\n
"
,
GetLastError
());
ok
(
context1
!=
NULL
,
"Expected a context
\n
"
);
ret
=
CertAddEncodedCertificateToStore
(
store
,
X509_ASN_ENCODING
,
certWithUsage
,
sizeof
(
certWithUsage
),
CERT_STORE_ADD_NEW
,
NULL
);
ok
(
ret
,
"CertAddEncodedCertificateToStore failed: %08lx
\n
"
,
GetLastError
());
context2
=
CertGetSubjectCertificateFromStore
(
store
,
X509_ASN_ENCODING
,
NULL
);
ok
(
!
context2
&&
GetLastError
()
==
HRESULT_FROM_WIN32
(
ERROR_INVALID_PARAMETER
),
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %08lx
\n
"
,
GetLastError
());
context2
=
CertGetSubjectCertificateFromStore
(
store
,
X509_ASN_ENCODING
,
&
info
);
ok
(
!
context2
&&
GetLastError
()
==
CRYPT_E_NOT_FOUND
,
"Expected CRYPT_E_NOT_FOUND, got %08lx
\n
"
,
GetLastError
());
info
.
SerialNumber
.
cbData
=
sizeof
(
serialNum
);
info
.
SerialNumber
.
pbData
=
(
LPBYTE
)
serialNum
;
context2
=
CertGetSubjectCertificateFromStore
(
store
,
X509_ASN_ENCODING
,
&
info
);
ok
(
!
context2
&&
GetLastError
()
==
CRYPT_E_NOT_FOUND
,
"Expected CRYPT_E_NOT_FOUND, got %08lx
\n
"
,
GetLastError
());
info
.
Issuer
.
cbData
=
sizeof
(
subjectName2
);
info
.
Issuer
.
pbData
=
(
LPBYTE
)
subjectName2
;
context2
=
CertGetSubjectCertificateFromStore
(
store
,
X509_ASN_ENCODING
,
&
info
);
ok
(
context2
!=
NULL
,
"CertGetSubjectCertificateFromStore failed: %08lx
\n
"
,
GetLastError
());
/* Not only should this find a context, but it should be the same
* (same address) as context1.
*/
ok
(
context1
==
context2
,
"Expected identical context addresses
\n
"
);
CertFreeCertificateContext
(
context2
);
CertFreeCertificateContext
(
context1
);
CertCloseStore
(
store
,
0
);
}
}
static
void
testMemStore
(
void
)
{
HCERTSTORE
store1
,
store2
;
...
...
@@ -1534,6 +1594,7 @@ START_TEST(store)
{
testDupCert
();
testFindCert
();
testGetSubjectCert
();
/* various combinations of CertOpenStore */
testMemStore
();
...
...
include/wincrypt.h
View file @
ae5823db
...
...
@@ -2693,6 +2693,9 @@ PCCTL_CONTEXT WINAPI CertFindCTLInStore(HCERTSTORE hCertStore,
DWORD
dwCertEncodingType
,
DWORD
dwFindFlags
,
DWORD
dwFindType
,
const
void
*
pvFindPara
,
PCCTL_CONTEXT
pPrevCtlContext
);
PCCERT_CONTEXT
WINAPI
CertGetSubjectCertificateFromStore
(
HCERTSTORE
hCertStore
,
DWORD
dwCertEncodingType
,
PCERT_INFO
pCertId
);
BOOL
WINAPI
CertSerializeCertificateStoreElement
(
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