Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
Net::SSH::Perl::CipherUser Contributed Perl DocumentaNet::SSH::Perl::Cipher(3)

       Net::SSH::Perl::Cipher -	Base cipher class, plus	utility	methods

	   use Net::SSH::Perl::Cipher;

	   # Get list of supported cipher IDs.
	   my $supported = Net::SSH::Perl::Cipher::supported();

	   # Translate a cipher	name into an ID.
	   my $id = Net::SSH::Perl::Cipher::id($name);

	   # Translate a cipher	ID into	a name.
	   my $name = Net::SSH::Perl::Cipher::name($id);

       Net::SSH::Perl::Cipher provides a base class for	each of	the encryption
       cipher classes. In addition, it defines a set of	utility	methods	that
       can be called either as functions or object methods.

   supported( [	protocol => $protocol, ] [ $ciph_id [, $server_supports	] ])
       Without arguments returns a reference to	an array of ciphers supported
       by Net::SSH::Perl. These	are ciphers that have working
       Net::SSH::Perl::Cipher::	implementations, essentially.  Pass 'protocol
       => 2' to	get a list of SSH2 ciphers.

       With one	argument $ciph_id, returns a true value	if that	cipher is
       supported by Net::SSH::Perl, and	false otherwise.

       With two	arguments, $ciph_id and	$server_supports, returns true if the
       cipher represented by $ciph_id is supported both	by Net::SSH::Perl and
       by the sshd server. The list of ciphers supported by the	server should
       be in $server_supports, a bit mask sent from the	server during the
       session identification phase.

       Can be called either as a non-exported function,	i.e.

	   my $i_support = Net::SSH::Perl::Cipher::supported();

       or as an	object method of a Net::SSH::Perl::Cipher object, or an	object
       of a subclass:

	   if ($ciph->supported($server_supports)) {
	       print "Server supports cipher $ciph";

   id( [ $cipher_name ]	)
       Translates a cipher name	into a cipher ID.

       If given	$cipher_name translates	that name into the corresponding ID.
       If called as an object method, translates the object's cipher class
       name into the ID.

   name( [ $cipher_id ]	)
       Translates a cipher ID into a cipher name.

       If given	$cipher_id translates that ID into the corresponding name. If
       called as an object method, returns the (stripped) object's cipher
       class name; for example,	if the object were of type
       Net::SSH::Perl::Cipher::IDEA, name would	return IDEA.

   Net::SSH::Perl::Cipher->new($cipher_name, $key)
       Instantiates a new cipher object	of the type $cipher_name with the key
       $key; returns the cipher	object,	which will be blessed into the actual
       cipher subclass.

       If $cipher_name is the special type 'None' (no encryption cipher), the
       object will actually be blessed directly	into the base class, and text
       to be encrypted and decrypted will be passed through without change.

       Encrypts	$text and returns the encrypted	string.

       Decrypts	$text and returns the decrypted	string.

       Classes implementing an encryption cipher must implement	the following
       three methods:

       o   $class->new($key)

	   Given a key $key, should construct a	new cipher object and bless it
	   into	$class,	presumably.

       o   $cipher->encrypt($text)

	   Given plain text $text, should encrypt the text and return the
	   encrypted string.

       o   $cipher->decrypt($text)

	   Given encrypted text	$text, should decrypt the text and return the
	   decrypted string.

       Please see the Net::SSH::Perl manpage for author, copyright, and
       license information.

perl v5.32.1			  2017-08-24	     Net::SSH::Perl::Cipher(3)


Want to link to this manual page? Use this URL:

home | help