tkca 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/usr/local/bin/perl5
  2. #
  3. # This is only something I'm playing with, it does not work :-)
  4. #
  5. use Tk;
  6. my $main=MainWindow->new();
  7. my $f=$main->Frame(-relief => "ridge", -borderwidth => 2);
  8. $f->pack(-fill => 'x');
  9. my $ff=$f->Frame;
  10. $ff->pack(-fill => 'x');
  11. my $l=$ff->Label(-text => "TkCA - SSLeay",
  12. -relief => "ridge", -borderwidth => 2);
  13. $l->pack(-fill => 'x', -ipady => 5);
  14. my $l=$ff->Button(-text => "Certify");
  15. $l->pack(-fill => 'x', -ipady => 5);
  16. my $l=$ff->Button(-text => "Review");
  17. $l->pack(-fill => 'x', -ipady => 5);
  18. my $l=$ff->Button(-text => "Revoke");
  19. $l->pack(-fill => 'x', -ipady => 5);
  20. my $l=$ff->Button(-text => "Generate CRL");
  21. $l->pack(-fill => 'x', -ipady => 5);
  22. my($db)=&load_db("demoCA/index.txt");
  23. MainLoop;
  24. sub load_db
  25. {
  26. my(%ret);
  27. my($file)=@_;
  28. my(*IN);
  29. my(%db_serial,%db_name,@f,@db_s);
  30. $ret{'serial'}=\%db_serial;
  31. $ret{'name'}=\%db_name;
  32. open(IN,"<$file") || die "unable to open $file:$!\n";
  33. while (<IN>)
  34. {
  35. chop;
  36. s/([^\\])\t/\1\t\t/g;
  37. my(@f)=split(/\t\t/);
  38. die "wrong number of fields in $file, line $.\n"
  39. if ($#f != 5);
  40. my(%f);
  41. $f{'type'}=$f[0];
  42. $f{'exp'}=$f[1];
  43. $f{'rev'}=$f[2];
  44. $f{'serial'}=$f[3];
  45. $f{'file'}=$f[4];
  46. $f{'name'}=$f[5];
  47. die "serial number $f{'serial'} appears twice (line $.)\n"
  48. if (defined($db{$f{'serial'}}))
  49. $db_serial{$f{'serial'}}=\%f;
  50. $db_name{$f{'name'}}.=$f{'serial'}." ";
  51. }
  52. return \%ret;
  53. }