Cheap Web Hosting for Developers

PHP, MySQL, Java, Unix Cheap Web Hosting

150 Chapter 4 Web Application Concepts Listing 4.4.

Filed under: PHP Web Hosting — webmaster @ 21:32

Security Considerations 151 return($ret); } function decrypt_conventional($file, $passphrase) { $file = $this->_check_file($file); $ret = $this->_exec_pgp_command( -z $passphrase $file ); return($ret); } } Because the pgp class is only calling your system s PGP binary with the appropriate arguments, you need a correctly configured PGP system. Specifically, your private key must be set up correctly and all public keys for which you want to encrypt need to be in your local key ring.The public key must be a trusted key,or PGP will ask if it s okay to encrypt for that user, and the class will fail. All functions work with either a file or a string. If you pass a string, it will be saved to $tmp_path as a temporary file because PGP works only with files. Warning: On a multiuser system, anyone may be able to read this file! The use of this class on a non-trusted system (meaning that untrusted users are allowed to access it) should be carefully evaluated. The class has six public functions,and two others are used internally.These functions return false if an error occurs in that case, you can access a verbose error message from $pgp->error. n void pgp() The constructor of the class checks whether the PGP binary is accessible. Returns true on success or false on error. n mixed encrypt(string what, string my_user_id, string to_user_id) PGP-encrypts the argument what, which may be a filename or a string, with the private key of my_user_id for the public key to_user_id. Returns the encrypted text or false on error. n mixed sign(string what, string my_user_id) Signs the argument what with my_user_id s private key. Returns the signed text or false on error. n mixed encrypt_sign(string what, string my_user_id, string to_user_id) Signs what with my_user_id s private key, then encrypts it for to_user_id s public key. Returns the signed and encrypted text or false on error. n mixed encrypt_conventional(string what, string passphrase) Encrypts what with conventional encryption only, using passphrase as the secret key. Returns the encrypted text or false on error.

Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Inexpensive Web Hosting services

No Comments

No comments yet.

RSS feed for comments on this post. TrackBack URI

Sorry, the comment form is closed at this time.

Powered by Cheap Web Hosting