aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-05-17 16:35:57 +0000
committerlloyd <[email protected]>2012-05-17 16:35:57 +0000
commitc2d0d2982e96ab7ce15e90b8d73c9774e2650d86 (patch)
tree9842416de789a48af904810619f336a7996b33fd
parent28c64de10a4a6621e79879fe3047983bb8da9904 (diff)
Remove OctetString::change, only allow construction. Turns out nothing
was using this, so no other changes needed.
-rw-r--r--src/algo_base/symkey.cpp8
-rw-r--r--src/algo_base/symkey.h29
2 files changed, 11 insertions, 26 deletions
diff --git a/src/algo_base/symkey.cpp b/src/algo_base/symkey.cpp
index 56648d9c5..a84ce2f19 100644
--- a/src/algo_base/symkey.cpp
+++ b/src/algo_base/symkey.cpp
@@ -26,7 +26,7 @@ OctetString::OctetString(RandomNumberGenerator& rng,
/*
* Create an OctetString from a hex string
*/
-void OctetString::change(const std::string& hex_string)
+OctetString::OctetString(const std::string& hex_string)
{
bits.resize(1 + hex_string.length() / 2);
bits.resize(hex_decode(&bits[0], hex_string));
@@ -35,12 +35,16 @@ void OctetString::change(const std::string& hex_string)
/*
* Create an OctetString from a byte string
*/
-void OctetString::change(const byte in[], size_t n)
+OctetString::OctetString(const byte in[], size_t n)
{
bits.resize(n);
bits.copy(in, n);
}
+OctetString::OctetString(const MemoryRegion<byte>& b) : bits(b)
+ {
+ }
+
/*
* Set the parity of each key byte to odd
*/
diff --git a/src/algo_base/symkey.h b/src/algo_base/symkey.h
index 6735b2b87..2ccc0b883 100644
--- a/src/algo_base/symkey.h
+++ b/src/algo_base/symkey.h
@@ -57,23 +57,10 @@ class BOTAN_DLL OctetString
void set_odd_parity();
/**
- * Change the contents of this octet string
- * @param hex_string a hex encoded bytestring
- */
- void change(const std::string& hex_string);
-
- /**
- * Change the contents of this octet string
- * @param in the input
- * @param length of in in bytes
- */
- void change(const byte in[], size_t length);
-
- /**
- * Change the contents of this octet string
- * @param in the input
+ * Create a new OctetString
+ * @param str is a hex encoded string
*/
- void change(const MemoryRegion<byte>& in) { bits = in; }
+ OctetString(const std::string& str = "");
/**
* Create a new random OctetString
@@ -84,22 +71,16 @@ class BOTAN_DLL OctetString
/**
* Create a new OctetString
- * @param str is a hex encoded string
- */
- OctetString(const std::string& str = "") { change(str); }
-
- /**
- * Create a new OctetString
* @param in is an array
* @param len is the length of in in bytes
*/
- OctetString(const byte in[], size_t len) { change(in, len); }
+ OctetString(const byte in[], size_t len);
/**
* Create a new OctetString
* @param in a bytestring
*/
- OctetString(const MemoryRegion<byte>& in) { change(in); }
+ OctetString(const MemoryRegion<byte>& in);
private:
SecureVector<byte> bits;
};