createKey()
creates a new key pair, i.e. a public and private key that do not belong to any certificate yet.
x509 certificates in a secured connection [closed]
-
19-10-2022 - |
Question
What is the meaning of RSA PRIVATE KEY
and PUBLIC KEY
that a x509
certificate contains?
UPD: @owlstead: I tried out phpseclib:
$text = "test";
$x509 = new File_X509();
$cert = $x509->loadX509(file_get_contents(CERT_PATH.'root.crt'));
$Crypt_RSA = $x509->getPublicKey();
extract($Crypt_RSA->createKey()); // got $publickey and $privatekey
$Crypt_RSA->loadKey($publickey);
$crypted_text = $Crypt_RSA->encrypt($text);
$Crypt_RSA->loadKey($privatekey);
$decrypted_text = $Crypt_RSA->decrypt($ciphertext);
La solution
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow