[PATCH] Preliminary OpenSSL Changes (PEM)

From: Date: Fri, 12 May 2006 23:39:24 +0000
Subject: [PATCH] Preliminary OpenSSL Changes (PEM)
Groups: php.internals 
Request: Send a blank email to internals+get-23325@lists.php.net to get a copy of this message
I'm not finished yet, but I'm at a decent check point, so I thought I'd send out what I've done so far with the hope of getting some feedback. The attached files contain the patches and new files (wrt 5.1.4) for implementing import and export of PEM strings for both public and private keys using an OO interface. BTW, I know the code doesn't conform to the CS very well, I plan to run everything through astyle at the very end. One of my initial goals was to avoid modifying existing code as much as possible to avoid introducing new breakage. In hindsight that might have been more trouble than it was worth because I ended up doing a lot more than I had originally planned. But it was a good learning experience. I decided on an OO interface because it seemed like it could be most easily accomplished w/o touching existing code. At present the new interface adds two classes, described below. I wasn't sure what to name them, so feel free to offer suggestions. class PrivateKey constructor( [string pem [, string passphrase]] ) constructor( [array configargs]] ) string pem( [ string passphrase [, encrypt_key]] ) PublicKey public() class PublicKey constructor(string pem) string pem() I'm not sure about the second constructor for PrivateKey, since it really only needs two of the configarg values. I'm thinking about having it take just those two as separate arguments. Most of the changes are in the new files. In openssl.c I added a call to init_object() in the MINIT function and moved struct php_x509_request to openssl.h so I could use it elsewhere. I also made a few functions non-static so they could be called from the other files. From here I think I might as well add an object for certificates (X509, X509Certificate, Certificate...?) and then I'll add PKCS12 support. Thoughts, suggestions? Problems?

« previous php.internals (#23325) next »