From: Manish R. J. <man...@gm...> - 2005-10-17 17:01:31
|
Hi I am trying to connect to an JAVA based SSL server, which is using X.509certificates. Here is the java code: ***************************************************************************= **** > SSLContext ctx; > KeyManagerFactory kmf; > KeyStore ks; > char[] passphrase =3D pass.toCharArray(); > ctx =3D SSLContext.getInstance("TLS"); > kmf =3D KeyManagerFactory.getInstance("SunX509"); > ks =3D KeyStore.getInstance("PKCS12"); > File keyFile =3D new File(keyfile); > if (keyFile.canRead()) { > ks.load(new FileInputStream(keyFile), passphrase); > System.out.println("Key file loaded..."); > kmf.init(ks, passphrase); > ctx.init(kmf.getKeyManagers(), null, null); > factory =3D ctx.getSocketFactory(); > } ********************************************************************* Here is my implementation of python code: ############################ > ctx =3D SSL.Context(SSL.TLSv1_METHOD) > # ctx.set_verify(SSL.VERIFY_PEER, verify_cb) > > #Get X509 certificate and the private key from the > #initial .p12 file provided to network client > f =3D open(pkey) > > pkcs12Obj =3D crypto.load_pkcs12(f.read(), passPhrase) > x509Obj =3D pkcs12Obj.get_certificate() > pkeyObj =3D pkcs12Obj.get_privatekey() > > ctx.use_privatekey(pkeyObj) > ctx.use_certificate(x509Obj) > > self.sock =3D SSL.Connection(ctx, socket.socket(socket.AF_INET, > socket.SOCK_STREAM)) > ################################################### But, the code doesn't seem to work. Apparently it can connect, and do the handshake w/o raising any interrupt, but, it is unable to gain any response from the server. However, on similar conditions, the java code does get response. Any thing I am missing/ any suggestions? Thanks Regards Manish |