GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  NET::SSH::PERL::MAC (3)

.ds Aq ’

NAME

Net::SSH::Perl::Mac - MAC support for SSH2

CONTENTS

SYNOPSIS



    use Net::SSH::Perl::Mac;
    my $mac = Net::SSH::Perl::Mac->new(hmac-sha1, $key);
    $mac->hmac("foo bar");



DESCRIPTION

Net::SSH::Perl::Mac (and its subclasses) provides MAC support for the SSH2 implementation in Net::SSH::Perl. In the SSH2 protocol, each packet sent between client and server (after the key exchange and algorithm negotiation phase) contains a MAC to protect its integrity. The sending party computes the MAC over the length, padding, and (encrypted) payload fields of the packet, then appends the MAC; and the receiving party recomputes the MAC against the data that it receives.

The MAC is computed using part of the key that is negotiated during the key exchange phase. During negotiation, packets do not contain MAC; after the SSH_MSG_NEWKEYS message is sent, each side turns on its respective encryption, MAC, and compression code, for each packet that is sent after that point.

Net::SSH::Perl supports two MAC algorithms: hmac-sha1 and hmac-md5. These algorithms are implemented, respectively, by Digest::HMAC_SHA1 and Digest::HMAC_MD5.

USAGE

Each MAC object supports the following methods:

CW$mac = Net::SSH::Perl::Mac->new( CW$name )

Constructs a new MAC object and returns that object.

CW$mac->init( CW$key )

Initializes $mac and sets its key to $key (or rather, to a substring of key, key_len bytes long). As this implies, the key_len method should be called before init to set the intended length of the key.

CW$mac->hmac( CW$data )

Computes the MAC over $data, using the key set in the initialization phase, and returns the MAC.

CW$mac->len

Returns the length of the MAC (eg. 20 for HMAC_SHA1).

CW$mac->key_len( CW$len )

Given $len sets the key length of $mac to $len. This should be called before the init method, because init uses this value to take a substring of the provided key value.

Most of the time this should just be set to the MAC length (the len method); certain SSH implementations have a bug, however, wherein they always use only the first 16 bytes of the provided key.

CW$mac->enable

Enables the MAC object. This is used by Net::SSH::Perl::Kex to turn on the MAC after key negotiation.

CW$mac->enabled

Tests the enabled flag (set with the enable method). This is used by Net::SSH::Perl::Packet to determine whether or not to compute a MAC on an outgoing packet.

AUTHOR & COPYRIGHTS

Please see the Net::SSH::Perl manpage for author, copyright, and license information.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 NET::SSH::PERL::MAC (3) 2015-09-12

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.