aboutsummaryrefslogtreecommitdiffstats
path: root/src/cert
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-10-13 18:53:45 +0000
committerlloyd <[email protected]>2008-10-13 18:53:45 +0000
commit2b9da25f8e1d0d5df5f4e2fb05beba519bb6949f (patch)
tree6a488dcf624adab887901c6082367c9b399d938c /src/cert
parent15f33368219371fc3430d77bd3a58ac83ab79ce2 (diff)
Doxygen comments and reformatting in CVC code
Diffstat (limited to 'src/cert')
-rw-r--r--src/cert/cvc/cvc_ado.h9
-rw-r--r--src/cert/cvc/cvc_cert.h134
-rw-r--r--src/cert/cvc/cvc_gen_cert.h32
-rw-r--r--src/cert/cvc/cvc_self.h8
4 files changed, 95 insertions, 88 deletions
diff --git a/src/cert/cvc/cvc_ado.h b/src/cert/cvc/cvc_ado.h
index f6e9de9ea..adfdb4ecb 100644
--- a/src/cert/cvc/cvc_ado.h
+++ b/src/cert/cvc/cvc_ado.h
@@ -24,13 +24,15 @@ namespace Botan {
// CRTP continuation from EAC1_1_obj
class BOTAN_DLL EAC1_1_ADO : public EAC1_1_obj<EAC1_1_ADO>
{
- friend class 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
@@ -46,6 +48,7 @@ class BOTAN_DLL EAC1_1_ADO : public EAC1_1_obj<EAC1_1_ADO>
std::auto_ptr<PK_Signer> signer,
const MemoryRegion<byte>& tbs_bits,
RandomNumberGenerator& rng);
+
/**
* Get the CAR of this CVC ADO request
* @result the CAR of this CVC ADO request
@@ -72,8 +75,8 @@ class BOTAN_DLL EAC1_1_ADO : public EAC1_1_obj<EAC1_1_ADO>
* @result the TBS data
*/
SecureVector<byte> tbs_data() const;
- virtual ~EAC1_1_ADO()
- {}
+
+ virtual ~EAC1_1_ADO() {}
private:
ASN1_Car m_car;
EAC1_1_Req m_req;
diff --git a/src/cert/cvc/cvc_cert.h b/src/cert/cvc/cvc_cert.h
index 00bdd6679..65ee83d0e 100644
--- a/src/cert/cvc/cvc_cert.h
+++ b/src/cert/cvc/cvc_cert.h
@@ -1,7 +1,7 @@
/*************************************************
* EAC1_1 CVC Header File *
* (C) 2008 Falko Strenzke *
+* 2008 Jack Lloyd *
*************************************************/
#ifndef BOTAN_CVC_EAC_H__
@@ -10,87 +10,81 @@
#include <botan/x509_key.h>
#include <botan/enums.h>
#include <botan/signed_obj.h>
-#include <string>
#include <botan/pubkey.h>
#include <botan/ecdsa.h>
#include <botan/ecdsa_sig.h>
#include <botan/eac_obj.h>
#include <botan/cvc_gen_cert.h>
-namespace Botan
- {
+#include <string>
+namespace Botan {
- /**
- * This class represents TR03110 (EAC) v1.1 CV Certificates
- */
- class EAC1_1_CVC : public EAC1_1_gen_CVC<EAC1_1_CVC>//Signed_Object
+/**
+* This class represents TR03110 (EAC) v1.1 CV Certificates
+*/
+class BOTAN_DLL EAC1_1_CVC : public EAC1_1_gen_CVC<EAC1_1_CVC>//Signed_Object
{
- friend class EAC1_1_obj<EAC1_1_CVC>;
-
public:
-
- /**
- * Get the CAR of the certificate.
- * @result the CAR of the certificate
- */
- ASN1_Car get_car() const;
-
- /**
- * Get the CED of this certificate.
- * @result the CED this certificate
- */
- ASN1_Ced get_ced() const;
- /**
- * Get the CEX of this certificate.
- * @result the CEX this certificate
- */
- ASN1_Cex get_cex() const;
-
- /**
- * Get the CHAT value.
- * @result the CHAT value
- */
- u32bit get_chat_value() const;
-
- bool operator==(const EAC1_1_CVC&) const;
-
- /**
- * Construct a CVC from a data source
- * @param source the data source
- */
- EAC1_1_CVC(std::tr1::shared_ptr<DataSource>& source);
- /**
- * Construct a CVC from a file
- * @param str the path to the certificate file
- */
- EAC1_1_CVC(const std::string& str);
- virtual ~EAC1_1_CVC()
- {}
-
- protected:
-
+ friend class EAC1_1_obj<EAC1_1_CVC>;
+
+ /**
+ * Get the CAR of the certificate.
+ * @result the CAR of the certificate
+ */
+ ASN1_Car get_car() const;
+
+ /**
+ * Get the CED of this certificate.
+ * @result the CED this certificate
+ */
+ ASN1_Ced get_ced() const;
+
+ /**
+ * Get the CEX of this certificate.
+ * @result the CEX this certificate
+ */
+ ASN1_Cex get_cex() const;
+
+ /**
+ * Get the CHAT value.
+ * @result the CHAT value
+ */
+ u32bit get_chat_value() const;
+
+ bool operator==(const EAC1_1_CVC&) const;
+
+ /**
+ * Construct a CVC from a data source
+ * @param source the data source
+ */
+ EAC1_1_CVC(std::tr1::shared_ptr<DataSource>& source);
+
+ /**
+ * Construct a CVC from a file
+ * @param str the path to the certificate file
+ */
+ EAC1_1_CVC(const std::string& str);
+
+ virtual ~EAC1_1_CVC() {}
private:
- void force_decode();
- friend class EAC1_1_CVC_CA;
- EAC1_1_CVC()
- {}
- ASN1_Car m_car;
- ASN1_Ced m_ced;
- ASN1_Cex m_cex;
- byte m_chat_val;
- OID m_chat_oid;
-
-
+ void force_decode();
+ friend class EAC1_1_CVC_CA;
+ EAC1_1_CVC() {}
+
+ ASN1_Car m_car;
+ ASN1_Ced m_ced;
+ ASN1_Cex m_cex;
+ byte m_chat_val;
+ OID m_chat_oid;
};
- /*************************************************
- *Comparison *
- *************************************************/
- inline bool operator!=(EAC1_1_CVC const& lhs, EAC1_1_CVC const& rhs)
- {
- return !(lhs == rhs);
- }
-
+/*************************************************
+* Comparison *
+*************************************************/
+inline bool operator!=(EAC1_1_CVC const& lhs, EAC1_1_CVC const& rhs)
+ {
+ return !(lhs == rhs);
+ }
}
diff --git a/src/cert/cvc/cvc_gen_cert.h b/src/cert/cvc/cvc_gen_cert.h
index 6d333e56c..007c80e26 100644
--- a/src/cert/cvc/cvc_gen_cert.h
+++ b/src/cert/cvc/cvc_gen_cert.h
@@ -1,18 +1,18 @@
/*************************************************
* EAC1_1 general CVC Header File *
* (C) 2008 Falko Strenzke *
+* 2008 Jack Lloyd *
*************************************************/
-#ifndef BOTAN_EAC_CVC_GCERT_H__
-#define BOTAN_EAC_CVC_GCERT_H__
+#ifndef BOTAN_EAC_CVC_GEN_CERT_H__
+#define BOTAN_EAC_CVC_GEN_CERT_H__
#include <botan/x509_key.h>
#include <botan/eac_asn_obj.h>
#include <botan/enums.h>
-#include <string>
#include <botan/pubkey.h>
#include <botan/ecdsa_sig.h>
+#include <string>
#include <assert.h>
namespace Botan {
@@ -24,12 +24,7 @@ template<typename Derived>
class BOTAN_DLL EAC1_1_gen_CVC : public EAC1_1_obj<Derived> // CRTP continuation from EAC1_1_obj
{
friend class EAC1_1_obj<EAC1_1_gen_CVC>;
- protected:
- ECDSA_PublicKey m_pk; // public key
- ASN1_Chr m_chr;
- bool self_signed;
- static void decode_info(SharedPtrConverter<DataSource> source, SecureVector<byte> & res_tbs_bits, ECDSA_Signature & res_sig);
public:
/**
@@ -84,16 +79,27 @@ class BOTAN_DLL EAC1_1_gen_CVC : public EAC1_1_obj<Derived> // CRTP continuation
virtual ~EAC1_1_gen_CVC<Derived>()
{}
- }
- ;
+ protected:
+ ECDSA_PublicKey m_pk; // public key
+ ASN1_Chr m_chr;
+ bool self_signed;
+
+ static void decode_info(SharedPtrConverter<DataSource> source,
+ SecureVector<byte> & res_tbs_bits,
+ ECDSA_Signature & res_sig);
+
+ };
+
template<typename Derived> ASN1_Chr EAC1_1_gen_CVC<Derived>::get_chr() const
{
return m_chr;
}
+
template<typename Derived> bool EAC1_1_gen_CVC<Derived>::is_self_signed() const
{
return self_signed;
}
+
template<typename Derived> MemoryVector<byte> EAC1_1_gen_CVC<Derived>::make_signed(
std::auto_ptr<PK_Signer> signer,
const MemoryRegion<byte>& tbs_bits,
@@ -108,10 +114,12 @@ template<typename Derived> MemoryVector<byte> EAC1_1_gen_CVC<Derived>::make_sign
.end_cons()
.get_contents();
}
+
template<typename Derived> std::auto_ptr<Public_Key> EAC1_1_gen_CVC<Derived>::subject_public_key() const
{
return std::auto_ptr<Public_Key>(new ECDSA_PublicKey(m_pk));
}
+
template<typename Derived> SecureVector<byte> EAC1_1_gen_CVC<Derived>::build_cert_body(MemoryRegion<byte> const& tbs)
{
return DER_Encoder()
@@ -119,10 +127,12 @@ template<typename Derived> SecureVector<byte> EAC1_1_gen_CVC<Derived>::build_cer
.raw_bytes(tbs)
.end_cons().get_contents();
}
+
template<typename Derived> SecureVector<byte> EAC1_1_gen_CVC<Derived>::tbs_data() const
{
return build_cert_body(EAC1_1_obj<Derived>::tbs_bits);
}
+
template<typename Derived> void EAC1_1_gen_CVC<Derived>::encode(Pipe& out, X509_Encoding encoding) const
{
SecureVector<byte> concat_sig(EAC1_1_obj<Derived>::m_sig.get_concatenation());
diff --git a/src/cert/cvc/cvc_self.h b/src/cert/cvc/cvc_self.h
index 6b84e1f55..735301989 100644
--- a/src/cert/cvc/cvc_self.h
+++ b/src/cert/cvc/cvc_self.h
@@ -31,11 +31,11 @@ class BOTAN_DLL EAC1_1_CVC_Options
ASN1_Cex cex;
std::string hash_alg;
};
+
/**
* This namespace represents general EAC 1.1 convenience functions.
*/
-namespace CVC_EAC
-{
+namespace CVC_EAC {
/**
* Create a selfsigned CVCA
@@ -81,8 +81,8 @@ EAC1_1_ADO create_ado_req(Private_Key const& priv_key,
* This namespace represents EAC 1.1 CVC convenience functions following the specific german
* requirements.
*/
-namespace DE_EAC
-{
+namespace DE_EAC {
+
/**
* Create a CVCA certificate.
* @param priv_key the private key associated with the CVCA certificate