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
3d38e859
Commit
3d38e859
authored
Mar 23, 2023
by
Paul Gofman
Committed by
Alexandre Julliard
Mar 24, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Support user properties for certificates.
parent
9af7faca
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
0 deletions
+39
-0
cert.c
dlls/crypt32/cert.c
+13
-0
serialize.c
dlls/crypt32/serialize.c
+6
-0
cert.c
dlls/crypt32/tests/cert.c
+20
-0
No files found.
dlls/crypt32/cert.c
View file @
3d38e859
...
@@ -714,6 +714,19 @@ static BOOL CertContext_SetProperty(cert_t *cert, DWORD dwPropId,
...
@@ -714,6 +714,19 @@ static BOOL CertContext_SetProperty(cert_t *cert, DWORD dwPropId,
if
(
!
cert
->
base
.
properties
)
if
(
!
cert
->
base
.
properties
)
ret
=
FALSE
;
ret
=
FALSE
;
else
if
(
dwPropId
>=
CERT_FIRST_USER_PROP_ID
&&
dwPropId
<=
CERT_LAST_USER_PROP_ID
)
{
if
(
pvData
)
{
const
CRYPT_DATA_BLOB
*
blob
=
pvData
;
ret
=
ContextPropertyList_SetProperty
(
cert
->
base
.
properties
,
dwPropId
,
blob
->
pbData
,
blob
->
cbData
);
}
else
{
ContextPropertyList_RemoveProperty
(
cert
->
base
.
properties
,
dwPropId
);
ret
=
TRUE
;
}
}
else
else
{
{
switch
(
dwPropId
)
switch
(
dwPropId
)
...
...
dlls/crypt32/serialize.c
View file @
3d38e859
...
@@ -405,6 +405,12 @@ static BOOL CRYPT_ReadContextProp(
...
@@ -405,6 +405,12 @@ static BOOL CRYPT_ReadContextProp(
SetLastError
(
ERROR_FILE_NOT_FOUND
);
SetLastError
(
ERROR_FILE_NOT_FOUND
);
ret
=
FALSE
;
ret
=
FALSE
;
}
}
else
if
(
hdr
->
propID
>=
CERT_FIRST_USER_PROP_ID
&&
hdr
->
propID
<=
CERT_LAST_USER_PROP_ID
)
{
CRYPT_DATA_BLOB
blob
=
{
hdr
->
cb
,
(
LPBYTE
)
pbElement
};
ret
=
contextInterface
->
setProp
(
context
,
hdr
->
propID
,
0
,
&
blob
);
}
else
if
(
hdr
->
propID
!=
CERT_CERT_PROP_ID
&&
else
if
(
hdr
->
propID
!=
CERT_CERT_PROP_ID
&&
hdr
->
propID
!=
CERT_CRL_PROP_ID
&&
hdr
->
propID
!=
CERT_CTL_PROP_ID
)
hdr
->
propID
!=
CERT_CRL_PROP_ID
&&
hdr
->
propID
!=
CERT_CTL_PROP_ID
)
{
{
...
...
dlls/crypt32/tests/cert.c
View file @
3d38e859
...
@@ -369,6 +369,7 @@ static void testCertProperties(void)
...
@@ -369,6 +369,7 @@ static void testCertProperties(void)
BYTE
hash
[
20
]
=
{
0
},
hashProperty
[
20
];
BYTE
hash
[
20
]
=
{
0
},
hashProperty
[
20
];
CRYPT_DATA_BLOB
blob
;
CRYPT_DATA_BLOB
blob
;
CERT_KEY_CONTEXT
keyContext
;
CERT_KEY_CONTEXT
keyContext
;
unsigned
int
value
;
ok
(
context
!=
NULL
,
"CertCreateCertificateContext failed: %08lx
\n
"
,
GetLastError
());
ok
(
context
!=
NULL
,
"CertCreateCertificateContext failed: %08lx
\n
"
,
GetLastError
());
...
@@ -566,6 +567,25 @@ static void testCertProperties(void)
...
@@ -566,6 +567,25 @@ static void testCertProperties(void)
free
(
buf
);
free
(
buf
);
}
}
}
}
ret
=
CertGetCertificateContextProperty
(
context
,
CERT_LAST_USER_PROP_ID
,
NULL
,
&
size
);
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_NOT_FOUND
,
"got ret %d, error %#lx.
\n
"
,
ret
,
GetLastError
());
blob
.
cbData
=
sizeof
(
value
);
blob
.
pbData
=
(
BYTE
*
)
&
value
;
value
=
1
;
ret
=
CertSetCertificateContextProperty
(
context
,
CERT_LAST_USER_PROP_ID
,
0
,
&
blob
);
ok
(
ret
,
"got error %#lx.
\n
"
,
GetLastError
());
value
=
0xdeadbeef
;
size
=
0xdeadbeef
;
ret
=
CertGetCertificateContextProperty
(
context
,
CERT_LAST_USER_PROP_ID
,
NULL
,
&
size
);
ok
(
ret
,
"got error %#lx.
\n
"
,
GetLastError
());
ok
(
size
==
sizeof
(
value
),
"got size %lu.
\n
"
,
size
);
ret
=
CertGetCertificateContextProperty
(
context
,
CERT_LAST_USER_PROP_ID
,
&
value
,
&
size
);
ok
(
ret
,
"got error %#lx.
\n
"
,
GetLastError
());
ok
(
size
==
sizeof
(
value
),
"got size %lu.
\n
"
,
size
);
ok
(
value
==
1
,
"got value %u.
\n
"
,
value
);
CertFreeCertificateContext
(
context
);
CertFreeCertificateContext
(
context
);
context
=
CertCreateCertificateContext
(
X509_ASN_ENCODING
,
context
=
CertCreateCertificateContext
(
X509_ASN_ENCODING
,
...
...
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