File: sig-validate

package info (click to toggle)
movabletype-opensource 5.1.4%2Bdfsg-4%2Bdeb7u3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 32,996 kB
  • sloc: perl: 197,285; php: 62,405; sh: 166; xml: 117; makefile: 83; sql: 32
file content (36 lines) | stat: -rwxr-xr-x 1,030 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/perl -w

use lib '/usr/share/movabletype/extlib';

use MT::App::Comments;

use MT;

$mt = new MT;

sub usage {
    print <<HERE;
Usage: sig-validate [email::name::nick::ts::token] [r::s]
[] brackets are optional
r and s are the fields of the signature
HERE
    exit(1);
}

$ARGV[0] or usage();
$ARGV[1] or usage();

$ARGV[0] =~ s/^[(.*)]$/$1/;
$ARGV[1] =~ s/^[(.*)]$/$1/;

my ($email, $name, $nick, $ts, $token) = split '::', $ARGV[0];

my $validation = MT::App::Comments::_validate_signature($mt, 
                                                        $ARGV[1],
                                                        email => $email,
                                                        name => $name,
                                                        nick => $nick,
                                                        ts => $ts,
                                                        token => $token);
print "The signature with timestamp together are: ",
    $validation ? "VALID" : "invalid", "\n";