Web студия "GrandView"
  Главная   Написать Контакты
   
   
О проекте
Руководство php
 

gnupg_encrypt

(no version information, might be only in CVS)

gnupg_encrypt -- Encrypts a given text

Описание

string gnupg_encrypt ( resource identifier, string plaintext )

Encrypts the given plaintext with the keys, which were set with gnupg_addencryptkey before and returns the encrypted text.

Возвращаемые значения

On success, this function returns the encrypted text. On failure, this function returns FALSE.

Примеры

Пример 1. Procedural gnupg_encrypt() example

<?php
$res
= gnupg_init();
gnupg_addencryptkey($res,"8660281B6051D071D94B5B230549F9DC851566DC");
$enc = gnupg_encrypt($res, "just a test");
echo
$enc;
?>

Пример 2. OO gnupg_encrypt() example

<?php
$gpg
= new gnupg();
$gpg -> addencryptkey("8660281B6051D071D94B5B230549F9DC851566DC");
$enc = $gpg -> encrypt("just a test");
echo
$enc;
?>



add a note add a note User Contributed Notes
gnupg_encrypt
paul at cressbrook dot co dot uk
14-Feb-2007 04:52
Hi

I found that the apache or httpd user (or whichever user the webserver is using to run) needed to have write access to the .gnupg directory for the gnupg_php functions to work. This could be your problem.  It seems a rather unsatisfactory feature of this module - gnupg keeps giving warnings that it is unsafe.
jkushner at livemercial dot com
03-Jan-2007 11:49
Very nice function, yet I cant seem to get it to work correctly.
Here is what I have..

/**
 * Test Values. Will be grabbed from database.
 */
$_STR_recipientKeyId='78F21BCA81042C23';

// This is a wrapper class I made that engulfs the gnupg class
if(!class_exists('core_Gnupg')){
    require(CORE_PATH_CLASS.'Gnupg.class.php');
}

//$_OBJ_gpg is just an instantiation of that class.
//returnInfo takes in the userID name, and uses the keyinfo() //function to return an array of data for that user.
$_ARR_keyinfo=$_OBJ_gpg->returnInfo($_STR_recipientUserId);

//now I have the fully functional userid
//ex: Jonathan Kushner <jkushner@livemercial.com>
$_STR_recipientUserId=$_ARR_keyinfo[0]['uids'][0]['uid'];
    
###########################

See, originally I was using the fingerprint from the $_ARR_keyinfo above and passing that into the encrypt function, but it still associated the encrypted data with my personal private key that I have associated with apache.

Any ideas?

gnupg_encryptsign> <gnupg_decryptverify
Last updated: Sat, 27 Jan 2007
 
 
Новости
11 июля 2007
Сайт запущен
© 2007 info@grandviewstudio.com

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 324

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 330
Z058440144362 Z348613067571