Botan
1.11.15
|
00001 /* 00002 * EAC1_1 CVC 00003 * (C) 2008 Falko Strenzke 00004 * 2008 Jack Lloyd 00005 * 00006 * Botan is released under the Simplified BSD License (see license.txt) 00007 */ 00008 00009 #ifndef BOTAN_CVC_EAC_H__ 00010 #define BOTAN_CVC_EAC_H__ 00011 00012 #include <botan/cvc_gen_cert.h> 00013 #include <botan/ecdsa.h> 00014 #include <string> 00015 00016 namespace Botan { 00017 00018 /** 00019 * This class represents TR03110 (EAC) v1.1 CV Certificates 00020 */ 00021 class BOTAN_DLL EAC1_1_CVC : public EAC1_1_gen_CVC<EAC1_1_CVC>//Signed_Object 00022 { 00023 public: 00024 friend class EAC1_1_obj<EAC1_1_CVC>; 00025 00026 /** 00027 * Get the CAR of the certificate. 00028 * @result the CAR of the certificate 00029 */ 00030 ASN1_Car get_car() const; 00031 00032 /** 00033 * Get the CED of this certificate. 00034 * @result the CED this certificate 00035 */ 00036 ASN1_Ced get_ced() const; 00037 00038 /** 00039 * Get the CEX of this certificate. 00040 * @result the CEX this certificate 00041 */ 00042 ASN1_Cex get_cex() const; 00043 00044 /** 00045 * Get the CHAT value. 00046 * @result the CHAT value 00047 */ 00048 u32bit get_chat_value() const; 00049 00050 bool operator==(const EAC1_1_CVC&) const; 00051 00052 /** 00053 * Construct a CVC from a data source 00054 * @param source the data source 00055 */ 00056 EAC1_1_CVC(DataSource& source); 00057 00058 /** 00059 * Construct a CVC from a file 00060 * @param str the path to the certificate file 00061 */ 00062 EAC1_1_CVC(const std::string& str); 00063 00064 virtual ~EAC1_1_CVC() {} 00065 private: 00066 void force_decode(); 00067 EAC1_1_CVC() {} 00068 00069 ASN1_Car m_car; 00070 ASN1_Ced m_ced; 00071 ASN1_Cex m_cex; 00072 byte m_chat_val; 00073 OID m_chat_oid; 00074 }; 00075 00076 /* 00077 * Comparison 00078 */ 00079 inline bool operator!=(EAC1_1_CVC const& lhs, EAC1_1_CVC const& rhs) 00080 { 00081 return !(lhs == rhs); 00082 } 00083 00084 /** 00085 * Create an arbitrary EAC 1.1 CVC. 00086 * The desired key encoding must be set within the key (if applicable). 00087 * @param signer the signer used to sign the certificate 00088 * @param public_key the DER encoded public key to appear in 00089 * the certificate 00090 * @param car the CAR of the certificate 00091 * @param chr the CHR of the certificate 00092 * @param holder_auth_templ the holder authorization value byte to 00093 * appear in the CHAT of the certificate 00094 * @param ced the CED to appear in the certificate 00095 * @param cex the CEX to appear in the certificate 00096 * @param rng a random number generator 00097 */ 00098 EAC1_1_CVC BOTAN_DLL make_cvc_cert(PK_Signer& signer, 00099 const std::vector<byte>& public_key, 00100 ASN1_Car const& car, 00101 ASN1_Chr const& chr, 00102 byte holder_auth_templ, 00103 ASN1_Ced ced, 00104 ASN1_Cex cex, 00105 RandomNumberGenerator& rng); 00106 00107 /** 00108 * Decode an EAC encoding ECDSA key 00109 */ 00110 BOTAN_DLL ECDSA_PublicKey* decode_eac1_1_key(const std::vector<byte>& enc_key, 00111 AlgorithmIdentifier& sig_algo); 00112 00113 } 00114 00115 #endif 00116