40 #ifndef LIBDCP_CRYPTO_CONTEXT_H
41 #define LIBDCP_CRYPTO_CONTEXT_H
47 #include <asdcp/AS_DCP.h>
48 #include <asdcp/KM_prng.h>
49 #include <boost/optional.hpp>
68 if (ASDCP_FAILURE (_context->InitKey(key->value()))) {
69 throw MiscError (
"could not set up crypto context");
72 uint8_t cbc_buffer[ASDCP::CBC_BLOCK_SIZE];
75 if (ASDCP_FAILURE (_context->SetIVec (rng.FillRandom (cbc_buffer, ASDCP::CBC_BLOCK_SIZE)))) {
76 throw MiscError (
"could not set up CBC initialization vector");
79 _hmac =
new ASDCP::HMACContext;
81 ASDCP::LabelSet_t type;
82 if (standard == Standard::INTEROP) {
83 type = ASDCP::LS_MXF_INTEROP;
85 type = ASDCP::LS_MXF_SMPTE;
88 if (ASDCP_FAILURE (_hmac->InitKey(key->value(), type))) {
89 throw MiscError (
"could not set up HMAC context");
103 ASDCP::HMACContext* hmac ()
const {
109 ASDCP::HMACContext* _hmac;
A miscellaneous exception.
Exceptions thrown by libdcp.
Namespace for everything in libdcp.