324 |
|
|
325 |
|
|
326 |
/* Construct an object with the given key in @key. */ |
/* Construct an object with the given key in @key. */ |
327 |
GpgKeyEdit::GpgKeyEdit (gpgme_key_t key) |
GpgKeyEdit::GpgKeyEdit (gpgme_key_t _key) |
328 |
{ |
{ |
329 |
this->key = key; |
this->key = _key; |
330 |
pass = NULL; |
pass = NULL; |
331 |
type = 0; |
type = 0; |
332 |
name = NULL; |
name = NULL; |
482 |
name, @cmt as the comment (or NULL) and @email as the email. |
name, @cmt as the comment (or NULL) and @email as the email. |
483 |
Return value: 0 on success. */ |
Return value: 0 on success. */ |
484 |
gpgme_error_t |
gpgme_error_t |
485 |
GpgKeyEdit::addUserid (const char *name, const char *cmt, const char *email) |
GpgKeyEdit::addUserid (const char *_name, const char *_cmt, const char *_email) |
486 |
{ |
{ |
487 |
if (!this->key || !this->pass) |
if (!this->key || !this->pass) |
488 |
return gpg_error (GPG_ERR_INV_OBJ); |
return gpg_error (GPG_ERR_INV_OBJ); |
489 |
|
|
490 |
type = GPG_EDITKEY_ADDUID; |
type = GPG_EDITKEY_ADDUID; |
491 |
free_if_alloc (this->name); |
free_if_alloc (this->name); |
492 |
this->name = m_strdup (name); |
this->name = m_strdup (_name); |
493 |
free_if_alloc (this->cmt); |
free_if_alloc (this->cmt); |
494 |
this->cmt = NULL; |
this->cmt = NULL; |
495 |
if (cmt != NULL) |
if (cmt != NULL) |
496 |
this->cmt = m_strdup (cmt); |
this->cmt = m_strdup (_cmt); |
497 |
free_if_alloc (this->email); |
free_if_alloc (this->email); |
498 |
this->email = m_strdup (email); |
this->email = m_strdup (_email); |
499 |
if (!this->email || !this->name) |
if (!this->email || !this->name) |
500 |
BUG (NULL); |
BUG (NULL); |
501 |
return gpg_editkey (this->ctx, this->key, this); |
return gpg_editkey (this->ctx, this->key, this); |
533 |
key expires in @valid days. |
key expires in @valid days. |
534 |
Return value: 0 on success. */ |
Return value: 0 on success. */ |
535 |
gpgme_error_t |
gpgme_error_t |
536 |
GpgKeyEdit::addSubkey (gpgme_pubkey_algo_t pubkey_algo, unsigned int pubkey_size, |
GpgKeyEdit::addSubkey (gpgme_pubkey_algo_t _pubkey_algo, |
537 |
long valid) |
unsigned int _pubkey_size, long _valid) |
538 |
{ |
{ |
539 |
if (!this->key || !this->pass) |
if (!this->key || !this->pass) |
540 |
return gpg_error (GPG_ERR_INV_OBJ); |
return gpg_error (GPG_ERR_INV_OBJ); |
541 |
|
|
542 |
type = GPG_EDITKEY_ADDKEY; |
type = GPG_EDITKEY_ADDKEY; |
543 |
this->pubkey_algo = pubkey_algo; |
this->pubkey_algo = _pubkey_algo; |
544 |
this->pubkey_size = pubkey_size; |
this->pubkey_size = _pubkey_size; |
545 |
this->valid = valid; |
this->valid = _valid; |
546 |
return gpg_editkey (this->ctx, this->key, this); |
return gpg_editkey (this->ctx, this->key, this); |
547 |
} |
} |
548 |
|
|