Friday, May 16, 2014

3074455752:error:27069065:OCSP routines:OCSP_basic_verify:certificate verify error:ocsp_vfy.c:125:Verify error:self signed certificate
If you are dealing with OCSP server you will get this error if you don't specify the path of CA certificate file in your query, so just add the -CA param followed by the relative/absolute path as follow

openssl ocsp -CA <PUT CA CERT PATH HERE> ...

Wednesday, April 30, 2014

ldap_bind(): Unable to bind to server: Protocol error
You have to specify the protocol version prior before making a call to ldap_bind(), when the server is expecting LDAP protocol version 3. else you will receive the above error

In order to avoid this, make this call:

<?php
ldap_set_option($ldapConnResult, LDAP_OPT_PROTOCOL_VERSION, 3);
?>

Where $ldapConnResult  is the result returned by ldap_connect() function.

Call to undefined function ldap_connect()

Call to undefined function ldap_connect()
Just go to php.ini file and un-comment php_ldap extension line

Thursday, April 24, 2014

PEM routines:PEM_read_bio:no start line

PEM routines:PEM_read_bio:no start line
 I got this error when I tried to convert a private key to PKCS12 format using openssl_pkcs12_export() function under PHP, after 48 hours of trying many solutions I finally found the wright one, it's soo simple just change the format of the private key (PEM encoded) from

-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,25E7BB5EB27D828C

<--- Private key here ----->
-----END RSA PRIVATE KEY-----

to

-----BEGIN RSA PRIVATE KEY-----
<--- Private key here ----->
-----END RSA PRIVATE KEY-----
 
That's all !

I reported this error to PHP and it's published on function manual http://www.php.net/manual/en/function.openssl-pkcs12-export.php#114908

Wednesday, April 23, 2014

error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt error:0906A065:PEM routines:PEM_do_header:bad decrypt
I got this error while working with OpenSSL library  on PHP, this happen when you try to export the private key of a certificate using bad passphrase, just make sure taht you are using the wright one.

Thursday, March 13, 2014

Warning: include(): http:// wrapper is disabled in the server configuration by allow_url_include=0
  The web server can't load an external php file, to patch it, go to php.ini file, find allow_url_include=off  and set it to on, restart all apache services and it's done !

Note: it's insecure to allow external files to be included in your web page (see why) so use it on your own risk.

Monday, March 10, 2014

RSA operation error
5747:error:0406D06E:rsa routines:RSA_padding_add_PKCS1_type_2:data too large for key size:rsa_pk1.c:151:
Basically RSA is not aimed to encrypt large data file, so you will get this error when you try to encrypt a file such as length(file) > length(RSA key).
I suggest to calculate first hash version of the file using MD5 or SHA-1 then encrypt it using the key.

Note: in real cryptographic system, RSA public/private key are only used to exchange symmetric key.