Repository: randombit/botan
Pull request #3265 (2023-02-08 23:47:33)

Deprecate get_ prefix functions on AlgorithmIdentifier
And update callers within the library


Patch:
diff --git a/src/cli/pk_crypt.cpp b/src/cli/pk_crypt.cpp
index 2cfcfb7af..24a9f9a5a 100644
--- a/src/cli/pk_crypt.cpp
+++ b/src/cli/pk_crypt.cpp
@@ -166,24 +166,24 @@ class PK_Decrypt final : public Command
             return set_return_code(1);
             }
 
-         if(pk_alg_id.get_oid() != Botan::OID::from_string("RSA/OAEP"))
+         if(pk_alg_id.oid() != Botan::OID::from_string("RSA/OAEP"))
             {
             error_output() << "Ciphertext was encrypted with something other than RSA/OAEP";
             return set_return_code(1);
             }
 
          Botan::AlgorithmIdentifier oaep_hash_id;
-         Botan::BER_Decoder(pk_alg_id.get_parameters()).decode(oaep_hash_id);
+         Botan::BER_Decoder(pk_alg_id.parameters()).decode(oaep_hash_id);
 
-         const std::string oaep_hash = Botan::OIDS::oid2str_or_empty(oaep_hash_id.get_oid());
+         const std::string oaep_hash = Botan::OIDS::oid2str_or_empty(oaep_hash_id.oid());
 
          if(oaep_hash.empty())
             {
-            error_output() << "Unknown hash function used with OAEP, OID " << oaep_hash_id.get_oid().to_string() << "\n";
+            error_output() << "Unknown hash function used with OAEP, OID " << oaep_hash_id.oid().to_string() << "\n";
             return set_return_code(1);
             }
 
