Add key creation functions.

- create a pair of keys with default engine algorithms
 - create a secret key
 - create a subkey (public) and add it to a secret key.
This commit is contained in:
SET
2020-11-11 14:47:05 +01:00
parent 15abc8b810
commit 9cce0febdb
2 changed files with 141 additions and 3 deletions

View File

@@ -84,6 +84,55 @@ public:
const Error SetExpiryTime(const char * keyFpr,
const string& passphrase,
const string& timeString = "0");
/**
* Creates a pair of secret and public keys with the default engine
* algorithms. Default expiry time is 2 * 365 days.
* @param k : must be a null key
* @param name
* @param email
* @param comment
* @param passphrase
* @param expires : seconds ahead of creation time. Use 0 for no expiry.
* @return
*/
const Error CreateKeyWithEngineDefaultAlgo(GpgME::Key& k,
const string& name,
const string& email,
const string& comment,
const string& passphrase,
ulong expires = 63072000);
/**
* Creates a secret key with passed in algorithm name. Default expiry time
* is 2 * 365 days.
* @param k : must be a null key
* @param name
* @param email
* @param comment
* @param algo : a valid algorithm name for a secret key
* @param passphrase
* @param expires : seconds ahead of creation time. Use 0 for no expiry.
* @return
*/
const Error CreateKey(GpgME::Key& k,
const string& name,
const string& email,
const string& comment,
const char * algo,
const string& passphrase,
ulong expires = 63072000);
/**
* Creates a public key with passed in algorithm name and adds it to secret
* key k. Default expiry time is 2 * 365 days.
* @param k : must be a secret key
* @param algo : : a valid algorithm name for a public key
* @param passphrase
* @param expires : seconds ahead of creation time. Use 0 for no expiry.
* @return
*/
const Error CreateSubKey(GpgME::Key& k,
const char * algo,
const string& passphrase,
ulong expires = 63072000);
private:
Context * m_ctx;