// CreateSSHKey creates new SSHKey on Vultr
176285
func (c *Client) CreateSSHKey(name, key string) (SSHKey, error) {
	values := url.Values{
		"name":    {name},
		"ssh_key": {key},
	}

	var sshKey SSHKey
	if err := c.post(`sshkey/create`, values, &sshKey); err != nil {
		return SSHKey{}, err
	}
	sshKey.Name = name
	sshKey.Key = key

	return sshKey, nil
}
1279950
func (o *InfrastructureAccessProfile) SSHKeys(info *bambou.FetchingInfo) (SSHKeysList, *bambou.Error) {

	var list SSHKeysList
	err := bambou.CurrentSession().FetchChildren(o, SSHKeyIdentity, &list, info)
	return list, err
}
550163
func (c *Client) CreateKey(opts CreateKeyOpts) (*Key, error) {
	var resp Key
	req := request{
		method:         client.POST,
		url:            apiKeys,
		reqValue:       opts,
		resp:           &resp,
		expectedStatus: http.StatusCreated,
	}
	if _, err := c.sendRequest(req); err != nil {
		return nil, errors.Newf(err, "failed to create key with name: %s", opts.Name)
	}
	return &resp, nil
}
183653
func CreateSSHShell(api libmachine.API, args []string) error {
	machineName := cfg.GetMachineName()
	host, err := CheckIfHostExistsAndLoad(api, machineName)
	if err != nil {
		return errors.Wrap(err, "host exists and load")
	}

	currentState, err := host.Driver.GetState()
	if err != nil {
		return errors.Wrap(err, "state")
	}

	if currentState != state.Running {
		return errors.Errorf("%q is not running", machineName)
	}

	client, err := host.CreateSSHClient()
	if err != nil {
		return errors.Wrap(err, "Creating ssh client")
	}
	return client.Shell(args...)
}
1287867
func (sshKeyApi *SSHKeyApi) Create(key SSHKey) (*SSHKey, error) {
	send, merr := json.Marshal(key)
	if merr != nil {
		return nil, merr
	}
	body, err := sshKeyApi.entityService.Create(send, map[string]string{})
	if err != nil {
		return nil, err
	}
	return parseSSHKey(body), nil
}
554563
func (c *CloudAPI) CreateKey(keyName, key string) (*cloudapi.Key, error) {
	if err := c.ProcessFunctionHook(c, keyName, key); err != nil {
		return nil, err
	}

	// check if key already exists or keyName already in use
	for _, k := range c.keys {
		if k.Name == keyName {
			return nil, fmt.Errorf("Key name %s already in use", keyName)
		}
		if k.Key == key {
			return nil, fmt.Errorf("Key %s already exists", key)
		}
	}

	newKey := cloudapi.Key{Name: keyName, Fingerprint: "", Key: key}
	c.keys = append(c.keys, newKey)

	return &newKey, nil
}
97153
func (vs *VSphere) AddSSHKeyToAllInstances(ctx context.Context, user string, keyData []byte) error {
	return cloudprovider.NotImplemented
}
613305
func (c *KopsModelContext) SSHKeyName() (string, error) {
	// use configured SSH key name if present
	name := c.Cluster.Spec.SSHKeyName
	if name != "" {
		return name, nil
	}

	fingerprint, err := pki.ComputeOpenSSHKeyFingerprint(string(c.SSHPublicKeys[0]))
	if err != nil {
		return "", err
	}

	name = "kubernetes." + c.Cluster.ObjectMeta.Name + "-" + fingerprint
	return name, nil
}
669534
func NewCredSshKeyFromMemory(username string, publicKey string, privateKey string, passphrase string) (int, Cred) {
	cred := Cred{}
	cusername := C.CString(username)
	defer C.free(unsafe.Pointer(cusername))
	cpublickey := C.CString(publicKey)
	defer C.free(unsafe.Pointer(cpublickey))
	cprivatekey := C.CString(privateKey)
	defer C.free(unsafe.Pointer(cprivatekey))
	cpassphrase := C.CString(passphrase)
	defer C.free(unsafe.Pointer(cpassphrase))
	ret := C.git_cred_ssh_key_memory_new(&cred.ptr, cusername, cpublickey, cprivatekey, cpassphrase)
	return int(ret), cred
}
853925
func (c CloudstackClient) CreateSSHKeyPair(name string) (CreateSshKeyPairResponse, error) {
	var resp CreateSshKeyPairResponse
	params := url.Values{}
	params.Set("name", name)
	response, err := NewRequest(c, "createSSHKeyPair", params)
	if err != nil {
		return resp, err
	}
	resp = response.(CreateSshKeyPairResponse)
	return resp, nil
}
475971
func (s *UpdateServerInput) SetHostKey(v string) *UpdateServerInput {
	s.HostKey = &v
	return s
}
740182
func signingKey(clientSecret string, timestamp string) []byte {
	h := hmac.New(sha256.New, []byte(clientSecret))
	h.Write([]byte(timestamp))
	key := make([]byte, base64.StdEncoding.EncodedLen(32))
	base64.StdEncoding.Encode(key, h.Sum(nil))
	return key
}
258411
func headerHashKey(number uint64) []byte {
	return append(append(headerPrefix, encodeBlockNumber(number)...), headerHashSuffix...)
}
966181
func (d *DiskEditValue) AddSSHKeys(keyID string) {
	if d.SSHKeys == nil {
		d.SSHKeys = []*SSHKey{}
	}
	d.SSHKeys = append(d.SSHKeys, &SSHKey{Resource: NewResourceByStringID(keyID)})
}
626814
func (s *KeyGen) Create(user string, details string) (err error) {
	guid := s.guidMaker.Create()
	hash := createHash(user, guid)
	row := map[string]string{
		HMFieldActive:  "true",
		HMFieldDetails: details,
	}
	_, err = s.store().Do("HMSET", redis.Args{hash}.AddFlat(row)...)
	return
}
1097342
func (s *SSHService) NewRegisterSSHKeyPairParams(name string, publickey string) *RegisterSSHKeyPairParams {
	p := &RegisterSSHKeyPairParams{}
	p.p = make(map[string]interface{})
	p.p["name"] = name
	p.p["publickey"] = publickey
	return p
}
1018850
func (hfs hashFS) Create(ctx context.Context, path string) (io.WriteCloser, error) {
	return &hashWriteCloser{
		buf:  &bytes.Buffer{},
		path: path,
		ctx:  ctx,
		hfs:  hfs,
	}, nil
}