Subject: | Crypt::DSA::Key $key-write comment wrong for public key |
I want to write a DSA public key to a file, then later
read it back. I write the public key with:
undef($key->{priv_key});
$key->write(Type=>'PEM', Filename=>$file);
The contents of this file contains the lines:
Show quoted text
-----BEGIN DSA PRIVATE KEY-----
-----END DSA PRIVATE KEY-----
Even though this is actually the public key. This can
be very confusing to some folks. Adding the following
line to the above code will fix this problem in the file:
$key->{__pem}{Name}='DSA PUBLIC KEY';
However, reading it back with the following line will fail:
$key=Crypt::DSA::Key->new(Filename=>$file, Type=>'PEM');
I would like to see the $key->write() code be smart enough
to label the output file correctly for PUBLIC or PRIVATE keys,
and the CRYPT::DSA::Key->new() code to be able to input
the correctly labeled files.
In addition, it would be nice for a better way to tell $key->write()
to write a public key, rather than requiring undefining the private key.
Thanks
-Craig