| 1 | #!/usr/bin/perl -sw | ||
| 2 | ## | ||
| 3 | ## Crypt::RSA::Key::Private::SSH | ||
| 4 | ## | ||
| 5 | ## Copyright (c) 2001, Vipul Ved Prakash. All rights reserved. | ||
| 6 | ## This code is free software; you can redistribute it and/or modify | ||
| 7 | ## it under the same terms as Perl itself. | ||
| 8 | ## | ||
| 9 | ## $Id: SSH.pm,v 1.1 2001/05/20 23:37:48 vipul Exp $ | ||
| 10 | |||
| 11 | package Crypt::RSA::Key::Public::SSH; | ||
| 12 | use strict; | ||
| 13 | use Crypt::RSA::DataFormat qw(bitsize); | ||
| 14 | use Crypt::RSA::Key::Public; | ||
| 15 | use vars qw(@ISA); | ||
| 16 | @ISA = qw(Crypt::RSA::Key::Public); | ||
| 17 | |||
| 18 | sub deserialize { | ||
| 19 | my ($self, %params) = @_; | ||
| 20 | my ($bitsize, $e, $n, $ident) = split /\s/, join'',@{$params{String}}; | ||
| 21 | $self->n ($n); | ||
| 22 | $self->e ($e); | ||
| 23 | $self->Identity ($ident); | ||
| 24 | return $self; | ||
| 25 | } | ||
| 26 | |||
| 27 | sub serialize { | ||
| 28 | my ($self, %params) = @_; | ||
| 29 | my $bitsize = bitsize ($self->n); | ||
| 30 | my $string = join ' ', $bitsize, $self->e, $self->n, $self->Identity; | ||
| 31 | return $string; | ||
| 32 | } | ||
| 33 | |||
| 34 | 1; | ||
| 35 | |||
| 36 | =head1 NAME | ||
| 37 | |||
| 38 | Crypt::RSA::Key::Public::SSH - SSH Public Key Import | ||
| 39 | |||
| 40 | =head1 SYNOPSIS | ||
| 41 | |||
| 42 | Crypt::RSA::Key::Public::SSH is a class derived from | ||
| 43 | Crypt::RSA::Key::Public that provides serialize() and | ||
| 44 | deserialze() methods for SSH 2.x keys. | ||
| 45 | |||
| 46 | =head1 AUTHOR | ||
| 47 | |||
| 48 | Vipul Ved Prakash, E<lt>mail@vipul.netE<gt> | ||
| 49 | |||
| 50 | =cut | ||
| 51 | |||
| 52 |