summaryrefslogtreecommitdiff
path: root/plugins/CryptoPP/GPGw/passphrases.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/CryptoPP/GPGw/passphrases.c')
-rw-r--r--plugins/CryptoPP/GPGw/passphrases.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/plugins/CryptoPP/GPGw/passphrases.c b/plugins/CryptoPP/GPGw/passphrases.c
new file mode 100644
index 0000000000..5e93936ffc
--- /dev/null
+++ b/plugins/CryptoPP/GPGw/passphrases.c
@@ -0,0 +1,50 @@
+#include "commonheaders.h"
+
+// globale variablen
+struct passphrase *passphrases;
+int passphrasecount;
+
+
+void initPassphrases(void)
+{
+ passphrasecount=0;
+ passphrases=NULL;
+}
+
+
+void releasePassphrases(void)
+{
+ int i;
+
+ for(i=0; i<passphrasecount; i++)
+ ZeroMemory(passphrases[i].passphrase, sizeof(passphrases[i].passphrase));
+
+ free(passphrases);
+}
+
+
+void addPassphrase(const char *akeyuserid, const char *apassphrase)
+{
+ passphrasecount++;
+ passphrases=realloc(passphrases, sizeof(struct passphrase)*passphrasecount);
+
+ strcpy(passphrases[passphrasecount-1].keyuserid, akeyuserid);
+ strcpy(passphrases[passphrasecount-1].passphrase, apassphrase);
+}
+
+
+char *getPassphrase(const char *akeyuserid)
+{
+ int i;
+ char *result;
+
+ result=NULL;
+ for(i=0; i<passphrasecount; i++)
+ {
+ if(strcmp(passphrases[i].keyuserid, akeyuserid)==0)
+ result=passphrases[i].passphrase;
+ }
+
+ return result;
+}
+