From de91921561092689369b56c54950474e0a86e66f Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 15 Oct 2018 21:08:04 +0300 Subject: Add implementation --- openssl/agent/pkcs11/url.test.cxx | 46 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 openssl/agent/pkcs11/url.test.cxx (limited to 'openssl/agent/pkcs11/url.test.cxx') diff --git a/openssl/agent/pkcs11/url.test.cxx b/openssl/agent/pkcs11/url.test.cxx new file mode 100644 index 0000000..501137a --- /dev/null +++ b/openssl/agent/pkcs11/url.test.cxx @@ -0,0 +1,46 @@ +// file : openssl/agent/pkcs11/url.test.cxx -*- C++ -*- +// copyright : Copyright (c) 2014-2018 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#include + +#include + +// Usage: argv[0] +// +// Create pkcs11::url objects from stdin lines, and for each of them print its +// string representation to stdout, one per line. +// +int +main () +{ + using namespace std; + using namespace openssl; + using namespace openssl::agent::pkcs11; + + cin.exceptions (ios::badbit); + cout.exceptions (ios::failbit | ios::badbit); + + try + { + string s; + while (!eof (getline (cin, s))) + { + url u (s); + + // Validate the URL attributes. + // + identity idn (u); + access acc (u); + + cout << u.string () << endl; + } + + return 0; + } + catch (const exception& e) + { + cerr << e << endl; + return 1; + } +} -- cgit v1.1