----- Original Message ----- 
From: Miguel Angel Fraga <[EMAIL PROTECTED]>
To: OpenSSL Users <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, October 19, 1999 9:26 PM
Subject: Re: How to get client certificate from IIS4.0 From asp.


Miguel,
I used your code to get the Client Certificate, but the Generated Cert file xxxx.pem 
is not a valid Certificate. I suspected It's my region setting cause the error. After 
I change the setting from [Chinese] to [United States], your code worked well. I think 
the VB do codepage conversion automatically when calling the function asc or even when 
'cer = Request.ClientCertificate( "Certificate" )' . Now, How can I get certificate 
from a Chinese NT4.0 with SP5 region Setting is [Chinese].
> 
> > Hi,
> > In my project, I need to retrieve Client Certificate. But the documented
> > ...
> 
> In order to get the client cert (pem format)  I have
> included some ASP code.
> 
> Regards,
> Miguel Angel
> 
> 
> //////////////////////////////////////////////
> 
>  ' Crear archivo de texto for append...
>  Set fs = Server.CreateObject("Scripting.FileSystemObject")
>  Set outStream = fs.OpenTextFile( "C:\InetPub\wwwroot\GetCertificate\xxxxx\
> & ".pem", 8, True )
> 
> 
>  ' Extract Cert
>     uue = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
>     outStream.WriteLine( "-----BEGIN CERTIFICATE-----" )
>     cer = Request.ClientCertificate( "Certificate" )
>     lcer = len(cer)
>  l = 0
>  for x = 1 to lcer step 3
>      a1 = asc(mid(cer,x,1))
>   if x+1 <= lcer then
>          a2 = asc(mid(cer,x+1,1))
>    if x+2 <=lcer then
>     a3 = asc(mid(cer,x+2,1))
>    else
>     a3 = 0
>    end if
>   else
>    a2 = 0
>    a3 = 0
>   end if
>         outStream.Write mid(uue, (a1 and 252)/4 +1 ,1)
>         outStream.Write mid(uue, (a1 and 3)*16 + (a2 and 240)/16 +1 ,1)
>         if x+1 <= lcer then
>          outStream.Write mid(uue, (a2 and 15)*4 + (a3 and 192)/64 +1 ,1)
>             if x+2 <= lcer then
>              outStream.Write mid(uue, (a3 and 63) +1 ,1)
>    else
>     outStream.Write "="
>    end if
>   else
>    outStream.Write "=="
>   end if
>   l = l +4
>   if l = 64 then
>          outStream.WriteLine("")
>    l = 0
>   end if
>  next
>  if l > 0 then
>   outStream.WriteLine( "" )
>  end if
>  outStream.WriteLine( "-----END CERTIFICATE-----" )
> 
> //////////////////////////////////////////////
> 
> 
> 
> 
> 
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> User Support Mailing List                    [EMAIL PROTECTED]
> Automated List Manager                           [EMAIL PROTECTED]
> 
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to