SSHSecure/sshkeys/func.go

49 lines
901 B
Go
Raw Normal View History

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.
}
return nil
}
2020-09-12 00:58:58 -04:00
func (k *EncryptedSSHKeyV1) GeneratePublic(force bool) error {
if err := k.GeneratePrivate(force); err != nil {
return err
}
2020-09-12 00:58:58 -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.
}
return nil
}
2020-09-12 00:58:58 -04:00
func (k *SSHKeyV1) GeneratePublic(force bool) error {
if err := k.GeneratePrivate(force); err != nil {
return err
}
return nil
}