Hi Soren,

Sorry, I should have gone into more detail.

What is the best approach to generating unique initialization vectors for
block ciphers such as AES in CFB mode?
I would personally use the Crypto++ RNG. There are better ways to
generate, rather than going for 1 byte at a time.

   CryptoPP::AutoSeededRandomPool rng;

   std::string Key( "BYTE key[ CryptoPP::AES::DEFAULT_KEYLENGTH ]
=\r\n    { " );
   std::string   IV( ("BYTE  iv[ CryptoPP::AES::BLOCKSIZE ] =\r\n    { " );

   //
   // IV
   //
   for( INT i = 0; i < CryptoPP::AES::BLOCKSIZE; i++ ) {

       BYTE b = rng.GenerateByte();
       ...

   }

How does AutoSeededRandomPool work? Is it guaranteed
not to return the same number twice?
Gleaned from osrng.cpp:
if Not WIN32
  Nonblocking RNG:  /dev/urandom
  Blocking RNG:  /dev/random

If WIN32
   Use Microsoft Cryptographic Provider

IIRC, MCP uses an OS derived value, stored in the registry (this is
for NT systems, not 9x systems)

Jeff

On 9/4/06, Søren Dreijer <[EMAIL PROTECTED]> wrote:

Yes, I know how you use it but I don't see anything about how to use it to
generate a unique IV..

________________________________
> Date: Mon, 4 Sep 2006 17:27:38 -0400
> From: [EMAIL PROTECTED]
> To: [email protected]
> Subject: Re: Generating Unique Initialization Vectors

>
> Hi Soren,
>
> > > How does AutoSeededRandomPool work?
>
http://www.eskimo.com/~weidai/cgi-bin/fom-serve/cache/83.html
>
> Jeff
>
> On 9/4/06, Søren Dreijer <[EMAIL PROTECTED]> wrote:
> >
> > Hey,
> >
> > What is the best approach to generating unique
initialization vectors for
> > block ciphers such as AES in CFB mode?
> >
> > How does AutoSeededRandomPool work? Is it guaranteed
not to return the same
> > number twice?
> >
> > - Soren
> >
> > ________________________________
> > Call friends with PC-to-PC calling -- FREE Try it now!
>

________________________________
Search from any Web page with powerful protection. Get the FREE Windows Live
Toolbar Today! Try it now!

Reply via email to