diff options
author | George Hazan <george.hazan@gmail.com> | 2013-11-13 12:47:58 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-11-13 12:47:58 +0000 |
commit | 268d637031d98cd88ef29dbac4a7c862f678cfc0 (patch) | |
tree | c6eceaf3a603af8158c3bed4541c4d1144569ef7 /src/core/stdcrypt/stdcrypt.h | |
parent | 0c2319086294bc02e08db82c507a3f6fc50af9fb (diff) |
initial version of stdcrypt, without encryption
git-svn-id: http://svn.miranda-ng.org/main/trunk@6888 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/core/stdcrypt/stdcrypt.h')
-rw-r--r-- | src/core/stdcrypt/stdcrypt.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/core/stdcrypt/stdcrypt.h b/src/core/stdcrypt/stdcrypt.h new file mode 100644 index 0000000000..4d5b0710ca --- /dev/null +++ b/src/core/stdcrypt/stdcrypt.h @@ -0,0 +1,50 @@ +/*
+
+Standard encryption plugin for Myranda NG
+Copyright (C) 2012-13 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 KEYLENGTH (256/8)
+
+struct CStdCrypt : public MICryptoEngine, public MZeroedObject
+{
+ CStdCrypt();
+
+ BYTE m_key[KEYLENGTH];
+ CMStringA m_password;
+
+ STDMETHODIMP_(void) destroy();
+
+ // get/set the instance key
+ STDMETHODIMP_(size_t) getKeyLength(void);
+ STDMETHODIMP_(bool) getKey(BYTE *pKey, size_t cbKeyLen);
+ STDMETHODIMP_(int) setKey(const BYTE *pKey, size_t cbKeyLen);
+
+ STDMETHODIMP_(void) generateKey(void); // creates a new key inside
+ STDMETHODIMP_(void) purgeKey(void); // purges a key from memory
+
+ // sets the master password (in utf-8)
+ 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*) encodeStringW(const WCHAR* src, 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_(WCHAR*) decodeStringW(const BYTE *pBuf, size_t bufLen, size_t *cbResultLen);
+};
|