update format spec, working on better structs

This commit is contained in:
2020-09-11 23:53:55 -04:00
parent 6e032d8969
commit ff9fbdab69
3 changed files with 38 additions and 12 deletions

View File

@@ -3,19 +3,35 @@ package sshkeys
// EncryptedSSHKeyV1 represents an encrypted private key.
type EncryptedSSHKeyV1 struct {
SSHKeyV1
Salt string
Rounds uint32
KDFOpts SSHKDFOpts
Passphrase string
}
// 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 {
CipherName string
KDFName string
KDFOpts string
NumKeys uint32
Publickey string
Privatekey string
Magic string
CipherName string
KDFName string
KDFOpts SSHKDFOpts
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
}