From 2b9da25f8e1d0d5df5f4e2fb05beba519bb6949f Mon Sep 17 00:00:00 2001 From: lloyd Date: Mon, 13 Oct 2008 18:53:45 +0000 Subject: Doxygen comments and reformatting in CVC code --- src/cert/cvc/cvc_ado.h | 9 ++- src/cert/cvc/cvc_cert.h | 134 +++++++++++++++++++++----------------------- src/cert/cvc/cvc_gen_cert.h | 32 +++++++---- src/cert/cvc/cvc_self.h | 8 +-- 4 files changed, 95 insertions(+), 88 deletions(-) (limited to 'src') 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 { - friend class EAC1_1_obj; public: + friend class EAC1_1_obj; + /** * 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 std::auto_ptr signer, const MemoryRegion& 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 * @result the TBS data */ SecureVector 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 * -* strenzke@flexsecure.de * +* 2008 Jack Lloyd * *************************************************/ #ifndef BOTAN_CVC_EAC_H__ @@ -10,87 +10,81 @@ #include #include #include -#include #include #include #include #include #include -namespace Botan - { +#include +namespace Botan { - /** - * This class represents TR03110 (EAC) v1.1 CV Certificates - */ - class EAC1_1_CVC : public EAC1_1_gen_CVC//Signed_Object +/** +* This class represents TR03110 (EAC) v1.1 CV Certificates +*/ +class BOTAN_DLL EAC1_1_CVC : public EAC1_1_gen_CVC//Signed_Object { - friend class EAC1_1_obj; - 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& 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; + + /** + * 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& 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 * -* strenzke@flexsecure.de * +* 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 #include #include -#include #include #include +#include #include namespace Botan { @@ -24,12 +24,7 @@ template class BOTAN_DLL EAC1_1_gen_CVC : public EAC1_1_obj // CRTP continuation from EAC1_1_obj { friend class EAC1_1_obj; - protected: - ECDSA_PublicKey m_pk; // public key - ASN1_Chr m_chr; - bool self_signed; - static void decode_info(SharedPtrConverter source, SecureVector & res_tbs_bits, ECDSA_Signature & res_sig); public: /** @@ -84,16 +79,27 @@ class BOTAN_DLL EAC1_1_gen_CVC : public EAC1_1_obj // CRTP continuation virtual ~EAC1_1_gen_CVC() {} - } - ; + protected: + ECDSA_PublicKey m_pk; // public key + ASN1_Chr m_chr; + bool self_signed; + + static void decode_info(SharedPtrConverter source, + SecureVector & res_tbs_bits, + ECDSA_Signature & res_sig); + + }; + template ASN1_Chr EAC1_1_gen_CVC::get_chr() const { return m_chr; } + template bool EAC1_1_gen_CVC::is_self_signed() const { return self_signed; } + template MemoryVector EAC1_1_gen_CVC::make_signed( std::auto_ptr signer, const MemoryRegion& tbs_bits, @@ -108,10 +114,12 @@ template MemoryVector EAC1_1_gen_CVC::make_sign .end_cons() .get_contents(); } + template std::auto_ptr EAC1_1_gen_CVC::subject_public_key() const { return std::auto_ptr(new ECDSA_PublicKey(m_pk)); } + template SecureVector EAC1_1_gen_CVC::build_cert_body(MemoryRegion const& tbs) { return DER_Encoder() @@ -119,10 +127,12 @@ template SecureVector EAC1_1_gen_CVC::build_cer .raw_bytes(tbs) .end_cons().get_contents(); } + template SecureVector EAC1_1_gen_CVC::tbs_data() const { return build_cert_body(EAC1_1_obj::tbs_bits); } + template void EAC1_1_gen_CVC::encode(Pipe& out, X509_Encoding encoding) const { SecureVector concat_sig(EAC1_1_obj::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 -- cgit v1.2.3