42 #include <asdcp/AS_DCP.h>
43 #include <asdcp/KM_prng.h>
44 #include <asdcp/KM_util.h>
56 : _value (new uint8_t[length])
60 rng.FillRandom (
_value, _length);
65 : _value (new uint8_t[length])
73 : _value (new uint8_t[value.length() / 2])
74 , _length (value.length() / 2)
76 unsigned int length_done;
77 Kumu::hex2bin (
value.c_str(),
_value, _length, &length_done);
82 : _value (new uint8_t[other._length])
83 , _length (other._length)
96 Key::operator= (
Key const & other)
102 _length = other._length;
111 char buffer[_length * 2 + 1];
114 for (
int i = 0; i < _length; ++i) {
115 #ifdef LIBDCP_WINDOWS
116 __mingw_snprintf (p, 3,
"%02hhx",
_value[i]);
118 snprintf (p, 3,
"%02hhx",
_value[i]);
128 dcp::operator== (
Key const & a,
Key const & b)
130 return a.length() == b.length() && memcmp(a.
value(), b.
value(), a.length()) == 0;
135 dcp::operator!= (
Key const & a,
Key const & b)
A key for decrypting/encrypting assets.
Key(int length=ASDCP::KeyLen)
uint8_t const * value() const
Namespace for everything in libdcp.