]> andersk Git - gssapi-openssh.git/blob - openssh/makegssname.pl
add prototype of kexgss
[gssapi-openssh.git] / openssh / makegssname.pl
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
This page took 0.040086 seconds and 5 git commands to generate.