Mercurial > projects > dcrypt
diff dcrypt/crypto/params/SymmetricKey.d @ 0:0e08791a1418
Initial import.
author | Thomas Dixon <reikon@reikon.us> |
---|---|
date | Sun, 10 Aug 2008 14:20:17 -0400 |
parents | |
children | 5ce3012f1def |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dcrypt/crypto/params/SymmetricKey.d Sun Aug 10 14:20:17 2008 -0400 @@ -0,0 +1,43 @@ +/** + * This file is part of the dcrypt project. + * + * Copyright: Copyright (C) dcrypt contributors 2008. All rights reserved. + * License: MIT + * Authors: Thomas Dixon + */ + +module dcrypt.crypto.params.SymmetricKey; + +import dcrypt.crypto.params.CipherParameters; + +/** Object representing and wrapping a symmetric key in bytes. */ +class SymmetricKey : CipherParameters { + private ubyte[] m_key; + + /** + * Params: + * key = Key to be held. + */ + this(void[] key_=null) { + ubyte[] key = cast(ubyte[]) key_; + if (key) + m_key = key; + } + + /** Returns: Key in ubytes held by this object. */ + ubyte[] key() { + return m_key; + } + + /** + * Set the key held by this object. + * + * Params: + * newKey = New key to be held. + * Returns: The new key. + */ + ubyte[] key(void[] newKey_) { + ubyte[] newKey = cast(ubyte[])newKey_; + return m_key = newKey; + } +}