Repository: randombit/botan
Pull request #2551 (2020-12-15 12:43:46)

Convert some enums to `enum class`
Should have happened before 2.0 but so it goes


Patch:
diff --git a/doc/migration_guide.rst b/doc/migration_guide.rst
index 14c73dcbd..d11f5115b 100644
--- a/doc/migration_guide.rst
+++ b/doc/migration_guide.rst
@@ -54,3 +54,10 @@ to query information about extensions. This is not longer the case; instead you
 should either call a specific function on ``X509_Certificate`` which returns the
 same information, or lacking that, iterate over the result of
 ``X509_Certificate::v3_extensions``.
+
+Use of ``enum class``
+--------------------------------
+
+Several enumerations where modified to become ``enum class``, including
+``DL_Group::Format``, ``CRL_Code``, ``EC_Group_Encoding``,
+
diff --git a/src/cli/pubkey.cpp b/src/cli/pubkey.cpp
index e70e616f8..66d394ca3 100644
--- a/src/cli/pubkey.cpp
+++ b/src/cli/pubkey.cpp
@@ -429,7 +429,7 @@ class DL_Group_Info final : public Command
 
          if(flag_set("pem"))
             {
-            output() << dl_group.PEM_encode(Botan::DL_Group::ANSI_X9_42_DH_PARAMETERS);
+            output() << dl_group.PEM_encode(Botan::DL_Group_Format::ANSI_X9_42_DH_PARAMETERS);
             }
          else
             {
@@ -503,14 +503,14 @@ class Gen_DL_Group final : public Command
             if(seed_str.size() > 0)
                { throw CLI_Usage_Error("Seed only supported for DSA param gen"); }
             Botan::DL_Group grp(rng(), Botan::DL_Group::Strong, pbits);
-            output() << grp.PEM_encode(Botan::DL_Group::ANSI_X9_42);
+            output() << grp.PEM_encode(Botan::DL_Group_Format::ANSI_X9_42);
             }
          else if(type == "subgroup")
             {
             if(seed_str.size() > 0)
                { throw CLI_Usage_Error("Seed only supported for DSA param gen"); }
             Botan::DL_Group grp(rng(), Botan::DL_Group::Prime_Subgroup, pbits, qbits);
-            output() << grp.PEM_encode(Botan::DL_Group::ANSI_X9_42);
+            output() << grp.PEM_encode(Botan::DL_Group_Format::ANSI_X9_42);
             }
          else if(type == "dsa")
             {
@@ -528,13 +528,13 @@ class Gen_DL_Group final : public Command
             if(seed_str.empty())
                {
                Botan::DL_Group grp(rng(), Botan::DL_Group::DSA_Kosherizer, pbits, dsa_qbits);
-               output() << grp.PEM_encode(Botan::DL_Group::ANSI_X9_57);
+               output() << grp.PEM_encode(Botan::DL_Group_Format::ANSI_X9_57);
                }
             else
                {
                const std::vector<uint8_t> seed = Botan::hex_decode(seed_str);
                Botan::DL_Group grp(rng(), seed, pbits, dsa_qbits);
-               output() << grp.PEM_encode(Botan::DL_Group::ANSI_X9_57);
+               output() << grp.PEM_encode(Botan::DL_Group_Format::ANSI_X9_57);
                }
 
             }
diff --git a/src/lib/prov/openssl/openssl_ec.cpp b/src/lib/prov/openssl/openssl_ec.cpp
index 1bbd613a0..bd64aef34 100644
--- a/src/lib/prov/openssl/openssl_ec.cpp
+++ b/src/lib/prov/openssl/openssl_ec.cpp
@@ -52,7 +52,7 @@ secure_vector<uint8_t> PKCS8_for_openssl(const EC_PrivateKey& ec)
         .encode(static_cast<size_t>(1))
         .encode(BigInt::encode_1363(priv_key, priv_key.bytes()), OCTET_STRING)
       .start_cons(ASN1_Tag(0), PRIVATE)
-      .raw_bytes(ec.domain().DER_encode(EC_DOMPAR_ENC_OID))
+      .raw_bytes(ec.domain().DER_encode(EC_Group_Encoding::NamedCurve))
       .end_cons()
       .start_cons(ASN1_Tag(1), PRIVATE)
       .encode(pub_key.encode(PointGFp::UNCOMPRESSED), BIT_STRING)
diff --git a/src/lib/prov/pkcs11/p11_ecc_key.cpp b/src/lib/prov/pkcs11/p11_ecc_key.cpp
index c14c96322..4a2736fc6 100644
--- a/src/lib/prov/pkcs11/p11_ecc_key.cpp
+++ b/src/lib/prov/pkcs11/p11_ecc_key.cpp
@@ -46,7 +46,7 @@ PKCS11_EC_PublicKey::PKCS11_EC_PublicKey(Session& session, ObjectHandle handle)
    secure_vector<uint8_t> ec_parameters = get_attribute_value(AttributeType::EcParams);
    m_domain_params = EC_Group(unlock(ec_parameters));
    m_public_key = decode_public_point(get_attribute_value(AttributeType::EcPoint), m_domain_params);
-   m_domain_encoding = EC_DOMPAR_ENC_EXPLICIT;
+   m_domain_encoding = EC_Group_Encoding::Explicit;
    }
 
 PKCS11_EC_PublicKey::PKCS11_EC_PublicKey(Session& session, const EC_PublicKeyImportProperties& props)
@@ -57,7 +57,7 @@ PKCS11_EC_PublicKey::PKCS11_EC_PublicKey(Session& session, const EC_PublicKeyImp
    secure_vector<uint8_t> ec_point;
    BER_Decoder(props.ec_point()).decode(ec_point, OCTET_STRING);
    m_public_key = m_domain_params.OS2ECP(ec_point);
-   m_domain_encoding = EC_DOMPAR_ENC_EXPLICIT;
+   m_domain_encoding = EC_Group_Encoding::Explicit;
    }
 
 EC_PrivateKeyImportProperties::EC_PrivateKeyImportProperties(const std::vector<uint8_t>& ec_params, const BigInt& value)
@@ -127,7 +127,7 @@ bool PKCS11_EC_PrivateKey::check_key(RandomNumberGenerator&, bool) const
 
 AlgorithmIdentifier PKCS11_EC_PrivateKey::algorithm_identifier() const
    {
-   return AlgorithmIdentifier(get_oid(), domain().DER_encode(EC_DOMPAR_ENC_EXPLICIT));
+   return AlgorithmIdentifier(get_oid(), domain().DER_encode(EC_Group_Encoding::Explicit));
    }
 }
 
