diff options
author | Stefan Roehrich <sr@php.net> | 2003-07-13 09:54:42 +0000 |
---|---|---|
committer | Stefan Roehrich <sr@php.net> | 2003-07-13 09:54:42 +0000 |
commit | 750635d1312a0434ce77bee03200725705f7a666 (patch) | |
tree | 300f9c488c14959ae0255423778d57531ca375a0 /ext/openssl | |
parent | 78e236da261c5894f2fcf5c4fe227681081aac72 (diff) | |
download | php-git-750635d1312a0434ce77bee03200725705f7a666.tar.gz |
Allow setting of the serial number.
Diffstat (limited to 'ext/openssl')
-rw-r--r-- | ext/openssl/openssl.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 7014886fee..5a1764ee01 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -1463,12 +1463,13 @@ PHP_FUNCTION(openssl_csr_export) } /* }}} */ -/* {{{ proto resource openssl_csr_sign(mixed csr, mixed x509, mixed priv_key, long days) +/* {{{ proto resource openssl_csr_sign(mixed csr, mixed x509, mixed priv_key, long days [, array config_args [, long serial]]) Signs a cert with another CERT */ PHP_FUNCTION(openssl_csr_sign) { zval * zcert = NULL, *zcsr, *zpkey, *args = NULL; long num_days; + long serial = 0L; X509 * cert = NULL, *new_cert = NULL; X509_REQ * csr; EVP_PKEY * key = NULL, *priv_key; @@ -1476,7 +1477,7 @@ PHP_FUNCTION(openssl_csr_sign) int i; struct php_x509_request req; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz!zl|a!", &zcsr, &zcert, &zpkey, &num_days, &args) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz!zl|a!l", &zcsr, &zcert, &zpkey, &num_days, &args, &serial) == FAILURE) return; RETVAL_FALSE; @@ -1535,8 +1536,7 @@ PHP_FUNCTION(openssl_csr_sign) if (!X509_set_version(new_cert, 2)) goto cleanup; - /* TODO: Allow specifying */ - ASN1_INTEGER_set(X509_get_serialNumber(new_cert), 0L); + ASN1_INTEGER_set(X509_get_serialNumber(new_cert), serial); X509_set_subject_name(new_cert, X509_REQ_get_subject_name(csr)); |