-         if(oaep_hash_id.get_parameters().empty() == false)
+         if(oaep_hash_id.parameters().empty() == false)
             {
             error_output() << "Unknown OAEP parameters used\n";
             return set_return_code(1);
diff --git a/src/lib/asn1/alg_id.cpp b/src/lib/asn1/alg_id.cpp
index 2f0848132..820159e8f 100644
--- a/src/lib/asn1/alg_id.cpp
+++ b/src/lib/asn1/alg_id.cpp
@@ -64,7 +64,7 @@ bool AlgorithmIdentifier::parameters_are_null() const
 
 bool operator==(const AlgorithmIdentifier& a1, const AlgorithmIdentifier& a2)
    {
-   if(a1.get_oid() != a2.get_oid())
+   if(a1.oid() != a2.oid())
       return false;
 
    /*
diff --git a/src/lib/asn1/asn1_obj.h b/src/lib/asn1/asn1_obj.h
index 622028799..c03f41c72 100644
--- a/src/lib/asn1/asn1_obj.h
+++ b/src/lib/asn1/asn1_obj.h
@@ -444,7 +444,10 @@ class BOTAN_PUBLIC_API(2,0) AlgorithmIdentifier final : public ASN1_Object
       const OID& oid() const { return m_oid; }
       const std::vector<uint8_t>& parameters() const { return m_parameters; }
 
+      BOTAN_DEPRECATED("Use AlgorithmIdentifier::oid")
       const OID& get_oid() const { return m_oid; }
+
+      BOTAN_DEPRECATED("Use AlgorithmIdentifier::parameters")
       const std::vector<uint8_t>& get_parameters() const { return m_parameters; }
 
       bool parameters_are_null() const;
diff --git a/src/lib/pubkey/dl_algo/dl_algo.cpp b/src/lib/pubkey/dl_algo/dl_algo.cpp
index 66f26fb3f..2188a6173 100644
--- a/src/lib/pubkey/dl_algo/dl_algo.cpp
+++ b/src/lib/pubkey/dl_algo/dl_algo.cpp
@@ -44,7 +44,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) :
-   m_group(alg_id.get_parameters(), format)
+   m_group(alg_id.parameters(), format)
    {
    BER_Decoder(key_bits).decode(m_y);
    }
@@ -58,7 +58,7 @@ DL_Scheme_PrivateKey::DL_Scheme_PrivateKey(const AlgorithmIdentifier& alg_id,
                                            const secure_vector<uint8_t>& key_bits,
                                            DL_Group_Format format)
    {
-   m_group.BER_decode(alg_id.get_parameters(), format);
+   m_group.BER_decode(alg_id.parameters(), format);
 
    BER_Decoder(key_bits).decode(m_x);
    }
diff --git a/src/lib/pubkey/ecc_key/ecc_key.cpp b/src/lib/pubkey/ecc_key/ecc_key.cpp
index fcd67ef22..ff3307d3f 100644
--- a/src/lib/pubkey/ecc_key/ecc_key.cpp
+++ b/src/lib/pubkey/ecc_key/ecc_key.cpp
@@ -53,7 +53,7 @@ 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_domain_params{EC_Group(alg_id.parameters())},
    m_public_key{domain().OS2ECP(key_bits)},
    m_domain_encoding(default_encoding_for(m_domain_params))
    {
@@ -157,7 +157,7 @@ EC_PrivateKey::EC_PrivateKey(const AlgorithmIdentifier& alg_id,
                              const secure_vector<uint8_t>& key_bits,
                              bool with_modular_inverse)
    {
-   m_domain_params = EC_Group(alg_id.get_parameters());
+   m_domain_params = EC_Group(alg_id.parameters());
    m_domain_encoding = default_encoding_for(m_domain_params);
 
    OID key_parameters;
diff --git a/src/lib/pubkey/gost_3410/gost_3410.cpp b/src/lib/pubkey/gost_3410/gost_3410.cpp
index 09db1f5a7..a7b51bb4a 100644
--- a/src/lib/pubkey/gost_3410/gost_3410.cpp
+++ b/src/lib/pubkey/gost_3410/gost_3410.cpp
@@ -68,7 +68,7 @@ GOST_3410_PublicKey::GOST_3410_PublicKey(const AlgorithmIdentifier& alg_id,
    OID ecc_param_id;
 
    // The parameters also includes hash and cipher OIDs
-   BER_Decoder(alg_id.get_parameters()).start_sequence().decode(ecc_param_id);
+   BER_Decoder(alg_id.parameters()).start_sequence().decode(ecc_param_id);
 
    m_domain_params = EC_Group(ecc_param_id);
 
diff --git a/src/lib/pubkey/kyber/kyber_common/kyber.cpp b/src/lib/pubkey/kyber/kyber_common/kyber.cpp
index 3cf7e5053..d3637afec 100644
--- a/src/lib/pubkey/kyber/kyber_common/kyber.cpp
+++ b/src/lib/pubkey/kyber/kyber_common/kyber.cpp
@@ -1359,7 +1359,7 @@ void Kyber_PublicKey::initialize_from_encoding(const std::vector<uint8_t>& pub_k
 Kyber_PublicKey::Kyber_PublicKey(const AlgorithmIdentifier& alg_id,
                                  const std::vector<uint8_t>& key_bits) :
    Kyber_PublicKey(key_bits,
-                   KyberMode(alg_id.get_oid()),
+                   KyberMode(alg_id.oid()),
                    KyberKeyEncoding::Full)
    {}
 
@@ -1449,7 +1449,7 @@ Kyber_PrivateKey::Kyber_PrivateKey(RandomNumberGenerator& rng, KyberMode m)
 Kyber_PrivateKey::Kyber_PrivateKey(const AlgorithmIdentifier& alg_id,
                                    const secure_vector<uint8_t>& key_bits) :
    Kyber_PrivateKey(key_bits,
-                    KyberMode(alg_id.get_oid()),
+                    KyberMode(alg_id.oid()),
                     KyberKeyEncoding::Full)
    {}
 
diff --git a/src/lib/pubkey/pbes2/pbes2.cpp b/src/lib/pubkey/pbes2/pbes2.cpp
index a0c5c511c..bc0227f72 100644
--- a/src/lib/pubkey/pbes2/pbes2.cpp
+++ b/src/lib/pubkey/pbes2/pbes2.cpp
@@ -29,13 +29,13 @@ secure_vector<uint8_t> derive_key(const std::string& passphrase,
                                   const AlgorithmIdentifier& kdf_algo,
                                   size_t default_key_size)
    {
-   if(kdf_algo.get_oid() == OID::from_string("PKCS5.PBKDF2"))
+   if(kdf_algo.oid() == OID::from_string("PKCS5.PBKDF2"))
       {
       secure_vector<uint8_t> salt;
       size_t iterations = 0, key_length = 0;
 
       AlgorithmIdentifier prf_algo;
-      BER_Decoder(kdf_algo.get_parameters())
+      BER_Decoder(kdf_algo.parameters())
          .start_sequence()
          .decode(salt, ASN1_Type::OctetString)
          .decode(iterations)
@@ -51,7 +51,7 @@ secure_vector<uint8_t> derive_key(const std::string& passphrase,
       if(key_length == 0)
          key_length = default_key_size;
 
-      const std::string prf = OIDS::oid2str_or_throw(prf_algo.get_oid());
+      const std::string prf = OIDS::oid2str_or_throw(prf_algo.oid());
       auto pbkdf_fam = PasswordHashFamily::create_or_throw("PBKDF2(" + prf + ")");
       auto pbkdf = pbkdf_fam->from_params(iterations);
 
@@ -61,14 +61,14 @@ secure_vector<uint8_t> derive_key(const std::string& passphrase,
                         salt.data(), salt.size());
       return derived_key;
       }
-   else if(kdf_algo.get_oid() == OID::from_string("Scrypt"))
+   else if(kdf_algo.oid() == OID::from_string("Scrypt"))
       {
       secure_vector<uint8_t> salt;
       size_t N = 0, r = 0, p = 0;
       size_t key_length = 0;
 
       AlgorithmIdentifier prf_algo;
-      BER_Decoder(kdf_algo.get_parameters())
+      BER_Decoder(kdf_algo.parameters())
          .start_sequence()
          .decode(salt, ASN1_Type::OctetString)
          .decode(N)
@@ -92,7 +92,7 @@ secure_vector<uint8_t> derive_key(const std::string& passphrase,
       }
    else
       throw Decoding_Error("PBE-PKCS5 v2.0: Unknown KDF algorithm " +
-                           kdf_algo.get_oid().to_string());
+                           kdf_algo.oid().to_string());
    }
 
 secure_vector<uint8_t> derive_key(const std::string& passphrase,
@@ -310,7 +310,7 @@ pbes2_decrypt(const secure_vector<uint8_t>& key_bits,
          .decode(enc_algo)
       .end_cons();
 
-   const std::string cipher = OIDS::oid2str_or_throw(enc_algo.get_oid());
+   const std::string cipher = OIDS::oid2str_or_throw(enc_algo.oid());
    const std::vector<std::string> cipher_spec = split_on(cipher, '/');
    if(cipher_spec.size() != 2)
       throw Decoding_Error("PBE-PKCS5 v2.0: Invalid cipher spec " + cipher);
@@ -318,7 +318,7 @@ pbes2_decrypt(const secure_vector<uint8_t>& key_bits,
       throw Decoding_Error("PBE-PKCS5 v2.0: Don't know param format for " + cipher);
 
    secure_vector<uint8_t> iv;
-   BER_Decoder(enc_algo.get_parameters()).decode(iv, ASN1_Type::OctetString).verify_end();
+   BER_Decoder(enc_algo.parameters()).decode(iv, ASN1_Type::OctetString).verify_end();
 
    std::unique_ptr<Cipher_Mode> dec = Cipher_Mode::create(cipher, Cipher_Dir::Decryption);
    if(!dec)
diff --git a/src/lib/pubkey/pk_algs.cpp b/src/lib/pubkey/pk_algs.cpp
index 698aaa029..b65954914 100644
--- a/src/lib/pubkey/pk_algs.cpp
+++ b/src/lib/pubkey/pk_algs.cpp
@@ -86,7 +86,7 @@ std::unique_ptr<Public_Key>
 load_public_key(const AlgorithmIdentifier& alg_id,
                 const std::vector<uint8_t>& key_bits)
    {
-   const std::string oid_str = alg_id.get_oid().to_formatted_string();
+   const std::string oid_str = alg_id.oid().to_formatted_string();
    const std::vector<std::string> alg_info = split_on(oid_str, '/');
    const std::string alg_name = alg_info[0];
 
@@ -177,7 +177,7 @@ std::unique_ptr<Private_Key>
 load_private_key(const AlgorithmIdentifier& alg_id,
                  const secure_vector<uint8_t>& key_bits)
    {
-   const std::string oid_str = alg_id.get_oid().to_formatted_string();
+   const std::string oid_str = alg_id.oid().to_formatted_string();
    const std::vector<std::string> alg_info = split_on(oid_str, '/');
    const std::string alg_name = alg_info[0];
 
diff --git a/src/lib/pubkey/pkcs8.cpp b/src/lib/pubkey/pkcs8.cpp
index bddabea8e..d4d7b9c7f 100644
--- a/src/lib/pubkey/pkcs8.cpp
+++ b/src/lib/pubkey/pkcs8.cpp
@@ -102,10 +102,10 @@ secure_vector<uint8_t> PKCS8_decode(
       {
       if(is_encrypted)
          {
-         if(OIDS::oid2str_or_throw(pbe_alg_id.get_oid()) != "PBE-PKCS5v20")
-            throw PKCS8_Exception("Unknown PBE type " + pbe_alg_id.get_oid().to_string());
+         if(OIDS::oid2str_or_throw(pbe_alg_id.oid()) != "PBE-PKCS5v20")
+            throw PKCS8_Exception("Unknown PBE type " + pbe_alg_id.oid().to_string());
 #if defined(BOTAN_HAS_PKCS5_PBES2)
-         key = pbes2_decrypt(key_data, get_passphrase(), pbe_alg_id.get_parameters());
+         key = pbes2_decrypt(key_data, get_passphrase(), pbe_alg_id.parameters());
 #else
          BOTAN_UNUSED(get_passphrase);
          throw Decoding_Error("Private key is encrypted but PBES2 was disabled in build");
@@ -339,10 +339,10 @@ load_key(DataSource& source,
    AlgorithmIdentifier alg_id;
    secure_vector<uint8_t> pkcs8_key = PKCS8_decode(source, get_pass, alg_id, is_encrypted);
 
-   const std::string alg_name = OIDS::oid2str_or_empty(alg_id.get_oid());
+   const std::string alg_name = OIDS::oid2str_or_empty(alg_id.oid());
    if(alg_name.empty())
       throw PKCS8_Exception("Unknown algorithm OID: " +
-                            alg_id.get_oid().to_string());
+                            alg_id.oid().to_string());
 
    return load_private_key(alg_id, pkcs8_key);
    }
diff --git a/src/lib/x509/ocsp.cpp b/src/lib/x509/ocsp.cpp
index 7441f69f2..ec30c2611 100644
--- a/src/lib/x509/ocsp.cpp
+++ b/src/lib/x509/ocsp.cpp
@@ -168,7 +168,7 @@ Certificate_Status_Code Response::verify_signature(const X509_Certificate& issue
       std::unique_ptr<Public_Key> pub_key(issuer.subject_public_key());
 
       const std::vector<std::string> sig_info =
-         split_on(m_sig_algo.get_oid().to_formatted_string(), '/');
+         split_on(m_sig_algo.oid().to_formatted_string(), '/');
 
       if(sig_info.size() != 2 || sig_info[0] != pub_key->algo_name())
          return Certificate_Status_Code::OCSP_RESPONSE_INVALID;
diff --git a/src/lib/x509/ocsp_types.cpp b/src/lib/x509/ocsp_types.cpp
index a5c12c20f..b057f4ed2 100644
--- a/src/lib/x509/ocsp_types.cpp
+++ b/src/lib/x509/ocsp_types.cpp
@@ -36,7 +36,7 @@ bool CertID::is_id_for(const X509_Certificate& issuer,
       if(BigInt::decode(subject.serial_number()) != m_subject_serial)
          return false;
 
-      const std::string hash_algo = m_hash_id.get_oid().to_formatted_string();
+      const std::string hash_algo = m_hash_id.oid().to_formatted_string();
       std::unique_ptr<HashFunction> hash = HashFunction::create_or_throw(hash_algo);
 
       if(m_issuer_dn_hash != unlock(hash->process(subject.raw_issuer_dn())))
diff --git a/src/lib/x509/x509_obj.cpp b/src/lib/x509/x509_obj.cpp
index fe785be59..a5ffdc7bc 100644
--- a/src/lib/x509/x509_obj.cpp
+++ b/src/lib/x509/x509_obj.cpp
@@ -40,7 +40,7 @@ Pss_params decode_pss_params(const std::vector<uint8_t>& encoded_pss_params)
          .decode_optional(pss_parameter.trailer_field, ASN1_Type(3), ASN1_Class::ExplicitContextSpecific, size_t(1))
       .end_cons();
 
-   BER_Decoder(pss_parameter.mask_gen_algo.get_parameters()).decode(pss_parameter.mask_gen_hash);
+   BER_Decoder(pss_parameter.mask_gen_algo.parameters()).decode(pss_parameter.mask_gen_hash);
 
    return pss_parameter;
    }
@@ -137,7 +137,7 @@ std::vector<uint8_t> X509_Object::tbs_data() const
 */
 std::string X509_Object::hash_used_for_signature() const
    {
-   const OID& oid = m_sig_algo.get_oid();
+   const OID& oid = m_sig_algo.oid();
    const std::vector<std::string> sig_info = split_on(oid.to_formatted_string(), '/');
 
    if(sig_info.size() == 1)
@@ -152,7 +152,7 @@ std::string X509_Object::hash_used_for_signature() const
 
    if(sig_info[1] == "EMSA4")
       {
-      const OID hash_oid = decode_pss_params(signature_algorithm().get_parameters()).hash_algo.get_oid();
+      const OID hash_oid = decode_pss_params(signature_algorithm().parameters()).hash_algo.oid();
       return hash_oid.to_formatted_string();
       }
    else
@@ -181,7 +181,7 @@ bool X509_Object::check_signature(const Public_Key& pub_key) const
 Certificate_Status_Code X509_Object::verify_signature(const Public_Key& pub_key) const
    {
    const std::vector<std::string> sig_info =
-      split_on(m_sig_algo.get_oid().to_formatted_string(), '/');
+      split_on(m_sig_algo.oid().to_formatted_string(), '/');
 
    if(sig_info.empty() || sig_info.size() > 2 || sig_info[0] != pub_key.algo_name())
       return Certificate_Status_Code::SIGNATURE_ALGO_BAD_PARAMS;
@@ -200,15 +200,15 @@ Certificate_Status_Code X509_Object::verify_signature(const Public_Key& pub_key)
    if(padding == "EMSA4")
       {
       // "MUST contain RSASSA-PSS-params"
-      if(signature_algorithm().get_parameters().empty())
+      if(signature_algorithm().parameters().empty())
          {
          return Certificate_Status_Code::SIGNATURE_ALGO_BAD_PARAMS;
          }
 
-      Pss_params pss_parameter = decode_pss_params(signature_algorithm().get_parameters());
+      Pss_params pss_parameter = decode_pss_params(signature_algorithm().parameters());
 
       // hash_algo must be SHA1, SHA2-224, SHA2-256, SHA2-384 or SHA2-512
-      const std::string hash_algo = pss_parameter.hash_algo.get_oid().to_formatted_string();
+      const std::string hash_algo = pss_parameter.hash_algo.oid().to_formatted_string();
       if(hash_algo != "SHA-1" &&
          hash_algo != "SHA-224" &&
          hash_algo != "SHA-256" &&
@@ -218,7 +218,7 @@ Certificate_Status_Code X509_Object::verify_signature(const Public_Key& pub_key)
          return Certificate_Status_Code::UNTRUSTED_HASH;
          }
 
-      const std::string mgf_algo = pss_parameter.mask_gen_algo.get_oid().to_formatted_string();
+      const std::string mgf_algo = pss_parameter.mask_gen_algo.oid().to_formatted_string();
       if(mgf_algo != "MGF1")
          {
          return Certificate_Status_Code::SIGNATURE_ALGO_BAD_PARAMS;
@@ -226,7 +226,7 @@ Certificate_Status_Code X509_Object::verify_signature(const Public_Key& pub_key)
 
       // For MGF1, it is strongly RECOMMENDED that the underlying hash function be the same as the one identified by hashAlgorithm
       // Must be SHA1, SHA2-224, SHA2-256, SHA2-384 or SHA2-512
-      if(pss_parameter.mask_gen_hash.get_oid() != pss_parameter.hash_algo.get_oid())
+      if(pss_parameter.mask_gen_hash.oid() != pss_parameter.hash_algo.oid())
          {
          return Certificate_Status_Code::SIGNATURE_ALGO_BAD_PARAMS;
          }
diff --git a/src/lib/x509/x509cert.cpp b/src/lib/x509/x509cert.cpp
index aec2e897a..80a4ad445 100644
--- a/src/lib/x509/x509cert.cpp
+++ b/src/lib/x509/x509cert.cpp
@@ -151,7 +151,7 @@ std::unique_ptr<X509_Certificate_Data> parse_x509_cert_body(const X509_Object& o
    BER_Decoder(public_key).decode(public_key_alg_id).discard_remaining();
 
    const std::vector<std::string> public_key_info =
-      split_on(OIDS::oid2str_or_empty(public_key_alg_id.get_oid()), '/');
+      split_on(OIDS::oid2str_or_empty(public_key_alg_id.oid()), '/');
 
    if(!public_key_info.empty() && public_key_info[0] == "RSA")
       {
@@ -183,7 +183,7 @@ std::unique_ptr<X509_Certificate_Data> parse_x509_cert_body(const X509_Object& o
       else
          {
          // oid = rsaEncryption -> parameters field MUST contain NULL
-         if(public_key_alg_id != AlgorithmIdentifier(public_key_alg_id.get_oid(), AlgorithmIdentifier::USE_NULL_PARAM))
+         if(public_key_alg_id != AlgorithmIdentifier(public_key_alg_id.oid(), AlgorithmIdentifier::USE_NULL_PARAM))
             {
             throw Decoding_Error("RSA algorithm parameters field MUST contain NULL");
             }
@@ -858,7 +858,7 @@ std::string X509_Certificate::to_string() const
    if(!crl_distribution_point().empty())
       out << "CRL " << crl_distribution_point() << "\n";
 
-   out << "Signature algorithm: " << this->signature_algorithm().get_oid().to_formatted_string() << "\n";
+   out << "Signature algorithm: " << this->signature_algorithm().oid().to_formatted_string() << "\n";
 
    out << "Serial number: " << hex_encode(this->serial_number()) << "\n";
 
@@ -877,7 +877,7 @@ std::string X509_Certificate::to_string() const
    catch(Decoding_Error&)
       {
       const AlgorithmIdentifier& alg_id = this->subject_public_key_algo();
-      out << "Failed to decode key with oid " << alg_id.get_oid().to_string() << "\n";
+      out << "Failed to decode key with oid " << alg_id.oid().to_string() << "\n";
       }
 
    return out.str();
diff --git a/src/lib/x509/x509path.cpp b/src/lib/x509/x509path.cpp
index db4dc78c3..db71ea799 100644
--- a/src/lib/x509/x509path.cpp
+++ b/src/lib/x509/x509path.cpp
@@ -120,7 +120,7 @@ PKIX::check_chain(const std::vector<X509_Certificate>& cert_path,
       std::unique_ptr<Public_Key> issuer_key(issuer.subject_public_key());
 
       // Check the signature algorithm is known
-      if(OIDS::oid2str_or_empty(subject.signature_algorithm().get_oid()).empty())
+      if(OIDS::oid2str_or_empty(subject.signature_algorithm().oid()).empty())
          {
          status.insert(Certificate_Status_Code::SIGNATURE_ALGO_UNKNOWN);
          }
diff --git a/src/lib/x509/x509self.cpp b/src/lib/x509/x509self.cpp
index 0f6ae459e..54fffda6e 100644
--- a/src/lib/x509/x509self.cpp
+++ b/src/lib/x509/x509self.cpp
@@ -59,7 +59,7 @@ X509_Certificate create_self_signed_cert(const X509_Cert_Options& opts,
 
    const std::vector<uint8_t> pub_key = X509::BER_encode(key);
    auto signer = X509_Object::choose_sig_format(sig_algo, key, rng, hash_fn, opts.padding_scheme);
-   BOTAN_ASSERT_NOMSG(sig_algo.get_oid().has_value());
+   BOTAN_ASSERT_NOMSG(sig_algo.oid().has_value());
    load_info(opts, subject_dn, subject_alt);
 
    Extensions extensions = opts.extensions;


Test patch:
diff --git a/src/tests/unit_ecdsa.cpp b/src/tests/unit_ecdsa.cpp
index 775ac6467..4875a4c34 100644
--- a/src/tests/unit_ecdsa.cpp
+++ b/src/tests/unit_ecdsa.cpp
@@ -82,7 +82,7 @@ Test::Result test_decode_ecdsa_X509()
    Test::Result result("ECDSA Unit");
    Botan::X509_Certificate cert(Test::data_file("x509/ecc/CSCA.CSCA.csca-germany.1.crt"));
 
-   result.test_eq("correct signature oid", cert.signature_algorithm().get_oid().to_formatted_string(), "ECDSA/EMSA1(SHA-224)");
+   result.test_eq("correct signature oid", cert.signature_algorithm().oid().to_formatted_string(), "ECDSA/EMSA1(SHA-224)");
 
    result.test_eq("serial number", cert.serial_number(), Botan::hex_decode("01"));
    result.test_eq("authority key id", cert.authority_key_id(), cert.subject_key_id());
diff --git a/src/tests/unit_x509.cpp b/src/tests/unit_x509.cpp
index db65a437b..c9ea8f087 100644
--- a/src/tests/unit_x509.cpp
+++ b/src/tests/unit_x509.cpp
@@ -487,7 +487,7 @@ Test::Result test_rsa_oaep()
    result.test_not_null("Decoding RSA-OAEP worked", public_key.get());
    const auto& pk_info = cert.subject_public_key_algo();
 
-   result.test_eq("RSA-OAEP OID", pk_info.get_oid().to_string(), Botan::OID::from_string("RSA/OAEP").to_string());
+   result.test_eq("RSA-OAEP OID", pk_info.oid().to_string(), Botan::OID::from_string("RSA/OAEP").to_string());
 #endif
 
    return result;
@@ -686,13 +686,13 @@ Test::Result test_verify_gost2012_cert()
 
    Botan::X509_Certificate ca_cert_def = Botan::X509::create_self_signed_cert(opt, (*sk), "SHA-512", Test::rng());
    test_result.test_eq("CA certificate signature algorithm (default)",
-      Botan::OIDS::oid2str_or_throw(ca_cert_def.signature_algorithm().get_oid()),"RSA/EMSA3(SHA-512)");
+      Botan::OIDS::oid2str_or_throw(ca_cert_def.signature_algorithm().oid()),"RSA/EMSA3(SHA-512)");
 
    // Create X509 CA certificate; RSA-PSS is explicitly set
    opt.set_padding_scheme("PSSR");
    Botan::X509_Certificate ca_cert_exp = Botan::X509::create_self_signed_cert(opt, (*sk), "SHA-512", Test::rng());
    test_result.test_eq("CA certificate signature algorithm (explicit)",
-      Botan::OIDS::oid2str_or_throw(ca_cert_exp.signature_algorithm().get_oid()),"RSA/EMSA4");
+      Botan::OIDS::oid2str_or_throw(ca_cert_exp.signature_algorithm().oid()),"RSA/EMSA4");
 
 #if defined(BOTAN_HAS_EMSA1)
 
@@ -712,7 +712,7 @@ Test::Result test_verify_gost2012_cert()
 #endif
 
    test_result.test_eq("CA certificate signature algorithm (explicit)",
-      Botan::OIDS::oid2str_or_throw(ca_cert_exp.signature_algorithm().get_oid()),"RSA/EMSA4");
+      Botan::OIDS::oid2str_or_throw(ca_cert_exp.signature_algorithm().oid()),"RSA/EMSA4");
 
    const Botan::X509_Time not_before = from_date(-1, 1, 1);
    const Botan::X509_Time not_after = from_date(2, 1, 2);
@@ -721,7 +721,7 @@ Test::Result test_verify_gost2012_cert()
    Botan::X509_Cert_Options req_opt("endpoint");
    req_opt.set_padding_scheme("EMSA4(SHA-512,MGF1,64)");
    Botan::PKCS10_Request end_req = Botan::X509::create_cert_req(req_opt, (*sk), "SHA-512", Test::rng());
-   test_result.test_eq("Certificate request signature algorithm", Botan::OIDS::oid2str_or_throw(end_req.signature_algorithm().get_oid()),"RSA/EMSA4");
+   test_result.test_eq("Certificate request signature algorithm", Botan::OIDS::oid2str_or_throw(end_req.signature_algorithm().oid()),"RSA/EMSA4");
 
    // Create X509 CA object: will fail as the chosen hash functions differ
    try
@@ -739,21 +739,21 @@ Test::Result test_verify_gost2012_cert()
    // Create X509 CA object: its signer will use the padding scheme from the CA certificate, i.e. EMSA3
    Botan::X509_CA ca_def(ca_cert_def, (*sk), "SHA-512", Test::rng());
    Botan::X509_Certificate end_cert_emsa3 = ca_def.sign_request(end_req, Test::rng(), not_before, not_after);
-   test_result.test_eq("End certificate signature algorithm", Botan::OIDS::oid2str_or_throw(end_cert_emsa3.signature_algorithm().get_oid()), "RSA/EMSA3(SHA-512)");
+   test_result.test_eq("End certificate signature algorithm", Botan::OIDS::oid2str_or_throw(end_cert_emsa3.signature_algorithm().oid()), "RSA/EMSA3(SHA-512)");
 
    // Create X509 CA object: its signer will use the explicitly configured padding scheme, which is different from the CA certificate's scheme
    Botan::X509_CA ca_diff(ca_cert_def, (*sk), "SHA-512", "EMSA-PSS", Test::rng());
    Botan::X509_Certificate end_cert_diff_emsa4 = ca_diff.sign_request(end_req, Test::rng(), not_before, not_after);
-   test_result.test_eq("End certificate signature algorithm", Botan::OIDS::oid2str_or_throw(end_cert_diff_emsa4.signature_algorithm().get_oid()), "RSA/EMSA4");
+   test_result.test_eq("End certificate signature algorithm", Botan::OIDS::oid2str_or_throw(end_cert_diff_emsa4.signature_algorithm().oid()), "RSA/EMSA4");
 
    // Create X509 CA object: its signer will use the explicitly configured padding scheme, which is identical to the CA certificate's scheme
    Botan::X509_CA ca_exp(ca_cert_exp, (*sk), "SHA-512", "EMSA4(SHA-512,MGF1,64)", Test::rng());
    Botan::X509_Certificate end_cert_emsa4= ca_exp.sign_request(end_req, Test::rng(), not_before, not_after);
-   test_result.test_eq("End certificate signature algorithm", Botan::OIDS::oid2str_or_throw(end_cert_emsa4.signature_algorithm().get_oid()), "RSA/EMSA4");
+   test_result.test_eq("End certificate signature algorithm", Botan::OIDS::oid2str_or_throw(end_cert_emsa4.signature_algorithm().oid()), "RSA/EMSA4");
 
    // Check CRL signature algorithm
    Botan::X509_CRL crl = ca_exp.new_crl(Test::rng());
-   test_result.test_eq("CRL signature algorithm", Botan::OIDS::oid2str_or_throw(crl.signature_algorithm().get_oid()), "RSA/EMSA4");
+   test_result.test_eq("CRL signature algorithm", Botan::OIDS::oid2str_or_throw(crl.signature_algorithm().oid()), "RSA/EMSA4");
 
    // sanity check for verification, the heavy lifting is done in the other unit tests
    const Botan::Certificate_Store_In_Memory trusted(ca_exp.ca_certificate());