Giter VIP home page Giter VIP logo

Comments (10)

Ejdamm avatar Ejdamm commented on August 10, 2024 14

@bathindahelper You can manually create the file with openssl rand -out <randFile> -hex 256. In your case sudo openssl rand -out /root/.rnd -hex 256.

from node-opcua-pki.

bathindahelper avatar bathindahelper commented on August 10, 2024 9

Can somebody give me the full command pls?
i was using this command (by finding the exact command from some 2 year old video): sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/nginx.key -out /etc/ssl/certs/nginx.crt

And I'm getting this error: "Can't load /root/.rnd into RNG
140121868997056:error:2406F079:random number generator:RAND_load_file:Cannot open file:../crypto/rand/randfile.c:88:Filename=/root/.rnd"

I'm using latest openssh (just downloaded) on Ubuntu 18.04.x (upgraded)

from node-opcua-pki.

Ejdamm avatar Ejdamm commented on August 10, 2024 5

@ppapias1987

Have you tried creating the file that is missing, eg /home/ubuntu/.rnd?
openssl rand -out /home/ubuntu/.rnd -hex 256
Also, your key and cert is named the same. Switch to -keyout mykey.pem

from node-opcua-pki.

Kiesel38 avatar Kiesel38 commented on August 10, 2024 2

I found a solution for the problem.

OpenSSL 1.1.1b need the command -writerand instead of -rand for the random number generation if no .rnd file is present. I changed this in the following files:

node-opcua-pki/dist/lib/pki/certificate_authority.js
node-opcua-pki/dist/lib/pki/toolbox.js
node-opcua-pki/lib/pki/certificate_authority.ts
node-opcua-pki/lib/pki/toolbox.ts

Now the certificates can be created.

from node-opcua-pki.

harimau99 avatar harimau99 commented on August 10, 2024

I found a solution for the problem.

OpenSSL 1.1.1b need the command -writerand instead of -rand for the random number generation if no .rnd file is present. I changed this in the following files:

node-opcua-pki/dist/lib/pki/certificate_authority.js
node-opcua-pki/dist/lib/pki/toolbox.js
node-opcua-pki/lib/pki/certificate_authority.ts
node-opcua-pki/lib/pki/toolbox.ts

Now the certificates can be created.

Hi @Kiesel38.
how do you make it writable ?
openssl rand <the listed file you mention ?>

from node-opcua-pki.

ppapias1987 avatar ppapias1987 commented on August 10, 2024

@Ejdamm : Hej.. I am dealing with a relevant problem when i give this command:
openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem

the terminal returns back the following:

Can't load /home/ubuntu/.rnd into RNG
140115398300096:error:2406F079:random number generator:RAND_load_file:Cannot open file:../crypto/rand/randfile.c:88:Filename=/home/ubuntu/.rnd

from node-opcua-pki.

jmasaki24 avatar jmasaki24 commented on August 10, 2024

I had the same problem, and then created the .rnd myself as you said. I'm trying to create a self-signed certificate, and this time, when I ran openssl req -x509 -newkey rsa:2048 -keyout ca_key.pem -out ca_cert.pem -days 365 I no longer got an error, but it hangs on "Generating a RSA private key". This is a bit of a different problem, but I was wondering if you could help me out?
This StackExchange answer said it lacks entropy.
Would that mean I need a bigger .rnd file? I'm terribly confused, and new to this stuff.

from node-opcua-pki.

ppapias1987 avatar ppapias1987 commented on August 10, 2024

@Ejdamm

Yes! I tried it before without success, however i managed to figure it out later. Sorry for the delay to respond.

from node-opcua-pki.

Lovor01 avatar Lovor01 commented on August 10, 2024

I had the same problem, and then created the .rnd myself as you said. I'm trying to create a self-signed certificate, and this time, when I ran openssl req -x509 -newkey rsa:2048 -keyout ca_key.pem -out ca_cert.pem -days 365 I no longer got an error, but it hangs on "Generating a RSA private key". This is a bit of a different problem, but I was wondering if you could help me out?
This StackExchange answer said it lacks entropy.
Would that mean I need a bigger .rnd file? I'm terribly confused, and new to this stuff.

If you are working on windows, you should set environment variable to path of .rnd file, i.e.
set RANDFILE=.rnd

from node-opcua-pki.

MohammadAliAfsahi avatar MohammadAliAfsahi commented on August 10, 2024

@bathindahelper You can manually create the file with openssl rand -out <randFile> -hex 256. In your case sudo openssl rand -out /root/.rnd -hex 256.

Thanks....
This solution was helpful to solve the problem.
I wanted to create self signed certificate using following command:
openssl req -key private.pem -new -x509 -days 365 -subj "/C=IR/" -out SelfSigned.crt

from node-opcua-pki.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.