2020-09-03 19:11:42 -04:00
|
|
|
package sshkeys
|
|
|
|
|
2020-09-11 23:06:51 -04:00
|
|
|
// EncryptedSSHKeyV1 represents an encrypted private key.
|
|
|
|
type EncryptedSSHKeyV1 struct {
|
|
|
|
SSHKeyV1
|
2020-09-12 00:58:58 -04:00
|
|
|
CipherName string
|
|
|
|
KDFName string
|
2020-09-11 23:53:55 -04:00
|
|
|
KDFOpts SSHKDFOpts
|
2020-09-11 23:06:51 -04:00
|
|
|
Passphrase string
|
2020-09-03 19:11:42 -04:00
|
|
|
}
|
|
|
|
|
2020-09-11 23:53:55 -04:00
|
|
|
// 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.
|
|
|
|
}
|
|
|
|
|
2020-09-11 23:06:51 -04:00
|
|
|
// 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 {
|
2020-09-11 23:53:55 -04:00
|
|
|
Magic string
|
|
|
|
PublicKeys []SSHPubKey
|
|
|
|
PrivateKeys []SSHPrivKey
|
|
|
|
}
|
|
|
|
|
|
|
|
// SSHPubKey contains the Public key of an SSH Keypair.
|
|
|
|
type SSHPubKey struct {
|
|
|
|
KeyType string
|
|
|
|
PrivateKey *SSHPrivKey
|
|
|
|
}
|
|
|
|
|
|
|
|
// SSHPrivKey contains the Private key of an SSH Keypair.
|
|
|
|
type SSHPrivKey struct {
|
|
|
|
PublicKey *SSHPubKey
|
2020-09-12 00:58:58 -04:00
|
|
|
Checksum uint32
|
|
|
|
Comment string
|
2020-09-03 19:11:42 -04:00
|
|
|
}
|