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
7e7e73d0
Commit
7e7e73d0
authored
Nov 06, 2009
by
Juan Lang
Committed by
Alexandre Julliard
Nov 09, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Implement decoding cert policy mappings.
parent
bf5e4d9b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
2 deletions
+60
-2
decode.c
dlls/crypt32/decode.c
+60
-0
encode.c
dlls/crypt32/tests/encode.c
+0
-2
No files found.
dlls/crypt32/decode.c
View file @
7e7e73d0
...
...
@@ -3632,6 +3632,59 @@ static BOOL WINAPI CRYPT_AsnDecodeCertPolicies(DWORD dwCertEncodingType,
return
ret
;
}
static
BOOL
CRYPT_AsnDecodeCertPolicyMapping
(
const
BYTE
*
pbEncoded
,
DWORD
cbEncoded
,
DWORD
dwFlags
,
void
*
pvStructInfo
,
DWORD
*
pcbStructInfo
,
DWORD
*
pcbDecoded
)
{
struct
AsnDecodeSequenceItem
items
[]
=
{
{
ASN_OBJECTIDENTIFIER
,
offsetof
(
CERT_POLICY_MAPPING
,
pszIssuerDomainPolicy
),
CRYPT_AsnDecodeOidInternal
,
sizeof
(
LPSTR
),
FALSE
,
TRUE
,
offsetof
(
CERT_POLICY_MAPPING
,
pszIssuerDomainPolicy
),
0
},
{
ASN_OBJECTIDENTIFIER
,
offsetof
(
CERT_POLICY_MAPPING
,
pszSubjectDomainPolicy
),
CRYPT_AsnDecodeOidInternal
,
sizeof
(
LPSTR
),
FALSE
,
TRUE
,
offsetof
(
CERT_POLICY_MAPPING
,
pszSubjectDomainPolicy
),
0
},
};
CERT_POLICY_MAPPING
*
mapping
=
pvStructInfo
;
BOOL
ret
;
TRACE
(
"%p, %d, %08x, %p, %d
\n
"
,
pbEncoded
,
cbEncoded
,
dwFlags
,
pvStructInfo
,
pvStructInfo
?
*
pcbStructInfo
:
0
);
ret
=
CRYPT_AsnDecodeSequence
(
items
,
sizeof
(
items
)
/
sizeof
(
items
[
0
]),
pbEncoded
,
cbEncoded
,
dwFlags
,
NULL
,
pvStructInfo
,
pcbStructInfo
,
pcbDecoded
,
mapping
?
mapping
->
pszIssuerDomainPolicy
:
NULL
);
return
ret
;
}
static
BOOL
WINAPI
CRYPT_AsnDecodeCertPolicyMappings
(
DWORD
dwCertEncodingType
,
LPCSTR
lpszStructType
,
const
BYTE
*
pbEncoded
,
DWORD
cbEncoded
,
DWORD
dwFlags
,
PCRYPT_DECODE_PARA
pDecodePara
,
void
*
pvStructInfo
,
DWORD
*
pcbStructInfo
)
{
BOOL
ret
=
FALSE
;
TRACE
(
"%p, %d, %08x, %p, %p, %d
\n
"
,
pbEncoded
,
cbEncoded
,
dwFlags
,
pDecodePara
,
pvStructInfo
,
pvStructInfo
?
*
pcbStructInfo
:
0
);
__TRY
{
struct
AsnArrayDescriptor
arrayDesc
=
{
ASN_SEQUENCEOF
,
offsetof
(
CERT_POLICY_MAPPINGS_INFO
,
cPolicyMapping
),
offsetof
(
CERT_POLICY_MAPPINGS_INFO
,
rgPolicyMapping
),
sizeof
(
CERT_POLICY_MAPPING
),
CRYPT_AsnDecodeCertPolicyMapping
,
sizeof
(
CERT_POLICY_MAPPING
),
TRUE
,
offsetof
(
CERT_POLICY_MAPPING
,
pszIssuerDomainPolicy
)
};
ret
=
CRYPT_AsnDecodeArray
(
&
arrayDesc
,
pbEncoded
,
cbEncoded
,
dwFlags
,
pDecodePara
,
pvStructInfo
,
pcbStructInfo
,
NULL
);
}
__EXCEPT_PAGE_FAULT
{
SetLastError
(
STATUS_ACCESS_VIOLATION
);
}
__ENDTRY
return
ret
;
}
#define RSA1_MAGIC 0x31415352
struct
DECODED_RSA_PUB_KEY
...
...
@@ -5494,6 +5547,9 @@ static CryptDecodeObjectExFunc CRYPT_GetBuiltinDecoder(DWORD dwCertEncodingType,
case
LOWORD
(
X509_NAME_CONSTRAINTS
):
decodeFunc
=
CRYPT_AsnDecodeNameConstraints
;
break
;
case
LOWORD
(
X509_POLICY_MAPPINGS
):
decodeFunc
=
CRYPT_AsnDecodeCertPolicyMappings
;
break
;
case
LOWORD
(
PKCS7_SIGNER_INFO
):
decodeFunc
=
CRYPT_AsnDecodePKCSSignerInfo
;
break
;
...
...
@@ -5510,6 +5566,8 @@ static CryptDecodeObjectExFunc CRYPT_GetBuiltinDecoder(DWORD dwCertEncodingType,
decodeFunc
=
CRYPT_AsnDecodeSMIMECapabilities
;
else
if
(
!
strcmp
(
lpszStructType
,
szOID_AUTHORITY_KEY_IDENTIFIER
))
decodeFunc
=
CRYPT_AsnDecodeAuthorityKeyId
;
else
if
(
!
strcmp
(
lpszStructType
,
szOID_LEGACY_POLICY_MAPPINGS
))
decodeFunc
=
CRYPT_AsnDecodeCertPolicyMappings
;
else
if
(
!
strcmp
(
lpszStructType
,
szOID_AUTHORITY_KEY_IDENTIFIER2
))
decodeFunc
=
CRYPT_AsnDecodeAuthorityKeyId2
;
else
if
(
!
strcmp
(
lpszStructType
,
szOID_CRL_REASON_CODE
))
...
...
@@ -5536,6 +5594,8 @@ static CryptDecodeObjectExFunc CRYPT_GetBuiltinDecoder(DWORD dwCertEncodingType,
decodeFunc
=
CRYPT_AsnDecodeCRLDistPoints
;
else
if
(
!
strcmp
(
lpszStructType
,
szOID_CERT_POLICIES
))
decodeFunc
=
CRYPT_AsnDecodeCertPolicies
;
else
if
(
!
strcmp
(
lpszStructType
,
szOID_POLICY_MAPPINGS
))
decodeFunc
=
CRYPT_AsnDecodeCertPolicyMappings
;
else
if
(
!
strcmp
(
lpszStructType
,
szOID_ENHANCED_KEY_USAGE
))
decodeFunc
=
CRYPT_AsnDecodeEnhancedKeyUsage
;
else
if
(
!
strcmp
(
lpszStructType
,
szOID_ISSUING_DIST_POINT
))
...
...
dlls/crypt32/tests/encode.c
View file @
7e7e73d0
...
...
@@ -7506,7 +7506,6 @@ static void test_decodeCertPolicyMappings(DWORD dwEncoding)
/* Each of the mapping OIDs is equivalent, so check with all of them */
for
(
i
=
0
;
i
<
sizeof
(
mappingOids
)
/
sizeof
(
mappingOids
[
0
]);
i
++
)
{
todo_wine
{
ret
=
pCryptDecodeObjectEx
(
dwEncoding
,
mappingOids
[
i
],
emptySequence
,
sizeof
(
emptySequence
),
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
&
info
,
&
size
);
...
...
@@ -7555,7 +7554,6 @@ static void test_decodeCertPolicyMappings(DWORD dwEncoding)
info
->
rgPolicyMapping
[
1
].
pszSubjectDomainPolicy
);
LocalFree
(
info
);
}
}
}
}
...
...
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