root/trunk/tools/sig-validate

Revision 1098, 1.0 kB (checked in by hachi, 2 years ago)

Branching for boomer from release-19, rev 62318

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1#!/usr/bin/perl -w
2
3use lib 'lib';
4
5use MT::App::Comments;
6
7use MT;
8
9$mt = new MT;
10
11sub usage {
12    print <<HERE;
13Usage: sig-validate [email::name::nick::ts::token] [r::s]
14[] brackets are optional
15r and s are the fields of the signature
16HERE
17    exit(1);
18}
19
20$ARGV[0] or usage();
21$ARGV[1] or usage();
22
23$ARGV[0] =~ s/^[(.*)]$/$1/;
24$ARGV[1] =~ s/^[(.*)]$/$1/;
25
26my ($email, $name, $nick, $ts, $token) = split '::', $ARGV[0];
27
28my $validation = MT::App::Comments::_validate_signature($mt, 
29                                                        $ARGV[1],
30                                                        email => $email,
31                                                        name => $name,
32                                                        nick => $nick,
33                                                        ts => $ts,
34                                                        token => $token);
35print "The signature with timestamp together are: ",
36    $validation ? "VALID" : "invalid", "\n";
Note: See TracBrowser for help on using the browser.