Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

X.509 Structure

6 views
Skip to first unread message

Kyzer

unread,
Sep 17, 2009, 10:46:25 PM9/17/09
to
Hi,

I am currently in the process of implementing SSL connections on my
WM5 client. I am in the process of validating the certificate, using
the callback function SslValidate(), however am unsure of the
structure definition used in pCertChain. Below is an extract from the
MSDN website (http://msdn.microsoft.com/en-us/library/ms880984.aspx):


int SslValidate (
DWORD dwType
LPVOID pvArg
DWORD dwChainLen
LPBLOB pCertChain
DWORD dwFlags
);

The pCertChain parameter is a pointer to the root certificate. The
BLOB struct is defined in Sslsock.h in the SDK. The pBlobData field
points to a X.509 certificate (ISO standard). The certificate is not
the root certificate but the server certificate. The caller must parse
the certificate to extract the pertinent data like the subject and
issuer names.


From debugging through the code, I can see that pCertChain->pBlobData
appears to contain the certificate details (by looking at the memory
referred to by pBlobData), however I require the details on how this
is typecasted so that I can obtain the appropriate information to
validate the certificate.

Any assistance on this would be greatly appreciated.

Thanks.

Kyzer

unread,
Sep 21, 2009, 8:21:58 PM9/21/09
to
Here is some more information which may be of assistance. The
structure (from what I can see) is as follows:

[Unknown](14 bytes) **I think the version may be within here**
[Serial Number Length](1 byte)
[Serial Number](Serial Number Length bytes)
[Unknown](28 bytes)
[Country Length](1 byte)
[Country](Country Length bytes)
[Unknown](10 bytes)
[State Length](1 byte)
[State](State Length bytes)
[Unknown](10 bytes)
[Location Length](1 byte)
[Location](Location Length bytes)
[Unknown](10 bytes)
[Issuer Name Length](1 byte)
[Issuer Name](Issuer Name Length bytes)
[Unknown](10 bytes)
...

What I need to find out is the complete structure of this so that I
can parse the certificate to obtain key information (eg. validity
dates, issuer names, etc)

Thanks.

0 new messages