Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
3dd2cc5e
Commit
3dd2cc5e
authored
Nov 13, 2008
by
Juan Lang
Committed by
Alexandre Julliard
Nov 17, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Implement encoding CERT_POLICY_QUALIFIER_USER_NOTICE.
parent
94de4208
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
113 additions
and
3 deletions
+113
-3
encode.c
dlls/crypt32/encode.c
+113
-0
encode.c
dlls/crypt32/tests/encode.c
+0
-3
No files found.
dlls/crypt32/encode.c
View file @
3dd2cc5e
...
...
@@ -1697,6 +1697,114 @@ static BOOL WINAPI CRYPT_AsnEncodeSMIMECapabilities(DWORD dwCertEncodingType,
return
ret
;
}
static
BOOL
WINAPI
CRYPT_AsnEncodeNoticeNumbers
(
DWORD
dwCertEncodingType
,
LPCSTR
lpszStructType
,
const
void
*
pvStructInfo
,
DWORD
dwFlags
,
PCRYPT_ENCODE_PARA
pEncodePara
,
BYTE
*
pbEncoded
,
DWORD
*
pcbEncoded
)
{
const
CERT_POLICY_QUALIFIER_NOTICE_REFERENCE
*
noticeRef
=
pvStructInfo
;
DWORD
bytesNeeded
,
dataLen
,
lenBytes
,
i
;
BOOL
ret
=
TRUE
;
for
(
i
=
0
,
dataLen
=
0
;
ret
&&
i
<
noticeRef
->
cNoticeNumbers
;
i
++
)
{
DWORD
size
;
ret
=
CRYPT_AsnEncodeInt
(
dwCertEncodingType
,
X509_INTEGER
,
&
noticeRef
->
rgNoticeNumbers
[
i
],
0
,
NULL
,
NULL
,
&
size
);
if
(
ret
)
dataLen
+=
size
;
}
if
(
ret
)
{
CRYPT_EncodeLen
(
dataLen
,
NULL
,
&
lenBytes
);
bytesNeeded
=
1
+
lenBytes
+
dataLen
;
if
(
!
pbEncoded
)
*
pcbEncoded
=
bytesNeeded
;
else
{
if
((
ret
=
CRYPT_EncodeEnsureSpace
(
dwFlags
,
pEncodePara
,
pbEncoded
,
pcbEncoded
,
bytesNeeded
)))
{
if
(
dwFlags
&
CRYPT_ENCODE_ALLOC_FLAG
)
pbEncoded
=
*
(
BYTE
**
)
pbEncoded
;
*
pbEncoded
++
=
ASN_SEQUENCE
;
CRYPT_EncodeLen
(
dataLen
,
pbEncoded
,
&
lenBytes
);
pbEncoded
+=
lenBytes
;
for
(
i
=
0
;
i
<
noticeRef
->
cNoticeNumbers
;
i
++
)
{
DWORD
size
=
dataLen
;
ret
=
CRYPT_AsnEncodeInt
(
dwCertEncodingType
,
X509_INTEGER
,
&
noticeRef
->
rgNoticeNumbers
[
i
],
0
,
NULL
,
pbEncoded
,
&
size
);
pbEncoded
+=
size
;
dataLen
-=
size
;
}
}
}
}
return
ret
;
}
static
BOOL
WINAPI
CRYPT_AsnEncodeNoticeReference
(
DWORD
dwCertEncodingType
,
LPCSTR
lpszStructType
,
const
void
*
pvStructInfo
,
DWORD
dwFlags
,
PCRYPT_ENCODE_PARA
pEncodePara
,
BYTE
*
pbEncoded
,
DWORD
*
pcbEncoded
)
{
const
CERT_POLICY_QUALIFIER_NOTICE_REFERENCE
*
noticeRef
=
pvStructInfo
;
BOOL
ret
;
CERT_NAME_VALUE
orgValue
=
{
CERT_RDN_IA5_STRING
,
{
0
,
(
LPBYTE
)
noticeRef
->
pszOrganization
}
};
struct
AsnEncodeSequenceItem
items
[]
=
{
{
&
orgValue
,
CRYPT_AsnEncodeNameValue
,
0
},
{
noticeRef
,
CRYPT_AsnEncodeNoticeNumbers
,
0
},
};
ret
=
CRYPT_AsnEncodeSequence
(
dwCertEncodingType
,
items
,
sizeof
(
items
)
/
sizeof
(
items
[
0
]),
dwFlags
,
pEncodePara
,
pbEncoded
,
pcbEncoded
);
return
ret
;
}
static
BOOL
WINAPI
CRYPT_AsnEncodePolicyQualifierUserNotice
(
DWORD
dwCertEncodingType
,
LPCSTR
lpszStructType
,
const
void
*
pvStructInfo
,
DWORD
dwFlags
,
PCRYPT_ENCODE_PARA
pEncodePara
,
BYTE
*
pbEncoded
,
DWORD
*
pcbEncoded
)
{
BOOL
ret
=
FALSE
;
__TRY
{
const
CERT_POLICY_QUALIFIER_USER_NOTICE
*
notice
=
pvStructInfo
;
struct
AsnEncodeSequenceItem
items
[
2
];
CERT_NAME_VALUE
displayTextValue
;
DWORD
cItem
=
0
;
ret
=
TRUE
;
if
(
notice
->
pNoticeReference
)
{
items
[
cItem
].
encodeFunc
=
CRYPT_AsnEncodeNoticeReference
;
items
[
cItem
].
pvStructInfo
=
notice
->
pNoticeReference
;
cItem
++
;
}
if
(
notice
->
pszDisplayText
)
{
displayTextValue
.
dwValueType
=
CERT_RDN_BMP_STRING
;
displayTextValue
.
Value
.
cbData
=
0
;
displayTextValue
.
Value
.
pbData
=
(
LPBYTE
)
notice
->
pszDisplayText
;
items
[
cItem
].
encodeFunc
=
CRYPT_AsnEncodeNameValue
;
items
[
cItem
].
pvStructInfo
=
&
displayTextValue
;
cItem
++
;
}
ret
=
CRYPT_AsnEncodeSequence
(
dwCertEncodingType
,
items
,
cItem
,
dwFlags
,
pEncodePara
,
pbEncoded
,
pcbEncoded
);
}
__EXCEPT_PAGE_FAULT
{
SetLastError
(
STATUS_ACCESS_VIOLATION
);
}
__ENDTRY
return
ret
;
}
static
BOOL
WINAPI
CRYPT_AsnEncodePKCSAttribute
(
DWORD
dwCertEncodingType
,
LPCSTR
lpszStructType
,
const
void
*
pvStructInfo
,
DWORD
dwFlags
,
PCRYPT_ENCODE_PARA
pEncodePara
,
BYTE
*
pbEncoded
,
DWORD
*
pcbEncoded
)
...
...
@@ -4063,6 +4171,9 @@ static CryptEncodeObjectExFunc CRYPT_GetBuiltinEncoder(DWORD dwCertEncodingType,
case
LOWORD
(
PKCS_SMIME_CAPABILITIES
):
encodeFunc
=
CRYPT_AsnEncodeSMIMECapabilities
;
break
;
case
LOWORD
(
X509_PKIX_POLICY_QUALIFIER_USERNOTICE
):
encodeFunc
=
CRYPT_AsnEncodePolicyQualifierUserNotice
;
break
;
case
LOWORD
(
PKCS_ATTRIBUTES
):
encodeFunc
=
CRYPT_AsnEncodePKCSAttributes
;
break
;
...
...
@@ -4120,6 +4231,8 @@ static CryptEncodeObjectExFunc CRYPT_GetBuiltinEncoder(DWORD dwCertEncodingType,
encodeFunc
=
CRYPT_AsnEncodeNameConstraints
;
else
if
(
!
strcmp
(
lpszStructType
,
szOID_AUTHORITY_INFO_ACCESS
))
encodeFunc
=
CRYPT_AsnEncodeAuthorityInfoAccess
;
else
if
(
!
strcmp
(
lpszStructType
,
szOID_PKIX_POLICY_QUALIFIER_USERNOTICE
))
encodeFunc
=
CRYPT_AsnEncodePolicyQualifierUserNotice
;
else
if
(
!
strcmp
(
lpszStructType
,
szOID_CTL
))
encodeFunc
=
CRYPT_AsnEncodeCTL
;
return
encodeFunc
;
...
...
dlls/crypt32/tests/encode.c
View file @
3dd2cc5e
...
...
@@ -7065,7 +7065,6 @@ static void test_encodePolicyQualifierUserNotice(DWORD dwEncoding)
ret
=
pCryptEncodeObjectEx
(
dwEncoding
,
X509_PKIX_POLICY_QUALIFIER_USERNOTICE
,
&
notice
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
todo_wine
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
if
(
ret
)
{
...
...
@@ -7077,7 +7076,6 @@ static void test_encodePolicyQualifierUserNotice(DWORD dwEncoding)
ret
=
pCryptEncodeObjectEx
(
dwEncoding
,
X509_PKIX_POLICY_QUALIFIER_USERNOTICE
,
&
notice
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
todo_wine
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
if
(
ret
)
{
...
...
@@ -7092,7 +7090,6 @@ static void test_encodePolicyQualifierUserNotice(DWORD dwEncoding)
ret
=
pCryptEncodeObjectEx
(
dwEncoding
,
X509_PKIX_POLICY_QUALIFIER_USERNOTICE
,
&
notice
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
todo_wine
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
if
(
ret
)
{
...
...
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