aboutsummaryrefslogtreecommitdiff
path: root/openssl/agent/pkcs11/url.test.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-10-15 21:08:04 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-10-17 15:02:42 +0300
commitde91921561092689369b56c54950474e0a86e66f (patch)
treea9949058021d911db1106b1a2e4d9e0e9281de16 /openssl/agent/pkcs11/url.test.cxx
parentfb65c93daaf369157bd712f2c4c20161c4840b94 (diff)
Add implementation
Diffstat (limited to 'openssl/agent/pkcs11/url.test.cxx')
-rw-r--r--openssl/agent/pkcs11/url.test.cxx46
1 files changed, 46 insertions, 0 deletions
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 <iostream>
+
+#include <openssl/agent/pkcs11/url.hxx>
+
+// 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;
+ }
+}