diff --git a/src/lib/pubkey/dh/dh.cpp b/src/lib/pubkey/dh/dh.cpp
index 77ac19da4..98a05260e 100644
--- a/src/lib/pubkey/dh/dh.cpp
+++ b/src/lib/pubkey/dh/dh.cpp
@@ -58,7 +58,7 @@ DH_PrivateKey::DH_PrivateKey(RandomNumberGenerator& rng,
 */
 DH_PrivateKey::DH_PrivateKey(const AlgorithmIdentifier& alg_id,
                              const secure_vector<uint8_t>& key_bits) :
-   DL_Scheme_PrivateKey(alg_id, key_bits, DL_Group::ANSI_X9_42)
+   DL_Scheme_PrivateKey(alg_id, key_bits, DL_Group_Format::ANSI_X9_42)
    {
    if(m_y.is_zero())
       {
diff --git a/src/lib/pubkey/dh/dh.h b/src/lib/pubkey/dh/dh.h
index bb6d5dae4..3b81bbf5d 100644
--- a/src/lib/pubkey/dh/dh.h
+++ b/src/lib/pubkey/dh/dh.h
@@ -22,7 +22,7 @@ class BOTAN_PUBLIC_API(2,0) DH_PublicKey : public virtual DL_Scheme_PublicKey
 
       std::vector<uint8_t> public_value() const;
 
-      DL_Group::Format group_format() const override { return DL_Group::ANSI_X9_42; }
+      DL_Group_Format group_format() const override { return DL_Group_Format::ANSI_X9_42; }
 
       /**
       * Create a public key.
@@ -31,7 +31,7 @@ class BOTAN_PUBLIC_API(2,0) DH_PublicKey : public virtual DL_Scheme_PublicKey
       */
       DH_PublicKey(const AlgorithmIdentifier& alg_id,
                    const std::vector<uint8_t>& key_bits) :
-         DL_Scheme_PublicKey(alg_id, key_bits, DL_Group::ANSI_X9_42) {}
+         DL_Scheme_PublicKey(alg_id, key_bits, DL_Group_Format::ANSI_X9_42) {}
 
       /**
       * Construct a public key with the specified parameters.
diff --git a/src/lib/pubkey/dl_algo/dl_algo.cpp b/src/lib/pubkey/dl_algo/dl_algo.cpp
index 15b0b175e..66efe7456 100644
--- a/src/lib/pubkey/dl_algo/dl_algo.cpp
+++ b/src/lib/pubkey/dl_algo/dl_algo.cpp
@@ -43,7 +43,7 @@ DL_Scheme_PublicKey::DL_Scheme_PublicKey(const DL_Group& group, const BigInt& y)
 
 DL_Scheme_PublicKey::DL_Scheme_PublicKey(const AlgorithmIdentifier& alg_id,
                                          const std::vector<uint8_t>& key_bits,
-                                         DL_Group::Format format) :
+                                         DL_Group_Format format) :
    m_group(alg_id.get_parameters(), format)
    {
    BER_Decoder(key_bits).decode(m_y);
@@ -56,7 +56,7 @@ secure_vector<uint8_t> DL_Scheme_PrivateKey::private_key_bits() const
 
 DL_Scheme_PrivateKey::DL_Scheme_PrivateKey(const AlgorithmIdentifier& alg_id,
                                            const secure_vector<uint8_t>& key_bits,
-                                           DL_Group::Format format)
+                                           DL_Group_Format format)
    {
    m_group.BER_decode(alg_id.get_parameters(), format);
 
diff --git a/src/lib/pubkey/dl_algo/dl_algo.h b/src/lib/pubkey/dl_algo/dl_algo.h
index af01bc217..d3edd6bb2 100644
--- a/src/lib/pubkey/dl_algo/dl_algo.h
+++ b/src/lib/pubkey/dl_algo/dl_algo.h
@@ -64,7 +64,7 @@ class BOTAN_PUBLIC_API(2,0) DL_Scheme_PublicKey : public virtual Public_Key
       * Get the underlying groups encoding format.
       * @return encoding format
       */
-      virtual DL_Group::Format group_format() const = 0;
+      virtual DL_Group_Format group_format() const = 0;
 
       size_t key_length() const override;
       size_t estimated_strength() const override;
@@ -82,7 +82,7 @@ class BOTAN_PUBLIC_API(2,0) DL_Scheme_PublicKey : public virtual Public_Key
       */
       DL_Scheme_PublicKey(const AlgorithmIdentifier& alg_id,
                           const std::vector<uint8_t>& key_bits,
-                          DL_Group::Format group_format);
+                          DL_Group_Format group_format);
 
       DL_Scheme_PublicKey(const DL_Group& group, const BigInt& y);
 
@@ -125,7 +125,7 @@ class BOTAN_PUBLIC_API(2,0) DL_Scheme_PrivateKey : public virtual DL_Scheme_Publ
       */
       DL_Scheme_PrivateKey(const AlgorithmIdentifier& alg_id,
                            const secure_vector<uint8_t>& key_bits,
-                           DL_Group::Format group_format);
+                           DL_Group_Format group_format);
 
       DL_Scheme_PrivateKey() = default;
 
diff --git a/src/lib/pubkey/dl_group/dl_group.cpp b/src/lib/pubkey/dl_group/dl_group.cpp
index 7ff0a1958..05fe9dcf3 100644
--- a/src/lib/pubkey/dl_group/dl_group.cpp
+++ b/src/lib/pubkey/dl_group/dl_group.cpp
@@ -123,7 +123,7 @@ class DL_Group_Data final
 
 //static
 std::shared_ptr<DL_Group_Data> DL_Group::BER_decode_DL_group(const uint8_t data[], size_t data_len,
-                                                             DL_Group::Format format,
+                                                             DL_Group_Format format,
                                                              DL_Group_Source source)
    {
    BigInt p, q, g;
@@ -131,21 +131,21 @@ std::shared_ptr<DL_Group_Data> DL_Group::BER_decode_DL_group(const uint8_t data[
    BER_Decoder decoder(data, data_len);
    BER_Decoder ber = decoder.start_cons(SEQUENCE);
 
-   if(format == DL_Group::ANSI_X9_57)
+   if(format == DL_Group_Format::ANSI_X9_57)
       {
       ber.decode(p)
          .decode(q)
          .decode(g)
          .verify_end();
       }
-   else if(format == DL_Group::ANSI_X9_42)
+   else if(format == DL_Group_Format::ANSI_X9_42)
       {
       ber.decode(p)
          .decode(g)
          .decode(q)
          .discard_remaining();
       }
-   else if(format == DL_Group::PKCS_3)
+   else if(format == DL_Group_Format::PKCS_3)
       {
       // q is left as zero
       ber.decode(p)
@@ -153,7 +153,7 @@ std::shared_ptr<DL_Group_Data> DL_Group::BER_decode_DL_group(const uint8_t data[
          .discard_remaining();
       }
    else
-      throw Invalid_Argument("Unknown DL_Group encoding " + std::to_string(format));
+      throw Invalid_Argument("Unknown DL_Group encoding");
 
    return std::make_shared<DL_Group_Data>(p, q, g, source);
    }
@@ -185,14 +185,14 @@ DL_Group::load_DL_group_info(const char* p_str,
 
 namespace {
 
-DL_Group::Format pem_label_to_dl_format(const std::string& label)
+DL_Group_Format pem_label_to_dl_format(const std::string& label)
    {
    if(label == "DH PARAMETERS")
-      return DL_Group::PKCS_3;
+      return DL_Group_Format::PKCS_3;
    else if(label == "DSA PARAMETERS")
-      return DL_Group::ANSI_X9_57;
+      return DL_Group_Format::ANSI_X9_57;
    else if(label == "X942 DH PARAMETERS" || label == "X9.42 DH PARAMETERS")
-      return DL_Group::ANSI_X9_42;
+      return DL_Group_Format::ANSI_X9_42;
    else
       throw Decoding_Error("DL_Group: Invalid PEM label " + label);
    }
@@ -213,7 +213,7 @@ DL_Group::DL_Group(const std::string& str)
          {
          std::string label;
          const std::vector<uint8_t> ber = unlock(PEM_Code::decode(str, label));
-         Format format = pem_label_to_dl_format(label);
+         DL_Group_Format format = pem_label_to_dl_format(label);
 
          m_data = BER_decode_DL_group(ber.data(), ber.size(), format, DL_Group_Source::ExternalSource);
          }
@@ -589,15 +589,15 @@ DL_Group_Source DL_Group::source() const
 /*
 * DER encode the parameters
 */
-std::vector<uint8_t> DL_Group::DER_encode(Format format) const
+std::vector<uint8_t> DL_Group::DER_encode(DL_Group_Format format) const
    {
-   if(get_q().is_zero() && (format == ANSI_X9_57 || format == ANSI_X9_42))
+   if(get_q().is_zero() && (format != DL_Group_Format::PKCS_3))
       throw Encoding_Error("Cannot encode DL_Group in ANSI formats when q param is missing");
 
    std::vector<uint8_t> output;
    DER_Encoder der(output);
 
-   if(format == ANSI_X9_57)
+   if(format == DL_Group_Format::ANSI_X9_57)
       {
       der.start_cons(SEQUENCE)
             .encode(get_p())
@@ -605,7 +605,7 @@ std::vector<uint8_t> DL_Group::DER_encode(Format format) const
             .encode(get_g())
          .end_cons();
       }
-   else if(format == ANSI_X9_42)
+   else if(format == DL_Group_Format::ANSI_X9_42)
       {
       der.start_cons(SEQUENCE)
             .encode(get_p())
@@ -613,7 +613,7 @@ std::vector<uint8_t> DL_Group::DER_encode(Format format) const
             .encode(get_q())
          .end_cons();
       }
-   else if(format == PKCS_3)
+   else if(format == DL_Group_Format::PKCS_3)
       {
       der.start_cons(SEQUENCE)
             .encode(get_p())
@@ -621,7 +621,7 @@ std::vector<uint8_t> DL_Group::DER_encode(Format format) const
          .end_cons();
       }
    else
-      throw Invalid_Argument("Unknown DL_Group encoding " + std::to_string(format));
+      throw Invalid_Argument("Unknown DL_Group encoding");
 
    return output;
    }
@@ -629,26 +629,26 @@ std::vector<uint8_t> DL_Group::DER_encode(Format format) const
 /*
 * PEM encode the parameters
 */
-std::string DL_Group::PEM_encode(Format format) const
+std::string DL_Group::PEM_encode(DL_Group_Format format) const
    {
    const std::vector<uint8_t> encoding = DER_encode(format);
 
-   if(format == PKCS_3)
+   if(format == DL_Group_Format::PKCS_3)
       return PEM_Code::encode(encoding, "DH PARAMETERS");
-   else if(format == ANSI_X9_57)
+   else if(format == DL_Group_Format::ANSI_X9_57)
       return PEM_Code::encode(encoding, "DSA PARAMETERS");
-   else if(format == ANSI_X9_42)
+   else if(format == DL_Group_Format::ANSI_X9_42)
       return PEM_Code::encode(encoding, "X9.42 DH PARAMETERS");
    else
-      throw Invalid_Argument("Unknown DL_Group encoding " + std::to_string(format));
+      throw Invalid_Argument("Unknown DL_Group encoding");
    }
 
-DL_Group::DL_Group(const uint8_t ber[], size_t ber_len, Format format)
+DL_Group::DL_Group(const uint8_t ber[], size_t ber_len, DL_Group_Format format)
    {
    m_data = BER_decode_DL_group(ber, ber_len, format, DL_Group_Source::ExternalSource);
    }
 
-void DL_Group::BER_decode(const std::vector<uint8_t>& ber, Format format)
+void DL_Group::BER_decode(const std::vector<uint8_t>& ber, DL_Group_Format format)
    {
    m_data = BER_decode_DL_group(ber.data(), ber.size(), format, DL_Group_Source::ExternalSource);
    }
@@ -658,7 +658,7 @@ DL_Group DL_Group::DL_Group_from_PEM(const std::string& pem)
    {
    std::string label;
    const std::vector<uint8_t> ber = unlock(PEM_Code::decode(pem, label));
-   Format format = pem_label_to_dl_format(label);
+   DL_Group_Format format = pem_label_to_dl_format(label);
    return DL_Group(ber, format);
    }
 
diff --git a/src/lib/pubkey/dl_group/dl_group.h b/src/lib/pubkey/dl_group/dl_group.h
index c3b9443b7..b9355da6f 100644
--- a/src/lib/pubkey/dl_group/dl_group.h
+++ b/src/lib/pubkey/dl_group/dl_group.h
@@ -21,6 +21,20 @@ enum class DL_Group_Source {
    ExternalSource,
 };
 
+/**
+* The DL group encoding format variants.
+*/
+enum class DL_Group_Format {
+   ANSI_X9_42,
+   ANSI_X9_57,
+   PKCS_3,
+
+   DSA_PARAMETERS = ANSI_X9_57,
+   DH_PARAMETERS = ANSI_X9_42,
+   ANSI_X9_42_DH_PARAMETERS = ANSI_X9_42,
+   PKCS3_DH_PARAMETERS = PKCS_3
+};
+
 /**
 * This class represents discrete logarithm groups. It holds a prime
 * modulus p, a generator g, and (optionally) a prime q which is a
@@ -34,19 +48,7 @@ class BOTAN_PUBLIC_API(2,0) DL_Group final
       */
       enum PrimeType { Strong, Prime_Subgroup, DSA_Kosherizer };
 
-      /**
-      * The DL group encoding format variants.
-      */
-      enum Format {
-         ANSI_X9_42,
-         ANSI_X9_57,
-         PKCS_3,
-
-         DSA_PARAMETERS = ANSI_X9_57,
-         DH_PARAMETERS = ANSI_X9_42,
-         ANSI_X9_42_DH_PARAMETERS = ANSI_X9_42,
-         PKCS3_DH_PARAMETERS = PKCS_3
-      };
+      using Format = DL_Group_Format;
 
       /**
       * Construct a DL group with uninitialized internal value.
@@ -115,13 +117,13 @@ class BOTAN_PUBLIC_API(2,0) DL_Group final
       /**
       * Decode a BER-encoded DL group param
       */
-      DL_Group(const uint8_t ber[], size_t ber_len, Format format);
+      DL_Group(const uint8_t ber[], size_t ber_len, DL_Group_Format format);
 
       /**
       * Decode a BER-encoded DL group param
       */
       template<typename Alloc>
-         DL_Group(const std::vector<uint8_t, Alloc>& ber, Format format) :
+         DL_Group(const std::vector<uint8_t, Alloc>& ber, DL_Group_Format format) :
          DL_Group(ber.data(), ber.size(), format) {}
 
       /**
@@ -170,14 +172,14 @@ class BOTAN_PUBLIC_API(2,0) DL_Group final
       * @param format the encoding format
       * @return string holding the PEM encoded group
       */
-      std::string PEM_encode(Format format) const;
+      std::string PEM_encode(DL_Group_Format format) const;
 
       /**
       * Encode this group into a string using DER encoding.
       * @param format the encoding format
       * @return string holding the DER encoded group
       */
-      std::vector<uint8_t> DER_encode(Format format) const;
+      std::vector<uint8_t> DER_encode(DL_Group_Format format) const;
 
       /**
       * Reduce an integer modulo p
@@ -324,7 +326,7 @@ class BOTAN_PUBLIC_API(2,0) DL_Group final
       *
       * @warning avoid this. Instead use the DL_Group constructor
       */
-      void BER_decode(const std::vector<uint8_t>& ber, Format format);
+      void BER_decode(const std::vector<uint8_t>& ber, DL_Group_Format format);
 
       DL_Group_Source source() const;
 
@@ -343,7 +345,7 @@ class BOTAN_PUBLIC_API(2,0) DL_Group final
 
       static std::shared_ptr<DL_Group_Data>
          BER_decode_DL_group(const uint8_t data[], size_t data_len,
-                             DL_Group::Format format,
+                             DL_Group_Format format,
                              DL_Group_Source source);
 
       const DL_Group_Data& data() const;
diff --git a/src/lib/pubkey/dsa/dsa.cpp b/src/lib/pubkey/dsa/dsa.cpp
index c2c7e8194..103cb8115 100644
--- a/src/lib/pubkey/dsa/dsa.cpp
+++ b/src/lib/pubkey/dsa/dsa.cpp
@@ -48,7 +48,7 @@ DSA_PrivateKey::DSA_PrivateKey(RandomNumberGenerator& rng,
 
 DSA_PrivateKey::DSA_PrivateKey(const AlgorithmIdentifier& alg_id,
                                const secure_vector<uint8_t>& key_bits) :
-   DL_Scheme_PrivateKey(alg_id, key_bits, DL_Group::ANSI_X9_57)
+   DL_Scheme_PrivateKey(alg_id, key_bits, DL_Group_Format::ANSI_X9_57)
    {
    m_y = m_group.power_g_p(m_x, m_group.q_bits());
    }
diff --git a/src/lib/pubkey/dsa/dsa.h b/src/lib/pubkey/dsa/dsa.h
index 1834737b5..75513a78d 100644
--- a/src/lib/pubkey/dsa/dsa.h
+++ b/src/lib/pubkey/dsa/dsa.h
@@ -20,7 +20,7 @@ class BOTAN_PUBLIC_API(2,0) DSA_PublicKey : public virtual DL_Scheme_PublicKey
    public:
       std::string algo_name() const override { return "DSA"; }
 
-      DL_Group::Format group_format() const override { return DL_Group::ANSI_X9_57; }
+      DL_Group_Format group_format() const override { return DL_Group_Format::ANSI_X9_57; }
       size_t message_parts() const override { return 2; }
       size_t message_part_size() const override { return group_q().bytes(); }
 
@@ -31,7 +31,7 @@ class BOTAN_PUBLIC_API(2,0) DSA_PublicKey : public virtual DL_Scheme_PublicKey
       */
       DSA_PublicKey(const AlgorithmIdentifier& alg_id,
                     const std::vector<uint8_t>& key_bits) :
-         DL_Scheme_PublicKey(alg_id, key_bits, DL_Group::ANSI_X9_57)
+         DL_Scheme_PublicKey(alg_id, key_bits, DL_Group_Format::ANSI_X9_57)
          {
          }
 
diff --git a/src/lib/pubkey/ec_group/ec_group.cpp b/src/lib/pubkey/ec_group/ec_group.cpp
index ab4a059fc..2e6739729 100644
--- a/src/lib/pubkey/ec_group/ec_group.cpp
+++ b/src/lib/pubkey/ec_group/ec_group.cpp
@@ -612,7 +612,7 @@ EC_Group::DER_encode(EC_Group_Encoding form) const
 
    DER_Encoder der(output);
 
-   if(form == EC_DOMPAR_ENC_EXPLICIT)
+   if(form == EC_Group_Encoding::Explicit)
       {
       const size_t ecpVers1 = 1;
       const OID curve_type("1.2.840.10045.1.1"); // prime field
@@ -636,7 +636,7 @@ EC_Group::DER_encode(EC_Group_Encoding form) const
             .encode(get_cofactor())
          .end_cons();
       }
-   else if(form == EC_DOMPAR_ENC_OID)
+   else if(form == EC_Group_Encoding::NamedCurve)
       {
       const OID oid = get_curve_oid();
       if(oid.empty())
@@ -645,7 +645,7 @@ EC_Group::DER_encode(EC_Group_Encoding form) const
          }
       der.encode(oid);
       }
-   else if(form == EC_DOMPAR_ENC_IMPLICITCA)
+   else if(form == EC_Group_Encoding::ImplicitCA)
       {
       der.encode_null();
       }
@@ -659,7 +659,7 @@ EC_Group::DER_encode(EC_Group_Encoding form) const
 
 std::string EC_Group::PEM_encode() const
    {
-   const std::vector<uint8_t> der = DER_encode(EC_DOMPAR_ENC_EXPLICIT);
+   const std::vector<uint8_t> der = DER_encode(EC_Group_Encoding::Explicit);
    return PEM_Code::encode(der, "EC PARAMETERS");
    }
 
diff --git a/src/lib/pubkey/ec_group/ec_group.h b/src/lib/pubkey/ec_group/ec_group.h
index 2a7876610..5f50edc9b 100644
--- a/src/lib/pubkey/ec_group/ec_group.h
+++ b/src/lib/pubkey/ec_group/ec_group.h
@@ -20,10 +20,14 @@ namespace Botan {
 /**
 * This class represents elliptic curce domain parameters
 */
-enum EC_Group_Encoding {
-   EC_DOMPAR_ENC_EXPLICIT = 0,
-   EC_DOMPAR_ENC_IMPLICITCA = 1,
-   EC_DOMPAR_ENC_OID = 2
+enum class EC_Group_Encoding {
+   Explicit,
+   ImplicitCA,
+   NamedCurve,
+
+   EC_DOMPAR_ENC_EXPLICIT = Explicit,
+   EC_DOMPAR_ENC_IMPLICITCA = ImplicitCA,
+   EC_DOMPAR_ENC_OID = NamedCurve
 };
 
 enum class EC_Group_Source {
diff --git a/src/lib/pubkey/ecc_key/ecc_key.cpp b/src/lib/pubkey/ecc_key/ecc_key.cpp
index 09748b847..90ffb260b 100644
--- a/src/lib/pubkey/ecc_key/ecc_key.cpp
+++ b/src/lib/pubkey/ecc_key/ecc_key.cpp
@@ -27,15 +27,24 @@ size_t EC_PublicKey::estimated_strength() const
    return ecp_work_factor(key_length());
    }
 
-EC_PublicKey::EC_PublicKey(const EC_Group& dom_par,
-                           const PointGFp& pub_point) :
-   m_domain_params(dom_par), m_public_key(pub_point)
+namespace {
+
+EC_Group_Encoding default_encoding_for(EC_Group& group)
    {
-   if (!dom_par.get_curve_oid().empty())
-      m_domain_encoding = EC_DOMPAR_ENC_OID;
+   if(group.get_curve_oid().empty())
+      return EC_Group_Encoding::Explicit;
    else
-      m_domain_encoding = EC_DOMPAR_ENC_EXPLICIT;
+      return EC_Group_Encoding::NamedCurve;
+   }
 
+}
+
+EC_PublicKey::EC_PublicKey(const EC_Group& dom_par,
+                           const PointGFp& pub_point) :
+   m_domain_params(dom_par),
+   m_public_key(pub_point),
+   m_domain_encoding(default_encoding_for(m_domain_params))
+   {
 #if 0
    if(domain().get_curve() != public_point().get_curve())
       throw Invalid_Argument("EC_PublicKey: curve mismatch in constructor");
@@ -45,12 +54,9 @@ EC_PublicKey::EC_PublicKey(const EC_Group& dom_par,
 EC_PublicKey::EC_PublicKey(const AlgorithmIdentifier& alg_id,
                            const std::vector<uint8_t>& key_bits) :
    m_domain_params{EC_Group(alg_id.get_parameters())},
-   m_public_key{domain().OS2ECP(key_bits)}
+   m_public_key{domain().OS2ECP(key_bits)},
+   m_domain_encoding(default_encoding_for(m_domain_params))
    {
-   if (!domain().get_curve_oid().empty())
-      m_domain_encoding = EC_DOMPAR_ENC_OID;
-   else
-      m_domain_encoding = EC_DOMPAR_ENC_EXPLICIT;
    }
 
 bool EC_PublicKey::check_key(RandomNumberGenerator& rng,
@@ -83,15 +89,8 @@ void EC_PublicKey::set_point_encoding(PointGFp::Compression_Type enc)
 
 void EC_PublicKey::set_parameter_encoding(EC_Group_Encoding form)
    {
-   if(form != EC_DOMPAR_ENC_EXPLICIT &&
-      form != EC_DOMPAR_ENC_IMPLICITCA &&
-      form != EC_DOMPAR_ENC_OID)
-      throw Invalid_Argument("Invalid encoding form for EC-key object specified");
-
-   if((form == EC_DOMPAR_ENC_OID) && (m_domain_params.get_curve_oid().empty()))
-      throw Invalid_Argument("Invalid encoding form OID specified for "
-                             "EC-key object whose corresponding domain "
-                             "parameters are without oid");
+   if(form == EC_Group_Encoding::NamedCurve && m_domain_params.get_curve_oid().empty())
+      throw Invalid_Argument("Cannot used NamedCurve encoding for a curve without an OID");
 
    m_domain_encoding = form;
    }
@@ -113,10 +112,7 @@ EC_PrivateKey::EC_PrivateKey(RandomNumberGenerator& rng,
                              bool with_modular_inverse)
    {
    m_domain_params = ec_group;
-   if (!ec_group.get_curve_oid().empty())
-      m_domain_encoding = EC_DOMPAR_ENC_OID;
-   else
-      m_domain_encoding = EC_DOMPAR_ENC_EXPLICIT;
+   m_domain_encoding = default_encoding_for(m_domain_params);
 
    if(x == 0)
       {
@@ -162,12 +158,7 @@ EC_PrivateKey::EC_PrivateKey(const AlgorithmIdentifier& alg_id,
                              bool with_modular_inverse)
    {
    m_domain_params = EC_Group(alg_id.get_parameters());
-   m_domain_encoding = EC_DOMPAR_ENC_EXPLICIT;
-
-   if (!domain().get_curve_oid().empty())
-      m_domain_encoding = EC_DOMPAR_ENC_OID;
-   else
-      m_domain_encoding = EC_DOMPAR_ENC_EXPLICIT;
+   m_domain_encoding = default_encoding_for(m_domain_params);
 
    OID key_parameters;
    secure_vector<uint8_t> public_key_bits;
diff --git a/src/lib/pubkey/ecc_key/ecc_key.h b/src/lib/pubkey/ecc_key/ecc_key.h
index ec2b5f9be..5e268da14 100644
--- a/src/lib/pubkey/ecc_key/ecc_key.h
+++ b/src/lib/pubkey/ecc_key/ecc_key.h
@@ -108,7 +108,7 @@ class BOTAN_PUBLIC_API(2,0) EC_PublicKey : public virtual Public_Key
       size_t estimated_strength() const override;
 
    protected:
-      EC_PublicKey() : m_domain_params{}, m_public_key{}, m_domain_encoding(EC_DOMPAR_ENC_EXPLICIT)
+      EC_PublicKey() : m_domain_params{}, m_public_key{}, m_domain_encoding(EC_Group_Encoding::Explicit)
       {}
 
       EC_Group m_domain_params;
diff --git a/src/lib/pubkey/elgamal/elgamal.cpp b/src/lib/pubkey/elgamal/elgamal.cpp
index 73e091d0a..017f57073 100644
--- a/src/lib/pubkey/elgamal/elgamal.cpp
+++ b/src/lib/pubkey/elgamal/elgamal.cpp
@@ -45,7 +45,7 @@ ElGamal_PrivateKey::ElGamal_PrivateKey(RandomNumberGenerator& rng,
 
 ElGamal_PrivateKey::ElGamal_PrivateKey(const AlgorithmIdentifier& alg_id,
                                        const secure_vector<uint8_t>& key_bits) :
-   DL_Scheme_PrivateKey(alg_id, key_bits, DL_Group::ANSI_X9_42)
+   DL_Scheme_PrivateKey(alg_id, key_bits, DL_Group_Format::ANSI_X9_42)
    {
    m_y = m_group.power_g_p(m_x, m_group.p_bits());
    }
diff --git a/src/lib/pubkey/elgamal/elgamal.h b/src/lib/pubkey/elgamal/elgamal.h
index 4147f5037..0c440df00 100644
--- a/src/lib/pubkey/elgamal/elgamal.h
+++ b/src/lib/pubkey/elgamal/elgamal.h
@@ -19,7 +19,7 @@ class BOTAN_PUBLIC_API(2,0) ElGamal_PublicKey : public virtual DL_Scheme_PublicK
    {
    public:
       std::string algo_name() const override { return "ElGamal"; }
-      DL_Group::Format group_format() const override { return DL_Group::ANSI_X9_42; }
+      DL_Group_Format group_format() const override { return DL_Group_Format::ANSI_X9_42; }
 
       /**
       * Load a public key.
@@ -28,7 +28,7 @@ class BOTAN_PUBLIC_API(2,0) ElGamal_PublicKey : public virtual DL_Scheme_PublicK
       */
       ElGamal_PublicKey(const AlgorithmIdentifier& alg_id,
                         const std::vector<uint8_t>& key_bits) :
-         DL_Scheme_PublicKey(alg_id, key_bits, DL_Group::ANSI_X9_42)
+         DL_Scheme_PublicKey(alg_id, key_bits, DL_Group_Format::ANSI_X9_42)
          {}
 
       /**
diff --git a/src/lib/x509/certstor_sql/certstor_sql.cpp b/src/lib/x509/certstor_sql/certstor_sql.cpp
index b29165ac3..72fdc59fc 100644
--- a/src/lib/x509/certstor_sql/certstor_sql.cpp
+++ b/src/lib/x509/certstor_sql/certstor_sql.cpp
@@ -270,7 +270,7 @@ void Certificate_Store_In_SQL::revoke_cert(const X509_Certificate& cert, CRL_Cod
          "INSERT OR REPLACE INTO " + m_prefix + "revoked ( fingerprint, reason, time ) VALUES ( ?1, ?2, ?3 )");
 
    stmt1->bind(1,cert.fingerprint("SHA-256"));
-   stmt1->bind(2,code);
+   stmt1->bind(2,static_cast<uint32_t>(code));
 
    if(time.time_is_set())
       {
diff --git a/src/lib/x509/crl_ent.cpp b/src/lib/x509/crl_ent.cpp
index d83d43d73..def7b87f2 100644
--- a/src/lib/x509/crl_ent.cpp
+++ b/src/lib/x509/crl_ent.cpp
@@ -18,7 +18,7 @@ struct CRL_Entry_Data
    {
    std::vector<uint8_t> m_serial;
    X509_Time m_time;
-   CRL_Code m_reason = UNSPECIFIED;
+   CRL_Code m_reason = CRL_Code::UNSPECIFIED;
    Extensions m_extensions;
    };
 
@@ -32,7 +32,7 @@ CRL_Entry::CRL_Entry(const X509_Certificate& cert, CRL_Code why)
    m_data->m_time = X509_Time(std::chrono::system_clock::now());
    m_data->m_reason = why;
 
-   if(why != UNSPECIFIED)
+   if(why != CRL_Code::UNSPECIFIED)
       {
       m_data->m_extensions.add(new Cert_Extension::CRL_ReasonCode(why));
       }
@@ -97,7 +97,7 @@ void CRL_Entry::decode_from(BER_Decoder& source)
          }
       else
          {
-         data->m_reason = UNSPECIFIED;
+         data->m_reason = CRL_Code::UNSPECIFIED;
          }
       }
 
diff --git a/src/lib/x509/pkix_enums.h b/src/lib/x509/pkix_enums.h
index a1c85293b..9d2bbce44 100644
--- a/src/lib/x509/pkix_enums.h
+++ b/src/lib/x509/pkix_enums.h
@@ -118,9 +118,8 @@ enum Key_Constraints {
 
 /**
 * X.509v2 CRL Reason Code.
-* This will become an enum class in a future major release
 */
-enum CRL_Code : uint32_t {
+enum class CRL_Code : uint32_t {
    UNSPECIFIED            = 0,
    KEY_COMPROMISE         = 1,
    CA_COMPROMISE          = 2,
diff --git a/src/lib/x509/x509_crl.cpp b/src/lib/x509/x509_crl.cpp
index 962794a0c..5f7484d5b 100644
--- a/src/lib/x509/x509_crl.cpp
+++ b/src/lib/x509/x509_crl.cpp
@@ -100,7 +100,7 @@ bool X509_CRL::is_revoked(const X509_Certificate& cert) const
       {
       if(cert_serial == entry.serial_number())
          {
-         if(entry.reason_code() == REMOVE_FROM_CRL)
+         if(entry.reason_code() == CRL_Code::REMOVE_FROM_CRL)
             is_revoked = false;
          else
             is_revoked = true;
diff --git a/src/lib/x509/x509_crl.h b/src/lib/x509/x509_crl.h
index 1123439e0..51208a788 100644
--- a/src/lib/x509/x509_crl.h
+++ b/src/lib/x509/x509_crl.h
@@ -65,7 +65,7 @@ class BOTAN_PUBLIC_API(2,0) CRL_Entry final : public ASN1_Object
       * @param reason the reason code to set in the entry
       */
       CRL_Entry(const X509_Certificate& cert,
-                CRL_Code reason = UNSPECIFIED);
+                CRL_Code reason = CRL_Code::UNSPECIFIED);
 
    private:
       friend class X509_CRL;
diff --git a/src/lib/x509/x509_ext.h b/src/lib/x509/x509_ext.h
index 58fd0b35a..aa26c59fd 100644
--- a/src/lib/x509/x509_ext.h
+++ b/src/lib/x509/x509_ext.h
@@ -351,7 +351,7 @@ class BOTAN_PUBLIC_API(2,0) CRL_ReasonCode final : public Certificate_Extension
       CRL_ReasonCode* copy() const override
          { return new CRL_ReasonCode(m_reason); }
 
-      explicit CRL_ReasonCode(CRL_Code r = UNSPECIFIED) : m_reason(r) {}
+      explicit CRL_ReasonCode(CRL_Code r = CRL_Code::UNSPECIFIED) : m_reason(r) {}
 
       CRL_Code get_reason() const { return m_reason; }
 
@@ -361,7 +361,7 @@ class BOTAN_PUBLIC_API(2,0) CRL_ReasonCode final : public Certificate_Extension
    private:
       std::string oid_name() const override { return "X509v3.ReasonCode"; }
 
-      bool should_encode() const override { return (m_reason != UNSPECIFIED); }
+      bool should_encode() const override { return (m_reason != CRL_Code::UNSPECIFIED); }
       std::vector<uint8_t> encode_inner() const override;
       void decode_inner(const std::vector<uint8_t>&) override;
 


Test patch:
diff --git a/src/tests/test_certstor.cpp b/src/tests/test_certstor.cpp
index 4fe2cc0e9..b0cdcd877 100644
--- a/src/tests/test_certstor.cpp
+++ b/src/tests/test_certstor.cpp
@@ -135,9 +135,9 @@ Test::Result test_certstor_sqlite3_crl_test(const std::vector<CertificateAndKey>
          store.insert_cert(a.certificate);
          }
 
-      store.revoke_cert(certsandkeys[0].certificate, Botan::CA_COMPROMISE);
-      store.revoke_cert(certsandkeys[3].certificate, Botan::CA_COMPROMISE);
-      store.revoke_cert(certsandkeys[3].certificate, Botan::CA_COMPROMISE);
+      store.revoke_cert(certsandkeys[0].certificate, Botan::CRL_Code::CA_COMPROMISE);
+      store.revoke_cert(certsandkeys[3].certificate, Botan::CRL_Code::CA_COMPROMISE);
+      store.revoke_cert(certsandkeys[3].certificate, Botan::CRL_Code::CA_COMPROMISE);
 
          {
          const auto crls = store.generate_crls();
diff --git a/src/tests/test_dl_group.cpp b/src/tests/test_dl_group.cpp
index da820d5a4..4e4faa2dd 100644
--- a/src/tests/test_dl_group.cpp
+++ b/src/tests/test_dl_group.cpp
@@ -56,9 +56,9 @@ class DL_Group_Tests final : public Test
 
          const Botan::DL_Group orig("modp/ietf/1024");
 
-         const std::string pem1 = orig.PEM_encode(Botan::DL_Group::ANSI_X9_42);
-         const std::string pem2 = orig.PEM_encode(Botan::DL_Group::ANSI_X9_57);
-         const std::string pem3 = orig.PEM_encode(Botan::DL_Group::PKCS_3);
+         const std::string pem1 = orig.PEM_encode(Botan::DL_Group_Format::ANSI_X9_42);
+         const std::string pem2 = orig.PEM_encode(Botan::DL_Group_Format::ANSI_X9_57);
+         const std::string pem3 = orig.PEM_encode(Botan::DL_Group_Format::PKCS_3);
 
          Botan::DL_Group group1(pem1);
 
diff --git a/src/tests/test_pkcs11_high_level.cpp b/src/tests/test_pkcs11_high_level.cpp
index 84c2c62c3..ce2d43639 100644
--- a/src/tests/test_pkcs11_high_level.cpp
+++ b/src/tests/test_pkcs11_high_level.cpp
@@ -930,7 +930,6 @@ Test::Result test_ecdsa_privkey_import()
    // create ecdsa private key
    ECDSA_PrivateKey priv_key(Test::rng(), EC_Group("secp256r1"));
    result.confirm("Key self test OK", priv_key.check_key(Test::rng(), true));
-   priv_key.set_parameter_encoding(EC_Group_Encoding::EC_DOMPAR_ENC_OID);
 
    // import to card
    EC_PrivateKeyImportProperties props(priv_key.DER_domain(), priv_key.private_value());
@@ -959,7 +958,6 @@ Test::Result test_ecdsa_privkey_export()
 
    // create private key
    ECDSA_PrivateKey priv_key(Test::rng(), EC_Group("secp256r1"));
-   priv_key.set_parameter_encoding(EC_Group_Encoding::EC_DOMPAR_ENC_OID);
 
    result.confirm("Check ECDSA key", priv_key.check_key(Test::rng(), true));
    // import to card
@@ -994,7 +992,6 @@ Test::Result test_ecdsa_pubkey_import()
 
    // create ecdsa private key
    ECDSA_PrivateKey priv_key(Test::rng(), EC_Group("secp256r1"));
-   priv_key.set_parameter_encoding(EC_Group_Encoding::EC_DOMPAR_ENC_OID);
 
    const auto enc_point = encode_ec_point_in_octet_str(priv_key.public_point());
 
@@ -1023,7 +1020,6 @@ Test::Result test_ecdsa_pubkey_export()
 
    // create public key from private key
    ECDSA_PrivateKey priv_key(Test::rng(), EC_Group("secp256r1"));
-   priv_key.set_parameter_encoding(EC_Group_Encoding::EC_DOMPAR_ENC_OID);
 
    const auto enc_point = encode_ec_point_in_octet_str(priv_key.public_point());
 
@@ -1058,7 +1054,7 @@ Test::Result test_ecdsa_generate_private_key()
    props.set_sign(true);
 
    PKCS11_ECDSA_PrivateKey pk(test_session.session(),
-                              EC_Group("secp256r1").DER_encode(EC_Group_Encoding::EC_DOMPAR_ENC_OID), props);
+                              EC_Group("secp256r1").DER_encode(EC_Group_Encoding::NamedCurve), props);
    result.test_success("ECDSA private key generation was successful");
 
    pk.destroy();
@@ -1098,7 +1094,7 @@ Test::Result test_ecdsa_generate_keypair()
 
    for(auto &curve : curves)
        {
-       PKCS11_ECDSA_KeyPair keypair = generate_ecdsa_keypair(test_session, curve, EC_DOMPAR_ENC_OID);
+       PKCS11_ECDSA_KeyPair keypair = generate_ecdsa_keypair(test_session, curve, EC_Group_Encoding::NamedCurve);
 
        keypair.first.destroy();
        keypair.second.destroy();
@@ -1171,14 +1167,14 @@ Test::Result test_ecdsa_sign_verify_core(EC_Group_Encoding ec_dompar_enc, std::s
 
 Test::Result test_ecdsa_sign_verify()
     {
-        // pass the curve OID to the PKCS#11 library
-        return test_ecdsa_sign_verify_core(EC_DOMPAR_ENC_OID, "PKCS11 ECDSA sign and verify");
+    // pass the curve OID to the PKCS#11 library
+    return test_ecdsa_sign_verify_core(EC_Group_Encoding::NamedCurve, "PKCS11 ECDSA sign and verify");
     }
 
 Test::Result test_ecdsa_curve_import()
     {
-        // pass the curve parameters to the PKCS#11 library and perform sign/verify to test them
-        return test_ecdsa_sign_verify_core(EC_DOMPAR_ENC_EXPLICIT, "PKCS11 ECDSA sign and verify with imported curve");
+    // pass the curve parameters to the PKCS#11 library and perform sign/verify to test them
+    return test_ecdsa_sign_verify_core(EC_Group_Encoding::Explicit, "PKCS11 ECDSA sign and verify with imported curve");
     }
 
 class PKCS11_ECDSA_Tests final : public Test
@@ -1217,7 +1213,6 @@ Test::Result test_ecdh_privkey_import()
 
    // create ecdh private key
    ECDH_PrivateKey priv_key(Test::rng(), EC_Group("secp256r1"));
-   priv_key.set_parameter_encoding(EC_Group_Encoding::EC_DOMPAR_ENC_OID);
 
    // import to card
    EC_PrivateKeyImportProperties props(priv_key.DER_domain(), priv_key.private_value());
@@ -1244,7 +1239,6 @@ Test::Result test_ecdh_privkey_export()
 
    // create private key
    ECDH_PrivateKey priv_key(Test::rng(), EC_Group("secp256r1"));
-   priv_key.set_parameter_encoding(EC_Group_Encoding::EC_DOMPAR_ENC_OID);
 
    // import to card
    EC_PrivateKeyImportProperties props(priv_key.DER_domain(), priv_key.private_value());
@@ -1274,7 +1268,6 @@ Test::Result test_ecdh_pubkey_import()
 
    // create ECDH private key
    ECDH_PrivateKey priv_key(Test::rng(), EC_Group("secp256r1"));
-   priv_key.set_parameter_encoding(EC_Group_Encoding::EC_DOMPAR_ENC_OID);
 
    const auto enc_point = encode_ec_point_in_octet_str(priv_key.public_point());
 
@@ -1303,7 +1296,6 @@ Test::Result test_ecdh_pubkey_export()
 
    // create public key from private key
    ECDH_PrivateKey priv_key(Test::rng(), EC_Group("secp256r1"));
-   priv_key.set_parameter_encoding(EC_Group_Encoding::EC_DOMPAR_ENC_OID);
 
    const auto enc_point = encode_ec_point_in_octet_str(priv_key.public_point());
 
@@ -1338,7 +1330,7 @@ Test::Result test_ecdh_generate_private_key()
    props.set_derive(true);
 
    PKCS11_ECDH_PrivateKey pk(test_session.session(),
-                             EC_Group("secp256r1").DER_encode(EC_Group_Encoding::EC_DOMPAR_ENC_OID), props);
+                             EC_Group("secp256r1").DER_encode(EC_Group_Encoding::NamedCurve), props);
    result.test_success("ECDH private key generation was successful");
 
    pk.destroy();
@@ -1348,8 +1340,8 @@ Test::Result test_ecdh_generate_private_key()
 
 PKCS11_ECDH_KeyPair generate_ecdh_keypair(const TestSession& test_session, const std::string& label)
    {
-   EC_PublicKeyGenerationProperties pub_props(EC_Group("secp256r1").DER_encode(
-            EC_Group_Encoding::EC_DOMPAR_ENC_OID));
+   EC_PublicKeyGenerationProperties pub_props(
+      EC_Group("secp256r1").DER_encode(EC_Group_Encoding::NamedCurve));
    pub_props.set_label(label + "_PUB_KEY");
    pub_props.set_token(true);
    pub_props.set_derive(true);
diff --git a/src/tests/unit_x509.cpp b/src/tests/unit_x509.cpp
index b969f7501..605297cd3 100644
--- a/src/tests/unit_x509.cpp
+++ b/src/tests/unit_x509.cpp
@@ -917,7 +917,7 @@ Test::Result test_x509_cert(const Botan::Private_Key& ca_key,
    store.add_crl(crl1);
 
    std::vector<Botan::CRL_Entry> revoked;
-   revoked.push_back(Botan::CRL_Entry(user1_cert, Botan::CESSATION_OF_OPERATION));
+   revoked.push_back(Botan::CRL_Entry(user1_cert, Botan::CRL_Code::CESSATION_OF_OPERATION));
    revoked.push_back(user2_cert);
 
    const Botan::X509_CRL crl2 = ca.update_crl(crl1, revoked, Test::rng());
@@ -934,7 +934,7 @@ Test::Result test_x509_cert(const Botan::Private_Key& ca_key,
    result.test_eq("user 1 revoked", result_u2.result_string(), revoked_str);
 
    revoked.clear();
-   revoked.push_back(Botan::CRL_Entry(user1_cert, Botan::REMOVE_FROM_CRL));
+   revoked.push_back(Botan::CRL_Entry(user1_cert, Botan::CRL_Code::REMOVE_FROM_CRL));
    Botan::X509_CRL crl3 = ca.update_crl(crl2, revoked, Test::rng());
 
    store.add_crl(crl3);