00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "CODEX_Exceptions/BignumExceptions.h"
00019 #include "Message.h"
00020
00021 using namespace CODEX_APSS;
00022
00023 BIGNUM *
00024 Message::digest( const CODEX_Ciphers::HashFunction& hf ) const
00025 {
00026 unsigned char* buff = NULL;
00027 BIGNUM * retVal = NULL;
00028 CODEX_ASN1::ustring* str = NULL;
00029
00030 try
00031 {
00032 int length = marshal(0);
00033 buff = new unsigned char[ length ];
00034 unsigned char* pBuff = buff;
00035 marshal(&pBuff);
00036 str = hf( CODEX_ASN1::ustring( buff, length ) );
00037 delete [] buff;
00038 buff = NULL;
00039 retVal = BN_new();
00040 if ( NULL == retVal )
00041 {
00042 throw CODEX_Exceptions::BignumNullException( __FILE__ , __LINE__ );
00043 }
00044 if ( NULL == BN_bin2bn( str->data(), str->length(), retVal ) )
00045 {
00046 throw CODEX_Exceptions::BignumBin2BNException( __FILE__ , __LINE__ );
00047 }
00048 delete str;
00049
00050 return retVal;
00051 }
00052 catch ( ... )
00053 {
00054 if ( NULL != buff ) delete buff;
00055 if ( NULL != str ) delete str;
00056 if ( NULL != retVal ) BN_free( retVal );
00057 throw;
00058 }
00059 }
00060
00061 template SignedInitMsg;
00062 template SignedEstablishMsg;
00063 template SignedEstablishedMsg;
00064 template SignedContributeMsg;
00065 template SignedComputeMsg;
00066 template SignedComputedMsg;
00067 template SignedFinishedMsg;
00068 template SignedRecoverMsg;
00069 template SignedRecoveredMsg;