ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/OpenSSL/t/04_CipherAll.t
Revision: 1.1
Committed: Sat Oct 27 01:53:25 2001 UTC (24 years, 11 months ago) by stefan
Content type: application/x-troff
Branch: MAIN
CVS Tags: BEFORE_5_8_REGEX_FIX, HEAD
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 stefan 1.1
2     use Test;
3     BEGIN { plan tests => 1 };
4     $|=1;
5    
6     use OpenSSL::Cipher qw(enum_ciphers new_encrypt new_decrypt);
7     use OpenSSL::Rand 'randbytes';
8    
9     %cip = enum_ciphers();
10     my ($msg,$err) = ('hallo Du kleiner Gartenzwerg, Alice liebt Bob', 0);
11    
12     for my $c (keys %cip) {
13     my $key = randbytes($cip{$c});
14     my ($dec, $enc);
15     $ctx = new_encrypt $c, $key;
16     $enc = $ctx->update($msg);
17     $enc .= $ctx->final;
18     print STDERR "E\10";
19     $ctx = new_decrypt $c, $key;
20     $dec = $ctx->update($enc);
21     $dec .= $ctx->final;
22     print STDERR "D\10";
23     $err++ if($dec ne $msg)
24     }
25     ok($err ? 0 :1);