CakeFest 2024: The Official CakePHP Conference

openssl_pkey_get_private

(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)

openssl_pkey_get_privateObtener una clave privada

Descripción

openssl_pkey_get_private(mixed $key, string $passphrase = ""): resource

openssl_get_privatekey() analiza la clave key y la prepara para usarla con otras funciones.

Parámetros

key

key puede ser una de las siguientes:

  1. una cadena con el formato file://ruta/al/archivo.pem. El archivo nombrado debe contener un certificado/clave privada PEM codificada (puede contener ambos).
  2. una clave privada con formato PEM.

passphrase

El parámetro opcional passphrase se debe usar si la clave especificada está encriptada (protegida por una frase de contraseña).

Valores devueltos

Devuelve un identificador de clave positivo si se tuvo éxito, o false si se produjo un error.

add a note

User Contributed Notes 2 notes

up
24
kristof1 at mailbox dot hu
9 years ago
It's actually "file://key.pem" when you want to give a relative path using unix systems. It will be three '/' in case of absolute path (e.g "file:///home/username/..."). But this path consists of two '/' originated from "file://" and one '/' from the fact that home is a subfolder of the unix filesystem's root directory ("/home/username/..."). This two part will be concatenated and you will get three '/' characters following each other.

So you only have to concatenate "file://" with an existing path string in every case.
up
-26
pablo dot siciliano at gmail dot com
3 years ago
Hi.

If this function not work with pathname try with a file_get_contents of a key file.
To Top