Re: Using Crypt::DSA




"Mike Friedman" <mikef@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message

>
> Here's the entirety of my little test script:
>
> ------------------------------------------
> #!/usr/local/bin/perl
>
> use Crypt::DSA;
> use strict;
>
> my $dsa = new Crypt::DSA;
> my $key = Crypt::DSA::Key->new;
> my $filename;
>
> $filename = "./dsakey";
>
> $key = $dsa->keygen (
> Size => 1024,
> Verbosity => 1,
> ) or die $dsa->errstr();
>
> $key->write(
> Type => 'PEM',
> Filename => "$filename.priv",
> );
>
> $key->priv_key(undef);
>
> $key->write(
> Type => 'PEM',
> Filename => "$filename.pub",
> );
>
> exit;
> ------------------------------------------
>
> The result is that 'dsakey.priv' and 'dsakey.pub' have exactly
> the same contents, including the 'BEGIN DSA PRIVATE KEY',
> 'END DSA PRIVATE KEY' delimiters, even though I've undefined priv_key.
> What am I doing wrong?
>

Hmmm ... I run a copy'n'paste of that script and get 2 different files. The
'.priv' file has 'BEGIN DSA PRIVATE KEY', 'END DSA PRIVATE KEY' delimiters
and the '.pub' file has 'BEGIN PUBLIC KEY', 'END PUBLIC KEY' delimiters. The
base64 content is also different. Are we using the same version of
Crypt::DSA ? (I've got 0.13 which, I think, is the latest.)

I'm on Win32 - but I don't think that's going to account for the different
behaviour (in this instance :-)

Other than that, check 'perldoc Crypt::DSA::Key' for some possible clues.

Cheers,
Rob



.