diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-09-19 20:44:42 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-09-19 20:44:42 +0100 |
| commit | 8d6c3c9ae554430582dcb016897e87f6d04d5d78 (patch) | |
| tree | 5b329eeb60fe7372cc89740d4cf8fa1d5fe51614 /src/key.h | |
| parent | 827901db3d834465b1121c9f8041b9faf4923ec9 (diff) | |
Various encryption-related stuff.
Diffstat (limited to 'src/key.h')
| -rw-r--r-- | src/key.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/key.h b/src/key.h new file mode 100644 index 00000000..fbadfd33 --- /dev/null +++ b/src/key.h @@ -0,0 +1,61 @@ +/* + Copyright (C) 2013 Carl Hetherington <cth@carlh.net> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef LIBDCP_KEY_H +#define LIBDCP_KEY_H + +#include <stdint.h> + +namespace libdcp { + +/** A key for encrypting MXFs */ +class Key +{ +public: + /** Create a new, random key */ + Key (); + + /** Create a Key from a raw key value */ + Key (uint8_t const *); + + /** Create a Key from a hex key value */ + Key (std::string); + + Key (Key const &); + ~Key (); + + Key& operator= (Key const &); + + uint8_t* value () const { + return _value; + } + + std::string hex () const; + +private: + /** Raw key value */ + uint8_t* _value; +}; + +extern bool operator== (Key const & a, Key const & b); +extern bool operator!= (Key const & a, Key const & b); + +} + +#endif |
