Hi,
just use Request.ClientCertificate to inspect the cert values - if you need
the cert in its raw binary format, use the .Certificate property.
---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com
> Hi all,
>
[quoted text clipped - 18 lines]
> Thanks
> Happy New Year from Spain
José Ignacio Aguillo - 05 Jan 2006 08:33 GMT
Hi Dominick,
Actually I need to convert the raw binary data format of .Certificate
property to a String formatted like
Request.ClientCertificate("CERTIFICATE"). But I don't know how to get it.
Let me explain the situation:
I'm working with several CAs to perform client authentication based on
certificates. Of course, I would like to check the revocation status of the
certificate before granting access for users to the application.
I thought in developing a web service. This web service takes the
.Certificate property base-64 encoded, loads a CAPICOM Certificate object
and checks the revocation status:
<WebMethod()> Public Function ValidaCertificado(ByVal certB64 As String) As
Integer
Dim oCert As CAPICOM.CertificateClass
oCert = New CAPICOM.CertificateClass
oCert.Import(certB64)
oCert.IsValid.CheckFlag =
CAPICOM.CAPICOM_CHECK_FLAG.CAPICOM_CHECK_TRUSTED_ROOT Or _
CAPICOM.CAPICOM_CHECK_FLAG.CAPICOM_CHECK_TIME_VALIDITY Or _
CAPICOM.CAPICOM_CHECK_FLAG.CAPICOM_CHECK_SIGNATURE_VALIDITY Or _
CAPICOM.CAPICOM_CHECK_FLAG.CAPICOM_CHECK_ONLINE_REVOCATION_STATUS
If oCert.IsValid.Result Then
'CERTIFICATE IS VALID!
Return 1
Else
Dim chain As New CAPICOM.Chain
chain.Build(oCert)
If CAPICOM.Constants.CAPICOM_TRUST_IS_REVOKED And chain.Status Then
'AT LEAST ONE CERTIFICATE IN THE CHAIN HAS BEEN REVOKED
Return 0
End If
If CAPICOM.Constants.CAPICOM_TRUST_REVOCATION_STATUS_UNKNOWN And
chain.Status Then
'THE REVOCATION STATUS COULD NOT BE DETERMINED
return 0
End If
End If
...
It works for every CAs, excepting one.
This CA emits its certificates with a CRL Distribution Point malformed. For
example:
[1]CRL Distribution Point
Distribution Point Name:
Full Name:
Directory Address:
CN=CRL1942
OU=FNMT Clase 2 CA
O=FNMT
C=ES
As you can see, there is not reference to the server where the LDAP
directory is stored.
This field only contains the necessary information to determine the
revocation status using a module provided by the CA (They consider it as a
service and, of course, it's not a free of charge service).
The function provided by this CA to validate the certificate expects to
receive the certificate as a string like the returned by
Request.ClientCertificate("CERTIFICATE").
That is the reason why I want to convert the raw binary format field
.Certificate into a String like Request.ClientCertificate("CERTIFICATE"). In
this way, my web service will be able to determine the revocation status of
every certificate.
Any idea?
Thanks in advance.
> Hi,
>
[quoted text clipped - 27 lines]
> > Thanks
> > Happy New Year from Spain