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
76d25370
Commit
76d25370
authored
Nov 19, 2008
by
Juan Lang
Committed by
Alexandre Julliard
Nov 20, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Implement CryptFormatObject for szOID_NETSCAPE_CERT_TYPE.
parent
5eb2a831
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
124 additions
and
0 deletions
+124
-0
crypt32_En.rc
dlls/crypt32/crypt32_En.rc
+7
-0
cryptres.h
dlls/crypt32/cryptres.h
+7
-0
object.c
dlls/crypt32/object.c
+110
-0
No files found.
dlls/crypt32/crypt32_En.rc
View file @
76d25370
...
...
@@ -227,4 +227,11 @@ STRINGTABLE DISCARDABLE
IDS_CRL_SIGN "CRL Signing"
IDS_ENCIPHER_ONLY "Encipher Only"
IDS_DECIPHER_ONLY "Decipher Only"
IDS_NETSCAPE_SSL_CLIENT "SSL Client Authentication"
IDS_NETSCAPE_SSL_SERVER "SSL Server Authentication"
IDS_NETSCAPE_SMIME "S/MIME"
IDS_NETSCAPE_SIGN "Signature"
IDS_NETSCAPE_SSL_CA "SSL CA"
IDS_NETSCAPE_SMIME_CA "S/MIME CA"
IDS_NETSCAPE_SIGN_CA "Signature CA"
}
dlls/crypt32/cryptres.h
View file @
76d25370
...
...
@@ -217,5 +217,12 @@
#define IDS_CRL_SIGN 1250
#define IDS_ENCIPHER_ONLY 1251
#define IDS_DECIPHER_ONLY 1252
#define IDS_NETSCAPE_SSL_CLIENT 1253
#define IDS_NETSCAPE_SSL_SERVER 1254
#define IDS_NETSCAPE_SMIME 1255
#define IDS_NETSCAPE_SIGN 1256
#define IDS_NETSCAPE_SSL_CA 1257
#define IDS_NETSCAPE_SMIME_CA 1258
#define IDS_NETSCAPE_SIGN_CA 1259
#endif
/* ndef __WINE_CRYPTRES_H__ */
dlls/crypt32/object.c
View file @
76d25370
...
...
@@ -2057,6 +2057,114 @@ static BOOL WINAPI CRYPT_FormatEnhancedKeyUsage(DWORD dwCertEncodingType,
return
ret
;
}
static
struct
BitToString
netscapeCertTypeMap
[]
=
{
{
NETSCAPE_SSL_CLIENT_AUTH_CERT_TYPE
,
IDS_NETSCAPE_SSL_CLIENT
,
{
0
}
},
{
NETSCAPE_SSL_SERVER_AUTH_CERT_TYPE
,
IDS_NETSCAPE_SSL_SERVER
,
{
0
}
},
{
NETSCAPE_SMIME_CERT_TYPE
,
IDS_NETSCAPE_SMIME
,
{
0
}
},
{
NETSCAPE_SIGN_CERT_TYPE
,
IDS_NETSCAPE_SIGN
,
{
0
}
},
{
NETSCAPE_SSL_CA_CERT_TYPE
,
IDS_NETSCAPE_SSL_CA
,
{
0
}
},
{
NETSCAPE_SMIME_CA_CERT_TYPE
,
IDS_NETSCAPE_SMIME_CA
,
{
0
}
},
{
NETSCAPE_SIGN_CA_CERT_TYPE
,
IDS_NETSCAPE_SIGN_CA
,
{
0
}
},
};
static
BOOL
WINAPI
CRYPT_FormatNetscapeCertType
(
DWORD
dwCertEncodingType
,
DWORD
dwFormatType
,
DWORD
dwFormatStrType
,
void
*
pFormatStruct
,
LPCSTR
lpszStructType
,
const
BYTE
*
pbEncoded
,
DWORD
cbEncoded
,
void
*
pbFormat
,
DWORD
*
pcbFormat
)
{
DWORD
size
;
CRYPT_BIT_BLOB
*
bits
;
BOOL
ret
;
if
(
!
cbEncoded
)
{
SetLastError
(
E_INVALIDARG
);
return
FALSE
;
}
if
((
ret
=
CryptDecodeObjectEx
(
dwCertEncodingType
,
X509_BITS
,
pbEncoded
,
cbEncoded
,
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
&
bits
,
&
size
)))
{
WCHAR
infoNotAvailable
[
MAX_STRING_RESOURCE_LEN
];
DWORD
bytesNeeded
=
sizeof
(
WCHAR
);
LoadStringW
(
hInstance
,
IDS_INFO_NOT_AVAILABLE
,
infoNotAvailable
,
sizeof
(
infoNotAvailable
)
/
sizeof
(
infoNotAvailable
[
0
]));
if
(
!
bits
->
cbData
||
bits
->
cbData
>
1
)
{
bytesNeeded
+=
strlenW
(
infoNotAvailable
)
*
sizeof
(
WCHAR
);
if
(
!
pbFormat
)
*
pcbFormat
=
bytesNeeded
;
else
if
(
*
pcbFormat
<
bytesNeeded
)
{
*
pcbFormat
=
bytesNeeded
;
SetLastError
(
ERROR_MORE_DATA
);
ret
=
FALSE
;
}
else
{
LPWSTR
str
=
pbFormat
;
*
pcbFormat
=
bytesNeeded
;
strcpyW
(
str
,
infoNotAvailable
);
}
}
else
{
static
BOOL
stringsLoaded
=
FALSE
;
int
i
;
DWORD
bitStringLen
;
BOOL
first
=
TRUE
;
if
(
!
stringsLoaded
)
{
for
(
i
=
0
;
i
<
sizeof
(
netscapeCertTypeMap
)
/
sizeof
(
netscapeCertTypeMap
[
0
]);
i
++
)
LoadStringW
(
hInstance
,
netscapeCertTypeMap
[
i
].
id
,
netscapeCertTypeMap
[
i
].
str
,
MAX_STRING_RESOURCE_LEN
);
stringsLoaded
=
TRUE
;
}
CRYPT_FormatBits
(
dwFormatStrType
,
bits
->
pbData
[
0
],
netscapeCertTypeMap
,
sizeof
(
netscapeCertTypeMap
)
/
sizeof
(
netscapeCertTypeMap
[
0
]),
NULL
,
&
bitStringLen
,
&
first
);
bytesNeeded
+=
bitStringLen
;
bytesNeeded
+=
3
*
sizeof
(
WCHAR
);
/* " (" + ")" */
CRYPT_FormatHexString
(
0
,
0
,
0
,
NULL
,
NULL
,
bits
->
pbData
,
bits
->
cbData
,
NULL
,
&
size
);
bytesNeeded
+=
size
;
if
(
!
pbFormat
)
*
pcbFormat
=
bytesNeeded
;
else
if
(
*
pcbFormat
<
bytesNeeded
)
{
*
pcbFormat
=
bytesNeeded
;
SetLastError
(
ERROR_MORE_DATA
);
ret
=
FALSE
;
}
else
{
LPWSTR
str
=
pbFormat
;
bitStringLen
=
bytesNeeded
;
first
=
TRUE
;
CRYPT_FormatBits
(
dwFormatStrType
,
bits
->
pbData
[
0
],
netscapeCertTypeMap
,
sizeof
(
netscapeCertTypeMap
)
/
sizeof
(
netscapeCertTypeMap
[
0
]),
str
,
&
bitStringLen
,
&
first
);
str
+=
bitStringLen
/
sizeof
(
WCHAR
)
-
1
;
*
str
++
=
' '
;
*
str
++
=
'('
;
CRYPT_FormatHexString
(
0
,
0
,
0
,
NULL
,
NULL
,
bits
->
pbData
,
bits
->
cbData
,
str
,
&
size
);
str
+=
size
/
sizeof
(
WCHAR
)
-
1
;
*
str
++
=
')'
;
*
str
=
0
;
}
}
LocalFree
(
bits
);
}
return
ret
;
}
static
WCHAR
financialCriteria
[
MAX_STRING_RESOURCE_LEN
];
static
WCHAR
available
[
MAX_STRING_RESOURCE_LEN
];
static
WCHAR
notAvailable
[
MAX_STRING_RESOURCE_LEN
];
...
...
@@ -2225,6 +2333,8 @@ static CryptFormatObjectFunc CRYPT_GetBuiltinFormatFunction(DWORD encodingType,
format
=
CRYPT_FormatCRLDistPoints
;
else
if
(
!
strcmp
(
lpszStructType
,
szOID_ENHANCED_KEY_USAGE
))
format
=
CRYPT_FormatEnhancedKeyUsage
;
else
if
(
!
strcmp
(
lpszStructType
,
szOID_NETSCAPE_CERT_TYPE
))
format
=
CRYPT_FormatNetscapeCertType
;
else
if
(
!
strcmp
(
lpszStructType
,
SPC_FINANCIAL_CRITERIA_OBJID
))
format
=
CRYPT_FormatSpcFinancialCriteria
;
if
(
!
format
&&
!
(
formatStrType
&
CRYPT_FORMAT_STR_NO_HEX
))
...
...
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