public function generateNewKeypair($usedForPasswords = false)
    {
        $keyResource = openssl_pkey_new($this->openSSLConfiguration);

        if ($keyResource === false) {
            throw new SecurityException('OpenSSL private key generation failed.', 1254838154);
        }

        $modulus = $this->getModulus($keyResource);
        $privateKeyString = $this->getPrivateKeyString($keyResource);
        $publicKeyString = $this->getPublicKeyString($keyResource);

        $privateKey = new OpenSslRsaKey($modulus, $privateKeyString);
        $publicKey = new OpenSslRsaKey($modulus, $publicKeyString);

        return $this->storeKeyPair($publicKey, $privateKey, $usedForPasswords);
    }
public function generateNewKeypair($usedForPasswords = false)
    {
        $keyResource = openssl_pkey_new($this->openSSLConfiguration);

        if ($keyResource === false) {
            throw new SecurityException('OpenSSL private key generation failed.', 1254838154);
        }

        $modulus = $this->getModulus($keyResource);
        $privateKeyString = $this->getPrivateKeyString($keyResource);
        $publicKeyString = $this->getPublicKeyString($keyResource);

        $privateKey = new OpenSslRsaKey($modulus, $privateKeyString);
        $publicKey = new OpenSslRsaKey($modulus, $publicKeyString);

        return $this->storeKeyPair($publicKey, $privateKey, $usedForPasswords);
    }
public function generateNewKeypair ( $ usedForPasswords = false ) { $ keyResource = openssl_pkey_new ( $ this -> openSSLConfiguration ) ; if ( $ keyResource === false ) { throw new SecurityException ( 'OpenSSL private key generation failed.' , 1254838154 ) ; } $ modulus = $ this -> getModulus ( $ keyResource ) ; $ privateKeyString = $ this -> getPrivateKeyString ( $ keyResource ) ; $ publicKeyString = $ this -> getPublicKeyString ( $ keyResource ) ; $ privateKey = new OpenSslRsaKey ( $ modulus , $ privateKeyString ) ; $ publicKey = new OpenSslRsaKey ( $ modulus , $ publicKeyString ) ; return $ this -> storeKeyPair ( $ publicKey , $ privateKey , $ usedForPasswords ) ; }
Generates a new keypair and returns a fingerprint to refer to it

@param boolean $usedForPasswords true if this keypair should be used to encrypt passwords (then decryption won't be allowed!).
@return string The RSA public key fingerprint for reference
@throws SecurityException
Generates a new keypair and returns a fingerprint to refer to it