]> andersk Git - gssapi-openssh.git/blame - openssh/makegssname.pl
recommit previous changes to simon's re-organized code
[gssapi-openssh.git] / openssh / makegssname.pl
CommitLineData
5598e598 1#!/usr/bin/perl
2
3use Convert::ASN1 qw(:tag);
4use Digest::MD5 qw(md5);
5use MIME::Base64;
6
7$oid=shift;
8$encoded=encode_object_id($oid);
9
10@entries=unpack("C*",$encoded);
11shift @entries; # Get rid of the NULL
12
13print "DER representation: ";
14foreach $entry (@entries) {
15 print "\\x";
16 printf "%02X",$entry;
17}
18print "\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);
25print "gsskeyex representation: ",encode_base64($digest),"\n";
26
27sub 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.06188 seconds and 5 git commands to generate.