omadrm/drmengine/roap/src/MeteringReportReq.cpp
changeset 23 493788a4a8a4
parent 0 95b198f216e5
equal deleted inserted replaced
5:79d62d1d7957 23:493788a4a8a4
    17 
    17 
    18 
    18 
    19 
    19 
    20 // INCLUDE FILES
    20 // INCLUDE FILES
    21 #include <e32std.h>
    21 #include <e32std.h>
    22 #include "base64.h"
    22 #include "Base64.h"
    23 #include "MeteringReportReq.h"
    23 #include "MeteringReportReq.h"
    24 #include "RoapLog.h"
    24 #include "RoapLog.h"
    25 
    25 
    26 using namespace Roap;
    26 using namespace Roap;
    27 
    27 
    64 
    64 
    65 _LIT8(KReqEncKeyInfoStart, "<ds:KeyInfo xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">");
    65 _LIT8(KReqEncKeyInfoStart, "<ds:KeyInfo xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">");
    66 
    66 
    67 // Note the two versions below are because of different namespace
    67 // Note the two versions below are because of different namespace
    68 // normalisation of element roap:X509SPKIHash on canonicalisation of
    68 // normalisation of element roap:X509SPKIHash on canonicalisation of
    69 // whole request to be signed and on canonicalisation of element 
    69 // whole request to be signed and on canonicalisation of element
    70 // <meteringReport> to be MAC calculated.
    70 // <meteringReport> to be MAC calculated.
    71 // when changing one of these another one must be cahnges too.
    71 // when changing one of these another one must be cahnges too.
    72 //
    72 //
    73 // This version is used when canonicalisation is performed over
    73 // This version is used when canonicalisation is performed over
    74 // <roap:meteringReportSubmit>
    74 // <roap:meteringReportSubmit>
   101 // ============================ LOCAL FUNCTIONS ===============================
   101 // ============================ LOCAL FUNCTIONS ===============================
   102 
   102 
   103 // ----------------------------------------------------------------------------
   103 // ----------------------------------------------------------------------------
   104 // MeteringReportElementAsTextL
   104 // MeteringReportElementAsTextL
   105 //
   105 //
   106 // write content of to given flat buffer 
   106 // write content of to given flat buffer
   107 // Used from MessageAsXmlL and from InsertMacL
   107 // Used from MessageAsXmlL and from InsertMacL
   108 // Note content depends on value of 
   108 // Note content depends on value of
   109 // ----------------------------------------------------------------------------
   109 // ----------------------------------------------------------------------------
   110 LOCAL_C inline void MeteringReportElementAsTextL(
   110 LOCAL_C inline void MeteringReportElementAsTextL(
   111     CBufFlat*& aBuf,
   111     CBufFlat*& aBuf,
   112     const Roap::CMeteringReportReq& aReq
   112     const Roap::CMeteringReportReq& aReq
   113     )
   113     )
   151         // so namespace ROAP already defined in container element
   151         // so namespace ROAP already defined in container element
   152         Roap::CRoapMessage::BufAppendL( aBuf, KReqRoapX509AndHash );
   152         Roap::CRoapMessage::BufAppendL( aBuf, KReqRoapX509AndHash );
   153         }
   153         }
   154     else
   154     else
   155         {
   155         {
   156         // used in mac calculation 
   156         // used in mac calculation
   157         // canonical form requires namespace definition for namespace roap
   157         // canonical form requires namespace definition for namespace roap
   158         Roap::CRoapMessage::BufAppendL( aBuf, KReqRoapX509AndHashNs );
   158         Roap::CRoapMessage::BufAppendL( aBuf, KReqRoapX509AndHashNs );
   159         }
   159         }
   160 
   160 
   161     // Insert 128-bit encrypted encryption key PKI hash
   161     // Insert 128-bit encrypted encryption key PKI hash
   165     Roap::CRoapMessage::BufAppendL( aBuf, KReqEncKeyInfoEnd );
   165     Roap::CRoapMessage::BufAppendL( aBuf, KReqEncKeyInfoEnd );
   166 
   166 
   167     // key wrapping info
   167     // key wrapping info
   168     Roap::CRoapMessage::BufAppendBase64L( aBuf, *aReq.iEncryptedMekAndMak );
   168     Roap::CRoapMessage::BufAppendBase64L( aBuf, *aReq.iEncryptedMekAndMak );
   169 
   169 
   170     Roap::CRoapMessage::BufAppendL( aBuf, KReqCipherValueEnd );    
   170     Roap::CRoapMessage::BufAppendL( aBuf, KReqCipherValueEnd );
   171 
   171 
   172     // Insert 128-bit encrypted MAC value
   172     // Insert 128-bit encrypted MAC value
   173     if ( aReq.iMac )
   173     if ( aReq.iMac )
   174         {
   174         {
   175         Roap::CRoapMessage::BufAppendL( aBuf, KReqMacStart );
   175         Roap::CRoapMessage::BufAppendL( aBuf, KReqMacStart );