aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/cert/cvc/cvc_ado.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2014-01-10 03:41:59 +0000
committerlloyd <[email protected]>2014-01-10 03:41:59 +0000
commit6894dca64c04936d07048c0e8cbf7e25858548c3 (patch)
tree5d572bfde9fe667dab14e3f04b5285a85d8acd95 /src/lib/cert/cvc/cvc_ado.h
parent9efa3be92442afb3d0b69890a36c7f122df18eda (diff)
Move lib into src
Diffstat (limited to 'src/lib/cert/cvc/cvc_ado.h')
-rw-r--r--src/lib/cert/cvc/cvc_ado.h98
1 files changed, 98 insertions, 0 deletions
diff --git a/src/lib/cert/cvc/cvc_ado.h b/src/lib/cert/cvc/cvc_ado.h
new file mode 100644
index 000000000..6f5b1d527
--- /dev/null
+++ b/src/lib/cert/cvc/cvc_ado.h
@@ -0,0 +1,98 @@
+/*
+* EAC1_1 CVC ADO
+* (C) 2008 Falko Strenzke
+*
+* Distributed under the terms of the Botan license
+*/
+
+#ifndef BOTAN_EAC_CVC_ADO_H__
+#define BOTAN_EAC_CVC_ADO_H__
+
+#include <botan/eac_obj.h>
+#include <botan/eac_asn_obj.h>
+#include <botan/cvc_req.h>
+#include <string>
+
+namespace Botan {
+
+/**
+* This class represents a TR03110 (EAC) v1.1 CVC ADO request
+*/
+
+ // CRTP continuation from EAC1_1_obj
+class BOTAN_DLL EAC1_1_ADO : public EAC1_1_obj<EAC1_1_ADO>
+ {
+ public:
+ friend class EAC1_1_obj<EAC1_1_ADO>;
+
+ /**
+ * Construct a CVC ADO request from a DER encoded CVC ADO request file.
+ * @param str the path to the DER encoded file
+ */
+ EAC1_1_ADO(const std::string& str);
+
+ /**
+ * Construct a CVC ADO request from a data source
+ * @param source the data source
+ */
+ EAC1_1_ADO(DataSource& source);
+
+ /**
+ * Create a signed CVC ADO request from to be signed (TBS) data
+ * @param signer the signer used to sign the CVC ADO request
+ * @param tbs_bits the TBS data to sign
+ * @param rng a random number generator
+ */
+ static std::vector<byte> make_signed(
+ PK_Signer& signer,
+ const std::vector<byte>& tbs_bits,
+ RandomNumberGenerator& rng);
+
+ /**
+ * Get the CAR of this CVC ADO request
+ * @result the CAR of this CVC ADO request
+ */
+ ASN1_Car get_car() const;
+
+ /**
+ * Get the CVC request contained in this object.
+ * @result the CVC request inside this CVC ADO request
+ */
+ EAC1_1_Req get_request() const;
+
+ /**
+ * Encode this object into a pipe. Only DER is supported.
+ * @param out the pipe to encode this object into
+ * @param encoding the encoding type to use, must be DER
+ */
+ void encode(Pipe& out, X509_Encoding encoding) const;
+
+ bool operator==(EAC1_1_ADO const& rhs) const;
+
+ /**
+ * Get the TBS data of this CVC ADO request.
+ * @result the TBS data
+ */
+ std::vector<byte> tbs_data() const;
+
+ virtual ~EAC1_1_ADO() {}
+ private:
+ ASN1_Car m_car;
+ EAC1_1_Req m_req;
+
+ void force_decode();
+ static void decode_info(DataSource& source,
+ std::vector<byte> & res_tbs_bits,
+ ECDSA_Signature & res_sig);
+ };
+
+inline bool operator!=(EAC1_1_ADO const& lhs, EAC1_1_ADO const& rhs)
+ {
+ return (!(lhs == rhs));
+ }
+
+}
+
+#endif
+
+