Alexandre Lision | ddd731e | 2014-01-31 11:50:08 -0500 | [diff] [blame] | 1 | // Copyright (C) 2010 David Sugar, Tycho Softworks. |
| 2 | // |
| 3 | // This file is part of GNU uCommon C++. |
| 4 | // |
| 5 | // GNU uCommon C++ is free software: you can redistribute it and/or modify |
| 6 | // it under the terms of the GNU Lesser General Public License as published |
| 7 | // by the Free Software Foundation, either version 3 of the License, or |
| 8 | // (at your option) any later version. |
| 9 | // |
| 10 | // GNU uCommon C++ is distributed in the hope that it will be useful, |
| 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | // GNU Lesser General Public License for more details. |
| 14 | // |
| 15 | // You should have received a copy of the GNU Lesser General Public License |
| 16 | // along with GNU uCommon C++. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | #include "local.h" |
| 19 | |
| 20 | #ifdef _MSWINDOWS_ |
| 21 | NAMESPACE_LOCAL |
| 22 | HCRYPTPROV _handle = (HCRYPTPROV)NULL; |
| 23 | END_NAMESPACE |
| 24 | #endif |
| 25 | |
| 26 | secure::~secure() |
| 27 | { |
| 28 | } |
| 29 | |
| 30 | bool secure::fips(void) |
| 31 | { |
| 32 | return false; |
| 33 | } |
| 34 | |
| 35 | bool secure::init(void) |
| 36 | { |
| 37 | Thread::init(); |
| 38 | Socket::init(); |
| 39 | |
| 40 | #ifdef _MSWINDOWS_ |
| 41 | if(_handle != (HCRYPTPROV)NULL) |
| 42 | return false; |
| 43 | |
| 44 | if(CryptAcquireContext(&_handle, NULL, NULL, PROV_RSA_FULL, 0)) |
| 45 | return false; |
| 46 | if(GetLastError() == (DWORD)NTE_BAD_KEYSET) { |
| 47 | if(CryptAcquireContext(&_handle, NULL, NULL, PROV_RSA_FULL, CRYPT_NEWKEYSET)) |
| 48 | return false; |
| 49 | } |
| 50 | |
| 51 | _handle = (HCRYPTPROV)NULL; |
| 52 | #endif |
| 53 | |
| 54 | return false; |
| 55 | } |
| 56 | |
| 57 | secure::server_t secure::server(const char *cert, const char *key) |
| 58 | { |
| 59 | return NULL; |
| 60 | } |
| 61 | |
| 62 | secure::client_t secure::client(const char *ca) |
| 63 | { |
| 64 | return NULL; |
| 65 | } |
| 66 | |
| 67 | void secure::cipher(secure *context, const char *ciphers) |
| 68 | { |
| 69 | } |
| 70 | |