[26170] in Perl-Users-Digest
Perl-Users Digest, Issue: 8359 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 26 03:05:36 2005
Date: Fri, 26 Aug 2005 00:05:05 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 26 Aug 2005 Volume: 10 Number: 8359
Today's topics:
Emacs modules for Perl programming (Jari Aalto+mail.perl)
GD::Graph::bars <""alexjaquet\"@[no spam]msn.com">
Re: Using Crypt::DSA <mikef@brillig.security.berkeley.edu>
Re: Using Crypt::DSA <sisyphus1@nomail.afraid.org>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 26 Aug 2005 04:30:49 GMT
From: <jari.aalto <AT> poboxes.com> (Jari Aalto+mail.perl)
Subject: Emacs modules for Perl programming
Message-Id: <perl-faq/emacs-lisp-modules_1125030596@rtfm.mit.edu>
Archive-name: perl-faq/emacs-lisp-modules
Posting-Frequency: 2 times a month
URL: http://tiny-tools.sourceforge.net/
Maintainer: Jari Aalto A T poboxes com
Announcement: "What Emacs lisp modules can help with programming Perl"
Preface
Emacs is your friend if you have to do anything comcerning software
development: It offers plug-in modules, written in Emacs lisp
(elisp) language, that makes all your programmings wishes come
true. Please introduce yourself to Emacs and your programming era
will get a new light.
Where to find Emacs/XEmacs
o Unix:
http://www.gnu.org/software/emacs/emacs.html
http://www.xemacs.org/
o Unix Windows port (for Unix die-hards):
install http://www.cygwin.com/ which includes native Emacs 21.x.
and XEmacs port
o Pure Native Windows port
http://www.gnu.org/software/emacs/windows/ntemacs.html
ftp://ftp.xemacs.org/pub/xemacs/windows/setup.exe
o More Emacs resources at
http://tiny-tools.sourceforge.net/ => Emacs resource page
Emacs Perl Modules
Cperl -- Perl programming mode
http://www.cpan.org/modules/by-authors/id/ILYAZ/cperl-mode/
http://math.berkeley.edu/~ilya/software/emacs/
by Ilya Zakharevich
CPerl is major mode for editing perl files. Forget the default
`perl-mode' that comes with Emacs, this is much better. Comes
standard in newest Emacs.
TinyPerl -- Perl related utilities
http://tiny-tools.sourceforge.net/
If you ever wonder how to deal with Perl POD pages or how to find
documentation from all perl manpages, this package is for you.
Couple of keystrokes and all the documentaion is in your hands.
o Instant function help: See documentation of `shift', `pop'...
o Show Perl manual pages in *pod* buffer
o Grep through all Perl manpages (.pod)
o Follow POD references e.g. [perlre] to next pod with RETURN
o Coloured pod pages with `font-lock'
o Separate `tiperl-pod-view-mode' for jumping topics and pages
forward and backward in *pod* buffer.
o Update `$VERSION' variable with YYYY.MMDD on save.
o Load source code into Emacs, like Devel::DProf.pm
o Prepare script (version numbering) and Upload it to PAUSE
o Generate autoload STUBS (Devel::SelfStubber) for you
Perl Module (.pm)
TinyIgrep -- Perl Code browsing and easy grepping
[TinyIgrep is included in Tiny Tools Kit]
To grep from all installed Perl modules, define database to
TinyIgrep. There is example file emacs-rc-tinyigrep.el that shows
how to set up dattabases for Perl5, Perl4 whatever you have
installed
TinyIgrep calls Igrep.el to to do the search, You can adjust
recursive grep options, set search case sensitivity, add user grep
options etc.
You can find latest `igrep.el' module at
<http://groups.google.com/groups?group=gnu.emacs.sources> The
maintainer is Jefin Rodgers <kevinr <AT> ihs.com>.
TinyCompile -- To Browse grep results in Emacs *compile* buffer
TinyCompile is a minor mode for *compile* buffer from where
you can collapse unwanted lines or shorten file URLs:
/asd/asd/asd/asd/ads/as/da/sd/as/as/asd/file1:NNN: MATCHED TEXT
/asd/asd/asd/asd/ads/as/da/sd/as/as/asd/file2:NNN: MATCHED TEXT
-->
cd /asd/asd/asd/asd/ads/as/da/sd/as/as/asd/
file1:NNN: MATCHED TEXT
file1:NNN: MATCHED TEXT
End
------------------------------
Date: Fri, 26 Aug 2005 01:21:08 +0200
From: Alexandre Jaquet <""alexjaquet\"@[no spam]msn.com">
Subject: GD::Graph::bars
Message-Id: <OnsPe.27049$hV3.10791@nntpserver.swip.net>
Hi,
I need to print out some text before and after an image,
how can I commbine text + image
right now I use and have try the commented solution but doesn't
work
use GD::Graph::bars;
#print "Content-type: image/html\n\n";
#print "test";
my $img = generate();
print "Content-type: image/jpeg\n\n";
print $img;
sub generate {
my @data = ( ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
[ 10],
[ 119] );
my $graph = GD::Graph::bars->new(300, 300);
$graph->set( title => "Evaluation vente",
y_label => "Nombre de ventes");
$graph->set_legend( "Négatif (0)",
"Positif (12)");
my $gd = $graph->plot(\@data);
binmode STDOUT;
return $gd->jpeg(100);
}
thanks
------------------------------
Date: Fri, 26 Aug 2005 02:41:17 +0000 (UTC)
From: Mike Friedman <mikef@brillig.security.berkeley.edu>
Subject: Re: Using Crypt::DSA
Message-Id: <delvgd$bpp$1@agate.berkeley.edu>
Sisyphus <sisyphus1@nomail.afraid.org> wrote:
>
> Do you have Convert::PEM installed ? It's not a pre-requisite for
> Crypt::DSA, but it might help you get at the answers you want. I
> don't understand PEM format at all - if you're in the same boat
> then maybe there's something in the openssl/doc/crypto/pem.pod
> for you.
I've decided for now that just writing out $key->pub_key is sufficient
for my purposes (to create a public key file). I can read in that hex
value and use it to sign a messages.
But now, I've run into another snag with Crypt::DSA. How in the world
do I write out a signature to a file, in a format that can be read
in by another script for the purpose of verifying the signed message?
I tried taking the signature object created by the sign() method,
base64 encoding it and writing it out. When I read that in, base64
decode it and populate a new signature object with it, verify()
complains, I think because I didn't first serialize the signature
(into an ASN.1 encoded format).
The CPAN docs say there's supposed to be a $sig->serialize method
on a signature object. But it appears this isn't true. Not only
does my script fail, complaining about the absence of such a method, but
looking at the source code for Crypt::RSA::Signature seems to reveal
that there is, in fact, no serialize method defined on a signature object.
So, once again, assuming I've signed a message, creating a signature
object, how do I write that signature to a file so it can be used
as input to a verify script?
BTW: if I do the sign and verify in the same script, passing the
signature object returned by the sign() method to the verify() method,
that works fine.
I'd really appreciate a pointer on this.
Thanks.
Mike
------------------------------
Date: Fri, 26 Aug 2005 16:50:54 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: Using Crypt::DSA
Message-Id: <430ebbfe$0$22808$afc38c87@news.optusnet.com.au>
"Mike Friedman" <mikef@brillig.security.berkeley.edu> wrote in message
>
> So, once again, assuming I've signed a message, creating a signature
> object, how do I write that signature to a file so it can be used
> as input to a verify script?
>
It may simply be that you failed to bless() the key and signature retrieved
from file. Here's a script that writes to file, then reads from that file
and verifies the message using information obtained only from that file:
use strict;
use warnings;
use Crypt::DSA;
my $message = "Je suis l'homme a tete de chou.";
for (1..4) {$message .= "\n$message"}
my $dsa = Crypt::DSA->new;
my $key = $dsa->keygen( Size => 512 );
my $sig = $dsa->sign( Message => $message, Key => $key );
# @file contains all of the signature and key information that
# needs to be written to the file.
my @file = ($key->{p}, $key->{q}, $key->{g}, $key->{pub_key},
$sig->{r}, $sig->{s});
# Save @file and $message to file:
open(WR, ">msg.txt") or die "Can't open WR:$!";
for(@file) {print WR $_, "\n"}
print WR $message;
close(WR) or die "Can't close WR: $!";
# Retrieve key, signature and message from file
open(RD, "msg.txt") or die "Can't open RD:$!";
my @msg_from_file = <RD>;
close(RD) or die "Can't close RD: $!";
my %key_from_file;
my %sig_from_file;
$key_from_file{p} = shift(@msg_from_file);
chomp($key_from_file{p});
$key_from_file{q} = shift(@msg_from_file);
chomp($key_from_file{q});
$key_from_file{g} = shift(@msg_from_file);
chomp($key_from_file{g});
$key_from_file{pub_key} = shift(@msg_from_file);
chomp($key_from_file{pub_key});
$sig_from_file{r} = shift(@msg_from_file);
chomp($sig_from_file{r});
$sig_from_file{s} = shift(@msg_from_file);
chomp($sig_from_file{s});
my $message_from_file;
for(@msg_from_file) {$message_from_file .= $_}
my $k = \%key_from_file;
bless($k, "Crypt::DSA::Key");
my $s = \%sig_from_file;
bless($s, "Crypt::DSA::Signature");
# Verify using data read from file:
my $dsa_verify = Crypt::DSA->new;
my $verified = $dsa_verify->verify(
Key => $k,
Message => $message_from_file,
Signature => $s
);
if($verified) {print "Message verified\n"}
else {print "Message NOT verified\n"}
__END__
Cheers,
Rob
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 8359
***************************************