From b43cc46149b6d653fb403b2f4c6b28483b6b975a Mon Sep 17 00:00:00 2001 From: lloyd Date: Tue, 2 Mar 2010 19:23:27 +0000 Subject: CVC assumed sigs were DER encoded by default. Not true --- src/cert/cvc/cvc_ado.cpp | 3 +-- src/cert/cvc/cvc_gen_cert.h | 3 +-- src/cert/cvc/eac_obj.h | 18 ++---------------- src/cert/cvc/signed_obj.cpp | 8 +++----- 4 files changed, 7 insertions(+), 25 deletions(-) (limited to 'src/cert') diff --git a/src/cert/cvc/cvc_ado.cpp b/src/cert/cvc/cvc_ado.cpp index 5ff27020d..8c38e90ae 100644 --- a/src/cert/cvc/cvc_ado.cpp +++ b/src/cert/cvc/cvc_ado.cpp @@ -49,8 +49,7 @@ MemoryVector EAC1_1_ADO::make_signed(PK_Signer& signer, const MemoryRegion& tbs_bits, RandomNumberGenerator& rng) { - SecureVector concat_sig = - EAC1_1_obj::make_signature(signer, tbs_bits, rng); + SecureVector concat_sig = signer.sign_message(tbs_bits, rng); return DER_Encoder() .start_cons(ASN1_Tag(7), APPLICATION) diff --git a/src/cert/cvc/cvc_gen_cert.h b/src/cert/cvc/cvc_gen_cert.h index 4e3f3013e..8140cb050 100644 --- a/src/cert/cvc/cvc_gen_cert.h +++ b/src/cert/cvc/cvc_gen_cert.h @@ -106,8 +106,7 @@ MemoryVector EAC1_1_gen_CVC::make_signed( const MemoryRegion& tbs_bits, RandomNumberGenerator& rng) // static { - SecureVector concat_sig = - EAC1_1_obj::make_signature(signer, tbs_bits, rng); + SecureVector concat_sig = signer.sign_message(tbs_bits, rng); return DER_Encoder() .start_cons(ASN1_Tag(33), APPLICATION) diff --git a/src/cert/cvc/eac_obj.h b/src/cert/cvc/eac_obj.h index 82aaee787..d4f02c530 100644 --- a/src/cert/cvc/eac_obj.h +++ b/src/cert/cvc/eac_obj.h @@ -46,30 +46,16 @@ class BOTAN_DLL EAC1_1_obj : public EAC_Signed_Object protected: void init(DataSource& in); - static SecureVector - make_signature(PK_Signer& signer, - const MemoryRegion& tbs_bits, - RandomNumberGenerator& rng); - virtual ~EAC1_1_obj(){} }; -template SecureVector EAC1_1_obj::get_concat_sig() const +template +SecureVector EAC1_1_obj::get_concat_sig() const { return m_sig.get_concatenation(); } -template SecureVector -EAC1_1_obj::make_signature(PK_Signer& signer, - const MemoryRegion& tbs_bits, - RandomNumberGenerator& rng) - { - // this is the signature as a der sequence - ECDSA_Signature sig(signer.sign_message(tbs_bits, rng)); - return sig.get_concatenation(); - } - template void EAC1_1_obj::init(DataSource& in) { diff --git a/src/cert/cvc/signed_obj.cpp b/src/cert/cvc/signed_obj.cpp index 4a08ed0ac..022d0fa5f 100644 --- a/src/cert/cvc/signed_obj.cpp +++ b/src/cert/cvc/signed_obj.cpp @@ -1,5 +1,5 @@ /* -* X.509 SIGNED Object +* EAC SIGNED Object * (C) 1999-2007 Jack Lloyd * 2007 FlexSecure GmbH * @@ -53,14 +53,12 @@ void EAC_Signed_Object::do_decode() catch(Decoding_Error& e) { const std::string what = e.what(); - throw Decoding_Error(PEM_label_pref + " decoding failed (" + - what.substr(23, std::string::npos) + ")"); + throw Decoding_Error(PEM_label_pref + " decoding failed (" + what + ")"); } catch(Invalid_Argument& e) { const std::string what = e.what(); - throw Decoding_Error(PEM_label_pref + " decoding failed (" + - what.substr(7, std::string::npos) + ")"); + throw Decoding_Error(PEM_label_pref + " decoding failed (" + what + ")"); } } -- cgit v1.2.3