[omniORB] omniORBpy + SSL

Nick Murtagh murtaghn@tcd.ie
Wed, 13 Mar 2002 21:00:16 +0000


--------------Boundary-00=_GOJXDIWXGZZ9PCOK40AK
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

On Wednesday 13 March 2002 18:43, Duncan Grisby wrote:
> Yes. It's trivial if you only use the simple strings in sslContext::.
> It becomes more tricky if you want to support custom behaviour by
> deriving a new class from sslContext.

Ok, here's my attempt at the trivial bit... 

It compiles and I can call the methods from python, but I haven't
tested it fully yet.

Nick
--------------Boundary-00=_GOJXDIWXGZZ9PCOK40AK
Content-Type: text/x-c++;
  charset="iso-8859-1";
  name="pySSLFunc.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="pySSLFunc.cc"

Ly8gLSotIE1vZGU6IEMrKzsgLSotCi8vICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBhY2th
Z2UgICA6IG9tbmlPUkJweQovLyBweVNTTEZ1bmMuY2MgICAgICAgICAgICAgICBDcmVhdGVkIG9u
OiAyMDAyLzAzLzEzCi8vICAgICAgICAgICAgICAgICAgICAgICAgICAgIEF1dGhvciAgICA6IE5p
Y2sgTXVydGFnaAovLwovLyAgICBDb3B5cmlnaHQgKEMpIDE5OTkgQVQmVCBMYWJvcmF0b3JpZXMg
Q2FtYnJpZGdlCi8vCi8vICAgIFRoaXMgZmlsZSBpcyBwYXJ0IG9mIHRoZSBvbW5pT1JCcHkgbGli
cmFyeQovLwovLyAgICBUaGUgb21uaU9SQnB5IGxpYnJhcnkgaXMgZnJlZSBzb2Z0d2FyZTsgeW91
IGNhbiByZWRpc3RyaWJ1dGUgaXQKLy8gICAgYW5kL29yIG1vZGlmeSBpdCB1bmRlciB0aGUgdGVy
bXMgb2YgdGhlIEdOVSBMZXNzZXIgR2VuZXJhbAovLyAgICBQdWJsaWMgTGljZW5zZSBhcyBwdWJs
aXNoZWQgYnkgdGhlIEZyZWUgU29mdHdhcmUgRm91bmRhdGlvbjs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