nginx-util: Rework ptr cleanup and error handling
As per @Ansuel's not about ctx cleanup in error path, decided to rework
the patch.
Changes and Improvements:
Smart Pointers for Memory Management:
* The `EVP_PKEY_ptr` and `X509_NAME_ptr` smart pointers
are used to manage the memory of `EVP_PKEY` and `X509_NAME`
objects respectively to ensure proper cleanup.
Error Handling:
* Improved error messages and exception handling to provide
more information about what went wrong.
Resource Cleanup:
* Ensured all allocated resources are now properly freed
in case of an error to prevent memory leaks.
Signed-off-by: Sean Khan <datapronix@protonmail.com>