Merge branch 'v2.0' (fix versions)
This commit is contained in:
commit
ba7f8695f7
|
@ -78,18 +78,19 @@ sub _getCipher {
|
|||
sub encrypt {
|
||||
my ( $self, $data, $low ) = @_;
|
||||
|
||||
# pad $data so that its length be multiple of 16 bytes
|
||||
my $l = bytes::length($data) % 16;
|
||||
$data .= "\0" x ( 16 - $l ) unless ( $l == 0 );
|
||||
|
||||
my $iv =
|
||||
$low
|
||||
? bytes::substr( Digest::SHA::sha1( rand() . time . {} ), 0, IV_LENGTH )
|
||||
: $newIv->();
|
||||
$data = $hash->($data) . $data;
|
||||
|
||||
# pad $data so that its length be multiple of 16 bytes
|
||||
my $l = bytes::length($data) % 16;
|
||||
$data .= "\0" x ( 16 - $l ) unless ( $l == 0 );
|
||||
my $hmac = $hash->($data);
|
||||
eval {
|
||||
$data =
|
||||
encode_base64( $iv . $self->_getCipher->set_iv($iv)->encrypt($data),
|
||||
encode_base64(
|
||||
$iv . $self->_getCipher->set_iv($iv)->encrypt( $hmac . $data ),
|
||||
'' );
|
||||
};
|
||||
if ($@) {
|
||||
|
@ -125,16 +126,16 @@ sub decrypt {
|
|||
}
|
||||
my $hmac = bytes::substr( $data, 0, HMAC_LENGTH );
|
||||
$data = bytes::substr( $data, HMAC_LENGTH );
|
||||
|
||||
# Obscure Perl re bug...
|
||||
$data .= "\0";
|
||||
$data =~ s/\0*$//;
|
||||
if ( $hash->($data) ne $hmac ) {
|
||||
$msg = "Bad MAC";
|
||||
return undef;
|
||||
}
|
||||
else {
|
||||
$msg = '';
|
||||
|
||||
# Obscure Perl re bug...
|
||||
$data .= "\0";
|
||||
$data =~ s/\0*$//;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,6 @@ sub run {
|
|||
return $_[0]->SERVER_ERROR;
|
||||
}
|
||||
|
||||
our $VERSION = '2.0.6';
|
||||
our $VERSION = '2.1.0';
|
||||
|
||||
1;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package Plack::Middleware::Auth::LemonldapNG;
|
||||
|
||||
our $AUTHORITY = 'cpan:GUIMARD';
|
||||
our $VERSION = '2.1.0';
|
||||
our $VERSION = '2.1.0';
|
||||
our $llclass = 'Lemonldap::NG::Handler::Server';
|
||||
|
||||
use strict;
|
||||
|
|
|
@ -12,7 +12,7 @@ use Unicode::String qw(utf8);
|
|||
use Scalar::Util 'weaken';
|
||||
use utf8;
|
||||
|
||||
our $VERSION = '2.1.0';
|
||||
our $VERSION = '2.1.0';
|
||||
our $ppLoaded = 0;
|
||||
|
||||
BEGIN {
|
||||
|
|
Loading…
Reference in New Issue