Skip to content

Commit

Permalink
Merge pull request #40 from msheby/expose-mic-key
Browse files Browse the repository at this point in the history
add API call to expose the MIC key from an encrypted MXF
  • Loading branch information
jhursty authored Sep 8, 2020
2 parents 193f45b + a4985b6 commit d417531
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/AS_DCP.h
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,11 @@ namespace ASDCP {
// point to a readable area of memory that is at least HMAC_SIZE bytes in length.
// Returns error if the buf argument is NULL or if the values do ot match.
Result_t TestHMACValue(const byte_t* buf) const;

// Writes MIC key to given buffer. buf must point to a writable area of
// memory that is at least KeyLen bytes in length. Returns error if the
// buf argument is NULL.
Result_t GetMICKey(byte_t* buf) const;
};

//---------------------------------------------------------------------------------
Expand Down
21 changes: 21 additions & 0 deletions src/AS_DCP_AES.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,13 @@ class HMACContext::h__HMACContext
SHA1_Final(m_SHAValue, &SHA);
m_Final = true;
}

//
void
GetMICKey(byte_t* buf) const
{
memcpy(buf, m_key, KeyLen);
}
};


Expand Down Expand Up @@ -444,6 +451,20 @@ HMACContext::TestHMACValue(const byte_t* buf) const
}


//
Result_t
HMACContext::GetMICKey(byte_t* buf) const
{
KM_TEST_NULL_L(buf);

if ( m_Context.empty() )
return RESULT_INIT;

m_Context->GetMICKey(buf);
return RESULT_OK;
}



//
// end AS_DCP_AES.cpp
Expand Down

0 comments on commit d417531

Please sign in to comment.