DirectAdmin\LetsEncrypt\Lib\Account::createKeys PHP Method

createKeys() public method

Create and save a key pair for user
public createKeys ( ) : KeyPair
return Kelunik\Acme\KeyPair
    public function createKeys()
    {
        $rsa = new RSA();
        $keys = $rsa->createKey(2048);
        if ($keys['partialkey'] === false) {
            $this->keyPair = new KeyPair($keys['privatekey'], $keys['publickey']);
            $this->writeToStorage('public.key', $this->keyPair->getPublic());
            $this->writeToStorage('private.key', $this->keyPair->getPrivate());
            $this->config('status', 'keys generated');
        } else {
            throw new \Exception('CPU was to slow, we\'ve not yet coded this part.');
        }
        $this->acme = new AcmeService(new AcmeClient($this->acmeServer, $this->keyPair), $this->keyPair);
        return $this->keyPair;
    }