2020-09-11 23:06:51 -04:00
|
|
|
package sshkeys
|
|
|
|
|
2020-09-12 00:58:58 -04:00
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
)
|
|
|
|
|
|
|
|
func genPrivKey(cipherAlgo string, kdf string, salt []byte, rounds uint32) ([]byte, error) {
|
|
|
|
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func genPubKey(privKey *[]byte) ([]byte, error) {
|
|
|
|
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (k *EncryptedSSHKeyV1) GeneratePrivate(force bool) error {
|
|
|
|
if k.Passphrase == "" {
|
|
|
|
return errors.New("cannot use encrypted key with empty passphrase")
|
|
|
|
}
|
|
|
|
if k.PrivateKeys != nil && !force {
|
|
|
|
return nil // Already generated.
|
|
|
|
}
|
|
|
|
|
2020-09-11 23:06:51 -04:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-09-12 00:58:58 -04:00
|
|
|
func (k *EncryptedSSHKeyV1) GeneratePublic(force bool) error {
|
|
|
|
if err := k.GeneratePrivate(force); err != nil {
|
2020-09-11 23:06:51 -04:00
|
|
|
return err
|
|
|
|
}
|
2020-09-12 00:58:58 -04:00
|
|
|
|
2020-09-11 23:06:51 -04:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-09-12 00:58:58 -04:00
|
|
|
func (k *SSHKeyV1) GeneratePrivate(force bool) error {
|
|
|
|
if k.PrivateKeys != nil && !force {
|
|
|
|
return nil // Already generated.
|
|
|
|
}
|
2020-09-11 23:06:51 -04:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-09-12 00:58:58 -04:00
|
|
|
func (k *SSHKeyV1) GeneratePublic(force bool) error {
|
|
|
|
if err := k.GeneratePrivate(force); err != nil {
|
2020-09-11 23:06:51 -04:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|