Apache Error Code: -12227 (Related to OpenSSL)

I had been fiddling with an SSL issue on Windows 2003 server for quite some time now. I reinstalled the certificate and also created a new CSR and bought new certificate, but apache dies intermittently. Today, I fixed the issue after digging in for long. Two files libeay32.dll and ssleay32.dll under system32 folder were corrupt and so, I replaced those with files from openssl directory.

libeay32.dll contains encryption functions which allow for coded communications over networks. This file is opensource and is used in many opensource programs to help with SSL communication.

ssleay32.dll is a module associated with The OpenSSL Toolkit from The OpenSSL Project.

If these two files are corrupt, you will see the following error on your ssl log files.

[error] SSL handshake failed (server www.serverName.com:443, client xxx.xxx.xx.xxx) (OpenSSL library error follows)
[error] OpenSSL: error:0407106B:rsa routines:RSA_padding_check_

PKCS1_type_2:block type is not 02
[error] OpenSSL: error:04065072:rsa routines:RSA_EAY_PRIVATE_DECRYPT:padding check failed
[error] OpenSSL: error:1408B076:SSL routines:SSL3_GET_CLIENT_KEY_EXCHANGE:bad rsa decrypt