summaryrefslogtreecommitdiff
path: root/plugins/Kuzne4ikCrypt/src/stdcrypt.h
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2016-02-18 17:25:11 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2016-02-18 17:25:11 +0000
commit9c247e83bd2241caddcffac926c4775d5b143940 (patch)
tree9c24d50a8990f247d7ad8fee5ba9c42883688cb1 /plugins/Kuzne4ikCrypt/src/stdcrypt.h
parent5c2a6bf8417b1d90d9937114b52d4e95c969dfc2 (diff)
KuznechikCrypt: initial commit
git-svn-id: http://svn.miranda-ng.org/main/trunk@16305 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Kuzne4ikCrypt/src/stdcrypt.h')
-rw-r--r--plugins/Kuzne4ikCrypt/src/stdcrypt.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/plugins/Kuzne4ikCrypt/src/stdcrypt.h b/plugins/Kuzne4ikCrypt/src/stdcrypt.h
new file mode 100644
index 0000000000..b0708da257
--- /dev/null
+++ b/plugins/Kuzne4ikCrypt/src/stdcrypt.h
@@ -0,0 +1,56 @@
+/*
+
+Standard encryption plugin for Miranda NG
+Copyright (C) 2012-16 George Hazan
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program 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 General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+
+#define KEY_LENGTH 32
+#define BLOCK_SIZE 16
+
+struct CCrypt : public MICryptoEngine, public MZeroedObject
+{
+ CCrypt();
+ ~CCrypt();
+ BOOL m_valid;
+ CMStringA m_password;
+
+ BYTE m_key[KEY_LENGTH];
+
+ BYTE m_ctx[kEcb14ContextLen];
+
+ STDMETHODIMP_(void) destroy();
+
+ // get/set the instance key
+ STDMETHODIMP_(size_t) getKeyLength(void);
+ STDMETHODIMP_(bool) getKey(BYTE *pKey, size_t cbKeyLen);
+ STDMETHODIMP_(bool) setKey(const BYTE *pKey, size_t cbKeyLen);
+
+ STDMETHODIMP_(bool) generateKey(void); // creates a new key inside
+ STDMETHODIMP_(void) purgeKey(void); // purges a key from memory
+
+ // sets the master password (in utf-8)
+ STDMETHODIMP_(bool) checkPassword(const char *pszPassword);
+ STDMETHODIMP_(void) setPassword(const char *pszPassword);
+
+ // result must be freed using mir_free or assigned to mir_ptr<BYTE>
+ STDMETHODIMP_(BYTE*) encodeString(const char *src, size_t *cbResultLen);
+ STDMETHODIMP_(BYTE*) encodeBuffer(const void *src, size_t cbLen, size_t *cbResultLen);
+
+ // result must be freed using mir_free or assigned to ptrA/ptrT
+ STDMETHODIMP_(char*) decodeString(const BYTE *pBuf, size_t bufLen, size_t *cbResultLen);
+ STDMETHODIMP_(void*) decodeBuffer(const BYTE *pBuf, size_t bufLen, size_t *cbResultLen);
+};