1#
2# Test cases for ssh2 keys
3#
4use Net::SSH::AuthorizedKey;
5use Net::SSH::AuthorizedKey::SSH2;
6use Test::More;
7use Log::Log4perl qw(:easy);
8use strict;
9use warnings;
10
11# Log::Log4perl->easy_init($DEBUG);
12
13my $offset = tell DATA;
14my @data = <DATA>;
15plan tests => scalar @data;
16
17seek DATA, $offset, 0;
18
19while(<DATA>) {
20    my($key, $comment) = split / ## /, $_;
21
22    chomp $comment;
23
24    my $ssh = Net::SSH::AuthorizedKey->parse($key);
25
26    ok !defined $ssh, "$comment";
27}
28
29__DATA__
30from="*.onk.com" from="*.onk.com" 1024 37 133009991 abc@foo.com ## spaces between options
31AAAAB3NzaC1yc2EU= worp@corp.com ## ssh-2 key without enc algo
32AAAAB3NzaC1yc2EU= ## ssh-2 key without enc algo
33from="*.onk.com",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,1024 35 1409076329 worp@corp.com ## no space but comma before ssh1 key len
34from ="*.onk.com" 1024 35 1743547142167 abc@foo.bar.baz.com ## space before options's "="
3563548219 abc@bar.baz.com ## Missing ssh1 keylen
36sh-rsa AAAAB3Nz ## Misspelled (sh-rsa) ssh2 algo
37ssh-dsa AAAAB3Nz ## Misspelled (ssh-dsa) ssh2 algo
38from="abc.com" no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding,command="ls" 1024 35 12923 abc@def.com ## space in options
39