Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8918819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:50:44+00:00 2026-06-15T05:50:44+00:00

My program connects to a server, the public key of the server is already

  • 0

My program connects to a server, the public key of the server is already known. The program then encrypts a AES key together with an initialization vector, and sends it to the server. The server decrypts the message and from now on AES is used to encrypt the conversation.

My question is about how to generate the IV. If I go the naive way and seed a pseudo random generator with the current time, an attacker could probably make a few very good guesses about the IV, which is of curse not what I want.

As hardware random generators are not only slow, but also not available everywhere, I’d like to go for a different approach. When the client program is first started, I let the user make a few random mouse moves, just like TrueCrypt does. I now save those “random bits” created by the mouse movement and when I need a generator, I’ll use them as a seed. Of course, the random bits have to get updated every time I use them as seed. And this is my question: I thought about just saving the first few random bits generated as the new “random bits”. (So they get used to initialize the random engine next time the software starts.) Now I’m not sure if this would be random enough or if pseudo random generators would show guessable patterns here. (I’d probably use std::mt19937 http://en.cppreference.com/w/cpp/numeric/random)

Edit: The chaining mode changes, so I want it to work for the mode with the “highest” requirements. Which would be CBC if I remember correctly.

Please note: The software I’m writing is purely experimental.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T05:50:48+00:00Added an answer on June 15, 2026 at 5:50 am

    Use a cryptography PRNG, just like you do for the key.

    On windows use CryptGenRandom/RtlGenRandom and on Linux/Unix use /dev/urandom. Those get seeded by the OS, so you don’t need to take care of it.

    If you really want to create your own PRNG, look into Fortuna. Don’t use a Mersenne twister.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Java program that connects to a webserver using SSL/TLS, and sends
I wrote this simple Java program which connects to internic server and returns the
I setup public key access to my server via ssh. I have a .ssh
My program connects with a embedded bluetooth device which acts as the server. I
This test program connects to an https server and gets some content. I've checked
I am running a Java program that connect 1000 clients to a server at
I've been struggling to get a Java program to connect to MS SQL Server,
My program connects to an IRC room on freenode.net, it uses port 6667, apparently
I have a java program that connects to a MySql database and it's working
I'm working on a program that connects to different brands of plc's and therefor

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.