diff options
| author | Carl Hetherington <cth@carlh.net> | 2019-04-08 20:37:26 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2019-04-08 20:37:26 +0100 |
| commit | b785a1a76e0863fc98d0acc98a098d328929d493 (patch) | |
| tree | 745ec26047135ee65f69838076f78985ce196af3 /src/key.h | |
| parent | 09af1b3914a63b05a015f95a580557184ae0231c (diff) | |
Make Key support any length.
Diffstat (limited to 'src/key.h')
| -rw-r--r-- | src/key.h | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -38,6 +38,7 @@ #ifndef LIBDCP_KEY_H #define LIBDCP_KEY_H +#include <asdcp/AS_DCP.h> #include <stdint.h> #include <string> @@ -50,10 +51,10 @@ class Key { public: /** Create a new, random key */ - Key (); + Key (int length = ASDCP::KeyLen); /** Create a Key from a raw key value */ - explicit Key (uint8_t const *); + explicit Key (uint8_t const *, int length = ASDCP::KeyLen); /** Create a Key from a hex key value */ explicit Key (std::string); @@ -68,12 +69,17 @@ public: return _value; } + int length () const { + return _length; + } + /** @return Key value as a hexadecimal string */ std::string hex () const; private: /** Raw key value */ uint8_t* _value; + int _length; }; extern bool operator== (Key const & a, Key const & b); |
