openssl - using exec() with PHP to run a command -
i trying run openssl command through php works fine there 1 particular command trying run doesn't work.
here command run manually works perfectly:
openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 -subj "/c=us/st=denial/l=springfield/o=dis/cn=www.example.com" -keyout keyfile.key -out requestfile.csr
for example, here openssl in php work:
exec('c:/xampp/apache/bin/openssl ecparam -out keyfile.key -name prime256v1 -genkey');
the same command through php not work..
exec('c:/xampp/apache/bin/openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 -subj \'/c=us/st=denial/l=springfield/o=dis/cn=www.example.com\' -keyout keyfile.key -out requestfile.csr');
i thinking there wrong parts in double quotes "/c=" may not getting interpreted properly. if make similar openssl calls through php without parts in "" command executes fine.
would knowledgeable php person check if being passed correct or not
please don't suggest me use php's built in openssl library, aware of them , have working on different project need use exec() create ecc keys not available in php's built in openssl library.
i don't think windows cmd.exe
allows use single quotes quote argument, have use double quotes.
exec('c:/xampp/apache/bin/openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 -subj "/c=us/st=denial/l=springfield/o=dis/cn=www.example.com" -keyout keyfile.key -out requestfile.csr');
Comments
Post a Comment