Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EasyRSA creates .rnd file in website root #16

Open
marijndegen opened this issue Jun 26, 2019 · 1 comment
Open

EasyRSA creates .rnd file in website root #16

marijndegen opened this issue Jun 26, 2019 · 1 comment

Comments

@marijndegen
Copy link

Whenever I run the following code, everything will work as planned, but a .rnd file is created in my /public folder. I use this secure wrapper in combination with the laravel framework. Is there a way to alter the folder where this file is created or disable the creation? For clients will be able to download the .rnd file when they enter the adres /.rnd

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use ParagonIE\EasyRSA\KeyPair;
use ParagonIE\EasyRSA\EasyRSA;

class Rsacontroller extends Controller
{
    public function generateKeyPair()
    {
        $keyPair = KeyPair::generateKeyPair(4096);

        $secretKey = $keyPair->getPrivateKey();
        $publicKey = $keyPair->getPublicKey();

        var_dump($secretKey->getKey());
        echo "<br><br><br><br>";
        var_dump($publicKey->getKey());

        $message = "test";

        $ciphertext = EasyRSA::encrypt($message, $publicKey);

        $plaintext = EasyRSA::decrypt($ciphertext, $secretKey);

        echo "<br><br><br><br><br>";

        echo $ciphertext;

        echo "<br><br><br><br>";

        echo $plaintext;
    }
}
@paragonie-scott
Copy link
Member

paragonie-scott commented Aug 22, 2019

Very strange. https://serverfault.com/a/892094/234383

This is an OpenSSL-specific behavior. I'm not sure how to disable it.

The best solution may be to move to ext/sodium instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants