1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
13 #include <anna/core/core.hpp>
15 #include <anna/xml/Node.hpp>
16 #include <anna/xml/Compiler.hpp>
18 #include <anna/app/Application.hpp>
20 #include <anna/core/util/Encoder.hpp>
22 class Test : public app::Application {
26 void initialize () throw (RuntimeException);
29 void run () throw (RuntimeException);
34 int main (int argc, const char** argv)
36 CommandLine& commandLine (CommandLine::instantiate ());
40 commandLine.initialize (argv, argc);
41 commandLine.verify ();
45 catch (Exception& ex) {
46 cout << ex.asString () << endl;
53 app::Application ("GenerateLogOn", "Database login encrypt keys generator", "1.0.0")
55 CommandLine& commandLine (CommandLine::instantiate ());
57 commandLine.add ("user", CommandLine::Argument::Mandatory, "User name");
58 commandLine.add ("pwd", CommandLine::Argument::Mandatory, "Password");
59 commandLine.add ("v", CommandLine::Argument::Optional, "Show original key in output file", false);
62 void Test::initialize ()
63 throw (RuntimeException)
65 Encoder::initialize ();
69 throw (RuntimeException)
71 CommandLine& commandLine (CommandLine::instantiate ());
73 string user (commandLine.getValue ("user"));
74 string password (commandLine.getValue ("pwd"));
75 const bool verbose = commandLine.exists ("v");
78 xml::Node root ("Logon");
80 const EncodedData& euser = encoder.encode (user);
82 xml::Node* node = root.createChild ("User");
85 node->createAttribute ("PlainText", user);
89 const EncodedData& epassword = encoder.encode (password);
91 node = root.createChild ("Password");
94 node->createAttribute ("PlainText", password);
96 epassword.asXML (node);
98 xml::Compiler xmlCompiler;
100 cerr << xmlCompiler.apply (&root) << endl << endl;