func (k *KeyData) Create() (ssh.KeyLocator, error) { handler, ok := ssh.KeyTypeHandlerFor(k.Type) if !ok { return nil, errors.New(fmt.Sprintf("The key type '%s' is not recognized.", k.Type)) } return handler.CreateKey(k.Value) }
func (k *KeyData) Check() error { _, ok := ssh.KeyTypeHandlerFor(k.Type) if !ok { return errors.New(fmt.Sprintf("The key type '%s' is not recognized.", k.Type)) } if len(k.Value) == 0 { return errors.New("Value must be specified.") } return nil }