SSH MAC Algorithm Names

Advertisement

TheCliGuy
Joined:
Posts:
13

SSH MAC Algorithm Names

Using WinSCP version 5.17.8, the WinSCP.com /info command returns the following MAC algorithms:

hmac-sha2-256
hmac-sha1
hmac-sha1-96
hmac-md5

Whereas WinSCP actually supports all of the following because for each of the encrypt-and-MAC algorithms above there's an encrypt-then-MAC equivalent:
hmac-sha2-256
hmac-sha1
hmac-sha1-96
hmac-md5
hmac-sha2-256-etm@openssh.com
hmac-sha1-etm@openssh.com
hmac-sha1-96-etm@openssh.com
hmac-md5-etm@openssh.com

Would it be possible to update WinSCP.com /info to list both the encrypt-and-MAC and encrypt-then-MAC algorithms?

The encrypt-then-MAC name can be found in the etm_name property of an ssh2_macalg:

name           etm_name
----           --------
hmac-sha2-256  hmac-sha2-256-etm@openssh.com
hmac-sha1      hmac-sha1-etm@openssh.com
hmac-sha1-96   hmac-sha1-96-etm@openssh.com
hmac-md5       hmac-md5-etm@openssh.com

Reply with quote

Advertisement

TheCliGuy
Joined:
Posts:
13

Re: SSH MAC Algorithm Names

Hi Martin,

I've just tested winscp.com /info using 5.18 beta and see that the encrypt-then-MAC algorithms are displayed in parenthesis next to their equivalent encrypt-and-MAC algorithms:

SSH MAC algorithms:
hmac-sha2-256 (hmac-sha2-256-etm@openssh.com)
hmac-sha1 (hmac-sha1-etm@openssh.com)
hmac-sha1-96 (hmac-sha1-96-etm@openssh.com)
hmac-md5 (hmac-md5-etm@openssh.com)

Is there any chance that this could be changed so that ETM algorithms are displayed on separate lines?

Having one algorithm per line makes it very easy to parse the output, EG:

# Create an object ($objAlgorithms) consisting of a property per algorithm type 
# with a value that contains a comma separated list of the algorithm names.

$WinScpInfo = & 'C:\Program Files (x86)\WinSCP\WinSCP.com' /info
$objAlgorithms = [PSCustomObject]@{}

$WinScpInfo.ForEach({
    # A heading is identified as a value ending in a colon.
    If ($_[-1] -eq ':') {
        $PropertyName = ($_.substring(0, ($_.length -1)))
    }
    # The end of a block of algorithms is identified as an empty line.
    ElseIf ($_ -eq '') {
        $objAlgorithms | Add-Member -Name $PropertyName -Type NoteProperty -Value $PropertyVal
        $PropertyVal = ''
    }
    # Anything else is an algorithm name.
    Else {
        If ($PropertyVal) {
            $PropertyVal = $PropertyVal, $_ -join ','
        }
        Else {
            $PropertyVal = $_
        }
    }
})

Reply with quote

Advertisement

martin
Site Admin
martin avatar

Re: SSH MAC Algorithm Names

I'm quite sure that it would take you less time to parse the current format, than to write this post and me to make the changes you ask for :)

Reply with quote

Advertisement

You can post new topics in this forum