Libssh2 publickey add ex
From Libssh2
int libssh2_publickey_add_ex(LIBSSH2_PUBLICKEY *pkey, const unsigned char *name, unsigned long name_len, const unsigned char *blob, unsigned long blob_len, char overwrite, unsigned long num_attrs, libssh2_publickey_attribute attrs[]); #define libssh2_publickey_add(pkey, name, blob, blob_len, \ overwrite, num_attrs, attrs) \ libssh2_publickey_add_ex((pkey), (name), strlen(name), (blob), (blob_len), \ (overwrite), (num_attrs), (attrs))
[edit]
About
Add a new publickey to the currently logged in user's list of authorized public keys. Depending on the specific server implementation, a specific set of attributes may (or may not) be supported.
[edit]
Parameters
- pkey
- Publickey instance as returned by libssh2_publickey_init().
- name / name_len
- A human-readable name to assign to this public key
- blob / blob_len
- Octet-stream describing this key (e.g.)
- uint32 0x0007
- octets "ssh-rsa"
- uint32 0x0081
- octets 00 CB 2A 1F 91 03 2D ...
- overwrite
- Boolean flag, if set to non-zero any existing publickey with this name will be overwritten. If passed as zero and a public key with this name exists, the operation will return failure.
- num_attrs / attrs
- A vector of num_attrs instances of libssh2_publickey_attribute structures.
[edit]
Returns
- On Success: 0
- On Failure: -1
