Jump to content
php.lv forumi

Atslēgu ģenerēšana


hoho

Recommended Posts

Man vajag ar php uzģenerēt privāto un publisko atslēgu. Oriģināls sākās ar "-----BEGIN RSA PRIVATE KEY-----", bet man visu laiku sanāk "-----BEGIN PUBLIC KEY----- ".

 

Es mēģinu sekojoši:

 

 

// generate keys pair

$v_config = array('private_key_bits' => 1024,'private_key_type' => OPENSSL_KEYTYPE_RSA);

$v_keys = openssl_pkey_new($v_config);

 

// get private key

openssl_pkey_export($v_keys, $v_private);

 

// get public key

$v_public = openssl_pkey_get_details($v_keys);

$v_public = $v_public['key'];

 

$File = $cert_path."private_key.pem";

$Handle = fopen($File, 'w');

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...