SSHSecure/sshkeys/struct.go

45 lines
1.0 KiB
Go

package sshkeys
// EncryptedSSHKeyV1 represents an encrypted private key.
type EncryptedSSHKeyV1 struct {
SSHKeyV1
CipherName string
KDFOpts SSHKDFOpts
Passphrase []byte
}
// SSHKDFOpts contains a set of KDF options.
type SSHKDFOpts struct {
Salt []byte // Also referred to as IV (initialization vector). (https://en.wikipedia.org/wiki/Initialization_vector)
Rounds uint32 // Also referred to as work factor.
}
// SSHKeyV1 represents an unencrypted private key.
// We don't bother with the legacy (pre v1) keys. Sorry not sorry.
// Patch your shit.
type SSHKeyV1 struct {
Magic string
BitSize uint32
DefKeyType string
KDFName string
KeySize uint32
BlockSize uint32
PublicKeys []SSHPubKey
PrivateKeys []SSHPrivKey
}
// SSHPubKey contains the Public key of an SSH Keypair.
type SSHPubKey struct {
PrivateKey *SSHPrivKey
KeyType string
Key []byte
}
// SSHPrivKey contains the Private key of an SSH Keypair.
type SSHPrivKey struct {
PublicKey *SSHPubKey
Key []byte
Checksum []byte
Comment string
}