conectar por https con certificado cliente
Miguel Beltran R.
yourpadre en gmail.com
Mie Jun 11 22:36:02 CEST 2008
Hola lista uso python pero no mucho y ahora tengo que hacer algo nuevo
y espero me puedan ayudar.
Como dice el asunto me quiero conectar a un servidor IIS v6 por HTTPS.
Configure el servidor como dice esta pagina. Con el certificado
cliente Firefox se conecta bien al servidor.
Estoy intentando algo sencillo pero no funciona, este es mi codigo
from M2Crypto import SSL
ctx = SSL.Context()
ctx.load_cert('c:\\temp\\certnew.cer')
#tamieb probe ctx.load_cert('c:\temp\certnew.cer')
Pero me da este error
Traceback (most recent call last):
File "<pyshell#29>", line 1, in -toplevel-
ctx.load_cert(certfile='c:\\temp\\certnew.cer')
File "C:\Python24\Lib\site-packages\M2Crypto\SSL\Context.py", line
75, in load_cert
m2.ssl_ctx_use_privkey(self.ctx, keyfile)
SSLError: system lib
o este otro
Traceback (most recent call last):
File "<pyshell#26>", line 1, in -toplevel-
ctx.load_cert(certfile='c:\\temp\\certnew.cer')
File "C:\Python24\Lib\site-packages\M2Crypto\SSL\Context.py", line
75, in load_cert
m2.ssl_ctx_use_privkey(self.ctx, keyfile)
SSLError: PEM lib
En los doc de M2Crypt dice esto
load_cert(self, certfile, keyfile=None, callback=<function passphrase_callback>)
Load certificate and private key into the context.
@param certfile: File that contains the PEM-encoded certificate.
@type certfile: str
@param keyfile: File that contains the PEM-encoded private key.
Default value of None indicates that the private key
is to be found in 'certfile'.
@type keyfile: str
@param callback: Callable object to be invoked if the private key is
passphrase-protected. Default callback provides a
simple terminal-style input for the passphrase.
El archivo certnew.cer tiene esto
-----BEGIN CERTIFICATE-----
MIIGRzCCBS+gAwIBAgIKYestsAAAAAAAAzANBgkqhkiG9w0BAQUFADBAMRMwEQYK
.....
.....
-----END CERTIFICATE-----
--
________________________________________
Lo bueno de vivir un dia mas
es saber que nos queda un dia menos de vida
_______________________________________________
Lista de correo Python-es
http://listas.aditel.org/listinfo/python-es
FAQ: http://listas.aditel.org/faqpyes
Más información sobre la lista de distribución Python-es