summaryrefslogtreecommitdiff
path: root/libdigidoc/DigiDocGlobals.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdigidoc/DigiDocGlobals.c')
-rw-r--r--libdigidoc/DigiDocGlobals.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/libdigidoc/DigiDocGlobals.c b/libdigidoc/DigiDocGlobals.c
new file mode 100644
index 0000000..fc3939c
--- /dev/null
+++ b/libdigidoc/DigiDocGlobals.c
@@ -0,0 +1,65 @@
+//==================================================
+// FILE: DigiDocGlobals.c
+// PROJECT: Digi Doc Encryption
+// DESCRIPTION: DigiDoc TSA profiles
+// AUTHOR: Veiko Sinivee, S|E|B IT Partner Estonia
+//==================================================
+// Copyright (C) AS Sertifitseerimiskeskus
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+// GNU Lesser General Public Licence is available at
+// http://www.gnu.org/copyleft/lesser.html
+//=================================================
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <libdigidoc/DigiDocDefs.h>
+#include <libdigidoc/DigiDocGlobals.h>
+#include <libdigidoc/DigiDocConfig.h>
+
+
+// default TSAProfile (to be extended)
+LPTSAProfile g_current_TSAProfile = 0;
+
+//--------------------------------------------------
+// Initializes TSA profile block
+// returns pointer to global TSA profile
+//--------------------------------------------------
+EXP_OPTION TSAProfile* TSAProfile_init()
+{
+ TSAProfile* p = g_current_TSAProfile;
+
+ if(!p) {
+ p = (TSAProfile*)malloc(sizeof(TSAProfile));
+ if(p) {
+ memset(p, 0, sizeof(TSAProfile));
+ g_current_TSAProfile = p;
+ p->g_bAddSignatureTimeStamp = 1;
+ p->g_bAddSigAndRefsTimeStamp = 1;
+ p->g_nTsaMaxTsInterval = 1;
+ p->m_nDebugLevel = 0;
+ strncpy(p->g_szTsaUrl, "http://ns.szikszi.hu:8080/tsa", sizeof(p->g_szTsaUrl));
+ memset(p->m_szDebugFilePath, 0, sizeof(p->m_szDebugFilePath)); // VS: changed initialization
+ g_current_TSAProfile = p;
+ }
+ // init config store
+ if(!isConfigInited())
+ initConfigStore(NULL);
+ }
+ return p;
+}
+
+EXP_OPTION void TSAProfile_free()
+{
+ if(g_current_TSAProfile)
+ free(g_current_TSAProfile);
+ g_current_TSAProfile = 0;
+} \ No newline at end of file