Documentation ¶
Overview ¶
Package SSHUtil provides some additional utilites to the golang.org/x/crypto/ssh libraries. These including methods for validating and parsing public keys.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Algorithms = []string{ ssh.KeyAlgoRSA, ssh.KeyAlgoDSA, ssh.KeyAlgoECDSA256, ssh.KeyAlgoECDSA384, ssh.KeyAlgoECDSA521, }
An array of algorithms accepted by the SSH protocol.
Functions ¶
func GetAlgorithm ¶
Given a byte array of SSH Key bytes, GetAlgorithm will deduce the public key format identifier. This is always included with traditional SSH Key algorithms as RSA and DSA.
func GetFingerPrint ¶
func GetFingerPrint(key OpenSSHPublicKey, algo string) (fp string, err error)
func ParseDecodedKey ¶
Given a byte array of SSH Key bytes, ParseDecodedKey returns the public key format identifier as well as the remainder of the key data and a read OK return. This is implemented internally in crypto/ssh as parseString, but is included here as a general utility parser. If only the algorithm is wanted, GetAlgorithm provides better functionality.
func ValidateOpenSSHPublicKey ¶
func ValidateOpenSSHPublicKey(key OpenSSHPublicKey) error
Types ¶
type OpenSSHPublicKey ¶
type OpenSSHPublicKey struct {
// contains filtered or unexported fields
}
SSH Public key struct as defined by the rfc4253 section 6.6
func ParseKeyfile ¶
func ParseKeyfile(dotpub string) (key OpenSSHPublicKey, err error)
When given the contents of an public key file, this will return with a OpenSSHPublicKey struct that contains the contents of the keyfile. The comment section of the keyfile is ignored. The contents of the keyfile are not validated.