Private/Get-SNMPv3AutenticationProvider.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function Get-SNMPv3AuthenticationProvider
{
    param(
        [string]$AuthType,
        [Lextm.SharpSnmpLib.OctetString]$AuthSecret
    )

    switch ($AuthType)
    {
        'MD5'
        {
            [Lextm.SharpSnmpLib.Security.MD5AuthenticationProvider]::new($AuthSecret)
        }

        'SHA1'
        {
            [Lextm.SharpSnmpLib.Security.SHA1AuthenticationProvider]::new($AuthSecret)
        }

        'SHA256'
        {
            [Lextm.SharpSnmpLib.Security.SHA256AuthenticationProvider]::new($AuthSecret)
        }

        default
        {
            [Lextm.SharpSnmpLib.Security.DefaultAuthenticationProvider]::Instance
        }
    }
}