suche nach in der

openssl_pkey_get_public> <openssl_pkey_get_details
Last updated: Sat, 07 Jan 2012

view this page in

openssl_pkey_get_private

(PHP 4 >= 4.2.0, PHP 5)

openssl_pkey_get_privateLiefert einen privaten Schlüssel

Beschreibung

resource openssl_pkey_get_private ( mixed $key [, string $passphrase ] )

openssl_get_privatekey() parst key und bereitet ihn zur Nutzung durch andere Funktionen vor.

Parameter-Liste

key

Als key kann angegeben werden:

  1. Eine Zeichenkette im Format file://path/to/file.pem. Die angegebene Datei muss ein PEM kodiertes Zertifikat und/oder einen privaten Schlüssel enthalten.
  2. Ein privater Schlüssel im PEM-Format.

passphrase

Der optionale Parameter passphrase muß angegeben werden falls der Schlüssel selbst verschlüsselt ist (durch eine Passphrase geschützt).

Rückgabewerte

Gibt bei Erfolg eine Schlüssel-Resource zurück, FALSE wenn ein Fehler auftritt.



add a note add a note User Contributed Notes
openssl_pkey_get_private
Joel Barker
30-Aug-2005 09:03
Note that the important part of meint's post is that there is a SINGLE argument: an ARRAY of two elements. In other words, the correct prototype of the function is

resource openssl_pkey_get_private ( array params )

where params = array( 0 => $key, 1 => $passphrase)

Thanks, meint, you made my day!
meint dot post at bigfoot dot com
17-Jan-2003 12:58
Trying for hours to get openssl_pkey_get_private to load my private key (no problems with openssl_pkey_get_public) I found that the following loaded the private key correctly:

$passphrase="test";
$priv_key_file_name = ("./private.pem");

if (openssl_pkey_get_private(array("file://$priv_key_file_name", $passphrase)))
{
        print "\nPrivate Key OK\n\n";
} else {
        print "\nPrivate key NOT OK\n\n";
}

openssl_pkey_get_public> <openssl_pkey_get_details
Last updated: Sat, 07 Jan 2012