Here\'s how I\'d do it with phpseclib (which works):
setPassword(\'password\');
$resul
Might find further info by looking into the cause of the error:
if ($pkey === false) {
echo openssl_error_string();
exit('FAILURE');
}
Edit: Given the error "PEM_read_bio:bad end line" here is the portion of OpenSSL source which triggers:
[...]
if ((strncmp(buf,"-----END ",9) != 0) ||
(strncmp(nameB->data,&(buf[9]),i) != 0) ||
(strncmp(&(buf[9+i]),"-----\n",6) != 0)) {
PEMerr(PEM_F_PEM_READ_BIO,PEM_R_BAD_END_LINE);
goto err;
}
[...]
Looking at your code I suspect you'll need a newline char appended to the end of the private key string.