Coverage Report

Created: 2020-06-30 13:58

/src/botan/build/include/botan/alg_id.h
Line
Count
Source
1
/*
2
* Algorithm Identifier
3
* (C) 1999-2007 Jack Lloyd
4
*
5
* Botan is released under the Simplified BSD License (see license.txt)
6
*/
7
8
#ifndef BOTAN_ALGORITHM_IDENTIFIER_H_
9
#define BOTAN_ALGORITHM_IDENTIFIER_H_
10
11
#include <botan/asn1_obj.h>
12
#include <botan/asn1_oid.h>
13
#include <string>
14
#include <vector>
15
16
namespace Botan {
17
18
/**
19
* Algorithm Identifier
20
*/
21
class BOTAN_PUBLIC_API(2,0) AlgorithmIdentifier final : public ASN1_Object
22
   {
23
   public:
24
      enum Encoding_Option { USE_NULL_PARAM, USE_EMPTY_PARAM };
25
26
      void encode_into(class DER_Encoder&) const override;
27
      void decode_from(class BER_Decoder&) override;
28
29
84.7k
      AlgorithmIdentifier() = default;
30
31
      AlgorithmIdentifier(const OID& oid, Encoding_Option enc);
32
      AlgorithmIdentifier(const std::string& oid_name, Encoding_Option enc);
33
34
      AlgorithmIdentifier(const OID& oid, const std::vector<uint8_t>& params);
35
      AlgorithmIdentifier(const std::string& oid_name, const std::vector<uint8_t>& params);
36
37
97.9k
      const OID& get_oid() const { return oid; }
38
17.7k
      const std::vector<uint8_t>& get_parameters() const { return parameters; }
39
40
      bool parameters_are_null() const;
41
50.9k
      bool parameters_are_empty() const { return parameters.empty(); }
42
43
      bool parameters_are_null_or_empty() const
44
50.9k
         {
45
50.9k
         return parameters_are_empty() || parameters_are_null();
46
50.9k
         }
47
48
   BOTAN_DEPRECATED_PUBLIC_MEMBER_VARIABLES:
49
      /*
50
      * These values are public for historical reasons, but in a future release
51
      * they will be made private. Do not access them.
52
      */
53
      OID oid;
54
      std::vector<uint8_t> parameters;
55
   };
56
57
/*
58
* Comparison Operations
59
*/
60
bool BOTAN_PUBLIC_API(2,0) operator==(const AlgorithmIdentifier&,
61
                                      const AlgorithmIdentifier&);
62
bool BOTAN_PUBLIC_API(2,0) operator!=(const AlgorithmIdentifier&,
63
                                      const AlgorithmIdentifier&);
64
65
}
66
67
#endif