diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2012-07-20 16:21:49 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2012-07-20 16:21:49 +0000 |
commit | f424a18112032cf61d2871a6b91a5af607c171ae (patch) | |
tree | 88fedc4e28941ceecda7026f0b06eba6271f91d5 /plugins/CryptoPP/src/GPGw/keys.c | |
parent | bfe1bd0fc087be44c70904aee0fe4276643d206d (diff) |
CryptoPP:
changed folder structure
git-svn-id: http://svn.miranda-ng.org/main/trunk@1083 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/CryptoPP/src/GPGw/keys.c')
-rw-r--r-- | plugins/CryptoPP/src/GPGw/keys.c | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/plugins/CryptoPP/src/GPGw/keys.c b/plugins/CryptoPP/src/GPGw/keys.c new file mode 100644 index 0000000000..4cfbe4f71d --- /dev/null +++ b/plugins/CryptoPP/src/GPGw/keys.c @@ -0,0 +1,67 @@ +#include "commonheaders.h"
+
+typedef char tkeyuserid[keyuseridsize];
+
+tkeyuserid *keyuserids[2];
+int keyuseridcount[2];
+
+
+void initKeyUserIDs(const int atype)
+{
+ keyuseridcount[atype]=0;
+ keyuserids[atype]=NULL;
+}
+
+
+void updateKeyUserIDs(const int atype)
+{
+ char *pos;
+ gpgResult gpgresult;
+ char buffer[largebuffersize];
+ char keyuserid[keyuseridsize];
+
+ releaseKeyUserIDs(atype);
+ initKeyUserIDs(atype);
+
+ ZeroMemory(buffer, sizeof(buffer));
+ if(atype==publickeyuserid) gpgresult=gpgListPublicKeys(buffer);
+ else gpgresult=gpgListSecretKeys(buffer);
+
+ if(gpgresult!=gpgSuccess)
+ {
+// if(atype==publickeyuserid) ErrorMessage(txterror, txtlistpublickeysfailed, txtverifyoptions);
+// else ErrorMessage(txterror, txtlistsecretkeysfailed, txtverifyoptions);
+ return;
+ }
+
+ for(pos=buffer; pos!=NULL; )
+ {
+ pos=getNextPart(keyuserid, pos, txtcrlf);
+
+ if(pos!=NULL)
+ {
+ keyuseridcount[atype]++;
+ keyuserids[atype]=realloc(keyuserids[atype], sizeof(tkeyuserid)*keyuseridcount[atype]);
+ strcpy(keyuserids[atype][keyuseridcount[atype]-1], keyuserid);
+ }
+ }
+}
+
+
+void releaseKeyUserIDs(const int atype)
+{
+ free(keyuserids[atype]);
+}
+
+
+char *getKeyUserID(const int atype, const int aindex)
+{
+ return keyuserids[atype][aindex];
+}
+
+
+int getKeyUserIDCount(const int atype)
+{
+ return keyuseridcount[atype];
+}
+
|