aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-09-29 00:15:14 +0000
committerlloyd <[email protected]>2008-09-29 00:15:14 +0000
commit68d3d539ad7752dc80c20c1a2ade909b1a4c4a6e (patch)
treec7e588d28427960c95eca9900844d5bf36c079df /src/utils
parent8269e2897e0a652bbd949d38b74873976a98adeb (diff)
Move what is left of the uncategorized library to 'core'. There is still
a lot of public key stuff in here that needs to be extracted however, and probably 2-3 other modules worth of stuff to split off (engines, etc)
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/modinfo.txt2
-rw-r--r--src/utils/ui.cpp34
-rw-r--r--src/utils/ui.h34
3 files changed, 70 insertions, 0 deletions
diff --git a/src/utils/modinfo.txt b/src/utils/modinfo.txt
index ed4450ff9..538057fcf 100644
--- a/src/utils/modinfo.txt
+++ b/src/utils/modinfo.txt
@@ -21,4 +21,6 @@ types.h
util.h
version.h
xor_buf.h
+ui.h
+ui.cpp
</add>
diff --git a/src/utils/ui.cpp b/src/utils/ui.cpp
new file mode 100644
index 000000000..fb81ae23c
--- /dev/null
+++ b/src/utils/ui.cpp
@@ -0,0 +1,34 @@
+/*************************************************
+* User Interface Source File *
+* (C) 1999-2007 Jack Lloyd *
+*************************************************/
+
+#include <botan/ui.h>
+
+namespace Botan {
+
+/*************************************************
+* Get a passphrase from the user *
+*************************************************/
+std::string User_Interface::get_passphrase(const std::string&,
+ const std::string&,
+ UI_Result& action) const
+ {
+ action = OK;
+
+ if(!first_try)
+ action = CANCEL_ACTION;
+
+ return preset_passphrase;
+ }
+
+/*************************************************
+* User_Interface Constructor *
+*************************************************/
+User_Interface::User_Interface(const std::string& preset) :
+ preset_passphrase(preset)
+ {
+ first_try = true;
+ }
+
+}
diff --git a/src/utils/ui.h b/src/utils/ui.h
new file mode 100644
index 000000000..f66ac3e56
--- /dev/null
+++ b/src/utils/ui.h
@@ -0,0 +1,34 @@
+/*************************************************
+* User Interface Header File *
+* (C) 1999-2007 Jack Lloyd *
+*************************************************/
+
+#ifndef BOTAN_UI_H__
+#define BOTAN_UI_H__
+
+#include <botan/build.h>
+#include <string>
+
+namespace Botan {
+
+/*************************************************
+* User Interface *
+*************************************************/
+class BOTAN_DLL User_Interface
+ {
+ public:
+ enum UI_Result { OK, CANCEL_ACTION };
+
+ virtual std::string get_passphrase(const std::string&,
+ const std::string&,
+ UI_Result&) const;
+ User_Interface(const std::string& = "");
+ virtual ~User_Interface() {}
+ protected:
+ std::string preset_passphrase;
+ mutable bool first_try;
+ };
+
+}
+
+#endif