Re: Using Crypt::DSA



Sisyphus <sisyphus1@xxxxxxxxxxxxxxxxx> wrote:
>
> "Mike Friedman" <mikef@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>
>> I want to be able to create a public key file and a signature in
>> formats that can be distributed to a user community whose
>> applications may be using other DSA implementations (e.g., Java
>> crypto lib, or other scripting languages besides perl). So, it's
>> important that the public key file be in a reasonably standard format.
>
> Which, afaik, would be a pem file. Crypt::DSA can parse them (as
> long as you have Convert::PEM) and so, presumably, can the other
> DSA implementations. To write a *public* key pem file with
> Crypt::DSA you just do (as in 04-pem.t):
>
> $key->priv_key(undef);
> $key->write( Type => 'PEM', Filename => $keyfile);

Rob,

I do have Convert::PEM.

I tried your suggestion above, but I get only a private key. In fact,
my script first writes the key object (using $key->write) returned
from sign(), as-is, to one file, then does the above in attempt to
write the *public* key to another file. But both files are identical!

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?

>> Also, I'd be passing the signature as a base64-encoded string
>> via a web form field. Once the application base64-decodes it,
>> the signature should be in a format easily fed to its DSA
>> verify routine.
>
> Are you saying the signature part is not a problem ? I find some
> ambiguity with "the signature should be in a format easily fed to
> its DSA verify routine" - not sure whether that means the signature
> is already in a suitable format, or whether it means that it needs
> to be in a suitable format (but isn't).

I was just expressing my concern that the signature as produced in your
earlier example (by writing out the separate components of the signature
object) wouldn't be 'standard' in some sense. But I haven't yet gotten
far enough to try all that out.

Right now, I'm interested in your idea of how to write out a public
key file in PEM format; it seems it should work, but I'm not getting
the right results. So, probably I'm overlooking something obvious.

Thanks for your help so far.

Mike

.



Relevant Pages

  • Re: Using Crypt::DSA
    ... > I want to be able to create a public key file and a signature in formats ... it's important that the public key file be ... > in a reasonably standard format. ... have Convert::PEM) and so, presumably, can the other DSA implementations. ...
    (comp.lang.perl.misc)
  • Re: Email signature does not appear as formatted
    ... Word as your editor you can format your signature in Word and save it in the ... e-mail signature in Word, Toosl, Options, E-mail Options. ...
    (microsoft.public.word.docmanagement)
  • Re: Email Format while Replying
    ... Outlook always replys in the same message format. ... Plain Text to HTML you'll need to re-insert your signature. ...
    (microsoft.public.outlook.general)
  • Re: formating business phone numbers to all employees - Outlook 20
    ... Why do i need to have HTML and RTF formating? ... There is 1 signture for each format. ... So for one signature you have .htm, ... automatically whenever the employee send emails as an outbound email? ...
    (microsoft.public.office.developer.outlook.vba)