Revision 17193,
943 bytes
checked in by zacheiss, 23 years ago
(diff) |
GSSAPI support for v2 of the ssh protocol.
|
Line | |
---|
1 | #!/usr/bin/perl |
---|
2 | |
---|
3 | use Convert::ASN1 qw(:tag); |
---|
4 | use Digest::MD5 qw(md5); |
---|
5 | use MIME::Base64; |
---|
6 | |
---|
7 | $oid=shift; |
---|
8 | $encoded=encode_object_id($oid); |
---|
9 | |
---|
10 | @entries=unpack("C*",$encoded); |
---|
11 | shift @entries; # Get rid of the NULL |
---|
12 | |
---|
13 | print "DER representation: "; |
---|
14 | foreach $entry (@entries) { |
---|
15 | print "\\x"; |
---|
16 | printf "%02X",$entry; |
---|
17 | } |
---|
18 | print "\n"; |
---|
19 | |
---|
20 | $digest = md5($encoded); |
---|
21 | # We only want the first 10 characters; |
---|
22 | # Conversations with the authors suggest that we want to use all of the |
---|
23 | # characters of the digest. |
---|
24 | #$digest = substr($digest,0,10); |
---|
25 | print "gsskeyex representation: ",encode_base64($digest),"\n"; |
---|
26 | |
---|
27 | sub encode_object_id { |
---|
28 | $string=""; |
---|
29 | |
---|
30 | my @data = ($_[0] =~ /(\d+)/g); |
---|
31 | |
---|
32 | if(@data < 2) { |
---|
33 | @data = (0); |
---|
34 | } |
---|
35 | else { |
---|
36 | my $first = $data[1] + ($data[0] * 40); |
---|
37 | splice(@data,0,2,$first); |
---|
38 | } |
---|
39 | |
---|
40 | # my $l = length $string; |
---|
41 | $string .= pack("cw*", 0, @data); |
---|
42 | # substr($string,$l,1) = asn_encode_length(length($string) - $l - 1); |
---|
43 | return $string; |
---|
44 | } |
---|
45 | |
---|
46 | |
---|
Note: See
TracBrowser
for help on using the repository browser.