diff --git a/src/lib/keygen.cpp b/src/lib/keygen.cpp index 9822d292a..e3d47bfe8 100644 --- a/src/lib/keygen.cpp +++ b/src/lib/keygen.cpp @@ -477,8 +477,8 @@ CertParams::populate(pgp_userid_pkt_t &uid) const void CertParams::populate(pgp_signature_t &sig) const { - if (expiration) { - sig.set_key_expiration(expiration); + if (key_expiration) { + sig.set_key_expiration(key_expiration); } if (primary) { sig.set_primary_uid(true); diff --git a/src/lib/keygen.hpp b/src/lib/keygen.hpp index f26084db8..affbfb1e3 100644 --- a/src/lib/keygen.hpp +++ b/src/lib/keygen.hpp @@ -154,11 +154,11 @@ class UserPrefs { class CertParams { public: - std::string userid; /* userid, required */ - uint8_t flags{}; /* key flags */ - uint32_t expiration{}; /* key expiration time (sec), 0 = no expiration */ - UserPrefs prefs; /* user preferences, optional */ - bool primary; /* mark this as the primary user id */ + std::string userid; /* userid, required */ + uint8_t flags{}; /* key flags */ + uint32_t key_expiration{}; /* key expiration time (sec), 0 = no expiration */ + UserPrefs prefs; /* user preferences, optional */ + bool primary; /* mark this as the primary user id */ void check_defaults(const KeygenParams ¶ms); @@ -174,7 +174,7 @@ class CertParams { class BindingParams { public: uint8_t flags{}; - uint32_t expiration{}; + uint32_t key_expiration{}; void check_defaults(const KeygenParams ¶ms); }; diff --git a/src/lib/pgp-key.cpp b/src/lib/pgp-key.cpp index 591bd951d..fa4c694d4 100644 --- a/src/lib/pgp-key.cpp +++ b/src/lib/pgp-key.cpp @@ -2579,8 +2579,8 @@ pgp_key_t::add_sub_binding(pgp_key_t & subsec, pgp_signature_t sig; sign_init(ctx.rng, sig, hash, ctx.time(), version()); sig.set_type(PGP_SIG_SUBKEY); - if (binding.expiration) { - sig.set_key_expiration(binding.expiration); + if (binding.key_expiration) { + sig.set_key_expiration(binding.key_expiration); } if (binding.flags) { sig.set_key_flags(binding.flags); diff --git a/src/lib/rnp.cpp b/src/lib/rnp.cpp index 1e37b19ff..6ca0514fd 100644 --- a/src/lib/rnp.cpp +++ b/src/lib/rnp.cpp @@ -4562,7 +4562,7 @@ parse_keygen_primary(rnp_ffi_t ffi, return nullptr; } /* Parse common key/subkey fields */ - if (!parse_keygen_common_fields(jso, cert.flags, cert.expiration, prot)) { + if (!parse_keygen_common_fields(jso, cert.flags, cert.key_expiration, prot)) { return nullptr; } /* UserID */ @@ -4597,7 +4597,7 @@ parse_keygen_sub(rnp_ffi_t ffi, return nullptr; } /* Parse common with primary key fields */ - if (!parse_keygen_common_fields(jso, binding.flags, binding.expiration, prot)) { + if (!parse_keygen_common_fields(jso, binding.flags, binding.key_expiration, prot)) { return nullptr; } /* Do not allow unknown extra fields */ @@ -4650,7 +4650,7 @@ gen_json_primary_key(rnp_ffi_t ffi, bool protect) { rnp::CertParams cert; - cert.expiration = DEFAULT_KEY_EXPIRATION; + cert.key_expiration = DEFAULT_KEY_EXPIRATION; auto keygen = parse_keygen_primary(ffi, jsoparams, cert, prot); if (!keygen) { @@ -4687,7 +4687,7 @@ gen_json_subkey(rnp_ffi_t ffi, rnp::BindingParams binding; rnp_key_protection_params_t prot = {}; - binding.expiration = DEFAULT_KEY_EXPIRATION; + binding.key_expiration = DEFAULT_KEY_EXPIRATION; auto keygen = parse_keygen_sub(ffi, jsoparams, binding, prot); if (!keygen) { return RNP_ERROR_BAD_PARAMETERS; @@ -5101,7 +5101,7 @@ try { *op = new rnp_op_generate_st(ffi, key_alg); (*op)->primary = true; (*op)->cert.flags = default_key_flags(key_alg, false); - (*op)->cert.expiration = DEFAULT_KEY_EXPIRATION; + (*op)->cert.key_expiration = DEFAULT_KEY_EXPIRATION; return RNP_SUCCESS; } @@ -5134,7 +5134,7 @@ try { *op = new rnp_op_generate_st(ffi, key_alg); (*op)->primary = false; (*op)->binding.flags = default_key_flags(key_alg, true); - (*op)->binding.expiration = DEFAULT_KEY_EXPIRATION; + (*op)->binding.key_expiration = DEFAULT_KEY_EXPIRATION; (*op)->primary_sec = primary->sec; (*op)->primary_pub = primary->pub; @@ -5341,9 +5341,9 @@ try { return RNP_ERROR_NULL_POINTER; } if (op->primary) { - op->cert.expiration = expiration; + op->cert.key_expiration = expiration; } else { - op->binding.expiration = expiration; + op->binding.key_expiration = expiration; } return RNP_SUCCESS; } @@ -5704,7 +5704,7 @@ try { rnp::CertParams info; info.userid = uid; info.flags = key_flags; - info.expiration = expiration; + info.key_expiration = expiration; info.primary = primary; /* obtain and unlok secret key */ diff --git a/src/tests/key-add-userid.cpp b/src/tests/key-add-userid.cpp index 8a0a772ef..7e4d7bd1d 100644 --- a/src/tests/key-add-userid.cpp +++ b/src/tests/key-add-userid.cpp @@ -67,7 +67,7 @@ TEST_F(rnp_tests, test_key_add_userid) rnp::CertParams selfsig0; selfsig0.userid = "added0"; selfsig0.flags = 0x2; - selfsig0.expiration = base_expiry; + selfsig0.key_expiration = base_expiry; selfsig0.primary = false; auto curtime = global_ctx.time(); global_ctx.set_time(curtime > SHA1_KEY_FROM ? SHA1_KEY_FROM - 100 : 0); @@ -100,7 +100,7 @@ TEST_F(rnp_tests, test_key_add_userid) rnp::CertParams selfsig1; selfsig1.userid = "added1"; selfsig1.flags = 0xAB; - selfsig1.expiration = base_expiry + 1; + selfsig1.key_expiration = base_expiry + 1; selfsig1.primary = 1; key->add_uid_cert(selfsig1, PGP_HASH_SHA256, global_ctx); diff --git a/src/tests/key-validate.cpp b/src/tests/key-validate.cpp index aece4bba9..d3ab059b6 100644 --- a/src/tests/key-validate.cpp +++ b/src/tests/key-validate.cpp @@ -669,7 +669,7 @@ TEST_F(rnp_tests, test_key_expiry_direct_sig) rnp::CertParams selfsig1 = {}; const char * boris = "Boris "; selfsig1.userid = boris; - selfsig1.expiration = 100; + selfsig1.key_expiration = 100; selfsig1.primary = true; key->add_uid_cert(selfsig1, PGP_HASH_SHA256, global_ctx); key->revalidate(*secring); @@ -704,7 +704,7 @@ TEST_F(rnp_tests, test_key_expiry_direct_sig) /* add primary userid with 0 expiration */ selfsig1 = {}; selfsig1.userid = boris; - selfsig1.expiration = 0; + selfsig1.key_expiration = 0; selfsig1.primary = true; key->add_uid_cert(selfsig1, PGP_HASH_SHA256, global_ctx); key->revalidate(*secring);