49 lines
901 B
Go
49 lines
901 B
Go
package sshkeys
|
|
|
|
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
|
|
}
|
|
|
|
func (k *EncryptedSSHKeyV1) GeneratePublic(force bool) error {
|
|
if err := k.GeneratePrivate(force); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (k *SSHKeyV1) GeneratePrivate(force bool) error {
|
|
if k.PrivateKeys != nil && !force {
|
|
return nil // Already generated.
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (k *SSHKeyV1) GeneratePublic(force bool) error {
|
|
if err := k.GeneratePrivate(force); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|