diff options
Diffstat (limited to 'wrappers')
33 files changed, 0 insertions, 2547 deletions
diff --git a/wrappers/perl-xs/Botan.pm b/wrappers/perl-xs/Botan.pm deleted file mode 100644 index ac4ad91fb..000000000 --- a/wrappers/perl-xs/Botan.pm +++ /dev/null @@ -1,117 +0,0 @@ -package Botan; - -use strict; -use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $AUTOLOAD); - -require DynaLoader; -require AutoLoader; -use Carp; - -@ISA = qw(DynaLoader); -$VERSION = '0.01'; - -@EXPORT_OK = qw( - NONE - IGNORE_WS - FULL_CHECK -); - -%EXPORT_TAGS = ( - 'all' => [ @EXPORT_OK ], - 'decoder_checking' => [ qw( - NONE - IGNORE_WS - FULL_CHECK - )], - -); - - -sub AUTOLOAD -{ - # This AUTOLOAD is used to 'autoload' constants from the constant() - # XS function. If a constant is not found then control is passed - # to the AUTOLOAD in AutoLoader. - - my $constname = $AUTOLOAD; - $constname =~ s/.*:://; - croak '& not defined' if $constname eq 'constant'; -# my $val = constant($constname, @_ ? $_[0] : 0); - my $val = constant($constname); - if ($! != 0) { - if ( $! =~ /Invalid/ ) - { - $AutoLoader::AUTOLOAD = $AUTOLOAD; - goto &AutoLoader::AUTOLOAD; - } - else - { - croak "Your vendor has not defined Botan symbol $constname"; - } - } - no strict 'refs'; - *$AUTOLOAD = sub { $val }; - goto &$AUTOLOAD; -} - - -bootstrap Botan $VERSION; - -# to setup inheritance... - -package Botan::Filter; -use vars qw(@ISA); -@ISA = qw(); - -package Botan::Chain; -use vars qw(@ISA); -@ISA = qw( Botan::Filter ); - -package Botan::Fork; -use vars qw(@ISA); -@ISA = qw( Botan::Filter ); - -package Botan::Hex_Encoder; -use vars qw(@ISA); -@ISA = qw( Botan::Filter ); - -package Botan::Hex_Decoder; -use vars qw(@ISA); -@ISA = qw( Botan::Filter ); - -package Botan::Base64_Decoder; -use vars qw(@ISA); -@ISA = qw( Botan::Filter ); - -package Botan::Base64_Encoder; -use vars qw(@ISA); -@ISA = qw( Botan::Filter ); - - -package Botan; - -1; -__END__ - -=head1 NAME - -Botan - Perl extension for access to Botan ... - -=head1 SYNOPSIS - - use Botan; - blah blah blah - -=head1 DESCRIPTION - -Blah blah blah. - -=head1 AUTHOR - -Vaclav Ovsik <[email protected]> - -=head1 SEE ALSO - -Bla - -=cut diff --git a/wrappers/perl-xs/Botan.xs b/wrappers/perl-xs/Botan.xs deleted file mode 100644 index ded129d2e..000000000 --- a/wrappers/perl-xs/Botan.xs +++ /dev/null @@ -1,829 +0,0 @@ -#ifdef __cplusplus -extern "C" { -#endif - -#include "EXTERN.h" -#include "perl.h" -#include "XSUB.h" - -#ifdef __cplusplus -} -#endif - -#include <botan/asn1_obj.h> -#include <botan/asn1_oid.h> -#include <botan/base64.h> -#include <botan/basefilt.h> -#include <botan/hex.h> -#include <botan/init.h> -#include <botan/oids.h> -#include <botan/x509cert.h> -#include <botan/x509_ext.h> - - -/* xsubpp converts ':' to '_' in typemap. We create our types without ':' */ - -typedef Botan::ASN1_String Botan__ASN1_String; -typedef Botan::AlgorithmIdentifier Botan__AlgorithmIdentifier; -typedef Botan::AlternativeName Botan__AlternativeName; -typedef Botan::Attribute Botan__Attribute; -typedef Botan::Base64_Decoder Botan__Base64_Decoder; -typedef Botan::Base64_Encoder Botan__Base64_Encoder; -typedef Botan::Chain Botan__Chain; -typedef Botan::Certificate_Extension Botan__Extension; -typedef Botan::Filter Botan__Filter; -typedef Botan::Fork Botan__Fork; -typedef Botan::Hex_Decoder Botan__Hex_Decoder; -typedef Botan::Hex_Encoder Botan__Hex_Encoder; -typedef Botan::OID Botan__OID; -typedef Botan::Pipe Botan__Pipe; -typedef Botan::X509_Certificate Botan__X509_Certificate; -typedef Botan::X509_DN Botan__X509_DN; -typedef Botan::X509_Time Botan__X509_Time; -typedef Botan::u32bit Botan__u32bit; - - -/* Types to keep track of destruction C++ objects passed - * into other objects... - * An Botan object is deleted by his parent object into which is passed, - * e.g. some Filter is deleted when his Pipe is destructed. We must - * track this and not to delete object again in Perls destructor. - */ - -class ObjectInfo -{ -private: - I32 d_signature; - bool d_del; -public: - static I32 const SIGNVAL = 0x696a626f; - ObjectInfo() : d_signature(SIGNVAL), - d_del(true) {}; - ~ObjectInfo() {}; - void set_delete(bool del = true) { d_del = del; }; - void set_delete_no() { set_delete(false); }; - void set_delete_yes() { set_delete(true); }; - bool should_delete() const { return d_del; }; -}; - -/* Constant object in initial state - template */ - -ObjectInfo const oi_init; - - -/* Botan library initializer ... */ - -Botan::LibraryInitializer botan_init; - - - -/*============================================================================*/ - -MODULE = Botan PACKAGE = Botan - -PROTOTYPES: ENABLE - -void -constant(char *name) - CODE: - using namespace Botan; - errno = 0; - switch (name[0]) - { - case 'F': - if ( strEQ(name, "FULL_CHECK") ) - XSRETURN_IV( FULL_CHECK ); // Decoder_Checking enum - break; - case 'I': - if ( strEQ(name, "IGNORE_WS") ) - XSRETURN_IV( IGNORE_WS ); // Decoder_Checking enum - break; - case 'N': - if ( strEQ(name, "NONE") ) - XSRETURN_IV( NONE ); // Decoder_Checking enum - break; - } - errno = EINVAL; - XSRETURN_UNDEF; - - -# =========================== Botan::Chain ========================== - -MODULE = Botan PACKAGE = Botan::Chain - -Botan__Chain * -Botan__Chain::new(f1 = 0, f2 = 0, f3 = 0, f4 = 0) - Botan__Filter *f1; - Botan__Filter *f2; - Botan__Filter *f3; - Botan__Filter *f4; - PREINIT: - ObjectInfo *f1_oi; - ObjectInfo *f2_oi; - ObjectInfo *f3_oi; - ObjectInfo *f4_oi; - CODE: - try { - RETVAL = new Botan__Chain(f1, f2, f3, f4); - if ( f1 ) f1_oi->set_delete_no(); - if ( f2 ) f2_oi->set_delete_no(); - if ( f3 ) f3_oi->set_delete_no(); - if ( f4 ) f4_oi->set_delete_no(); - } - catch (const std::exception &e) { - croak(e.what()); - } - OUTPUT: - RETVAL - -void -Botan__Chain::DESTROY() - PREINIT: - ObjectInfo *THIS_oi; - CODE: - if ( THIS_oi->should_delete() ) - try { - delete THIS; - } - catch (const std::exception &e) { - croak(e.what()); - } - - -# =========================== Botan::Fork ========================== - -MODULE = Botan PACKAGE = Botan::Fork - -Botan__Fork * -Botan__Fork::new(f1 = 0, f2 = 0, f3 = 0, f4 = 0) - Botan__Filter *f1; - Botan__Filter *f2; - Botan__Filter *f3; - Botan__Filter *f4; - PREINIT: - ObjectInfo *f1_oi; - ObjectInfo *f2_oi; - ObjectInfo *f3_oi; - ObjectInfo *f4_oi; - CODE: - try { - RETVAL = new Botan__Fork(f1, f2, f3, f4); - if ( f1 ) f1_oi->set_delete_no(); - if ( f2 ) f2_oi->set_delete_no(); - if ( f3 ) f3_oi->set_delete_no(); - if ( f4 ) f4_oi->set_delete_no(); - } - catch (const std::exception &e) { - croak(e.what()); - } - OUTPUT: - RETVAL - -void -Botan__Fork::DESTROY() - PREINIT: - ObjectInfo *THIS_oi; - CODE: - if ( THIS_oi->should_delete() ) - try { - delete THIS; - } - catch (const std::exception &e) { - croak(e.what()); - } - - -# ============================ Botan::Base64_Decoder ============================ - -MODULE = Botan PACKAGE = Botan::Base64_Decoder - -Botan__Base64_Decoder * -Botan__Base64_Decoder::new(checking = Botan::NONE) - int checking; - CODE: - try { - using namespace Botan; - RETVAL = new Base64_Decoder((Decoder_Checking)checking); - } - catch (const std::exception &e) { - croak(e.what()); - } - OUTPUT: - RETVAL - -void -Botan__Base64_Decoder::DESTROY() - PREINIT: - ObjectInfo *THIS_oi; - CODE: - if ( THIS_oi->should_delete() ) - try { - delete THIS; - } - catch (const std::exception &e) { - croak(e.what()); - } - - -# =========================== Botan::Base64_Encoder ========================== - -MODULE = Botan PACKAGE = Botan::Base64_Encoder - -Botan__Base64_Encoder * -Botan__Base64_Encoder::new(breaks = false, length = 72) - bool breaks; - Botan__u32bit length; - CODE: - try { - RETVAL = new Botan__Base64_Encoder(breaks, length); - } - catch (const std::exception &e) { - croak(e.what()); - } - OUTPUT: - RETVAL - -void -Botan__Base64_Encoder::DESTROY() - PREINIT: - ObjectInfo *THIS_oi; - CODE: - if ( THIS_oi->should_delete() ) - try { - delete THIS; - } - catch (const std::exception &e) { - croak(e.what()); - } - - -# ============================ Botan::Hex_Decoder ============================ - -MODULE = Botan PACKAGE = Botan::Hex_Decoder - -Botan__Hex_Decoder * -Botan__Hex_Decoder::new(checking = Botan::NONE) - int checking; - CODE: - try { - using namespace Botan; - RETVAL = new Hex_Decoder((Decoder_Checking)checking); - } - catch (const std::exception &e) { - croak(e.what()); - } - OUTPUT: - RETVAL - -void -Botan__Hex_Decoder::DESTROY() - PREINIT: - ObjectInfo *THIS_oi; - CODE: - if ( THIS_oi->should_delete() ) - try { - delete THIS; - } - catch (const std::exception &e) { - croak(e.what()); - } - - -# ============================ Botan::Hex_Encoder ============================ - -MODULE = Botan PACKAGE = Botan::Hex_Encoder - -Botan__Hex_Encoder * -Botan__Hex_Encoder::new(breaks = false, length = 72, lcase = false) - bool breaks; - Botan__u32bit length; - bool lcase; - CODE: - try { - using Botan::Hex_Encoder; - RETVAL = new Hex_Encoder(breaks, length, - lcase ? Hex_Encoder::Lowercase : Hex_Encoder::Uppercase); - } - catch (const std::exception &e) { - croak(e.what()); - } - OUTPUT: - RETVAL - -void -Botan__Hex_Encoder::DESTROY() - PREINIT: - ObjectInfo *THIS_oi; - CODE: - if ( THIS_oi->should_delete() ) - try { - delete THIS; - } - catch (const std::exception &e) { - croak(e.what()); - } - - -# ================================ Botan::OID ================================ - -MODULE = Botan PACKAGE = Botan::OID - -Botan__OID * -Botan__OID::new(s) - char *s; - CODE: - try { - RETVAL = new Botan__OID(s); - } - catch (const std::exception &e) { - croak(e.what()); - } - OUTPUT: - RETVAL - -void -Botan__OID::DESTROY() - CODE: - try { - delete THIS; - } - catch (const std::exception &e) { - croak(e.what()); - } - -char * -Botan__OID::as_string() - CODE: - try { - RETVAL = const_cast<char *>(THIS->as_string().c_str()); - } - catch (const std::exception &e) { - croak(e.what()); - } - OUTPUT: - RETVAL - - -# ================================ Botan::OIDS ================================ - -MODULE = Botan PACKAGE = Botan::OIDS - -void -add_oid(oid, name) - Botan__OID *oid; - char *name; - CODE: - try { - Botan::OIDS::add_oid(*oid, name); - } - catch (const std::exception &e) { - croak(e.what()); - } - -char * -lookup_by_oid(oid) - Botan__OID *oid; - CODE: - try { - RETVAL = const_cast<char *>(Botan::OIDS::lookup(*oid).c_str()); - } - catch (const std::exception &e) { - croak(e.what()); - } - OUTPUT: - RETVAL - -Botan__OID * -lookup_by_name(name) - char *name; - CODE: - try { - RETVAL = new Botan__OID(Botan::OIDS::lookup(name)); - } - catch (const std::exception &e) { - croak(e.what()); - } - char const * CLASS = "Botan::OID"; - OUTPUT: - RETVAL - -int -have_oid(name) - char *name; - CODE: - try { - RETVAL = Botan::OIDS::have_oid(name); - } - catch (const std::exception &e) { - croak(e.what()); - } - OUTPUT: - RETVAL - - -# ================================ Botan::Pipe ================================ - -MODULE = Botan PACKAGE = Botan::Pipe - -Botan__Pipe * -Botan__Pipe::new(...) - CODE: - for (I32 i = 1; i < items; i++) - { - if ( !sv_isobject(ST(i)) || (SvTYPE(SvRV(ST(i))) != SVt_PVMG) ) - croak("Botan::Pipe::new() -- arg %u is not " - "a blessed SV reference", i +1); - if ( !sv_derived_from(ST(i), "Botan::Filter") ) - croak("Botan::Pipe::new() -- arg %u is not " - "an object derived from Botan::Filter", i +1); - MAGIC *mg = mg_find(SvRV(ST(i)), '~'); - if ( mg == 0 - || mg->mg_len != sizeof(ObjectInfo) - || *(I32 *)(mg->mg_ptr) != ObjectInfo::SIGNVAL ) - croak("Botan::Pipe::new() -- arg %u has no " - "valid private magic data (ObjectInfo)", i +1); - } - try { - RETVAL = new Botan__Pipe(); - for (I32 i = 1; i < items; i++) - { - SV *osv = (SV *)SvRV(ST(i)); - ObjectInfo *oi = (ObjectInfo *)(mg_find(osv, '~')->mg_ptr); - RETVAL->append((Botan__Filter *)(SvIV(osv))); - oi->set_delete_no(); - } - } - catch (const std::exception &e) { - croak(e.what()); - } - OUTPUT: - RETVAL - -void -Botan__Pipe::DESTROY() - PREINIT: - ObjectInfo *THIS_oi; - CODE: - try { - delete THIS; - } - catch (const std::exception &e) { - croak(e.what()); - } - -void -Botan__Pipe::write(s) - SV *s; - PREINIT: - ObjectInfo *THIS_oi; - CODE: - STRLEN len; - char *ptr = SvPV(s, len); - try { - THIS->write((unsigned char *)ptr, len); - } - catch (const std::exception &e) { - croak(e.what()); - } - -void -Botan__Pipe::process_msg(s) - SV *s; - PREINIT: - ObjectInfo *THIS_oi; - CODE: - STRLEN len; - char *ptr = SvPV(s, len); - try { - THIS->process_msg((unsigned char *)ptr, len); - } - catch (const std::exception &e) { - croak(e.what()); - } - -Botan__u32bit -Botan__Pipe::remaining(msgno = Botan::Pipe::DEFAULT_MESSAGE) - Botan__u32bit msgno; - PREINIT: - ObjectInfo *THIS_oi; - CODE: - try { - RETVAL = THIS->remaining(msgno); - } - catch (const std::exception &e) { - croak(e.what()); - } - OUTPUT: - RETVAL - -SV * -Botan__Pipe::read(len = 0xFFFFFFFF, msgno = Botan::Pipe::DEFAULT_MESSAGE) - Botan__u32bit len; - Botan__u32bit msgno; - PREINIT: - ObjectInfo *THIS_oi; - CODE: - try { - if ( len > THIS->remaining(msgno) ) - len = THIS->remaining(msgno); - RETVAL = NEWSV(0, len); - SvPOK_on(RETVAL); - if ( len > 0 ) - SvCUR_set(RETVAL, THIS->read((unsigned char *)SvPVX(RETVAL), - len, msgno)); - } - catch (const std::exception &e) { - croak(e.what()); - } - OUTPUT: - RETVAL - -SV * -Botan__Pipe::peek(len = 0xFFFFFFFF, offset = 0, \ - msgno = Botan::Pipe::DEFAULT_MESSAGE) - Botan__u32bit len; - Botan__u32bit offset; - Botan__u32bit msgno; - PREINIT: - ObjectInfo *THIS_oi; - CODE: - try { - if ( len > THIS->remaining(msgno) ) - len = THIS->remaining(msgno); - RETVAL = NEWSV(0, len); - SvPOK_on(RETVAL); - if ( len > 0 ) - SvCUR_set(RETVAL, THIS->peek((unsigned char *)SvPVX(RETVAL), - len, offset, msgno)); - } - catch (const std::exception &e) { - croak(e.what()); - } - OUTPUT: - RETVAL - -Botan__u32bit -Botan__Pipe::default_msg() - PREINIT: - ObjectInfo *THIS_oi; - CODE: - try { - RETVAL = THIS->default_msg(); - } - catch (const std::exception &e) { - croak(e.what()); - } - OUTPUT: - RETVAL - -void -Botan__Pipe::set_default_msg(msgno) - Botan__u32bit msgno; - PREINIT: - ObjectInfo *THIS_oi; - CODE: - try { - THIS->set_default_msg(msgno); - } - catch (const std::exception &e) { - croak(e.what()); - } - -Botan__u32bit -Botan__Pipe::message_count() - PREINIT: - ObjectInfo *THIS_oi; - CODE: - try { - RETVAL = THIS->message_count(); - } - catch (const std::exception &e) { - croak(e.what()); - } - OUTPUT: - RETVAL - -bool -Botan__Pipe::end_of_data() - PREINIT: - ObjectInfo *THIS_oi; - CODE: - try { - RETVAL = THIS->end_of_data(); - } - catch (const std::exception &e) { - croak(e.what()); - } - OUTPUT: - RETVAL - -void -Botan__Pipe::start_msg() - PREINIT: - ObjectInfo *THIS_oi; - CODE: - try { - THIS->start_msg(); - } - catch (const std::exception &e) { - croak(e.what()); - } - -void -Botan__Pipe::end_msg() - PREINIT: - ObjectInfo *THIS_oi; - CODE: - try { - THIS->end_msg(); - } - catch (const std::exception &e) { - croak(e.what()); - } - -void -Botan__Pipe::reset() - PREINIT: - ObjectInfo *THIS_oi; - CODE: - try { - THIS->reset(); - } - catch (const std::exception &e) { - croak(e.what()); - } - - -# ========================== Botan::X509_Certificate ========================== - -MODULE = Botan PACKAGE = Botan::X509_Certificate - -Botan__X509_Certificate * -Botan__X509_Certificate::new(char *fn) - CODE: - try { - RETVAL = new Botan__X509_Certificate(fn); - } - catch (const std::exception &e) { - croak(e.what()); - } - OUTPUT: - RETVAL - -void -Botan__X509_Certificate::DESTROY() - CODE: - try { - delete THIS; - } - catch (const std::exception &e) { - croak(e.what()); - } - -unsigned int -Botan__X509_Certificate::x509_version() - CODE: - try { - RETVAL = THIS->x509_version(); - } - catch (const std::exception &e) { - croak(e.what()); - } - OUTPUT: - RETVAL - -char * -Botan__X509_Certificate::start_time() - CODE: - try { - RETVAL = const_cast<char *>(THIS->start_time().c_str()); - } - catch (const std::exception &e) { - croak(e.what()); - } - OUTPUT: - RETVAL - -char * -Botan__X509_Certificate::end_time() - CODE: - try { - RETVAL = const_cast<char *>(THIS->end_time().c_str()); - } - catch (const std::exception &e) { - croak(e.what()); - } - OUTPUT: - RETVAL - -char * -Botan__X509_Certificate::subject_info(char *info) - CODE: - try { - std::vector<std::string> s = THIS->subject_info(info); - - if(s.size() > 0) - RETVAL = const_cast<char *>(s[0].c_str()); - else - RETVAL = "err"; - } - catch (const std::exception &e) { - croak(e.what()); - } - OUTPUT: - RETVAL - -char * -Botan__X509_Certificate::issuer_info(char *info) - CODE: - try { - std::vector<std::string> s = THIS->subject_info(info); - - if(s.size() > 0) - RETVAL = const_cast<char *>(s[0].c_str()); - else - RETVAL = "err"; - } - catch (const std::exception &e) { - croak(e.what()); - } - OUTPUT: - RETVAL - -Botan__X509_DN * -Botan__X509_Certificate::subject_dn() - CODE: - try { - RETVAL = new Botan__X509_DN(THIS->subject_dn()); - } - catch (const std::exception &e) { - croak(e.what()); - } - char const * CLASS = "Botan::X509_DN"; - OUTPUT: - RETVAL - -Botan__X509_DN * -Botan__X509_Certificate::issuer_dn() - CODE: - try { - RETVAL = new Botan__X509_DN(THIS->issuer_dn()); - } - catch (const std::exception &e) { - croak(e.what()); - } - char const * CLASS = "Botan::X509_DN"; - OUTPUT: - RETVAL - - -# ============================== Botan::X509_DN ============================== - -MODULE = Botan PACKAGE = Botan::X509_DN - -Botan__X509_DN * -Botan__X509_DN::new() - CODE: - try { - RETVAL = new Botan__X509_DN(); - } - catch (const std::exception &e) { - croak(e.what()); - } - OUTPUT: - RETVAL - -void -Botan__X509_DN::DESTROY() - CODE: - try { - delete THIS; - } - catch (const std::exception &e) { - croak(e.what()); - } - -AV * -Botan__X509_DN::get_attributes() - CODE: - try { - using namespace std; - using namespace Botan; - - typedef multimap<OID, string>::const_iterator rdn_iter; - - multimap<OID, string> const &atrmmap = THIS->get_attributes(); - RETVAL = newAV(); - for(rdn_iter i = atrmmap.begin(); i != atrmmap.end(); i++) - { - string const &atr = i->first.as_string(); - string const &val = i->second; - av_push(RETVAL, newSVpvn(atr.c_str(), atr.length())); - av_push(RETVAL, newSVpvn(val.c_str(), val.length())); - } - } - catch (const std::exception &e) { - croak(e.what()); - } - OUTPUT: - RETVAL diff --git a/wrappers/perl-xs/Changes b/wrappers/perl-xs/Changes deleted file mode 100644 index 5f32b0c63..000000000 --- a/wrappers/perl-xs/Changes +++ /dev/null @@ -1,4 +0,0 @@ -Revision history for Perl extension to Botan. - -0.01 Fri, 20 Feb 2004 15:10:50 +0100 - - first version diff --git a/wrappers/perl-xs/MANIFEST b/wrappers/perl-xs/MANIFEST deleted file mode 100644 index b9d8454d6..000000000 --- a/wrappers/perl-xs/MANIFEST +++ /dev/null @@ -1,15 +0,0 @@ -Botan.pm -Botan.xs -Changes -MANIFEST -Makefile.PL -data/ca.cert.der -data/ca.cert.pem -t/base64.t -t/filt.t -t/hex.t -t/oid.t -t/pipe.t -t/testutl.pl -t/x509cert.t -typemap diff --git a/wrappers/perl-xs/Makefile.PL b/wrappers/perl-xs/Makefile.PL deleted file mode 100644 index d35c99168..000000000 --- a/wrappers/perl-xs/Makefile.PL +++ /dev/null @@ -1,29 +0,0 @@ -use ExtUtils::MakeMaker; - -my ($cc, $cflags, $lids); -if ( $^O eq 'MSWin32' ) -{ -# $cflags = ''; -# $libs = ':nosearch -lgdi32 -llibeay32'; -} -else -{ - $cc = 'g++'; - $cflags = '-fexceptions ' . qx( botan-config --cflags ); - $libs = qx( botan-config --libs ); -} - -WriteMakefile( - 'NAME' => 'Botan', - 'DISTNAME' => 'Botan-XS', - 'VERSION_FROM' => 'Botan.pm', # finds $VERSION - 'XSOPT' => '-C++', - 'CC' => $cc, - 'LD' => '$(CC)', - 'CCFLAGS' => $cflags, - 'LIBS' => [ $libs ], - 'OPTIMIZE' => '-g', -# 'clean' => { -# 'FILES' => 'neco.p12 rnd', -# }, -); diff --git a/wrappers/perl-xs/data/ca.cert.der b/wrappers/perl-xs/data/ca.cert.der Binary files differdeleted file mode 100644 index d6ed8aeaf..000000000 --- a/wrappers/perl-xs/data/ca.cert.der +++ /dev/null diff --git a/wrappers/perl-xs/data/ca.cert.pem b/wrappers/perl-xs/data/ca.cert.pem deleted file mode 100644 index 012913b26..000000000 --- a/wrappers/perl-xs/data/ca.cert.pem +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICxDCCAi2gAwIBAgIBEjANBgkqhkiG9w0BAQUFADBSMQswCQYDVQQGEwJDWjER -MA8GA1UEChMISUNaIGEucy4xGDAWBgNVBAMTD1Rlc3QgcHJpbWFyeSBDQTEWMBQG -CSqGSIb3DQEJARYHY2FAaS5jejAeFw0wMDA4MjAyMTQ4MDBaFw0wMjA4MTAyMTQ4 -MDBaME8xCzAJBgNVBAYTAkNaMREwDwYDVQQKEwhJQ1ogYS5zLjEVMBMGA1UEAxMM -VGVzdCBzaWduIENBMRYwFAYJKoZIhvcNAQkBFgdjYUBpLmN6MIGfMA0GCSqGSIb3 -DQEBAQUAA4GNADCBiQKBgQCo2GReNqwU0/8bZZua5hgYaVHvD9QAmfILNXD25jRk -C8lqe5m/GzbmftSUso5HyUy1t+qzvRDTmxK8uRn0P00Mqj9gjwF8PGQvZE/FrDF7 -rta9GCcH4n2GfQ0iexlhRZW44AfOD4HCgq38Z0bzBclsvUslBWe1AT+S5+chZ5Wb -UwIDAQABo4GsMIGpMAwGA1UdEwQFMAMBAf8wHQYDVR0OBBYEFLXqc1b1DOfGehii -k4Z+/ih9BYZmMHoGA1UdIwRzMHGAFL7x2ToS4RDAbDJu4fHnzzGjfGmgoVakVDBS -MQswCQYDVQQGEwJDWjERMA8GA1UEChMISUNaIGEucy4xGDAWBgNVBAMTD1Rlc3Qg -cHJpbWFyeSBDQTEWMBQGCSqGSIb3DQEJARYHY2FAaS5jeoIBADANBgkqhkiG9w0B -AQUFAAOBgQAKD9ku9kKXUGhSw8KuWJXTnEsIUzDtgmREBEUOtEvGfU45vogWN7ZL -9fQZ1deywN4RJ4T5ZTTcCTPodOdG+IXLJ+uPn/m9iQ/D86c3GKS3yx4JNAn5PH1m -qLsMYVjbFD2uREZQsqbg3RT6L1D8+oK0pN379u3bD6oJx/qa7+F4Jg== ------END CERTIFICATE----- diff --git a/wrappers/perl-xs/t/base64.t b/wrappers/perl-xs/t/base64.t deleted file mode 100644 index f0973e13e..000000000 --- a/wrappers/perl-xs/t/base64.t +++ /dev/null @@ -1,273 +0,0 @@ -# vim: set ft=perl: -# Before `make install' is performed this script should be runnable with -# `make test'. After `make install' it should work as `perl test.pl' - -######################### We start with some black magic to print on failure. - -# Change 1..1 below to 1..last_test_to_print . -# (It may become useful if the test is moved to ./t subdirectory.) - -BEGIN { $| = 1; print "1..24\n"; } -END { print "not ok 1\n" unless $loaded; } - -require 't/testutl.pl'; -use Botan; - -$loaded = 1; -print "ok 1\n"; - -######################### End of black magic. - -# Insert your test code below (better if it prints "ok 13" -# (correspondingly "not ok 13") depending on the success of chunk 13 -# of the test code): - -use strict; - -# Data prep - -my $botan_lic_b64_garbage = <<'EOF'; -Q29weXJpZ2h0IChDKSAxOTk5LTIwMDQgVGhlIEJvdGFuIFByb2plY3QuIEFsbCBy__� -aWdodHMgcmVzZXJ2ZWQuCgpSZWRpc3RyaWJ1dGlvbiBhbmQgdXNlIGluIHNvdXJj$$*: -ZSBhbmQgYmluYXJ5IGZvcm1zLCBmb3IgYW55IHVzZSwgd2l0aCBvciB3aXRob3V0!@#$%^&*( -Cm1vZGlmaWNhdGlvbiwgaXMgcGVybWl0dGVkIHByb3ZpZGVkIHRoYXQgdGhlIGZv[\] -bGxvd2luZyBjb25kaXRpb25zIGFyZSBtZXQ6CgoxLiBSZWRpc3RyaWJ1dGlvbnMg'~` -b2Ygc291cmNlIGNvZGUgbXVzdCByZXRhaW4gdGhlIGFib3ZlIGNvcHlyaWdodCBu() -b3RpY2UsIHRoaXMKbGlzdCBvZiBjb25kaXRpb25zLCBhbmQgdGhlIGZvbGxvd2lu -ZyBkaXNjbGFpbWVyLgoKMi4gUmVkaXN0cmlidXRpb25zIGluIGJpbmFyeSBmb3Jt -IG11c3QgcmVwcm9kdWNlIHRoZSBhYm92ZSBjb3B5cmlnaHQgbm90aWNlLAp0aGlz -IGxpc3Qgb2YgY29uZGl0aW9ucywgYW5kIHRoZSBmb2xsb3dpbmcgZGlzY2xhaW1l -ciBpbiB0aGUgZG9jdW1lbnRhdGlvbgphbmQvb3Igb3RoZXIgbWF0ZXJpYWxzIHBy_,^ -b3ZpZGVkIHdpdGggdGhlIGRpc3RyaWJ1dGlvbi4KClRISVMgU09GVFdBUkUgSVMg{|}~~~~~ -UFJPVklERUQgQlkgVEhFIEFVVEhPUihTKSAiQVMgSVMiIEFORCBBTlkgRVhQUkVT~~~~~~~~ -UyBPUiBJTVBMSUVECldBUlJBTlRJRVMsIElOQ0xVRElORywgQlVUIE5PVCBMSU1J__:; -VEVEIFRPLCBUSEUgSU1QTElFRCBXQVJSQU5USUVTIE9GCk1FUkNIQU5UQUJJTElU -WSBBTkQgRklUTkVTUyBGT1IgQSBQQVJUSUNVTEFSIFBVUlBPU0UsIEFSRSBESVND -TEFJTUVELgoKSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUihTKSBPUiBDT05U -UklCVVRPUihTKSBCRSBMSUFCTEUgRk9SIEFOWSBESVJFQ1QsCklORElSRUNULCBJ -TkNJREVOVEFMLCBTUEVDSUFMLCBFWEVNUExBUlksIE9SIENPTlNFUVVFTlRJQUwg -REFNQUdFUyAoSU5DTFVESU5HLApCVVQgTk9UIExJTUlURUQgVE8sIFBST0NVUkVN -RU5UIE9GIFNVQlNUSVRVVEUgR09PRFMgT1IgU0VSVklDRVM7IExPU1MgT0YgVVNF -LApEQVRBLCBPUiBQUk9GSVRTOyBPUiBCVVNJTkVTUyBJTlRFUlJVUFRJT04pIEhP -V0VWRVIgQ0FVU0VEIEFORCBPTiBBTlkgVEhFT1JZIE9GCkxJQUJJTElUWSwgV0hF -VEhFUiBJTiBDT05UUkFDVCwgU1RSSUNUIExJQUJJTElUWSwgT1IgVE9SVCAoSU5D -TFVESU5HIE5FR0xJR0VOQ0UKT1IgT1RIRVJXSVNFKSBBUklTSU5HIElOIEFOWSBX -QVkgT1VUIE9GIFRIRSBVU0UgT0YgVEhJUyBTT0ZUV0FSRSwgRVZFTiBJRgpBRFZJ -U0VEIE9GIFRIRSBQT1NTSUJJTElUWSBPRiBTVUNIIERBTUFHRS4K -EOF - -my $botan_lic_b64_ws = $botan_lic_b64_garbage; -$botan_lic_b64_ws =~ s/[^A-Za-z0-9+\/= \n]//g; - -my $botan_lic_b64 = $botan_lic_b64_ws; -$botan_lic_b64 =~ s/[ \n]//g; - - -my $botan_lic = <<'EOF'; -Copyright (C) 1999-2004 The Botan Project. All rights reserved. - -Redistribution and use in source and binary forms, for any use, with or without -modification, is permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this -list of conditions, and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, -this list of conditions, and the following disclaimer in the documentation -and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. - -IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTOR(S) BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -EOF - - -# Decoder... - -my $f; - -eval { $f = Botan::Base64_Decoder->new(&Botan::NONE); }; -print "not " if $@ || !defined $f; -print "ok 2\n"; - -my $dec; -eval { $dec = Botan::Pipe->new($f); }; -print "not " if $@ || !defined $dec; -print "ok 3\n"; - -eval { $f = Botan::Base64_Decoder->new(&Botan::IGNORE_WS); }; -print "not " if $@ || !defined $f; -print "ok 4\n"; - -my $dec_is; -eval { $dec_is = Botan::Pipe->new($f); }; -print "not " if $@ || !defined $dec_is; -print "ok 5\n"; - -eval { $f = Botan::Base64_Decoder->new(&Botan::FULL_CHECK); }; -print "not " if $@ || !defined $f; -print "ok 6\n"; - -my $dec_fc; -eval { $dec_fc = Botan::Pipe->new($f); }; -print "not " if $@ || !defined $dec_fc; -print "ok 7\n"; - - -# Testing clean base64 input - -my $data; - -undef $data; -eval { - $dec->process_msg($botan_lic_b64); - $data = $dec->read(); -}; - -print "not " if $@ || $data ne $botan_lic; -print "ok 8\n"; - -undef $data; -eval { - $dec_is->process_msg($botan_lic_b64); - $data = $dec_is->read(); -}; - -print "not " if $@ || $data ne $botan_lic; -print "ok 9\n"; - -undef $data; -eval { - $dec_fc->process_msg($botan_lic_b64); - $data = $dec_fc->read(); -}; - -print "not " if $@ || $data ne $botan_lic; -print "ok 10\n"; - - -# Testing base64 input with whitespaces - -undef $data; -eval { - $dec->process_msg($botan_lic_b64_ws); - $dec->set_default_msg(1); - $data = $dec->read(); -}; - -print "not " if $@ || $data ne $botan_lic; -print "ok 11\n"; - -undef $data; -eval { - $dec_is->process_msg($botan_lic_b64_ws); - $dec_is->set_default_msg(1); - $data = $dec_is->read(); -}; - -print "not " if $@ || $data ne $botan_lic; -print "ok 12\n"; - -undef $data; -eval { - $dec_fc->process_msg($botan_lic_b64_ws); - $dec_fc->set_default_msg(1); - $data = $dec_fc->read(); -}; - -print "not " unless $@ && !defined $data; -print "ok 13\n"; - - -# Testing base64 input with garbage - -undef $data; -eval { - $dec->process_msg($botan_lic_b64_garbage); - $dec->set_default_msg(2); - $data = $dec->read(); -}; - -print "not " if $@ || $data ne $botan_lic; -print "ok 14\n"; - -undef $data; -eval { - $dec_is->process_msg($botan_lic_b64_garbage); - $dec_is->set_default_msg(2); - $data = $dec_is->read(); -}; - -print "not " unless $@ && !defined $data; -print "ok 15\n"; - -undef $data; -eval { - $dec_fc->process_msg($botan_lic_b64_garbage); - $dec_fc->set_default_msg(2); - $data = $dec_fc->read(); -}; - -print "not " unless $@ && !defined $data; -print "ok 16\n"; - - -# Encoder... - -eval { $f = Botan::Base64_Encoder->new(); }; -print "not " if $@ || !defined $f; -print "ok 17\n"; - -my $enc; -eval { $enc = Botan::Pipe->new($f); }; -print "not " if $@ || !defined $enc; -print "ok 18\n"; - -eval { $f = Botan::Base64_Encoder->new(1, 5); }; -print "not " if $@ || !defined $f; -print "ok 19\n"; - -my $enc2; -eval { $enc2 = Botan::Pipe->new($f); }; -print "not " if $@ || !defined $enc2; -print "ok 20\n"; - -undef $data; -eval { - $enc->process_msg("Hello\n"); - $data = $enc->read(); -}; -print "not " if $@ || $data ne "SGVsbG8K"; -print "ok 21\n"; - -undef $data; -eval { - $enc2->process_msg("Hello\n"); - $data = $enc2->read(); -}; -print "not " if $@ || $data ne "SGVsb\nG8K\n"; -print "ok 22\n"; - - -# Encoder with decoder... - -my $p; -eval { - $p = Botan::Pipe->new( - Botan::Base64_Encoder->new(), - Botan::Base64_Decoder->new(), - ); -}; -print "not " if $@ || !defined $p; -print "ok 23\n"; - -print "not " unless random_message_ok($p); -print "ok 24\n"; diff --git a/wrappers/perl-xs/t/filt.t b/wrappers/perl-xs/t/filt.t deleted file mode 100644 index 2a7b4c8ba..000000000 --- a/wrappers/perl-xs/t/filt.t +++ /dev/null @@ -1,56 +0,0 @@ -# vim: set ft=perl: -# Before `make install' is performed this script should be runnable with -# `make test'. After `make install' it should work as `perl test.pl' - -######################### We start with some black magic to print on failure. - -# Change 1..1 below to 1..last_test_to_print . -# (It may become useful if the test is moved to ./t subdirectory.) - -BEGIN { $| = 1; print "1..5\n"; } -END { print "not ok 1\n" unless $loaded; } - -use Botan; - -$loaded = 1; -print "ok 1\n"; - -######################### End of black magic. - -# Insert your test code below (better if it prints "ok 13" -# (correspondingly "not ok 13") depending on the success of chunk 13 -# of the test code): - -use strict; - -my $pipe = Botan::Pipe->new(Botan::Hex_Encoder->new()); - -print "not " unless $pipe; -print "ok 2\n"; - -$pipe->process_msg('FOO'); - -print "not " if $pipe->read() ne '464F4F'; -print "ok 3\n"; - -$pipe = Botan::Pipe->new(Botan::Hex_Encoder->new(0, 0, 1)); - -print "not " unless $pipe; -print "ok 4\n"; - -$pipe->process_msg('FOO'); - -print "not " if $pipe->read() ne '464f4f'; -print "ok 5\n"; - - - - - - -#my $pipe = Botan::Pipe->new(Botan::Base64_Encoder->new()); -#$pipe->process_msg('FOO'); -# -#print "not " if $pipe->read() ne 'Rk9P'; -#print "ok 4\n"; - diff --git a/wrappers/perl-xs/t/hex.t b/wrappers/perl-xs/t/hex.t deleted file mode 100644 index 6f447b25c..000000000 --- a/wrappers/perl-xs/t/hex.t +++ /dev/null @@ -1,256 +0,0 @@ -# vim: set ft=perl: -# Before `make install' is performed this script should be runnable with -# `make test'. After `make install' it should work as `perl test.pl' - -######################### We start with some black magic to print on failure. - -# Change 1..1 below to 1..last_test_to_print . -# (It may become useful if the test is moved to ./t subdirectory.) - -BEGIN { $| = 1; print "1..24\n"; } -END { print "not ok 1\n" unless $loaded; } - -require 't/testutl.pl'; -use Botan; - -$loaded = 1; -print "ok 1\n"; - -######################### End of black magic. - -# Insert your test code below (better if it prints "ok 13" -# (correspondingly "not ok 13") depending on the success of chunk 13 -# of the test code): - -use strict; - -# Data prep - -my ($hex, $hex_ws, $hex_garbage); -while ( $_ = <DATA> ) -{ - $hex_garbage .= $_; - s/[^[:xdigit:][:space:]]//g; - $hex_ws .= $_; - s/[^[:xdigit:]]//g; - $hex .= $_; -} -my $data_test = pack("H*", $hex); - -# Decoder... - -my $f; - -eval { $f = Botan::Hex_Decoder->new(&Botan::NONE); }; -print "not " if $@ || !defined $f; -print "ok 2\n"; - -my $dec; -eval { $dec = Botan::Pipe->new($f); }; -print "not " if $@ || !defined $dec; -print "ok 3\n"; - -eval { $f = Botan::Hex_Decoder->new(&Botan::IGNORE_WS); }; -print "not " if $@ || !defined $f; -print "ok 4\n"; - -my $dec_is; -eval { $dec_is = Botan::Pipe->new($f); }; -print "not " if $@ || !defined $dec_is; -print "ok 5\n"; - -eval { $f = Botan::Hex_Decoder->new(&Botan::FULL_CHECK); }; -print "not " if $@ || !defined $f; -print "ok 6\n"; - -my $dec_fc; -eval { $dec_fc = Botan::Pipe->new($f); }; -print "not " if $@ || !defined $dec_fc; -print "ok 7\n"; - - -# Testing clean hexadecimal input - -my $data; - -undef $data; -eval { - $dec->process_msg($hex); - $data = $dec->read(); -}; - -print "not " if $@ || $data ne $data_test; -print "ok 8\n"; - -undef $data; -eval { - $dec_is->process_msg($hex); - $data = $dec_is->read(); -}; - -print "not " if $@ || $data ne $data_test; -print "ok 9\n"; - -undef $data; -eval { - $dec_fc->process_msg($hex); - $data = $dec_fc->read(); -}; - -print "not " if $@ || $data ne $data_test; -print "ok 10\n"; - - -# Testing hexadecimal input with whitespaces - -undef $data; -eval { - $dec->process_msg($hex_ws); - $dec->set_default_msg(1); - $data = $dec->read(); -}; - -print "not " if $@ || $data ne $data_test; -print "ok 11\n"; - -undef $data; -eval { - $dec_is->process_msg($hex_ws); - $dec_is->set_default_msg(1); - $data = $dec_is->read(); -}; - -print "not " if $@ || $data ne $data_test; -print "ok 12\n"; - -undef $data; -eval { - $dec_fc->process_msg($hex_ws); - $dec_fc->set_default_msg(1); - $data = $dec_fc->read(); -}; - -print "not " unless $@ && !defined $data; -print "ok 13\n"; - - -# Testing hexadecimal input with garbage - -undef $data; -eval { - $dec->process_msg($hex_garbage); - $dec->set_default_msg(2); - $data = $dec->read(); -}; - -print "not " if $@ || $data ne $data_test; -print "ok 14\n"; - -undef $data; -eval { - $dec_is->process_msg($hex_garbage); - $dec_is->set_default_msg(2); - $data = $dec_is->read(); -}; - -print "not " unless $@ && !defined $data; -print "ok 15\n"; - -undef $data; -eval { - $dec_fc->process_msg($hex_garbage); - $dec_fc->set_default_msg(2); - $data = $dec_fc->read(); -}; - -print "not " unless $@ && !defined $data; -print "ok 16\n"; - - -# Encoder... - -eval { $f = Botan::Hex_Encoder->new(); }; -print "not " if $@ || !defined $f; -print "ok 17\n"; - -my $enc; -eval { $enc = Botan::Pipe->new($f); }; -print "not " if $@ || !defined $enc; -print "ok 18\n"; - -eval { $f = Botan::Hex_Encoder->new(1, 5, 1); }; -print "not " if $@ || !defined $f; -print "ok 19\n"; - -my $enc2; -eval { $enc2 = Botan::Pipe->new($f); }; -print "not " if $@ || !defined $enc2; -print "ok 20\n"; - -undef $data; -eval { - $enc->process_msg("Hello\n"); - $data = $enc->read(); -}; -print "not " if $@ || $data ne "48656C6C6F0A"; -print "ok 21\n"; - -undef $data; -eval { - $enc2->process_msg("Hello\n"); - $data = $enc2->read(); -}; -print "not " if $@ || $data ne "48656\nc6c6f\n0a\n"; -print "ok 22\n"; - - -# Encoder with decoder... - -my $p; -eval { - $p = Botan::Pipe->new( - Botan::Hex_Encoder->new(), - Botan::Hex_Decoder->new(), - ); -}; -print "not " if $@ || !defined $p; -print "ok 23\n"; - -print "not " unless random_message_ok($p); -print "ok 24\n"; - - - -__DATA__ -cb13 4a4d 7522 1fd3 c6f6 7786 d04b 3043 ..JMu"....w..K.. -4552 4bcf 4d2b 9d71 0cfe 4d6a 1caf bcfd .RK.M+.q..Mj.... -8f91 6151 ff85 e900 7e6a bafc 15e9 ae51 ...Q....~j.....Q -b14b 7210 bb40 5958 2b82 d49e b808 68a5 .Kr..@YX+.....h. -7945 9dec f686 9b98 989e 826d 8088 6ee7 y..........m..n. -d066 1eac 8c34 c461 bb54 7726 87ab d681 .........Tw&.... -a0be 52e5 1128 0cf2 759e cb2d e690 4ed9 ..R..(..u..-..N. -7e88 bda7 2523 4a0f 185a 02b1 f898 fc41 ~...%#J..Z...... -dd48 fa87 945d 7611 b8c9 a50a 2de2 b670 .H...]v.....-..p -0056 c8be 2cbb e7d0 1e70 4a3d 79f0 dce9 .V..,....pJ=y... -b57f 154b 2b3a db73 f086 de11 9f3e 1641 ...K+:.s.....>.. -3a28 8b9b bb0f 682b 80db b791 89e0 62c0 :(....h+........ -7204 db97 5432 2eb0 a04e f38e 809f 7223 r...T....N....r# -912e e552 1452 6dd2 e09f dd06 c715 7c1a ...R.Rm.......|. -fe3d d6cc b6d0 a17a 27d7 4327 4e43 8af3 .=.....z'..'N... -6eb5 e9f8 bfe9 34c3 6636 8243 358f 966d n..............m -7d87 d17b 5c37 6acb 4972 f4ec 6806 bbde }..{\.j.Ir..h... -2689 a019 a9e2 4101 7fe2 de72 bc03 eb5e &..........r...^ -b699 2d6b f8cd a08e 6e01 edfc a81a 94b6 ..-k....n....... -9073 15fb efb2 c8d9 9f85 6633 85f1 e9d0 .s.............. -20ce 578b ab9d 2e51 b947 69bf fba5 82c6 .W....Q.Gi..... -2ed0 dd36 d679 a399 7db3 8a0d cdef 0eda .....y..}....... -e761 e7f1 5b17 3f67 0c83 215a eddf 9d2a ....[.?g..!Z...* -5e70 0a77 c92e 94e1 a82b fd7c f10a 894f ^p.w.....+.|...O -2955 f0e8 7398 f409 2040 b797 da03 a5a6 )U..s... @...... -7ba4 c3c9 2659 b9f7 6a56 e17a b481 983f {...&Y..jV.z...? -00ed 3cc8 5a22 ad5c b6e0 3566 d717 35a6 ..<.Z".\........ -1523 4104 de63 477e fd24 68e5 e816 98df .#....G~.$h..... -1747 417e db72 a76a be5b b9dc 3dfb 2d05 .G.~.r.j.[..=.-. -d27f e597 eafc 9a29 15c5 792d 9c88 9aea .......)..y-.... -485e e431 96c3 7723 da6d 28b2 477a fd12 H^....w#.m(.Gz.. -e645 5dcd 7d5a d8b4 7acc 10b2 b41a e11d ..].}Z..z....... diff --git a/wrappers/perl-xs/t/oid.t b/wrappers/perl-xs/t/oid.t deleted file mode 100644 index 66204541f..000000000 --- a/wrappers/perl-xs/t/oid.t +++ /dev/null @@ -1,45 +0,0 @@ -# vim: set ft=perl: -# Before `make install' is performed this script should be runnable with -# `make test'. After `make install' it should work as `perl test.pl' - -######################### We start with some black magic to print on failure. - -# Change 1..1 below to 1..last_test_to_print . -# (It may become useful if the test is moved to ./t subdirectory.) - -BEGIN { $| = 1; print "1..6\n"; } -END { print "not ok 1\n" unless $loaded; } - -use Botan; - -$loaded = 1; -print "ok 1\n"; - -######################### End of black magic. - -# Insert your test code below (better if it prints "ok 13" -# (correspondingly "not ok 13") depending on the success of chunk 13 -# of the test code): - -use strict; - -print "not " unless Botan::OIDS::have_oid('X520.CommonName'); -print "ok 2\n"; - -my $oid_c = Botan::OID->new('2.5.4.3'); -print "not " if Botan::OIDS::lookup_by_oid($oid_c) ne 'X520.CommonName'; -print "ok 3\n"; - -my $oid_x = Botan::OIDS::lookup_by_name('X520.CommonName'); -print "not " if $oid_x->as_string() ne '2.5.4.3'; -print "ok 4\n"; - -my $oid_foo_num = '1.2.3.4.5.6.7.8.9.10.11.12.13.14.15'; -my $oid_foo = Botan::OID->new($oid_foo_num); -print "not " if Botan::OIDS::lookup_by_oid($oid_foo) ne $oid_foo_num; -print "ok 5\n"; - -Botan::OIDS::add_oid($oid_foo, 'Zito.Foo'); - -print "not " if Botan::OIDS::lookup_by_oid($oid_foo) ne 'Zito.Foo'; -print "ok 6\n"; diff --git a/wrappers/perl-xs/t/pipe.t b/wrappers/perl-xs/t/pipe.t deleted file mode 100644 index f850d8519..000000000 --- a/wrappers/perl-xs/t/pipe.t +++ /dev/null @@ -1,98 +0,0 @@ -# vim: set ft=perl: -# Before `make install' is performed this script should be runnable with -# `make test'. After `make install' it should work as `perl test.pl' - -######################### We start with some black magic to print on failure. - -# Change 1..1 below to 1..last_test_to_print . -# (It may become useful if the test is moved to ./t subdirectory.) - -BEGIN { $| = 1; print "1..20\n"; } -END { print "not ok 1\n" unless $loaded; } - -use Botan; - -$loaded = 1; -print "ok 1\n"; - -######################### End of black magic. - -# Insert your test code below (better if it prints "ok 13" -# (correspondingly "not ok 13") depending on the success of chunk 13 -# of the test code): - -use strict; - -my $pipe = Botan::Pipe->new(); - -print "not " unless $pipe; -print "ok 2\n"; - -$pipe->start_msg(); -$pipe->write('Hello world'); -$pipe->end_msg(); - -print "not " if $pipe->message_count() != 1; -print "ok 3\n"; - -print "not " if $pipe->remaining() != 11; -print "ok 4\n"; - -print "not " if $pipe->end_of_data(); -print "ok 5\n"; - -print "not " if $pipe->read() ne 'Hello world'; -print "ok 6\n"; - -print "not " if $pipe->remaining() != 0; -print "ok 7\n"; - -print "not " unless $pipe->end_of_data(); -print "ok 8\n"; - -$pipe->process_msg('Hello world'); - -print "not " if $pipe->message_count() != 2; -print "ok 9\n"; - -my $msg_num = $pipe->message_count() -1; - -print "not " if $pipe->read(5, $msg_num) ne 'Hello'; -print "ok 10\n"; - -print "not " if $pipe->read(6, $msg_num) ne ' world'; -print "ok 11\n"; - -print "not " if $pipe->remaining() != 0; -print "ok 12\n"; - -print "not " unless $pipe->end_of_data(); -print "ok 13\n"; - -$pipe->process_msg("The\0string\0with\0null\0chars\0"); -$msg_num = $pipe->message_count() -1; - -print "not " if $pipe->read(80, $msg_num) ne "The\0string\0with\0null\0chars\0"; -print "ok 14\n"; - -$pipe->process_msg('FOO BAR'); -$pipe->set_default_msg($pipe->message_count() -1); - -print "not " if $pipe->peek(3) ne 'FOO'; -print "ok 15\n"; - -print "not " if $pipe->peek(3, 4) ne 'BAR'; -print "ok 16\n"; - -print "not " if $pipe->peek() ne 'FOO BAR'; -print "ok 17\n"; - -print "not " if $pipe->read() ne 'FOO BAR'; -print "ok 18\n"; - -print "not " if $pipe->remaining() != 0; -print "ok 19\n"; - -print "not " unless $pipe->end_of_data(); -print "ok 20\n"; - diff --git a/wrappers/perl-xs/t/testutl.pl b/wrappers/perl-xs/t/testutl.pl deleted file mode 100644 index add6f6a45..000000000 --- a/wrappers/perl-xs/t/testutl.pl +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/perl - -sub random_message_ok -{ - my ($pipe, $iter, $chunkmax) = @_; - $iter = 100 unless defined $iter; - $chunkmax = 300 unless defined $chunkmax; - eval { - my $input = ''; - $pipe->start_msg(); - for(my $i = 0; $i < $iter; $i++) - { - my $chunk = ''; - my $chunklen = int(rand($chunkmax)); - $chunk .= pack("C", int(rand(256))) while $chunklen--; - $input .= $chunk; - $pipe->write($chunk); - } - $pipe->end_msg(); - my $msg_num = $pipe->message_count() -1; - my $output = $pipe->read(0xFFFFFFFF, $msg_num); - return $input eq $output; - }; -} - -1; diff --git a/wrappers/perl-xs/t/x509cert.t b/wrappers/perl-xs/t/x509cert.t deleted file mode 100644 index 2a943aeac..000000000 --- a/wrappers/perl-xs/t/x509cert.t +++ /dev/null @@ -1,42 +0,0 @@ -# vim: set ft=perl: -# Before `make install' is performed this script should be runnable with -# `make test'. After `make install' it should work as `perl test.pl' - -######################### We start with some black magic to print on failure. - -# Change 1..1 below to 1..last_test_to_print . -# (It may become useful if the test is moved to ./t subdirectory.) - -BEGIN { $| = 1; print "1..4\n"; } -END { print "not ok 1\n" unless $loaded; } - -use Botan; - -$loaded = 1; -print "ok 1\n"; - -######################### End of black magic. - -# Insert your test code below (better if it prints "ok 13" -# (correspondingly "not ok 13") depending on the success of chunk 13 -# of the test code): - -use strict; - -my $cert = Botan::X509_Certificate->new('data/ca.cert.der'); - -print "not " if $cert->x509_version() != 3; -print "ok 2\n"; - -print "not " if $cert->start_time() ne '2000/8/20 21:48:00 UTC'; -print "ok 3\n"; - -print "not " if $cert->end_time() ne '2002/8/10 21:48:00 UTC'; -print "ok 4\n"; - -#my $subject = $cert->subject_dn()->get_attributes(); -#print STDERR "subject=", join(',', @{$subject}), "\n"; -# -#my $issuer = $cert->issuer_dn()->get_attributes(); -#print STDERR "issuer=", join(',', @{$issuer}), "\n"; -# diff --git a/wrappers/perl-xs/typemap b/wrappers/perl-xs/typemap deleted file mode 100644 index d7403d40d..000000000 --- a/wrappers/perl-xs/typemap +++ /dev/null @@ -1,62 +0,0 @@ -TYPEMAP - -Botan__ASN1_String * O_OBJECT -Botan__AlgorithmIdentifier * O_OBJECT -Botan__AlternativeName * O_OBJECT -Botan__Attribute * O_OBJECT -Botan__Base64_Decoder * O_EXTOBJECT -Botan__Base64_Encoder * O_EXTOBJECT -Botan__Chain * O_EXTOBJECT -Botan__Extension * O_OBJECT -Botan__Filter * O_EXTOBJECT -Botan__Fork * O_EXTOBJECT -Botan__Hex_Decoder * O_EXTOBJECT -Botan__Hex_Encoder * O_EXTOBJECT -Botan__OID * O_OBJECT -Botan__Pipe * O_OBJECT -Botan__X509_Certificate * O_OBJECT -Botan__X509_DN * O_OBJECT -Botan__X509_Time * O_OBJECT -Botan__u32bit T_UV - - -###################################################################### -OUTPUT - -# The Perl object is blessed into 'CLASS', which should be a -# char* having the name of the package for the blessing. -O_OBJECT - sv_setref_pv($arg, CLASS, (void*)$var); - -O_EXTOBJECT - sv_setref_pv($arg, CLASS, (void*)$var); - sv_magic(SvRV($arg), 0, '~', (char *)&oi_init, sizeof(oi_init)); - - -###################################################################### -INPUT - -O_OBJECT - if ( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) ) - $var = ($type)SvIV((SV*)SvRV( $arg )); - else - croak(\"${Package}::$func_name() -- \" - \"$var is not a blessed SV reference\"); - -# The pointer variable "ObjectInfo *${var}_oi;" must be declared -# in PREINIT section. I don't know how to emit this declaration safely here. -O_EXTOBJECT - if ( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) ) - $var = ($type)SvIV((SV*)SvRV($arg)); - else - croak(\"${Package}::$func_name() -- \" - \"$var is not a blessed SV reference\"); - { - MAGIC *mg = mg_find(SvRV($arg), '~'); - if ( mg == 0 - || mg->mg_len != sizeof(ObjectInfo) - || *(I32 *)(mg->mg_ptr) != ObjectInfo::SIGNVAL ) - croak(\"${Package}::$func_name() -- \" - \"private magic data for $var invalid\"); - ${var}_oi = (ObjectInfo *)(mg->mg_ptr); - } diff --git a/wrappers/swig/Makefile b/wrappers/swig/Makefile deleted file mode 100644 index ff55c793c..000000000 --- a/wrappers/swig/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -LANG=-python -LANG_INC=/usr/include/python2.3 - -CFLAGS=$(shell botan-config --cflags) -LIBS=$(shell botan-config --libs) - -CXX = g++ -g -SWIG = swig -Wall - -all: _botan.so - -_botan.so: base.o pipe.o filter.o botan_wrap.o - $(CXX) -shared $^ $(LIBS) -o $@ - -botan_wrap.cpp: botan.swg base.h - $(SWIG) $(LANG) -c++ -o $@ $< - -botan_wrap.o: botan_wrap.cpp - $(CXX) $(CFLAGS) -I$(LANG_INC) -c $^ -o $@ - -base.o: base.cpp base.h - $(CXX) $(CFLAGS) -c $< -o $@ - -pipe.o: pipe.cpp base.h - $(CXX) $(CFLAGS) -c $< -o $@ - -filter.o: filter.cpp base.h - $(CXX) $(CFLAGS) -c $< -o $@ - -clean: - rm -f *.o _botan.so botan.py botan.pyc - rm -f *_wrap.o *_wrap.cpp diff --git a/wrappers/swig/base.cpp b/wrappers/swig/base.cpp deleted file mode 100644 index 448b3d48e..000000000 --- a/wrappers/swig/base.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/************************************************* -* SWIG Interface for basic Botan interface * -* (C) 1999-2003 Jack Lloyd * -*************************************************/ - -#include "base.h" -#include <botan/init.h> - -#include <stdio.h> - -/************************************************* -* Initialize the library * -*************************************************/ -LibraryInitializer::LibraryInitializer(const char* args) - { - Botan::Init::initialize(args); - } - -/************************************************* -* Shut down the library * -*************************************************/ -LibraryInitializer::~LibraryInitializer() - { - Botan::Init::deinitialize(); - } - -/************************************************* -* Create a SymmetricKey * -*************************************************/ -SymmetricKey::SymmetricKey(const std::string& str) - { - key = new Botan::SymmetricKey(str); - printf("STR CON: %p %p\n", this, key); - } - -/************************************************* -* Create a SymmetricKey * -*************************************************/ -SymmetricKey::SymmetricKey(u32bit n) - { - key = new Botan::SymmetricKey(n); - printf("N CON: %p %p\n", this, key); - } - -/************************************************* -* Destroy a SymmetricKey * -*************************************************/ -SymmetricKey::~SymmetricKey() - { - printf("DESTR: %p %p\n", this, key); - delete key; - key = 0; - //printf("deleted\n"); - } - -/************************************************* -* Create an InitializationVector * -*************************************************/ -InitializationVector::InitializationVector(const std::string& str) : iv(str) - { - } diff --git a/wrappers/swig/base.h b/wrappers/swig/base.h deleted file mode 100644 index 341a5c35a..000000000 --- a/wrappers/swig/base.h +++ /dev/null @@ -1,102 +0,0 @@ -/************************************************* -* SWIG Interface for Botan * -* (C) 1999-2003 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_WRAP_BASE_H__ -#define BOTAN_WRAP_BASE_H__ - -#include <botan/pipe.h> - -#if !defined(SWIG) - #define OUTPUT - #define INOUT -#endif - -/************************************************* -* Typedefs * -*************************************************/ -typedef unsigned char byte; -typedef unsigned int u32bit; - -/************************************************* -* Library Initalization/Shutdown Object * -*************************************************/ -class LibraryInitializer - { - public: - LibraryInitializer(const char*); - ~LibraryInitializer(); - }; - -/************************************************* -* Symmetric Key Object * -*************************************************/ -class SymmetricKey - { - public: - std::string as_string() const { return key->as_string(); } - u32bit length() const { return key->length(); } - SymmetricKey(u32bit = 0); - SymmetricKey(const std::string&); - ~SymmetricKey(); - private: - Botan::SymmetricKey* key; - }; - -/************************************************* -* Initialization Vector Object * -*************************************************/ -class InitializationVector - { - public: - std::string as_string() const { return iv.as_string(); } - u32bit length() const { return iv.length(); } - InitializationVector(u32bit n = 0) { iv.change(n); } - InitializationVector(const std::string&); - private: - Botan::InitializationVector iv; - }; - -/************************************************* -* Filter Object * -*************************************************/ -class Filter - { - public: - Filter(const char*); - //Filter(const char*, const SymmetricKey&); - //Filter(const char*, const SymmetricKey&, const InitializationVector&); - ~Filter(); - private: - friend class Pipe; - Botan::Filter* filter; - bool pipe_owns; - }; - -/************************************************* -* Pipe Object * -*************************************************/ -class Pipe - { - public: - static const u32bit DEFAULT_MESSAGE = 0xFFFFFFFF; - - void write_file(const char*); - void write_string(const char*); - - u32bit read(byte*, u32bit, u32bit = DEFAULT_MESSAGE); - std::string read_all_as_string(u32bit = DEFAULT_MESSAGE); - - u32bit remaining(u32bit = DEFAULT_MESSAGE); - - void start_msg(); - void end_msg(); - - Pipe(Filter* = 0, Filter* = 0, Filter* = 0, Filter* = 0); - ~Pipe(); - private: - Botan::Pipe* pipe; - }; - -#endif diff --git a/wrappers/swig/botan.swg b/wrappers/swig/botan.swg deleted file mode 100644 index 9088f4272..000000000 --- a/wrappers/swig/botan.swg +++ /dev/null @@ -1,26 +0,0 @@ -/************************************************* -* SWIG Interface for Botan * -*************************************************/ -%module botan - -%include "typemaps.i" -%include "std_string.i" -%include "exception.i" -%include "constraints.i" -%include "carrays.i" - -%{ -#include "base.h" -%} - -%exception { - try { - $action - } - catch(std::exception& e) - { - SWIG_exception(SWIG_RuntimeError, e.what()); - } -} - -%include "base.h" diff --git a/wrappers/swig/doit.py b/wrappers/swig/doit.py deleted file mode 100755 index 98bc97087..000000000 --- a/wrappers/swig/doit.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/python2 - -import botan - -def hash_it(hash, input): - f1 = botan.Filter("MD5") - f2 = botan.Filter("Hex_Encoder") - pipe = botan.Pipe(f1, f2) - - pipe.start_msg() - pipe.write_string(input) - pipe.end_msg() - - print pipe.remaining() - - out = pipe.read(0) - - - - -def main: - init = botan.LibraryInitializer - - print hash_it("MD5", "foo") - - - key1 = botan.SymmetricKey("ABCD") - print key1.as_string() - key2 = botan.SymmetricKey(16) - print key2.as_string() - - iv1 = botan.InitializationVector(8) - print iv1.as_string() - - - f3 = pipe.read(pipe.remaining()) - - size = pipe.remaining() - out = botan.byte_array(size) - pipe.read(out.cast,size) - - for i in range (0,size): - print "%02X" % out[i] - - print pipe.read_all_as_string() - -if __name__ == "__main__": - sys.exit(main()) - diff --git a/wrappers/swig/filter.cpp b/wrappers/swig/filter.cpp deleted file mode 100644 index 53ff0e6a3..000000000 --- a/wrappers/swig/filter.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/************************************************* -* SWIG Interface for Filter Retrieval * -* (C) 1999-2003 Jack Lloyd * -*************************************************/ - -#include "base.h" -#include <botan/lookup.h> -#include <botan/filters.h> - -/************************************************* -* Filter Creation * -*************************************************/ -Filter::Filter(const char* filt_string) - { - filter = 0; - pipe_owns = false; - - /* - Fixme: This is all so totally wrong. It needs to have full argument - processing for everything, all that kind of crap. - */ - const std::string filt_name = filt_string; - - if(Botan::have_hash(filt_name)) - filter = new Botan::Hash_Filter(filt_name); - else if(filt_name == "Hex_Encoder") - filter = new Botan::Hex_Encoder; - } - -/************************************************* -* Filter Destruction * -*************************************************/ -Filter::~Filter() - { - /* - if(!pipe_owns) - delete filter; - */ - } diff --git a/wrappers/swig/pipe.cpp b/wrappers/swig/pipe.cpp deleted file mode 100644 index 0f35d5a43..000000000 --- a/wrappers/swig/pipe.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/************************************************* -* SWIG Interface for Botan Pipe API * -* (C) 1999-2003 Jack Lloyd * -*************************************************/ - -#include "base.h" -#include <botan/pipe.h> - -#include <stdio.h> - -/************************************************* -* Write the contents of a file into a Pipe * -*************************************************/ -void Pipe::write_file(const char* filename) - { - Botan::DataSource_Stream in(filename); - pipe->write(in); - } - -/************************************************* -* Write the contents of a string into a Pipe * -*************************************************/ -void Pipe::write_string(const char* string) - { - pipe->write(string); - } - -/************************************************* -* Read the contents of a Pipe into a buffer * -*************************************************/ -u32bit Pipe::read(byte* buf, u32bit length, u32bit msg) - { - printf("read %p %d\n", buf, length); - return 0; - //return pipe->read(buf, length, msg); - } - -/************************************************* -* Read the contents of a Pipe as a string * -*************************************************/ -std::string Pipe::read_all_as_string(u32bit msg) - { - return pipe->read_all_as_string(msg); - } - -/************************************************* -* Find out how much stuff the Pipe still has * -*************************************************/ -u32bit Pipe::remaining(u32bit msg) - { - return pipe->remaining(); - } - -/************************************************* -* Start a new message * -*************************************************/ -void Pipe::start_msg() - { - pipe->start_msg(); - } - -/************************************************* -* End the current msessage * -*************************************************/ -void Pipe::end_msg() - { - pipe->end_msg(); - } - -/************************************************* -* Create a new Pipe * -*************************************************/ -Pipe::Pipe(Filter* f1, Filter* f2, Filter* f3, Filter* f4) - { - pipe = new Botan::Pipe(); - - if(f1) { pipe->append(f1->filter); f1->pipe_owns = true; } - if(f2) { pipe->append(f2->filter); f2->pipe_owns = true; } - if(f3) { pipe->append(f3->filter); f3->pipe_owns = true; } - if(f4) { pipe->append(f4->filter); f4->pipe_owns = true; } - } - -/************************************************* -* Destroy this Pipe * -*************************************************/ -Pipe::~Pipe() - { - delete pipe; - } diff --git a/wrappers/swig/pk.swg b/wrappers/swig/pk.swg deleted file mode 100644 index 8e03cf120..000000000 --- a/wrappers/swig/pk.swg +++ /dev/null @@ -1,8 +0,0 @@ -%module botan - -%{ -#undef ANY -#include "botan/pubkey.h" -%} - -%include "botan/pubkey.h" diff --git a/wrappers/swig/readme.txt b/wrappers/swig/readme.txt deleted file mode 100644 index a9965d914..000000000 --- a/wrappers/swig/readme.txt +++ /dev/null @@ -1,34 +0,0 @@ -This is the beginning of an attempt to SWIG-ify Botan so it can be accessed by -other languages. You should use the latest SWIG 1.3 release (I am currently -using SWIG 1.3.19). Currently I am only testing this code with Python 2.2.1, -since that is the language I am mainly interested in at this point. Feel free -to send me patches so this is usable with Perl or whatever. - -I'm not attempting to make everything in Botan usable from a script - -basically, I just want the parts that *I* want to use. Most things are not -supported yet, and there are lots of bugs in the stuff that does exist. If -there is something in particular that you would like to be able to use from a -script, let me know (patches are good, too). - -Todo: - * Why does it seg fault if we don't create a LibraryInitializer. It should - throw an exception, like it does in C++. Maybe have it init Botan when the - module is loaded? That seems a lot cleaner/nicer, but I don't know how to - do it yet. - * Lots of problems with exceptions - * Use constraints to prevent bad args when possible - * Pipe/Filter - - Better argument processing for all filters - - Support for ciphers, MACs, etc - - Chain + Fork - - Support for append/prepend/pop/reset in Pipe? - * Public Key Crypto - - RSA - - DSA - - DH - - Generic X.509 and PKCS #8 stuff - * PKI - - X.509 certs + CRLs - - PKCS #10 requests - - X.509 stores - - X.509 CA diff --git a/wrappers/swig/tests/block.py b/wrappers/swig/tests/block.py deleted file mode 100644 index 593937c81..000000000 --- a/wrappers/swig/tests/block.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/python - -import botan, base64 - -class MyCipher(botan.BlockCipher): - def __init__(self): - botan.BlockCipher.__init__(self, 16, 16, 32, 8) - def encrypt(self, val): - print "encrypt", val - return val.swapcase() - def decrypt(self, val): - print "decrypt", val - return val.swapcase() - def set_key(self, key): - print "set_key", key - def clone(self): - print "cloning" - return MyCipher() - def name(self): - print "naming" - return "MyCipher" - -cipher = botan.BlockCipher("AES-128") - -print cipher.block_size -print cipher.keylength_min -print cipher.keylength_max -print cipher.keylength_mod -print cipher.name() - -for kl in range(1, 128): - if cipher.valid_keylength(kl): - print "1", - else: - print "0", -print -key = botan.SymmetricKey(16) - -cipher.set_key(key) -ciphertext = cipher.encrypt("ABCDEFGH12345678") -print base64.b16encode(ciphertext) - -cipher2 = cipher.clone() -cipher2.set_key(key) - -plaintext = cipher2.decrypt(ciphertext) -print plaintext - -botan.get_info(cipher) - -mycipher = MyCipher() -botan.get_info(mycipher) diff --git a/wrappers/swig/tests/block2.py b/wrappers/swig/tests/block2.py deleted file mode 100644 index 5faccaf9a..000000000 --- a/wrappers/swig/tests/block2.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/python - -import botan, base64 - -class MyCipher(botan.BlockCipherImpl): - def __init__(self): - botan.BlockCipherImpl.__init__(self, 8, 8, 16, 1) - - def name(self): - return "MyCipher" - - def encrypt(self, input): - return input.swapcase() - - def decrypt(self, input): - return input.swapcase() - - def set_key(self, key): - print "Got key",key - -def test(cipher): - print - print cipher - print "Testing", cipher.name() - print cipher.block_size - print cipher.keylength_min, cipher.keylength_max, cipher.keylength_mod - for i in range(1, 64): - if cipher.valid_keylength(i): - print "1", - else: - print "0", - print - cipher.set_key(botan.SymmetricKey(16)) - ciphertext = cipher.encrypt("aBcDeFgH" * (cipher.block_size / 8)) - print repr(ciphertext) - print cipher.decrypt(ciphertext) - -def main(): - test(botan.BlockCipher("Blowfish")) - test(MyCipher()) - test(botan.BlockCipher("AES")) - -if __name__ == "__main__": - main() diff --git a/wrappers/swig/tests/encrypt.py b/wrappers/swig/tests/encrypt.py deleted file mode 100644 index 9896777d4..000000000 --- a/wrappers/swig/tests/encrypt.py +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/python - -import sys, botan - -def encrypt(input): - cipher_key = botan.SymmetricKey("AABB") - print cipher_key.length - cipher_key = botan.SymmetricKey("AABBCCDD") - print cipher_key.length - - cipher = botan.Filter("ARC4", key = cipher_key) - - pipe = botan.Pipe(cipher, botan.Filter("Hex_Encoder")) - - pipe.start_msg() - pipe.write(input) - pipe.end_msg() - - str = pipe.read_all() - print str - return str - -def decrypt(input): - pipe = botan.Pipe(botan.Filter("Hex_Decoder"), - botan.Filter("ARC4", - key = botan.SymmetricKey("AABBCCDD"))) - - pipe.process_msg(input) - return pipe.read_all() - -def main(): - ciphertext = encrypt("hi chappy") - print ciphertext - print decrypt(ciphertext) - -if __name__ == "__main__": - sys.exit(main()) diff --git a/wrappers/swig/tests/filter.py b/wrappers/swig/tests/filter.py deleted file mode 100644 index 2b65d9ff2..000000000 --- a/wrappers/swig/tests/filter.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/python - -import sys, botan - -class MyFilter(botan.FilterObj): - def write(self, input): - print "MyFilter::write",input - self.send(input) - def start_msg(self): - print "MyFilter::start_msg" - def end_msg(self): - print "MyFilter::end_msg" - def __del__(self): - print "~MyFilter" - -def main(): - filter = MyFilter() - - pipe = botan.Pipe(botan.Filter("Hex_Encoder"), filter, - botan.Filter("Hex_Decoder")) - pipe.start_msg() - pipe.write("hi chappy") - pipe.end_msg() - print pipe.read_all() - -if __name__ == "__main__": - sys.exit(main()) diff --git a/wrappers/swig/tests/hash.py b/wrappers/swig/tests/hash.py deleted file mode 100644 index 930b8c81a..000000000 --- a/wrappers/swig/tests/hash.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/python - -import botan, base64, md5 - -class PyMD5(botan.HashFunctionImpl): - def name(self): - return "PyMD5" - def update(self, input): - self.md5.update(input) - def final(self): - output = self.md5.digest() - self.md5 = md5.new() - return output - def __init__(self): - botan.HashFunctionImpl.__init__(self, 16, 64) - self.md5 = md5.new() - -hash = botan.HashFunction("SHA-256") - -print hash.name() -print hash.digest_size - -hash.update("hi") -hash.update(" ") -hash.update("chappy") -print base64.b16encode(hash.final()) - -hash2 = PyMD5() -hash2.update("hi chappy") -print base64.b16encode(hash2.final()) diff --git a/wrappers/swig/tests/mac.py b/wrappers/swig/tests/mac.py deleted file mode 100644 index 6110b6102..000000000 --- a/wrappers/swig/tests/mac.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/python - -import botan, base64 - -mac = botan.MAC("HMAC(SHA-512)") - -print mac.name -print mac.output_length - -mac.set_key(botan.SymmetricKey("abcd")) -mac.update("hi chappy") -print base64.b16encode(mac.final()) diff --git a/wrappers/swig/tests/pubkey.py b/wrappers/swig/tests/pubkey.py deleted file mode 100644 index 456c52069..000000000 --- a/wrappers/swig/tests/pubkey.py +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/python - -import botan - -key = botan.X509_PublicKey("rsapub.pem") -print key -print key.key_id() -print key.max_input_bits -print key.algo -print key.oid diff --git a/wrappers/swig/tests/stream.py b/wrappers/swig/tests/stream.py deleted file mode 100644 index 59d3ffa16..000000000 --- a/wrappers/swig/tests/stream.py +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/python - -import botan, base64 - -cipher = botan.StreamCipher("ARC4") - -print cipher.name - -key = botan.SymmetricKey(16) - -cipher.set_key(key) -ciphertext = cipher.crypt("hi chappy") - -cipher.set_key(key) -plaintext = cipher.crypt(ciphertext) - -print plaintext diff --git a/wrappers/swig/x509.swg b/wrappers/swig/x509.swg deleted file mode 100644 index 736d3a385..000000000 --- a/wrappers/swig/x509.swg +++ /dev/null @@ -1,9 +0,0 @@ -%module botan - -class X509_Certificate - { - public: - - - private: - }; |