r51797 - in /branches/upstream/libconvert-ascii-armour-perl: ./ current/ current/lib/ current/lib/Convert/ current/lib/Convert/ASCII/ current/t/
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Sat Jan 30 03:10:51 UTC 2010
Author: jawnsy-guest
Date: Sat Jan 30 03:10:45 2010
New Revision: 51797
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=51797
Log:
[svn-inject] Installing original source of libconvert-ascii-armour-perl
Added:
branches/upstream/libconvert-ascii-armour-perl/
branches/upstream/libconvert-ascii-armour-perl/current/
branches/upstream/libconvert-ascii-armour-perl/current/ARTISTIC
branches/upstream/libconvert-ascii-armour-perl/current/MANIFEST
branches/upstream/libconvert-ascii-armour-perl/current/Makefile.PL
branches/upstream/libconvert-ascii-armour-perl/current/lib/
branches/upstream/libconvert-ascii-armour-perl/current/lib/Convert/
branches/upstream/libconvert-ascii-armour-perl/current/lib/Convert/ASCII/
branches/upstream/libconvert-ascii-armour-perl/current/lib/Convert/ASCII/Armor.pm
branches/upstream/libconvert-ascii-armour-perl/current/lib/Convert/ASCII/Armour.pm
branches/upstream/libconvert-ascii-armour-perl/current/t/
branches/upstream/libconvert-ascii-armour-perl/current/t/01-encode_content.t (with props)
branches/upstream/libconvert-ascii-armour-perl/current/t/02-armour.t (with props)
branches/upstream/libconvert-ascii-armour-perl/current/t/03-armour-compress.t (with props)
branches/upstream/libconvert-ascii-armour-perl/current/t/04-noheaders.t (with props)
branches/upstream/libconvert-ascii-armour-perl/current/t/05-armor.t (with props)
Added: branches/upstream/libconvert-ascii-armour-perl/current/ARTISTIC
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconvert-ascii-armour-perl/current/ARTISTIC?rev=51797&op=file
==============================================================================
--- branches/upstream/libconvert-ascii-armour-perl/current/ARTISTIC (added)
+++ branches/upstream/libconvert-ascii-armour-perl/current/ARTISTIC Sat Jan 30 03:10:45 2010
@@ -1,0 +1,117 @@
+
+
+ The "Artistic License"
+
+ Preamble
+
+The intent of this document is to state the conditions under which a
+Package may be copied, such that the Copyright Holder maintains some
+semblance of artistic control over the development of the package, while
+giving the users of the package the right to use and distribute the
+Package in a more-or-less customary fashion, plus the right to make
+reasonable modifications.
+
+Definitions:
+
+ "Package" refers to the collection of files distributed by the
+ Copyright Holder, and derivatives of that collection of files
+ created through textual modification.
+
+ "Standard Version" refers to such a Package if it has not been
+ modified, or has been modified in accordance with the wishes of
+ the Copyright Holder.
+
+ "Copyright Holder" is whoever is named in the copyright or
+ copyrights for the package.
+
+ "You" is you, if you're thinking about copying or distributing
+ this Package.
+
+ "Reasonable copying fee" is whatever you can justify on the basis
+ of media cost, duplication charges, time of people involved, and
+ so on. (You will not be required to justify it to the Copyright
+ Holder, but only to the computing community at large as a market
+ that must bear the fee.)
+
+ "Freely Available" means that no fee is charged for the item
+ itself, though there may be fees involved in handling the item. It
+ also means that recipients of the item may redistribute it under
+ the same conditions they received it.
+
+1. You may make and give away verbatim copies of the source form of the
+ Standard Version of this Package without restriction, provided that you
+ duplicate all of the original copyright notices and associated
+ disclaimers.
+
+2. You may apply bug fixes, portability fixes and other modifications
+ derived from the Public Domain or from the Copyright Holder. A Package
+ modified in such a way shall still be considered the Standard Version.
+
+3. You may otherwise modify your copy of this Package in any way, provided
+ that you insert a prominent notice in each changed file stating how and
+ when you changed that file, and provided that you do at least ONE of
+ the following:
+
+ a) place your modifications in the Public Domain or otherwise make
+ them Freely Available, such as by posting said modifications to
+ Usenet or an equivalent medium, or placing the modifications on a
+ major archive site such as ftp.uu.net, or by allowing the
+ Copyright Holder to include your modifications in the Standard
+ Version of the Package.
+
+ b) use the modified Package only within your corporation or
+ organization.
+
+ c) rename any non-standard executables so the names do not conflict
+ with standard executables, which must also be provided, and provide
+ a separate manual page for each non-standard executable that
+ clearly documents how it differs from the Standard Version.
+
+ d) make other distribution arrangements with the Copyright Holder.
+
+4. You may distribute the programs of this Package in object code or
+ executable form, provided that you do at least ONE of the following:
+
+ a) distribute a Standard Version of the executables and library files,
+ together with instructions (in the manual page or equivalent) on
+ where to get the Standard Version.
+
+ b) accompany the distribution with the machine-readable source of the
+ Package with your modifications.
+
+ c) accompany any non-standard executables with their corresponding
+ Standard Version executables, giving the non-standard executables
+ non-standard names, and clearly documenting the differences in
+ manual pages (or equivalent), together with instructions on where
+ to get the Standard Version.
+
+ d) make other distribution arrangements with the Copyright Holder.
+
+5. You may charge a reasonable copying fee for any distribution of this
+ Package. You may charge any fee you choose for support of this Package.
+ You may not charge a fee for this Package itself. However, you may
+ distribute this Package in aggregate with other (possibly commercial)
+ programs as part of a larger (possibly commercial) software
+ distribution provided that you do not advertise this Package as a
+ product of your own.
+
+6. The scripts and library files supplied as input to or produced as
+ output from the programs of this Package do not automatically fall
+ under the copyright of this Package, but belong to whomever
+ generated them, and may be sold commercially, and may be aggregated
+ with this Package.
+
+7. C or perl subroutines supplied by you and linked into this Package
+ shall not be considered part of this Package.
+
+8. The name of the Copyright Holder may not be used to endorse or promote
+ products derived from this software without specific prior written
+ permission.
+
+9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+
+ The End
+
+
Added: branches/upstream/libconvert-ascii-armour-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconvert-ascii-armour-perl/current/MANIFEST?rev=51797&op=file
==============================================================================
--- branches/upstream/libconvert-ascii-armour-perl/current/MANIFEST (added)
+++ branches/upstream/libconvert-ascii-armour-perl/current/MANIFEST Sat Jan 30 03:10:45 2010
@@ -1,0 +1,19 @@
+
+# Files in Convert-ASCII-Armour bundle.
+
+MANIFEST
+ARTISTIC
+
+Makefile.PL
+
+lib/Convert/ASCII/Armour.pm
+lib/Convert/ASCII/Armor.pm
+
+t/01-encode_content.t
+t/02-armour.t
+t/03-armour-compress.t
+t/04-noheaders.t
+t/05-armor.t
+
+# $Id: MANIFEST,v 1.2 2001/03/19 23:15:08 vipul Exp $
+
Added: branches/upstream/libconvert-ascii-armour-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconvert-ascii-armour-perl/current/Makefile.PL?rev=51797&op=file
==============================================================================
--- branches/upstream/libconvert-ascii-armour-perl/current/Makefile.PL (added)
+++ branches/upstream/libconvert-ascii-armour-perl/current/Makefile.PL Sat Jan 30 03:10:45 2010
@@ -1,0 +1,23 @@
+#!/usr/bin/perl -sw
+##
+## Makefile.PL for Conver::ASCII::Armour
+##
+## Copyright (c) 2001, Vipul Ved Prakash. All rights reserved.
+## This code is free software; you can redistribute it and/or modify
+## it under the same terms as Perl itself.
+##
+## $Id: Makefile.PL,v 1.2 2001/03/19 23:02:47 vipul Exp $
+
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+ 'NAME' => 'Convert::ASCII::Armour',
+ 'AUTHOR' => 'Vipul Ved Prakash <mail at vipul.net>',
+ 'VERSION_FROM' => 'lib/Convert/ASCII/Armour.pm',
+ 'PREREQ_PM' => { 'Digest::MD5' => 0,
+ 'MIME::Base64' => 0,
+ 'Compress::Zlib' => 0,
+ },
+);
+
+
Added: branches/upstream/libconvert-ascii-armour-perl/current/lib/Convert/ASCII/Armor.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconvert-ascii-armour-perl/current/lib/Convert/ASCII/Armor.pm?rev=51797&op=file
==============================================================================
--- branches/upstream/libconvert-ascii-armour-perl/current/lib/Convert/ASCII/Armor.pm (added)
+++ branches/upstream/libconvert-ascii-armour-perl/current/lib/Convert/ASCII/Armor.pm Sat Jan 30 03:10:45 2010
@@ -1,0 +1,37 @@
+#!/usr/bin/perl -sw
+##
+##
+##
+## Copyright (c) 2001, Vipul Ved Prakash. All rights reserved.
+## This code is free software; you can redistribute it and/or modify
+## it under the same terms as Perl itself.
+##
+## $Id: Armor.pm,v 1.1 2001/03/19 23:15:09 vipul Exp $
+
+package Convert::ASCII::Armor;
+use lib "../../../lib";
+use Convert::ASCII::Armour;
+use vars qw(@ISA);
+ at ISA = qw(Convert::ASCII::Armour);
+
+1;
+
+=head1 NAME
+
+Convert::ASCII::Armor - Convert binary octets into ASCII armoured messages.
+
+=head1 SYNOPSIS
+
+See SYNOPSIS in Convert::ASCII::Armour.
+
+=head1 DESCRIPTION
+
+Empty subclass of Convert::ASCII::Armour for American English speakers.
+
+=head1 AUTHOR
+
+Vipul Ved Prakash, E<lt>mail at vipul.netE<gt>
+
+=cut
+
+
Added: branches/upstream/libconvert-ascii-armour-perl/current/lib/Convert/ASCII/Armour.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconvert-ascii-armour-perl/current/lib/Convert/ASCII/Armour.pm?rev=51797&op=file
==============================================================================
--- branches/upstream/libconvert-ascii-armour-perl/current/lib/Convert/ASCII/Armour.pm (added)
+++ branches/upstream/libconvert-ascii-armour-perl/current/lib/Convert/ASCII/Armour.pm Sat Jan 30 03:10:45 2010
@@ -1,0 +1,247 @@
+#!/usr/bin/perl -sw
+##
+## Convert::ASCII::Armour
+##
+## Copyright (c) 2001, Vipul Ved Prakash. All rights reserved.
+## This code is free software; you can redistribute it and/or modify
+## it under the same terms as Perl itself.
+##
+## $Id: Armour.pm,v 1.4 2001/03/19 23:15:09 vipul Exp $
+
+package Convert::ASCII::Armour;
+use strict;
+use Digest::MD5 qw(md5);
+use MIME::Base64;
+use Compress::Zlib qw(compress uncompress);
+use vars qw($VERSION);
+
+($VERSION) = '$Revision: 1.4 $' =~ /\s(\d+\.\d+)\s/;
+
+
+sub new {
+ return bless {}, shift;
+}
+
+
+sub error {
+ my ($self, $errstr) = @_;
+ $$self{errstr} = "$errstr\n";
+ return;
+}
+
+
+sub errstr {
+ my $self = shift;
+ return $$self{errstr};
+}
+
+
+sub armour {
+
+ my ($self, %params) = @_;
+
+ my $compress = $params{Compress} ? "COMPRESSED " : "";
+ return undef unless $params{Content};
+ $params{Object} = "UNKNOWN $compress DATA" unless $params{Object};
+
+ my $head = "-"x5 . "BEGIN $compress$params{Object}" . "-"x5;
+ my $tail = "-"x5 . "END $compress$params{Object}" . "-"x5;
+
+ my $content = $self->encode_content (%{$params{Content}});
+ $content = compress($content) if $compress;
+ my $checksum = encode_base64 (md5 ($content));
+ my $econtent = encode_base64 ($content);
+
+ my $eheaders = "";
+ for my $key (keys %{$params{Headers}}) {
+ $eheaders .= "$key: $params{Headers}->{$key}\n";
+ }
+
+ my $message = "$head\n$eheaders\n$econtent=$checksum$tail\n";
+ return $message;
+
+}
+
+
+sub unarmour {
+ my ($self, $message) = @_;
+
+ my ($head, $object, $headers, $content, $tail) = $message =~
+ m:(-----BEGIN ([^\n\-]+)-----)\n(.*?\n\n)?(.+)(-----END .*?-----)$:s
+ or return $self->error ("Breached Armour.");
+
+ my ($compress, $obj) = $object =~ /^(COMPRESSED )(.*)$/;
+ $object = $obj if $obj;
+ $content =~ s:=([^\n]+)$::s or return $self->error ("Breached Armour.");
+ my $checksum = $1; $content = decode_base64 ($content);
+ my $ncheck = encode_base64 (md5 ($content)); $ncheck =~ s/\n//;
+ return $self->error ("Checksum Failed.") unless $ncheck eq $checksum;
+ $content = uncompress ($content) if $compress;
+ my $dcontent = $self->decode_content ($content) || return;
+
+ my $dheaders;
+ if ($headers) {
+ my @pairs = split /\n/, $headers;
+ for (@pairs) {
+ my ($key, $value) = split /: /, $_, 2;
+ $$dheaders{$key} = $value if $key;
+ }
+ }
+
+ my %return = ( Content => $dcontent,
+ Object => $object,
+ Headers => $dheaders );
+
+ return \%return;
+
+}
+
+
+sub encode_content {
+ my ($self, %data) = @_;
+ my $encoded = "";
+
+ for my $key (keys %data) {
+ $encoded .= length ($key) . chr(0) . length ($data{$key}) .
+ chr(0) . "$key$data{$key}";
+ }
+
+ return $encoded;
+}
+
+
+sub decode_content {
+ my ($self, $content) = @_;
+ my %data;
+
+ while ($content) {
+ $content =~ s/^(\d+)\x00(\d+)\x00// ||
+ return $self->error ("Inconsistent content.");
+ my $keylen = $1; my $valuelen = $2;
+ my $key = substr $content, 0, $keylen;
+ my $value = substr $content, $keylen, $valuelen;
+ substr ($content, 0, $keylen + $valuelen) = "";
+ $data{$key} = $value;
+ }
+
+ return \%data;
+}
+
+
+sub armor { armour (@_) }
+sub unarmor { unarmour (@_) }
+
+
+1;
+
+
+=head1 NAME
+
+Convert::ASCII::Armour - Convert binary octets into ASCII armoured messages.
+
+=head1 SYNOPSIS
+
+ my $converter = new Convert::ASCII::Armour;
+
+ my $message = $converter->armour(
+ Object => "FOO RECORD",
+ Headers => {
+ Table => "FooBar",
+ Version => "1.23",
+ },
+ Content => {
+ Key => "0x8738FA7382",
+ Name => "Zoya Hall",
+ Pic => "....", # gif
+ },
+ Compress => 1,
+ );
+
+ print $message;
+
+
+ -----BEGIN COMPRESSED FOO RECORD-----
+ Version: 1.23
+ Table: FooBar
+
+ eJwzZzA0Z/BNLS5OTE8NycgsVgCiRIVciIAJg6EJg0tiSaqhsYJvYlFy...
+ XnpOZl5qYlJySmpaekZmVnZObl5+QWFRcUlpWXlFZRWXAk7g6OTs4urm...
+ Fh4VGaWAR5ehkbGJqZm5hSUeNXWKDsoGcWpaGpq68bba0dWxtTVmDOYM...
+ NzuZ
+ =MxpZvjkrv5XyhkVCuXmsBQ==
+ -----END COMPRESSED FOO RECORD-----
+
+
+ my $decoded = $converter->unarmour( $message )
+ || die $converter->errstr();
+
+
+=head1 DESCRIPTION
+
+This module converts hashes of binary octets into ASCII messages suitable
+for transfer over 6-bit clean transport channels. The encoded ASCII
+resembles PGP's armoured messages, but are in no way compatible with PGP.
+
+=head1 METHODS
+
+=head2 B<new()>
+
+Constructor.
+
+=head2 B<armour()>
+
+Converts a hash of binary octets into an ASCII encoded message. The
+encoded message has 4 parts: head and tail strings that act as identifiers
+and delimiters, a cluster of headers at top of the message, Base64 encoded
+message body and a Base64 encoded MD5 digest of the message body. armour()
+takes a hash as argument with following keys:
+
+=over 4
+
+=item B<Object>
+
+An identification string embedded in head and tail strings.
+
+=item B<Content>
+
+Content is a hashref that contains the binary octets to be encoded. This
+hash is serialized, compressed (if specified) and encoded into ASCII with
+MIME::Base64. The result is the body of the encoded message.
+
+=item B<Headers>
+
+Headers is a hashref that contains ASCII headers that are placed at top of
+the encoded message. Headers are encoded as RFC822 headers.
+
+=item B<Compress>
+
+A boolean parameter that forces armour() to compress the message body.
+
+=back
+
+=head2 B<unarmour()>
+
+Decodes an armoured ASCII message into the hash provided as argument
+to armour(). The hash contains Content, Object, and Headers.
+unarmour() performs several consistency checks and returns a non-true
+value on failure.
+
+=head2 B<errstr()>
+
+Returns the error message set by unarmour() on failure.
+
+=head1 AUTHOR
+
+Vipul Ved Prakash, E<lt>mail at vipul.netE<gt>
+
+=head1 LICENSE
+
+Copyright (c) 2001, Vipul Ved Prakash. All rights reserved. This code is
+free software; you can redistribute it and/or modify it under the same
+terms as Perl itself.
+
+=head1 SEE ALSO
+
+MIME::Base64(3), Compress::Zlib(3), Digest::MD5(3)
+
+=cut
Added: branches/upstream/libconvert-ascii-armour-perl/current/t/01-encode_content.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconvert-ascii-armour-perl/current/t/01-encode_content.t?rev=51797&op=file
==============================================================================
--- branches/upstream/libconvert-ascii-armour-perl/current/t/01-encode_content.t (added)
+++ branches/upstream/libconvert-ascii-armour-perl/current/t/01-encode_content.t Sat Jan 30 03:10:45 2010
@@ -1,0 +1,37 @@
+#!/usr/bin/perl -sw
+##
+## 01-encode_content.t
+##
+## Copyright (c) 2001, Vipul Ved Prakash. All rights reserved.
+## This code is free software; you can redistribute it and/or modify
+## it under the same terms as Perl itself.
+##
+## $Id: 01-encode_content.t,v 1.1.1.1 2001/03/18 07:27:39 vipul Exp $
+
+use lib '../lib';
+use Convert::ASCII::Armour;
+use Data::Dumper;
+
+print "1..5\n";
+my $i = 0;
+my $converter = new Convert::ASCII::Armour;
+
+my %data = ( Message => "This is a message",
+ Number => "8989323",
+ Date => "13 March, 2001",
+ Longline => "abcdefghijklmnopqrstuvwxyz\
+ ABCDEFGHIJKLMNOPQRSTUVWZYZ\
+ 123456789\
+ ~!@#$%^&*()-_=+[{]}\|"
+ );
+
+my $encoded = $converter->encode_content (%data);
+print "$encoded\n";
+print $encoded ? "ok " : "not ok "; print ++$i . "\n";
+
+my $data = $converter->decode_content ($encoded);
+
+print $data{Longline} eq $$data{Longline} ? "ok " : "not ok "; print ++$i . "\n";
+print $data{Number} eq $$data{Number} ? "ok " : "not ok "; print ++$i . "\n";
+print $data{Date} eq $$data{Date} ? "ok " : "not ok "; print ++$i . "\n";
+print $data{Message} eq $$data{Message} ? "ok " : "not ok "; print ++$i . "\n";
Propchange: branches/upstream/libconvert-ascii-armour-perl/current/t/01-encode_content.t
------------------------------------------------------------------------------
svn:executable =
Added: branches/upstream/libconvert-ascii-armour-perl/current/t/02-armour.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconvert-ascii-armour-perl/current/t/02-armour.t?rev=51797&op=file
==============================================================================
--- branches/upstream/libconvert-ascii-armour-perl/current/t/02-armour.t (added)
+++ branches/upstream/libconvert-ascii-armour-perl/current/t/02-armour.t Sat Jan 30 03:10:45 2010
@@ -1,0 +1,49 @@
+#!/usr/bin/perl -sw
+##
+## 01-encode_content.t
+##
+## Copyright (c) 2001, Vipul Ved Prakash. All rights reserved.
+## This code is free software; you can redistribute it and/or modify
+## it under the same terms as Perl itself.
+##
+## $Id: 02-armour.t,v 1.1.1.1 2001/03/18 07:27:39 vipul Exp $
+
+use lib '../lib';
+use Convert::ASCII::Armour;
+
+print "1..8\n";
+my $i = 0;
+my $converter = new Convert::ASCII::Armour;
+
+my %data = ( Message => "This is a message",
+ Number => "8989323",
+ Date => "13 March, 2001",
+ Longline => "abcdefghijklmnopqrstuvwxyz\
+ ABCDEFGHIJKLMNOPQRSTUVWZYZ\
+ 123456789\
+ ~!@#$%^&*()-_=+[{]}\|"
+ );
+
+my %headers = ( Scheme => "Crypt::RSA::EME::OAEP",
+ Version => "1.24"
+ );
+
+my $encoded = $converter->armour (
+ Content => \%data,
+ Headers => \%headers,
+ Object => "RSA ENCRYPTED MESSAGE",
+ );
+
+print "$encoded\n";
+print $encoded ? "ok " : "not ok "; print ++$i . "\n";
+
+$decoded = $converter->unarmour ( $encoded ) or die $converter->errstr;
+
+print $data{Longline} eq $$decoded{Content}{Longline} ? "ok " : "not ok "; print ++$i . "\n";
+print $data{Number} eq $$decoded{Content}{Number} ? "ok " : "not ok "; print ++$i . "\n";
+print $data{Date} eq $$decoded{Content}{Date} ? "ok " : "not ok "; print ++$i . "\n";
+print $data{Message} eq $$decoded{Content}{Message} ? "ok " : "not ok "; print ++$i . "\n";
+print $headers{Scheme} eq $$decoded{Headers}{Scheme} ? "ok " : "not ok "; print ++$i . "\n";
+print $headers{Version} eq $$decoded{Headers}{Version} ? "ok " : "not ok "; print ++$i . "\n";
+print "RSA ENCRYPTED MESSAGE" eq $$decoded{Object} ? "ok " : "not ok "; print ++$i . "\n";
+
Propchange: branches/upstream/libconvert-ascii-armour-perl/current/t/02-armour.t
------------------------------------------------------------------------------
svn:executable =
Added: branches/upstream/libconvert-ascii-armour-perl/current/t/03-armour-compress.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconvert-ascii-armour-perl/current/t/03-armour-compress.t?rev=51797&op=file
==============================================================================
--- branches/upstream/libconvert-ascii-armour-perl/current/t/03-armour-compress.t (added)
+++ branches/upstream/libconvert-ascii-armour-perl/current/t/03-armour-compress.t Sat Jan 30 03:10:45 2010
@@ -1,0 +1,51 @@
+#!/usr/bin/perl -sw
+##
+## 01-encode_content.t
+##
+## Copyright (c) 2001, Vipul Ved Prakash. All rights reserved.
+## This code is free software; you can redistribute it and/or modify
+## it under the same terms as Perl itself.
+##
+## $Id: 03-armour-compress.t,v 1.1.1.1 2001/03/18 07:27:39 vipul Exp $
+
+use lib '../lib';
+use Convert::ASCII::Armour;
+
+print "1..8\n";
+my $i = 0;
+my $converter = new Convert::ASCII::Armour;
+
+my %data = ( Message => "This is a message",
+ Number => "8989323",
+ Date => "13 March, 2001",
+ Longline => "abcdefghijklmnopqrstuvwxyz\
+ ABCDEFGHIJKLMNOPQRSTUVWZYZ\
+ 123456789\
+ ~!@#$%^&*()-_=+[{]}\|"
+ );
+
+my %headers = (
+ Scheme => "Crypt::RSA::EME::OAEP",
+ Version => "1.24"
+ );
+
+my $encoded = $converter->armour (
+ Content => \%data,
+ Headers => \%headers,
+ Object => "RSA ENCRYPTED MESSAGE",
+ Compress => 1
+ );
+
+print "$encoded\n";
+print $encoded ? "ok " : "not ok "; print ++$i . "\n";
+
+$decoded = $converter->unarmour ( $encoded ) or die $converter->errstr;
+
+print $data{Longline} eq $$decoded{Content}{Longline} ? "ok " : "not ok "; print ++$i . "\n";
+print $data{Number} eq $$decoded{Content}{Number} ? "ok " : "not ok "; print ++$i . "\n";
+print $data{Date} eq $$decoded{Content}{Date} ? "ok " : "not ok "; print ++$i . "\n";
+print $data{Message} eq $$decoded{Content}{Message} ? "ok " : "not ok "; print ++$i . "\n";
+print $headers{Scheme} eq $$decoded{Headers}{Scheme} ? "ok " : "not ok "; print ++$i . "\n";
+print $headers{Version} eq $$decoded{Headers}{Version} ? "ok " : "not ok "; print ++$i . "\n";
+print "RSA ENCRYPTED MESSAGE" eq $$decoded{Object} ? "ok " : "not ok "; print ++$i . "\n";
+
Propchange: branches/upstream/libconvert-ascii-armour-perl/current/t/03-armour-compress.t
------------------------------------------------------------------------------
svn:executable =
Added: branches/upstream/libconvert-ascii-armour-perl/current/t/04-noheaders.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconvert-ascii-armour-perl/current/t/04-noheaders.t?rev=51797&op=file
==============================================================================
--- branches/upstream/libconvert-ascii-armour-perl/current/t/04-noheaders.t (added)
+++ branches/upstream/libconvert-ascii-armour-perl/current/t/04-noheaders.t Sat Jan 30 03:10:45 2010
@@ -1,0 +1,42 @@
+#!/usr/bin/perl -sw
+##
+## 01-encode_content.t
+##
+## Copyright (c) 2001, Vipul Ved Prakash. All rights reserved.
+## This code is free software; you can redistribute it and/or modify
+## it under the same terms as Perl itself.
+##
+## $Id: 04-noheaders.t,v 1.1.1.1 2001/03/18 07:27:39 vipul Exp $
+
+use lib '../lib';
+use Convert::ASCII::Armour;
+
+print "1..6\n";
+my $i = 0;
+my $converter = new Convert::ASCII::Armour;
+
+my %data = ( Message => "This is a message",
+ Number => "8989323",
+ Date => "13 March, 2001",
+ Longline => "abcdefghijklmnopqrstuvwxyz\
+ ABCDEFGHIJKLMNOPQRSTUVWZYZ\
+ 123456789\
+ ~!@#$%^&*()-_=+[{]}\|"
+ );
+
+my $encoded = $converter->armour (
+ Content => \%data,
+ Object => "RSA ENCRYPTED MESSAGE",
+ );
+
+print "$encoded\n";
+print $encoded ? "ok " : "not ok "; print ++$i . "\n";
+
+$decoded = $converter->unarmour ( $encoded ) or die $converter->errstr;
+
+print $data{Longline} eq $$decoded{Content}{Longline} ? "ok " : "not ok "; print ++$i . "\n";
+print $data{Number} eq $$decoded{Content}{Number} ? "ok " : "not ok "; print ++$i . "\n";
+print $data{Date} eq $$decoded{Content}{Date} ? "ok " : "not ok "; print ++$i . "\n";
+print $data{Message} eq $$decoded{Content}{Message} ? "ok " : "not ok "; print ++$i . "\n";
+print "RSA ENCRYPTED MESSAGE" eq $$decoded{Object} ? "ok " : "not ok "; print ++$i . "\n";
+
Propchange: branches/upstream/libconvert-ascii-armour-perl/current/t/04-noheaders.t
------------------------------------------------------------------------------
svn:executable =
Added: branches/upstream/libconvert-ascii-armour-perl/current/t/05-armor.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconvert-ascii-armour-perl/current/t/05-armor.t?rev=51797&op=file
==============================================================================
--- branches/upstream/libconvert-ascii-armour-perl/current/t/05-armor.t (added)
+++ branches/upstream/libconvert-ascii-armour-perl/current/t/05-armor.t Sat Jan 30 03:10:45 2010
@@ -1,0 +1,51 @@
+#!/usr/bin/perl -sw
+##
+## 01-encode_content.t
+##
+## Copyright (c) 2001, Vipul Ved Prakash. All rights reserved.
+## This code is free software; you can redistribute it and/or modify
+## it under the same terms as Perl itself.
+##
+## $Id: 05-armor.t,v 1.1 2001/03/19 23:15:10 vipul Exp $
+
+use lib '../lib';
+use Convert::ASCII::Armor;
+
+print "1..8\n";
+my $i = 0;
+my $converter = new Convert::ASCII::Armor;
+
+my %data = ( Message => "This is a message",
+ Number => "8989323",
+ Date => "13 March, 2001",
+ Longline => "abcdefghijklmnopqrstuvwxyz\
+ ABCDEFGHIJKLMNOPQRSTUVWZYZ\
+ 123456789\
+ ~!@#$%^&*()-_=+[{]}\|"
+ );
+
+my %headers = (
+ Scheme => "Crypt::RSA::EME::OAEP",
+ Version => "1.24"
+ );
+
+my $encoded = $converter->armor (
+ Content => \%data,
+ Headers => \%headers,
+ Object => "RSA ENCRYPTED MESSAGE",
+ Compress => 1
+ );
+
+print "$encoded\n";
+print $encoded ? "ok " : "not ok "; print ++$i . "\n";
+
+$decoded = $converter->unarmor ( $encoded ) or die $converter->errstr;
+
+print $data{Longline} eq $$decoded{Content}{Longline} ? "ok " : "not ok "; print ++$i . "\n";
+print $data{Number} eq $$decoded{Content}{Number} ? "ok " : "not ok "; print ++$i . "\n";
+print $data{Date} eq $$decoded{Content}{Date} ? "ok " : "not ok "; print ++$i . "\n";
+print $data{Message} eq $$decoded{Content}{Message} ? "ok " : "not ok "; print ++$i . "\n";
+print $headers{Scheme} eq $$decoded{Headers}{Scheme} ? "ok " : "not ok "; print ++$i . "\n";
+print $headers{Version} eq $$decoded{Headers}{Version} ? "ok " : "not ok "; print ++$i . "\n";
+print "RSA ENCRYPTED MESSAGE" eq $$decoded{Object} ? "ok " : "not ok "; print ++$i . "\n";
+
Propchange: branches/upstream/libconvert-ascii-armour-perl/current/t/05-armor.t
------------------------------------------------------------------------------
svn:executable =
More information about the Pkg-perl-cvs-commits
mailing list