Re: openssl module for php
| From: | Stig Venaas | Date: | Fri, 04 May 2001 19:47:25 +0000 |
| Subject: | Re: openssl module for php | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-53944@lists.php.net to get a copy of this message | ||
On Fri, May 04, 2001 at 09:21:28PM +0200, Sascha Kettler wrote:
> > On 2001-05-04 17:59:03, "Stig Venaas" <venaas@php.net> wrote:
> > > followed up on that. It would be good if you and Sascha Kettler could
> > > agree on how the API should be
> >
> > How about:
> >
> > openssl_key_encrypt(
> > string data, // to encrypt
> > string &crypted, // encrypted result
> > mixed key, // key to use
> > bool public, // true if you want public key, false for private key
> > [int padding] // optional padding
> > );
Even though it is 4 functions, I think users will find it easier to
work with functions called openssl_public_encrypt,
openssl_private_decrypt etc. It also separates them from possible
symmetric enryption later on.
How about returning the result like this:
string openssl_public_encrypt(
string data,
mixed key,
[int padding]
);
I think it's generally better to not alter arguments, better return it
this way. Is it good enough to report errors by returning an empty
string? I think so.
Stig