summaryrefslogtreecommitdiff
path: root/src/key.h
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2019-04-08 20:37:26 +0100
committerCarl Hetherington <cth@carlh.net>2019-04-08 20:37:26 +0100
commitb785a1a76e0863fc98d0acc98a098d328929d493 (patch)
tree745ec26047135ee65f69838076f78985ce196af3 /src/key.h
parent09af1b3914a63b05a015f95a580557184ae0231c (diff)
Make Key support any length.
Diffstat (limited to 'src/key.h')
-rw-r--r--src/key.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/key.h b/src/key.h
index c1402c54..0464296f 100644
--- a/src/key.h
+++ b/src/key.h
@@ -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);