Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeyIdentifier ¶
type KeyIdentifier struct {
// contains filtered or unexported fields
}
keyidentifier attempts to identify a key. It uses a set of herusitics to try to guiess what kind, what size, and whether or not it's encrypted.
func New ¶
func New(opts ...Option) (*KeyIdentifier, error)
func (*KeyIdentifier) Identify ¶
func (kIdentifer *KeyIdentifier) Identify(keyBytes []byte) (*KeyInfo, error)
Identify uses a manually curated set of heuristics to determine what kind of key something is. Generally speaking, we consider `err == nil` as success, and throw away errors as unparsable keys.
func (*KeyIdentifier) IdentifyFile ¶
func (kIdentifer *KeyIdentifier) IdentifyFile(path string) (*KeyInfo, error)
type KeyInfo ¶
type KeyInfo struct { Type string // Key type. rsa/dsa/etc Format string // file format Bits int // number of bits in the key Encryption string // key encryption algorythem Encrypted *bool // is the key encrypted Comment string // comments attached to the key Parser string // what parser we used to determine information FingerprintSHA256 string // the fingerprint of the key, as a SHA256 hash FingerprintMD5 string // the fingerprint of the key, as an MD5 hash }
func ParseOpenSSHPrivateKey ¶
ParseOpenSSHPrivateKey returns key information from an openssh private key. It is adapted from https://github.com/golang/crypto/blob/master/ssh/keys.go
func ParsePuttyPrivateKey ¶
ParseSshComPrivateKey returns key information from a putty (ppk) formatted key file.
func ParseSsh1PrivateKey ¶
ParseSsh1PrivateKey returns key information from an ssh1 private key.
The underlying format was gleaned from various other code. Notably:
https://github.com/openssh/openssh-portable/blob/c7670b091a7174760d619ef6738b4f26b2093301/sshkey.c https://github.com/KasperDeng/putty/blob/037a4ccb6e731fafc4cc77c0d16f80552fd69dce/putty-src/sshpubk.c#L176-L180 https://github.com/chrber/pcells-maven/blob/bb7a1ef3aa5e9313c532c043a624bfb929962b48/modules/pcells-gui-core/src/main/java/dmg/security/cipher/SshPrivateKeyInputStream.java#L23