-
Notifications
You must be signed in to change notification settings - Fork 25
/
key_setting.go
47 lines (40 loc) · 1009 Bytes
/
key_setting.go
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package ssh
import (
"crypto/rsa"
"crypto/ecdsa"
"crypto/ed25519"
"golang.org/x/crypto/ssh"
"github.com/tjfoc/gmsm/sm2"
)
func init() {
AddKey(GetStructName(&rsa.PrivateKey{}), func() Key {
return new(KeyRsa)
})
AddKey(ssh.KeyAlgoRSA, func() Key {
return new(KeyRsa)
})
AddKey(GetStructName(&ecdsa.PrivateKey{}), func() Key {
return new(KeyEcdsa)
})
AddKey(ssh.KeyAlgoECDSA256, func() Key {
return new(KeyEcdsa)
})
AddKey(ssh.KeyAlgoECDSA384, func() Key {
return new(KeyEcdsa)
})
AddKey(ssh.KeyAlgoECDSA521, func() Key {
return new(KeyEcdsa)
})
AddKey(GetStructName(ed25519.PrivateKey{}), func() Key {
return new(KeyEdDsa)
})
AddKey(ssh.KeyAlgoED25519, func() Key {
return new(KeyEdDsa)
})
AddKey(GetStructName(&sm2.PrivateKey{}), func() Key {
return new(KeySM2)
})
AddKey(KeyAlgoSM2, func() Key {
return new(KeySM2)
})
}